/* Pieces added after the first design: sign-in, the settings button and its
   panels, the speech check, and small helpers. Uses the tokens in style.css. */

:root {
  color-scheme: dark;
}
/* Paper surfaces read as light, so the browser draws light controls on them. */
.card,
.pad,
.sheet,
.gate__card {
  color-scheme: light;
}
/* Classes that set `display` would otherwise win over the hidden attribute. */
[hidden] {
  display: none !important;
}

/* ---------- Wide screens: the notes beside the phone ---------- */
.keys {
  display: grid;
  gap: var(--space-3);
}
.keys li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--on-desk-soft);
}
.keys li span {
  margin-left: 4px;
}
.side__note {
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--on-desk-soft);
}

/* ---------- Settings button and the dot that says "not saved yet" ---------- */
.corner {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 4px);
  right: 8px;
  z-index: 5;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--on-desk-soft);
}
.corner .ic {
  width: 20px;
  height: 20px;
}
@media (hover: hover) {
  .corner:hover {
    background: var(--desk-raised);
    color: var(--on-desk);
  }
}
.corner:active {
  transform: scale(0.94);
}
.sync-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--desk);
  opacity: 0;
  transition: opacity 120ms linear;
}
/* A save that finishes quickly never shows the dot at all. */
.sync-dot[data-state='busy'] {
  background: var(--pen-on-desk);
  opacity: 1;
  transition: opacity 160ms linear 900ms;
}
.sync-dot[data-state='offline'] {
  background: var(--on-desk-soft);
  opacity: 1;
}
.sync-dot[data-state='error'] {
  background: var(--redpen-on-desk);
  opacity: 1;
}

/* ---------- Today ---------- */
.tilt-0 {
  --tilt: 0deg;
}
.tilt-1 {
  --tilt: 0.6deg;
}
.tilt-2 {
  --tilt: -0.5deg;
}
.starter {
  display: grid;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--desk-raised);
}
.starter .hand {
  color: var(--pen-on-desk);
  font-size: 1.5rem;
  font-weight: 700;
}
.starter__alt {
  color: var(--on-desk-soft);
  font-size: var(--text-sm);
}
.closed-note {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) var(--space-1) 0;
  font-size: var(--text-sm);
  color: var(--on-desk-soft);
}
.closed-note .ic {
  width: 15px;
  height: 15px;
}
.pill--wait {
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
}
.pill--wait .ic {
  color: var(--ink-soft);
}
@media (hover: hover) {
  .pill--wait:hover {
    color: var(--ink);
    background: oklch(1 0 0);
  }
}

/* ---------- Board ---------- */
.lane__head {
  align-items: center;
  min-height: 28px;
}
.lane__head h2 {
  margin-right: auto;
}
.lane__add {
  margin: -8px -4px -8px 0;
}
@media (hover: hover) {
  .lane__add:hover {
    background: var(--desk);
  }
}
.lane__clear {
  margin: -8px 0;
}

/* ---------- Notes ---------- */
.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-2);
}
.search-row .search {
  margin-bottom: 0;
}
.search-row .btn {
  min-height: 48px;
  border-radius: var(--radius-lg);
  padding: 0 14px;
}

/* ---------- Panels ---------- */
.sheet .link {
  color: var(--pen);
  margin: 0 0 0 -4px;
  text-align: left;
}
.sheet__back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: -8px 0 2px -8px !important;
  padding-right: var(--space-2);
  font-weight: 600;
  text-decoration: none;
}
.sheet__back .ic {
  width: 16px;
  height: 16px;
}
.sheet__actions--more {
  margin-top: var(--space-3);
}
.sheet__actions .stamp {
  align-self: center;
  padding: 0;
}
.field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid var(--paper-line);
  background: oklch(1 0 0);
  color: var(--ink);
  /* 16px stops iOS Safari from zooming the page when a field takes focus */
  font-size: 1rem;
  font-weight: 400;
  caret-color: var(--pen);
}
.field input:focus-visible {
  outline: none;
  border-color: var(--pen);
  box-shadow: 0 0 0 3px oklch(from var(--pen) l c h / 0.2);
}
.field input::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}
.field__wrap {
  position: relative;
}
.field__wrap input {
  padding-right: 50px;
}
.field__eye {
  position: absolute;
  top: 2px;
  right: 2px;
}
.sorted__input {
  display: block;
  width: 100%;
  min-height: 32px;
  padding: 2px 0 3px;
  overflow: hidden;
  resize: none;
  font-family: inherit;
  border: 0;
  border-bottom: 1.5px dashed var(--paper-line);
  border-radius: 0;
  background: none;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  caret-color: var(--pen);
}
@media (hover: hover) {
  .sorted__input:hover {
    border-bottom-color: var(--ink-soft);
  }
}
.sorted__input:focus-visible {
  outline: none;
  border-bottom-style: solid;
  border-bottom-color: var(--pen);
}
.learn {
  margin-top: var(--space-3);
  padding: 10px 12px 12px;
  border-radius: 12px;
  background: var(--paper-strip);
}
.learn .fine {
  margin-top: 0;
}
.learn .who {
  margin-top: var(--space-2);
}
.learn .chip--paper,
.result .chip--paper {
  background: var(--paper);
  color: var(--ink);
}
.chip .ic {
  width: 15px;
  height: 15px;
}
.chip--icon {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
}
.chip--icon .ic {
  width: 18px;
  height: 18px;
}

