* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: #8a6438;
  min-height: 100vh;
}
body {
  padding: 16px;
}

.stb-root {
  font-family: 'Work Sans', sans-serif;
  background: #B98A54;
  background-image:
    radial-gradient(rgba(94,62,27,0.35) 1px, transparent 1.6px),
    radial-gradient(rgba(140,100,55,0.28) 1px, transparent 1.7px);
  background-size: 15px 15px, 23px 23px;
  background-position: 0 0, 8px 12px;
  min-height: calc(100vh - 32px);
  padding: 28px;
  border-radius: 12px;
  max-width: 1200px;
  margin: 0 auto;
}
.stb-auth {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  color: rgba(251,248,241,0.9);
}
.stb-auth-guest { opacity: 0.85; }
.stb-auth-email { font-weight: 600; color: #FBF8F1; }
.stb-auth-toggle, .stb-auth-signout {
  background: rgba(0,0,0,0.2);
  color: #FBF8F1;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.stb-auth-toggle:hover, .stb-auth-signout:hover { background: rgba(0,0,0,0.32); }
.stb-auth-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.15);
  padding: 8px;
  border-radius: 8px;
}
.stb-auth-form input {
  border: none;
  border-radius: 5px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: 'Work Sans', sans-serif;
  min-width: 140px;
}
.stb-auth-form button {
  background: #2B2620;
  color: #FBF8F1;
  border: none;
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.stb-auth-msg { font-size: 12px; color: #FBF8F1; }
.stb-auth-link {
  background: none;
  border: none;
  color: #FBF8F1;
  text-decoration: underline;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.stb-auth-link:hover { opacity: 0.8; }

.stb-trial-badge {
  background: rgba(0,0,0,0.2);
  color: #FBF8F1;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}
.stb-trial-badge--expired { background: #6B322A; color: #FBF8F1; }
.stb-trial-badge--needsname { background: #6B4E12; color: #FBF8F1; }

.stb-upgrade-btn {
  background: #3A4B24;
  color: #FBF8F1;
  border: none;
  border-radius: 6px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.stb-upgrade-btn:hover { background: #2c3a1b; }
.stb-upgrade-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.stb-upgrade-btn--banner { margin-left: 10px; flex: 0 0 auto; }

.stb-readonly-banner {
  display: none;
  align-items: center;
  gap: 10px;
  background: #FBF8F1;
  color: #2B2620;
  border-left: 4px solid #6B322A;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 14px;
}
.stb-readonly-banner a { color: #2B2620; font-weight: 700; }
.stb-readonly-banner.is-visible { display: flex; }

.stb-locked { opacity: 0.6; pointer-events: none; }

.stb-reminder-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.2);
  color: #FBF8F1;
  border: none;
  padding: 10px 16px;
  border-radius: 7px;
  font-family: 'Work Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.stb-reminder-btn:disabled { opacity: 0.7; cursor: default; }
.stb-reminder-btn:not(:disabled):hover { background: rgba(0,0,0,0.3); }

.stb-reminder-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
}
.stb-reminder-input {
  border: 1px solid rgba(0,0,0,0.25);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 12px;
  font-family: 'Work Sans', sans-serif;
  background: rgba(255,255,255,0.4);
}
.stb-reminder-clear {
  background: none;
  border: none;
  opacity: 0.6;
  cursor: pointer;
  padding: 2px;
}
.stb-reminder-clear:hover { opacity: 1; }

.stb-alarm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 14, 8, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: stb-alarm-fade-in 0.25s ease;
}
@keyframes stb-alarm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.stb-alarm-card {
  background: #FBF8F1;
  color: #2B2620;
  border-radius: 14px;
  padding: 28px 26px 22px;
  width: 90%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
  animation: stb-alarm-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes stb-alarm-pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.stb-alarm-bell {
  color: #9C5B2E;
  margin-bottom: 10px;
  animation: stb-alarm-ring 0.6s ease-in-out infinite;
  display: inline-block;
}
@keyframes stb-alarm-ring {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-15deg); }
  40% { transform: rotate(12deg); }
  60% { transform: rotate(-8deg); }
  80% { transform: rotate(5deg); }
}
.stb-alarm-title {
  font-family: 'Caveat', cursive;
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 8px 0;
}
.stb-alarm-body {
  font-size: 14px;
  color: #6B6152;
  margin: 0 0 20px 0;
  line-height: 1.4;
}
.stb-alarm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.stb-alarm-dismiss, .stb-alarm-snooze {
  border: none;
  border-radius: 7px;
  padding: 10px 16px;
  font-family: 'Work Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.stb-alarm-dismiss { background: #2B2620; color: #FBF8F1; }
.stb-alarm-snooze { background: rgba(0,0,0,0.08); color: #2B2620; }
.stb-alarm-dismiss:hover, .stb-alarm-snooze:hover { opacity: 0.85; }
.stb-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.stb-title {
  font-family: 'Caveat', cursive;
  font-size: 42px;
  font-weight: 700;
  color: #FBF8F1;
  margin: 0;
  line-height: 1;
}
.stb-date {
  font-size: 13px;
  color: rgba(251,248,241,0.85);
  margin: 4px 0 0 2px;
}
.stb-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stb-add-btn, .stb-install-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #2B2620;
  color: #FBF8F1;
  border: none;
  padding: 10px 16px;
  border-radius: 7px;
  font-family: 'Work Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
}
.stb-install-btn { background: #7A4B6B; }
.stb-add-btn--doc { background: #4B6B5A; }
.stb-add-btn:hover, .stb-install-btn:hover { transform: translateY(-1px); }
.stb-add-btn:active, .stb-install-btn:active { transform: translateY(0); }

.stb-ios-tip {
  background: #FBF8F1;
  color: #2B2620;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.stb-ios-tip button {
  background: none;
  border: none;
  color: #6B6152;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.stb-main {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
@media (max-width: 819px) {
  .stb-main { flex-direction: column; }
}

.stb-board {
  position: relative;
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 560px;
  height: 620px;
  background: rgba(0,0,0,0.05);
  border-radius: 10px;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.15);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 819px) {
  .stb-board { height: 680px; }
}

/* Keep the real free-form board at every width -- on a narrow screen you scroll
   to reach notes placed further out, rather than losing the corkboard entirely. */
@media (max-width: 680px) {
  .stb-root { padding: 16px; }
  .stb-header { flex-direction: column; align-items: flex-start; }
  .stb-header-actions { width: 100%; flex-direction: column; align-items: stretch; }
  .stb-add-btn, .stb-install-btn { width: 100%; justify-content: center; }
}

.stb-note {
  position: absolute;
  width: 210px;
  border-radius: 3px;
  padding: 18px 14px 14px 14px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.22), 0 1px 3px rgba(0,0,0,0.15);
  cursor: grab;
  touch-action: none;
}
.stb-note.is-dragging {
  cursor: grabbing;
  user-select: none;
  box-shadow: 0 16px 28px rgba(0,0,0,0.38), 0 2px 4px rgba(0,0,0,0.2);
}

.stb-doc {
  position: absolute;
  min-width: 260px;
  min-height: 230px;
  border-radius: 3px;
  padding: 18px 16px 34px 16px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.22), 0 1px 3px rgba(0,0,0,0.15);
  cursor: grab;
  touch-action: none;
  box-sizing: border-box;
  background-image: repeating-linear-gradient(to bottom, transparent 0px, transparent 25px, rgba(0,0,0,0.06) 26px);
  display: flex;
  flex-direction: column;
}
.stb-doc.is-resizing {
  cursor: default;
  user-select: none;
}
.stb-doc.is-dragging {
  cursor: grabbing;
  user-select: none;
  box-shadow: 0 16px 28px rgba(0,0,0,0.38), 0 2px 4px rgba(0,0,0,0.2);
}
.stb-doc-text {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 150px;
  resize: none;
  overflow: hidden;
  border: none;
  background: transparent;
  font-family: 'Work Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: inherit;
  box-sizing: border-box;
  cursor: text;
}
.stb-doc-text:focus { outline: none; }
.stb-doc-text::placeholder { color: inherit; opacity: 0.5; }
.stb-doc-label {
  font-size: 10.5px;
  font-weight: 700;
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stb-doc-resize-handle {
  position: absolute;
  right: 6px;
  bottom: 5px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 3px;
  box-sizing: border-box;
  cursor: nwse-resize;
  touch-action: none;
  opacity: 0.45;
}
.stb-doc-resize-handle:hover { opacity: 0.9; }
.stb-pin {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
  pointer-events: none;
}
.stb-note-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 5px;
}
.stb-note-copy, .stb-note-delete, .stb-note-save, .stb-note-popout {
  background: none;
  border: none;
  opacity: 0.4;
  cursor: pointer;
  padding: 2px;
}
.stb-note-delete { color: #2B2620; }
.stb-note-copy:hover, .stb-note-delete:hover, .stb-note-save:hover, .stb-note-popout:hover { opacity: 0.9; }

.stb-placeholder {
  position: absolute;
  border-radius: 4px;
  padding: 14px;
  box-sizing: border-box;
  cursor: pointer;
}
.stb-placeholder-title {
  font-family: 'Caveat', cursive;
  font-size: 18px;
  font-weight: 600;
  padding-right: 16px;
}
.stb-placeholder-sub {
  font-size: 11px;
  margin-top: 6px;
  font-family: 'Work Sans', sans-serif;
}
.stb-placeholder-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  opacity: 0.6;
  cursor: pointer;
  padding: 2px;
}
.stb-placeholder-close:hover { opacity: 1; }
.stb-note-title {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  font-family: 'Caveat', cursive;
  font-size: 22px;
  font-weight: 600;
  margin: 6px 0 8px 0;
  padding: 0;
  cursor: text;
}
.stb-note-title:focus { outline: none; border-bottom: 1px dashed currentColor; }
.stb-items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.stb-item { display: flex; align-items: flex-start; gap: 6px; }
.stb-checkbox {
  flex: none;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  border: 2px solid;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-top: 1px;
}
.stb-carried-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  opacity: 0.55;
}
.stb-item-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  font-family: 'Work Sans', sans-serif;
  font-size: 14px;
  cursor: text;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.35;
  padding: 0;
  margin: 0;
}
.stb-item-input:focus { outline: none; }
.stb-item-delete {
  flex: none;
  background: none;
  border: none;
  opacity: 0.35;
  cursor: pointer;
  padding: 2px;
}
.stb-item-delete:hover { opacity: 0.85; }
.stb-item-reminder {
  flex: none;
  background: none;
  border: none;
  opacity: 0.3;
  cursor: pointer;
  padding: 2px;
}
.stb-item-reminder:hover { opacity: 0.8; }
.stb-item-reminder.has-reminder { opacity: 0.9; }
.stb-item-reminder-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 4px 25px;
  margin-top: -2px;
}
.stb-additem-input {
  width: 100%;
  background: transparent;
  border: none;
  border-top: 1px dashed;
  padding-top: 6px;
  font-family: 'Work Sans', sans-serif;
  font-size: 13px;
  font-style: italic;
  cursor: text;
}
.stb-additem-input:focus { outline: none; }
.stb-additem-input::placeholder { color: inherit; opacity: 0.55; }

.stb-note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
  row-gap: 6px;
}
.stb-doc .stb-note-footer {
  margin-bottom: 0;
  padding-right: 26px;
}
.stb-schedule-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.stb-repeat-btn, .stb-reminder-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px dashed currentColor;
  opacity: 0.8;
  border-radius: 20px;
  padding: 3px 8px;
  font-family: 'Work Sans', sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.stb-repeat-btn:hover, .stb-reminder-btn:hover { opacity: 1; }
.stb-swatches { display: flex; gap: 5px; }
.stb-swatch {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.15);
  cursor: pointer;
  padding: 0;
}
.stb-day-picker {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.stb-day-chip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Work Sans', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.stb-day-done {
  margin-left: 4px;
  background: transparent;
  border: 1.5px solid;
  border-radius: 12px;
  padding: 0 10px;
  height: 22px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Work Sans', sans-serif;
  cursor: pointer;
}

.stb-empty {
  padding: 60px 20px;
  text-align: center;
  color: rgba(251,248,241,0.9);
  font-size: 15px;
}
.stb-empty button {
  margin-top: 14px;
  background: #2B2620;
  color: #FBF8F1;
  border: none;
  padding: 9px 16px;
  border-radius: 7px;
  cursor: pointer;
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
}

.stb-clipboard {
  width: 280px;
  flex: none;
  background: #FBF8F1;
  border-radius: 6px;
  padding: 34px 20px 22px 20px;
  position: relative;
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 27px,
    rgba(47,72,88,0.08) 28px
  );
}
@media (max-width: 819px) {
  .stb-clipboard { width: 100%; }
}
.stb-clip-band {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 16px;
  background: linear-gradient(#dcdcdc, #9a9a9a);
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.stb-clip-ring {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 46px;
  height: 22px;
  border: 5px solid #b0b0b0;
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  background: #FBF8F1;
}
.stb-clipboard-heading {
  font-family: 'Caveat', cursive;
  font-size: 28px;
  font-weight: 700;
  color: #2B2620;
  margin: 0;
}
.stb-clipboard-date {
  font-size: 12px;
  color: #6B6152;
  margin: 2px 0 16px 0;
}
.stb-saved-section {
  margin: -6px 0 16px 0;
  padding-bottom: 14px;
  border-bottom: 1px dashed #E3DCC8;
}
.stb-saved-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #A69C89;
  margin: 0 0 8px 0;
}
.stb-saved-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
}
.stb-saved-dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1.5px solid;
}
.stb-saved-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: #2B2620;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stb-saved-restore {
  flex: none;
  background: none;
  border: none;
  color: #6B6152;
  opacity: 0.6;
  cursor: pointer;
  padding: 2px;
}
.stb-saved-restore:hover { opacity: 1; }
.stb-saved-delete {
  flex: none;
  background: none;
  border: none;
  color: #6B6152;
  opacity: 0.4;
  cursor: pointer;
  padding: 2px;
}
.stb-saved-delete:hover { opacity: 0.9; color: #8A3B2E; }
.stb-ring-wrap { display: flex; justify-content: center; margin-bottom: 10px; }
.stb-stat-line {
  text-align: center;
  font-size: 13px;
  color: #6B6152;
  margin-bottom: 6px;
}
.stb-carried-line {
  text-align: center;
  font-size: 12px;
  color: #9C5B2E;
  font-weight: 600;
  margin: 0 0 14px 0;
}
.stb-streak {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: #7A4B6B;
  font-weight: 600;
  margin-bottom: 18px;
}
.stb-streak.is-empty { color: #A69C89; font-weight: 400; font-size: 12px; }
.stb-week-label {
  font-size: 11px;
  color: #A69C89;
  margin-bottom: 6px;
}
.stb-week-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 48px;
  margin-bottom: 20px;
}
.stb-bar {
  flex: 1;
  border-radius: 3px 3px 1px 1px;
  background: #E3DCC8;
}
.stb-reveal-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: 1px solid #2F4858;
  color: #2F4858;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: 'Work Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.stb-reveal-btn svg { transition: transform 0.3s ease; }
.stb-reveal-btn.is-open svg { transform: rotate(180deg); }
.stb-narrative {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.4s ease, margin 0.4s ease;
  font-family: 'Caveat', cursive;
  font-size: 19px;
  line-height: 1.4;
  color: #2B2620;
}
.stb-narrative.is-open {
  max-height: 220px;
  opacity: 1;
  margin-top: 14px;
}

/* ==========================================================================
   v2 UI/UX polish layer
   Appended deliberately so every rule here builds on (and can override) the
   original sheet without rewriting it. The goals, in order:
     1. Keyboard users can see where they are (the old sheet removed every
        focus outline and put nothing back).
     2. Destructive and background actions tell you what happened (toasts).
     3. Touch targets are actually tappable (checkbox was 17px square).
     4. Motion respects prefers-reduced-motion, like the marketing page does.
   ========================================================================== */

:root {
  --stb-ink: #2B2620;
  --stb-ink-soft: #6B6152;
  --stb-cream: #FBF8F1;
  --stb-line: #E3DCC8;
  --stb-ok: #3A4B24;
  --stb-warn: #6B4E12;
  --stb-danger: #6B322A;
  --stb-info: #20424C;
  --stb-radius: 8px;
  --stb-shadow-card: 0 8px 16px rgba(0,0,0,0.22), 0 1px 3px rgba(0,0,0,0.15);
  --stb-shadow-card-hover: 0 14px 26px rgba(0,0,0,0.28), 0 2px 5px rgba(0,0,0,0.18);
  --stb-shadow-lift: 0 20px 40px rgba(0,0,0,0.35), 0 3px 6px rgba(0,0,0,0.2);
}

/* ---------- 1. focus visibility ---------- */
.stb-root :focus-visible,
.stb-modal :focus-visible,
.stb-toast :focus-visible,
.stb-alarm-card :focus-visible {
  outline: 2px solid var(--stb-ink);
  outline-offset: 2px;
  border-radius: 4px;
}
/* Cards sit on the cork, where a dark ring is low contrast: give them cream. */
.stb-note :focus-visible,
.stb-doc :focus-visible,
.stb-clipboard :focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.stb-add-btn:focus-visible,
.stb-install-btn:focus-visible,
.stb-reminder-btn:focus-visible {
  outline: 2px solid var(--stb-cream);
  outline-offset: 2px;
}
.stb-item-input:focus-visible,
.stb-doc-text:focus-visible,
.stb-note-title:focus-visible,
.stb-additem-input:focus-visible {
  outline: none; /* text fields already show a caret + underline change */
}

/* ---------- 2. skip link ---------- */
.stb-skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 4000;
  background: var(--stb-ink);
  color: var(--stb-cream);
  padding: 10px 16px;
  border-radius: 6px;
  font-family: 'Work Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.stb-skip-link:focus {
  left: 16px;
}

