:root {
  --bg: #F2F3F1; --surface: #FFFFFF; --ink: #1E2320; --muted: #5E676B;
  --steel: #A9B1B5; --rule: #D5D9DA; --coffee: #5A3825; --heat: #C8372D;
  --free: #2F7D4F; --cell-empty: #E7EAE8;
  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171A19; --surface: #202423; --ink: #E6E8E6; --muted: #9AA3A6;
    --steel: #56606A; --rule: #323837; --coffee: #C89A78; --heat: #E5574C;
    --free: #5CC18A; --cell-empty: #262B2A;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--sans);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--coffee); }
:focus-visible { outline: 2px solid var(--heat); outline-offset: 2px; }
[hidden] { display: none !important; }

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 40rem; margin: 0 auto; padding: .9rem 1rem;
}
.brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--ink); letter-spacing: -.01em; }
.bar nav { display: flex; gap: 1.1rem; }
.bar nav a { color: var(--muted); text-decoration: none; font-size: .95rem; padding: .2rem 0; }
.bar nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }

main { max-width: 40rem; margin: 0 auto; padding: 0 1rem 3rem; }
h1 { font-size: 1.6rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.05rem; margin: 2rem 0 .4rem; }
.note { color: var(--muted); margin: .3rem 0; font-size: .95rem; }

/* Home dial */
.dial { position: relative; width: min(78vw, 300px); aspect-ratio: 1; margin: 1.5rem auto 1rem; --c: var(--steel); }
.dial[data-state="free"] { --c: var(--free); }
.dial[data-state="brewing"] { --c: var(--heat); }
.dial-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--rule);
}
.dial-fill {
  position: absolute; inset: 0; border-radius: 50%;
  --p: 100;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--cell-empty) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px));
  transition: --p .6s;
}
.dial-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 2.5rem; }
.state { font-size: clamp(2.2rem, 11vw, 3.2rem); font-weight: 800; line-height: 1; letter-spacing: -.02em; color: var(--ink); }
.sub { color: var(--muted); margin-top: .5rem; font-variant-numeric: tabular-nums; }

.queue-line { text-align: center; margin: .25rem 0; color: var(--muted); }
.queue-list { list-style: none; padding: 0; margin: .25rem auto; max-width: 18rem; text-align: center; }
.queue-list li { padding: .1rem 0; }
.queue-list li.me { font-weight: 700; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin: 1.25rem 0 .5rem; }
#view-settings .actions { justify-content: flex-start; }
.btn {
  font: inherit; font-weight: 600; text-decoration: none; text-align: center;
  padding: .75rem 1.2rem; min-height: 44px; border-radius: 8px; cursor: pointer;
  border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink);
}
.btn.primary { background: var(--ink); color: var(--bg); }
.btn:disabled { opacity: .5; cursor: default; }
.msg { text-align: center; color: var(--muted); min-height: 1.5em; margin: .25rem 0; }

.ios-hint {
  background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--coffee);
  border-radius: 6px; padding: .8rem 1rem; margin: 1rem 0; font-size: .95rem;
}
.ios-hint ol { margin: .4rem 0 0; padding-left: 1.2rem; }

.row { display: flex; gap: .6rem; flex-wrap: wrap; }
input {
  font: inherit; flex: 1 1 12rem; min-height: 44px; padding: .5rem .75rem;
  border: 1.5px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink);
}

/* Stats */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .6rem; }
.tile { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: .8rem .9rem; }
.tile .num { font-size: 1.9rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .lbl { color: var(--muted); font-size: .85rem; }

.bars { display: flex; align-items: flex-end; gap: 2px; height: 120px; padding-bottom: 1.4rem; position: relative; border-bottom: 1px solid var(--rule); }
.bars .b { flex: 1; position: relative; height: 100%; display: flex; align-items: flex-end; }
.bars .b i { display: block; width: 100%; background: var(--coffee); border-radius: 4px 4px 0 0; min-height: 0; }
.bars .b span { position: absolute; bottom: -1.35rem; left: 50%; transform: translateX(-50%); font-size: .7rem; color: var(--muted); white-space: nowrap; }

.heat-wrap { overflow-x: auto; padding-bottom: .25rem; }
.heat { display: grid; grid-template-columns: 2.2rem repeat(24, minmax(14px, 1fr)); gap: 2px; min-width: 26rem; font-size: .7rem; color: var(--muted); }
.heat .c { aspect-ratio: 1; border-radius: 3px; background: var(--cell-empty); }
.heat .h { text-align: center; }
.heat .d { align-self: center; }
.tip {
  position: fixed; pointer-events: none; z-index: 10; background: var(--ink); color: var(--bg);
  font-size: .8rem; padding: .3rem .5rem; border-radius: 4px; white-space: nowrap;
}

/* Wall display */
body.walling .bar { display: none; }
.wall { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 1rem; }
.wall-state { font-size: clamp(4rem, 18vw, 12rem); font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.wall-state[data-state="free"] { color: var(--free); }
.wall-state[data-state="brewing"] { color: var(--heat); }
.wall-state[data-state="offline"] { color: var(--muted); }
.wall-sub { font-size: clamp(1.2rem, 4vw, 2.5rem); color: var(--muted); font-variant-numeric: tabular-nums; }
.wall-stats { display: flex; gap: 3rem; font-size: clamp(1rem, 3vw, 1.8rem); color: var(--muted); margin-top: 2rem; }
.wall-stats span { color: var(--ink); font-weight: 800; }
.wall-exit { position: fixed; bottom: 1rem; right: 1rem; color: var(--muted); font-size: .8rem; }

@property --p { syntax: "<number>"; inherits: false; initial-value: 100; }
@media (prefers-reduced-motion: reduce) { .dial-fill { transition: none; } }