/* ---------- Settings ---------- */
.syncbox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding: 8px 8px 8px 14px;
  border-radius: 12px;
  background: var(--paper-strip);
  font-size: var(--text-sm);
  line-height: 1.4;
}
.syncbox p {
  flex: 1;
}
.syncbox .btn--paper {
  background: var(--paper);
}
@media (hover: hover) {
  .syncbox .btn--paper:hover {
    background: oklch(1 0 0);
  }
}
.setlist {
  gap: 0;
  margin-top: var(--space-4);
  border-radius: var(--radius-lg);
  background: oklch(1 0 0);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.14);
  overflow: hidden;
}
.setlist > li + li {
  border-top: 1px solid var(--paper-line);
}
.setlist > .fine {
  margin: 0;
  padding: 14px;
}
.setrow {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 56px;
  padding: 8px 8px 8px 14px;
  text-align: left;
  max-width: none;
}
.setrow--go {
  padding-right: 12px;
}
@media (hover: hover) {
  .setrow--go:hover {
    background: var(--paper);
  }
}
.setrow > .ic {
  color: var(--ink-soft);
}
.setrow__text {
  flex: 1;
  min-width: 0;
}
.setrow__text strong {
  display: block;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.setrow__text small {
  display: block;
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: var(--text-xs);
  line-height: 1.35;
}
.fixadd {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 10px;
  align-items: end;
}
.fixadd .btn {
  grid-column: 1 / -1;
  margin-top: var(--space-3);
}

/* ---------- Speech check ---------- */
.say {
  margin-top: var(--space-4);
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: oklch(1 0 0);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.14);
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.4;
}
.say__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-5);
  margin-top: var(--space-1);
}
.sheet .btn--live,
.sheet .btn--live:hover {
  background: var(--redpen);
  color: oklch(1 0 0);
}
#check-time {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.result {
  margin-top: var(--space-4);
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--paper-strip);
}
.result__score {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
}
.result__score b {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.result__score span {
  color: var(--ink-soft);
  font-size: var(--text-sm);
}
.diff {
  margin-top: var(--space-2);
  font-size: var(--text-md);
  line-height: 1.6;
}
.diff s {
  color: var(--redpen);
  text-decoration-thickness: 1.5px;
}
.diff__bad,
.diff__miss {
  font-weight: 600;
}
.diff__miss {
  text-decoration: underline;
  text-decoration-color: var(--redpen);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.terms {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
}
.term {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.term .ic {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}
.term.is-ok .ic {
  color: var(--pen);
}
.term.is-miss {
  color: var(--redpen);
}
.runline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: var(--space-3);
}
.runline b {
  font-size: var(--text-md);
  font-variant-numeric: tabular-nums;
}
.runline .ic {
  width: 15px;
  height: 15px;
  color: var(--ink-soft);
}
.runline span {
  flex-basis: 100%;
  color: var(--ink-soft);
  font-size: var(--text-xs);
}

/* ---------- Sign-in ---------- */
.gate {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 0px) + var(--space-8)) var(--space-5) calc(env(safe-area-inset-bottom, 0px) + var(--space-6));
  background: var(--desk);
}
.gate__in {
  width: 100%;
  max-width: 23rem;
  margin: auto;
}
.gate .promise {
  color: var(--on-desk-soft);
  font-size: var(--text-md);
}
.gate__card {
  --color-primary: var(--pen);
  margin-top: var(--space-6);
  padding: 18px 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-card);
}
.gate__card h1 {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.012em;
  line-height: 1.22;
}
.gate__sub {
  margin-top: var(--space-1);
  color: var(--ink-soft);
}
.gate__card .btn {
  width: 100%;
  min-height: 48px;
  margin-top: var(--space-4);
}
.gate__card .btn--primary {
  background: var(--ink);
  color: var(--paper);
}
@media (hover: hover) {
  .gate__card .btn--primary:hover {
    background: oklch(0.28 0.02 265);
  }
}
.gate__wait {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.gate__wait .skel {
  background: var(--paper-line);
}
.gate__slow {
  margin-top: var(--space-4);
  font-size: var(--text-xs);
  color: var(--ink-soft);
  opacity: 0;
  animation: late-in 300ms ease-out 6s forwards;
}
@keyframes late-in {
  to {
    opacity: 1;
  }
}
.gate__hand {
  margin-top: var(--space-3);
}
/* Beside the phone on a wide screen the name is already shown once. */
@media (min-width: 1080px) {
  .gate .brand,
  .gate .promise {
    display: none;
  }
  .gate__card {
    margin-top: 0;
  }
}

/* ---------- The "nothing here" page ---------- */
.lost {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: var(--space-3);
  max-width: 24rem;
  margin: 0 auto;
  padding: var(--space-6);
}
.lost h1 {
  margin-top: var(--space-4);
  font-size: var(--text-xl);
}
.lost p:not(.brand) {
  color: var(--on-desk-soft);
}
.lost .btn {
  margin-top: var(--space-3);
  text-decoration: none;
}