/* ---------- 3. header: title + save status ---------- */
.stb-header-titles { min-width: 0; }
.stb-date-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px 0 0 2px;
}
.stb-date-wrap .stb-date { margin: 0; }

.stb-sync-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(251,248,241,0.92);
  background: rgba(0,0,0,0.18);
  border-radius: 20px;
  padding: 3px 9px 3px 8px;
  transition: background 0.2s ease, color 0.2s ease;
}
.stb-sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #C9D6B8;
  flex: none;
  transition: background 0.2s ease;
}
.stb-sync-status.is-saving .stb-sync-dot { background: #F5E6A8; animation: stb-pulse 1.1s ease-in-out infinite; }
.stb-sync-status.is-error,
.stb-sync-status.is-readonly { background: #6B322A; color: #FBF8F1; }
.stb-sync-status.is-error .stb-sync-dot,
.stb-sync-status.is-readonly .stb-sync-dot { background: #E8C5C0; }
.stb-sync-status.is-offline { background: rgba(0,0,0,0.32); }
.stb-sync-status.is-offline .stb-sync-dot { background: #B9D3DD; }
.stb-sync-status.is-local { background: rgba(0,0,0,0.12); color: rgba(251,248,241,0.75); }
.stb-sync-status.is-local .stb-sync-dot { background: rgba(251,248,241,0.55); }
@keyframes stb-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

/* ---------- 4. toasts ---------- */
.stb-toasts {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 1500;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.stb-toast {
  pointer-events: auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--stb-ink);
  color: var(--stb-cream);
  border-radius: 10px;
  padding: 12px 12px 12px 16px;
  font-family: 'Work Sans', sans-serif;
  font-size: 13.5px;
  line-height: 1.35;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.stb-toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.stb-toast.is-leaving { opacity: 0; transform: translateY(8px) scale(0.98); }
.stb-toast--success { background: #33421F; }
.stb-toast--warn { background: #6B322A; }
.stb-toast-text { flex: 1; min-width: 0; }
.stb-toast-action {
  flex: none;
  background: rgba(251,248,241,0.14);
  color: var(--stb-cream);
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.stb-toast-action:hover { background: rgba(251,248,241,0.26); }
.stb-toast-close {
  flex: none;
  background: none;
  border: none;
  color: var(--stb-cream);
  opacity: 0.5;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}
.stb-toast-close:hover { opacity: 1; }

/* ---------- 5. shortcuts / help dialog ---------- */
.stb-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 14, 8, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2200;
  padding: 20px;
  animation: stb-alarm-fade-in 0.2s ease;
}
.stb-modal {
  background: var(--stb-cream);
  color: var(--stb-ink);
  border-radius: 14px;
  padding: 26px 24px 20px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--stb-shadow-lift);
  font-family: 'Work Sans', sans-serif;
  animation: stb-alarm-pop 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.stb-modal-title {
  font-family: 'Caveat', cursive;
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 14px;
}
.stb-shortcut-list { list-style: none; margin: 0; padding: 0; }
.stb-shortcut-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--stb-line);
  font-size: 13.5px;
}
.stb-shortcut-list li:last-child { border-bottom: none; }
.stb-shortcut-keys { display: flex; gap: 4px; flex: none; }
kbd {
  display: inline-block;
  font-family: 'Work Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 7px;
  min-width: 22px;
  text-align: center;
  color: var(--stb-ink);
  background: #EFE9DA;
  border: 1px solid #D7CEB8;
  border-bottom-width: 2px;
  border-radius: 5px;
}
.stb-modal-close {
  width: 100%;
  margin-top: 18px;
  background: var(--stb-ink);
  color: var(--stb-cream);
  border: none;
  border-radius: 7px;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.stb-modal-close:hover { background: #453d32; }

/* ---------- 6. cards: affordance + feedback ---------- */
.stb-note,
.stb-doc {
  box-shadow: var(--stb-shadow-card);
  transition: box-shadow 0.18s ease, transform 0.12s ease;
}
.stb-note:hover,
.stb-doc:hover { box-shadow: var(--stb-shadow-card-hover); }
.stb-note.is-dragging,
.stb-doc.is-dragging {
  box-shadow: var(--stb-shadow-lift);
  transition: box-shadow 0.12s ease;
}
.stb-note-actions > button {
  opacity: 0.35;
  border-radius: 4px;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.stb-note:hover .stb-note-actions > button,
.stb-doc:hover .stb-note-actions > button,
.stb-note-actions > button:focus-visible { opacity: 0.8; }
.stb-note-actions > button:hover {
  opacity: 1;
  background: rgba(0,0,0,0.08);
}
.stb-checkbox {
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.stb-checkbox:active { transform: scale(0.88); }
.stb-item { border-radius: 4px; }
.stb-item-delete,
.stb-item-reminder {
  transition: opacity 0.15s ease;
}
.stb-item:hover .stb-item-delete,
.stb-item:hover .stb-item-reminder { opacity: 0.6; }
.stb-swatch {
  transition: transform 0.12s ease;
}
.stb-swatch:hover { transform: scale(1.18); }

/* ---------- 7. empty state ---------- */
.stb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.stb-empty-title {
  font-family: 'Caveat', cursive;
  font-size: 26px;
  font-weight: 700;
  color: var(--stb-cream);
  margin-bottom: 2px;
}
.stb-empty p { max-width: 42ch; }
.stb-empty-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 16px;
}
.stb-empty button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 0;
}
.stb-empty button.stb-empty-secondary {
  background: rgba(251,248,241,0.16);
  color: var(--stb-cream);
  border: 1px solid rgba(251,248,241,0.4);
}
.stb-empty button.stb-empty-secondary:hover { background: rgba(251,248,241,0.26); }
.stb-empty-hint {
  margin-top: 18px;
  font-size: 12px;
  color: rgba(251,248,241,0.7);
}
.stb-empty-hint kbd {
  background: rgba(251,248,241,0.16);
  border-color: rgba(251,248,241,0.32);
  color: var(--stb-cream);
  padding: 3px 5px;
  font-size: 10px;
}

/* ---------- 8. board sizing that respects small viewports ---------- */
.stb-board {
  height: clamp(420px, 62vh, 760px);
}
@supports (height: 1dvh) {
  .stb-board { height: clamp(420px, 62dvh, 760px); }
}
@media (max-width: 819px) {
  .stb-board { height: clamp(380px, 58dvh, 680px); }
}

/* ---------- 9. touch devices: bigger targets, visible controls ---------- */
@media (hover: none), (pointer: coarse) {
  .stb-checkbox { width: 22px; height: 22px; border-radius: 6px; }
  .stb-item-delete,
  .stb-item-reminder { opacity: 0.55; padding: 6px; }
  .stb-note-actions > button { opacity: 0.5; padding: 5px; }
  .stb-swatch { width: 18px; height: 18px; }
  .stb-note-footer { row-gap: 8px; }
  .stb-repeat-btn, .stb-reminder-btn { padding: 5px 9px; font-size: 11px; }
  .stb-day-chip { width: 28px; height: 28px; font-size: 11px; }
  .stb-day-done { height: 28px; padding: 0 12px; }
  .stb-item-input { font-size: 15px; } /* also stops iOS zoom-on-focus */
  .stb-additem-input { font-size: 15px; }
  .stb-note-title { font-size: 23px; }
}

/* Stack the header controls into a tidy 2-up grid on phones instead of four
   full-width buttons, which pushed the actual board below the fold. */
@media (max-width: 680px) {
  .stb-root { padding: 14px; border-radius: 10px; }
  .stb-header { gap: 14px; margin-bottom: 14px; }
  .stb-header-actions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .stb-header-actions .stb-add-btn,
  .stb-header-actions .stb-install-btn,
  .stb-header-actions .stb-reminder-btn {
    width: auto;
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    padding: 11px 12px;
    font-size: 13px;
  }
  .stb-trial-badge { font-size: 11.5px; }
  .stb-clipboard { padding: 30px 16px 20px; }
}

/* ---------- 10. clipboard / stats column ---------- */
.stb-stat-line { font-variant-numeric: tabular-nums; }
.stb-carried-line {
  font-size: 12px;
  color: #8a6a2f;
  font-weight: 600;
  margin-top: 2px;
}
.stb-streak { font-weight: 600; }
.stb-week-bars { align-items: flex-end; }
.stb-bar { transition: height 0.4s ease; }
.stb-reveal-btn { transition: background 0.15s ease; }

/* ---------- 11. respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .stb-toast,
  .stb-toast.is-visible,
  .stb-toast.is-leaving {
    transition: opacity 0.01s linear;
    transform: none;
  }
  .stb-alarm-card,
  .stb-modal,
  .stb-alarm-overlay,
  .stb-modal-overlay {
    animation: none;
  }
  .stb-alarm-bell,
  .stb-sync-status.is-saving .stb-sync-dot {
    animation: none;
  }
  .stb-note,
  .stb-doc,
  .stb-bar,
  .stb-swatch,
  .stb-checkbox {
    transition: none;
  }
}

/* ---------- 12. print: the board is a useful paper checklist ---------- */
@media print {
  .stb-root { background: #fff; padding: 0; }
  .stb-header-actions,
  .stb-auth,
  .stb-sync-status,
  .stb-readonly-banner,
  .stb-clipboard,
  .stb-toasts,
  .stb-note-actions,
  .stb-additem-input,
  .stb-swatches,
  .stb-skip-link { display: none !important; }
  .stb-board { height: auto; overflow: visible; background: none; box-shadow: none; }
  .stb-note, .stb-doc {
    position: static !important;
    transform: none !important;
    width: 100% !important;
    box-shadow: none;
    border: 1px solid #ccc;
    margin-bottom: 12px;
    break-inside: avoid;
  }
  .stb-title { color: #000; }
}

/* ---------- 13. "Nudgeboard for Windows" card (?desktop=1) ----------
   Shown only when someone arrives from the landing page's desktop section. The action it
   offers depends on state: sign in (no session), upgrade (signed in, unpaid), or download
   (paid). The paid check itself happens server-side -- this is just the affordance. */
.stb-desktop-card {
  background: #FBF8F1;
  color: #2B2620;
  border-radius: 8px;
  padding: 18px 20px 16px;
  margin-bottom: 16px;
  border-left: 4px solid #C9D6B8;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}
.stb-desktop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stb-desktop-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #3A4B24;
}
.stb-desktop-close {
  border: none;
  background: transparent;
  color: rgba(43, 38, 32, 0.45);
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 4px;
}
.stb-desktop-close:hover { background: rgba(43, 38, 32, 0.08); color: #2B2620; }
.stb-desktop-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 21px;
  font-weight: 600;
  margin: 2px 0 6px;
}
.stb-desktop-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: rgba(43, 38, 32, 0.78);
  margin: 0 0 12px;
  max-width: 62ch;
}
.stb-desktop-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stb-desktop-btn {
  font-family: 'Work Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 6px;
  border: none;
  background: #2B2620;
  color: #FBF8F1;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.stb-desktop-btn:hover { background: #3d362e; }
.stb-desktop-btn:disabled { opacity: 0.6; cursor: default; }
.stb-desktop-btn--ghost {
  background: transparent;
  color: rgba(43, 38, 32, 0.7);
  border: 1px solid rgba(43, 38, 32, 0.22);
}
.stb-desktop-btn--ghost:hover { background: rgba(43, 38, 32, 0.06); color: #2B2620; }
.stb-desktop-fine {
  font-size: 11.5px;
  line-height: 1.5;
  color: rgba(43, 38, 32, 0.55);
  margin: 10px 0 0;
}

/* ---------- 14. solo mode (?solo=<cardId>) ----------
   One card, filling the window -- what the desktop build shows inside each frameless note
   window. Everything that belongs to the app as a whole is hidden; the card itself is
   positioned by a per-window stylesheet from js/solo-mode.js, because its id is dynamic. */
html.stb-solo-mode,
html.stb-solo-mode body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #FBF8F1;
}
.stb-solo-mode .stb-root {
  margin: 0;
  padding: 0;
  max-width: none;
  min-height: 0;
  border-radius: 0;
  background: none;
  background-image: none;
}
.stb-solo-mode .stb-header,
.stb-solo-mode .stb-clipboard,
.stb-solo-mode .stb-desktop-card,
.stb-solo-mode .stb-readonly-banner,
.stb-solo-mode #stb-ios-tip,
.stb-solo-mode .stb-auth,
.stb-solo-mode .stb-skip-link,
.stb-solo-mode .stb-toasts,
.stb-solo-mode .stb-empty {
  display: none !important;
}
.stb-solo-mode .stb-main {
  display: block;
  margin: 0;
  padding: 0;
  gap: 0;
}
.stb-solo-mode .stb-board {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0;
  box-shadow: none;
  background: none;
  overflow: hidden;
}
