/* momchill — calm blue ground, square shapes, colour that shifts from blue to coral */
:root {
  --ground: #EAF0F3;
  --surface: #F6F9FA;
  --line: #D3DDE2;
  --ink: #2F332E;
  --muted: #555A52;
  --muted-tint: #3E433C;
  --action: #2D4A63;
  --on-action: #EAF0F3;
  --chosen: #DCE6D5;
  --panel: #DCE5EA;
  --mist: #CFDDE4;
  --coral: #EE9B8A;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; border-radius: 0; }
h1, h2, .big, .stat b, .stepper b, .primary, .add, .timeinput, .code {
  font-family: 'Fredoka', 'Nunito', system-ui, sans-serif;
}

#app {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding-block: calc(env(safe-area-inset-top, 0px) + 24px) calc(env(safe-area-inset-bottom, 0px) + 20px);
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
}

/* headers */
.home-head { display: flex; justify-content: space-between; align-items: center; }
.logo { margin: 0; font-size: 26px; font-weight: 500; }
.date { display: block; font-size: 15px; color: var(--muted); }
.iconbtn, .back {
  width: 44px; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.iconbtn { margin-right: -10px; }
.bar { display: flex; align-items: center; gap: 4px; margin-left: -12px; }
.bar h1 { margin: 0; font-size: 24px; font-weight: 500; }

/* home tiles */
.tiles { margin-top: 26px; flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tiles.one { grid-template-columns: minmax(0, 1fr); }
.tile { display: flex; flex-direction: column; padding: 18px 18px 0; background: var(--surface); transition: background 1s; min-width: 0; }
.tile.empty { box-shadow: inset 0 0 0 1px var(--line); }
.tile-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tile h2 { margin: 0; font-size: 19px; font-weight: 500; }
.stage { font-size: 13px; font-weight: 600; color: var(--muted-tint); }
.art { flex: 1; min-height: 110px; padding: 14px 0; display: flex; align-items: center; justify-content: center; }
.big { font-size: 52px; font-weight: 400; line-height: 1; font-variant-numeric: tabular-nums; }
.cap { margin-top: 4px; font-size: 14px; color: var(--muted-tint); }
.next { margin-top: 14px; font-size: 15px; font-weight: 600; }
.tilelink { align-self: flex-start; min-height: 44px; margin-top: 4px; padding: 0; border: 0; background: transparent; text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.add {
  margin: 20px -18px 0; height: 60px; border: 0; background: var(--action); color: var(--on-action);
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 17px; font-weight: 500; cursor: pointer;
}
.loglink {
  margin-top: 18px; height: 56px; padding: 0; border: 0; border-top: 1px solid var(--line); background: transparent;
  display: flex; align-items: center; justify-content: space-between; font-size: 17px; font-weight: 500; cursor: pointer;
}

/* shared */
.label { margin: 24px 0 10px; font-size: 15px; font-weight: 500; color: var(--muted); }
.note { margin: 10px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.error { margin: 10px 0 0; font-size: 15px; color: #8A2E1C; }
.spacer { flex: 1; min-height: 24px; }
.primary {
  width: 100%; height: 60px; border: 0; background: var(--action); color: var(--on-action);
  font-size: 18px; font-weight: 500; cursor: pointer;
}
.primary:disabled { opacity: .5; cursor: default; }
.secondary {
  width: 100%; height: 54px; margin-top: 10px; border: 0; background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line); font-size: 16px; font-weight: 600; cursor: pointer;
}
.secondary.danger { background: var(--coral); box-shadow: none; }

/* choices */
.choices { display: grid; gap: 8px; }
.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice {
  min-height: 54px; padding: 8px; border: 0; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  font-size: 17px; font-weight: 600; cursor: pointer;
}
.choice.tall { min-height: 100px; }
.choice[aria-pressed="true"] { background: var(--chosen); box-shadow: inset 0 0 0 1.5px var(--ink); }

/* time rows */
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.row label { padding: 0 16px; font-size: 17px; font-weight: 500; }
.timeinput {
  height: 56px; min-width: 0; padding: 0 16px; border: 0; box-shadow: inset 1px 0 0 var(--line);
  background: transparent; font-size: 20px; font-weight: 400;
}
.timerbox { margin-top: 20px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); display: flex; flex-direction: column; }
.timerbox .row { background: transparent; box-shadow: none; }
.timerbox .face + .row, .timerbox .row + .row { border-top: 1px solid var(--line); }
.face { min-height: 230px; padding: 20px; background: var(--mist); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.face .capline { font-size: 15px; font-weight: 600; color: var(--muted-tint); }
.face .big { font-size: 60px; }

/* settings */
.toggles { margin-top: 26px; border-top: 1px solid var(--line); }
.toggle {
  width: 100%; height: 62px; padding: 0; border: 0; border-bottom: 1px solid var(--line); background: transparent;
  display: flex; align-items: center; gap: 16px; font-size: 18px; font-weight: 500; text-align: left; cursor: pointer;
}
.toggle:disabled { cursor: default; color: var(--muted); }
.soon { margin-left: auto; font-size: 13px; font-weight: 600; }
.check { width: 24px; height: 24px; flex: none; display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1.5px var(--ink); }
.toggle[aria-pressed="true"] .check { background: var(--action); box-shadow: inset 0 0 0 1.5px var(--action); }
.toggle:disabled .check { box-shadow: inset 0 0 0 1.5px var(--line); }
.rowlink {
  margin-top: 28px; width: 100%; padding: 16px 0; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: transparent; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  text-align: left; font-size: 18px; font-weight: 500; cursor: pointer;
}
.rowlink small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); }
.panel { margin-top: 10px; padding: 16px; background: var(--panel); }
.panel .small { font-size: 14px; color: var(--muted); }
.code { margin-top: 6px; font-size: 30px; font-weight: 500; letter-spacing: .12em; }

/* log */
.stats { margin-top: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { padding: 14px 16px; background: var(--panel); display: flex; flex-direction: column; gap: 4px; }
.stat b { font-size: 30px; font-weight: 400; line-height: 1; }
.stat span { font-size: 14px; color: var(--muted); }
.day { margin: 26px 0 4px; font-size: 15px; font-weight: 500; color: var(--muted); }
.entry {
  min-height: 56px; display: grid; grid-template-columns: 50px 22px minmax(0, 1fr) auto minmax(44px, auto);
  align-items: center; gap: 10px; border-bottom: 1px solid var(--line);
}
.entry .t { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.entry .k { font-size: 17px; font-weight: 500; }
.entry .d { font-size: 15px; color: var(--muted); text-align: right; }
.entry button { min-width: 44px; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.entry button.confirm { padding: 0 12px; background: var(--coral); font-size: 15px; font-weight: 600; }

/* time between */
.gap-sec { margin-top: 30px; }
.gap-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.gap-head h2 { margin: 0; font-size: 19px; font-weight: 500; }
.gap-head span { font-size: 14px; color: var(--muted); }
.stepper { margin-top: 12px; display: grid; grid-template-columns: 60px minmax(0, 1fr) 60px; align-items: center; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.stepper button { height: 60px; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.stepper button:first-child { box-shadow: inset -1px 0 0 var(--line); }
.stepper button:last-child { box-shadow: inset 1px 0 0 var(--line); }
.stepper b { text-align: center; font-size: 30px; font-weight: 400; font-variant-numeric: tabular-nums; }
.gradient { margin-top: 8px; height: 18px; background: linear-gradient(90deg, #A9CBE0 0%, #B5D9A8 33.3%, #F2D67E 66.6%, #EE9B8A 100%); }
.marks { margin-top: 8px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.marks div { display: flex; flex-direction: column; gap: 2px; font-size: 13px; font-weight: 600; }
.marks span { font-size: 12px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }

/* sign in */
.field { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.field label { font-size: 15px; font-weight: 500; color: var(--muted); }
.field input { height: 56px; padding: 0 16px; border: 0; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: 19px; outline: none; }
.field input:focus { box-shadow: inset 0 0 0 1.5px var(--action); }

:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); transform: translateX(-50%) translateY(20px);
  max-width: calc(100% - 40px); padding: 14px 18px; background: var(--action); color: var(--on-action);
  font-family: 'Nunito', system-ui, sans-serif; font-size: 16px; opacity: 0; pointer-events: none; transition: .25s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .tile, #toast { transition: none; }
}
