:root {
  --bg: #0e0c09;
  --panel: #191510;
  --panel-2: #221c15;
  --line: #332a1f;
  --ink: #f6efe2;
  --muted: #9b8f7c;
  --amber: #ffb020;
  --amber-dim: #7a5310;
  --clock: #6f9fd8;
  --good: #4fd07a;
  --bad: #e8604c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 50% -10%, #241c12 0%, transparent 70%),
    var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 20px 56px;
}

/* ---------- header ---------- */

header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 span {
  color: var(--amber);
}

.brand {
  display: grid;
  gap: 3px;
}

.venue {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.venue a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}

.venue a:hover {
  color: var(--amber);
}

.pill {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.pill[data-status="running"] {
  color: var(--good);
  border-color: #2c5f3d;
  background: #16281c;
}

.pill[data-status="complete"] {
  color: var(--amber);
  border-color: var(--amber-dim);
  background: #2b1f0c;
}

.spacer {
  flex: 1;
}

.link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px dotted var(--line);
}

.link:hover {
  color: var(--amber);
}

/* ---------- countdowns ---------- */

.clocks {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.clock {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px 18px;
}

.clock .label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.clock .value {
  font: 700 clamp(38px, 9vw, 76px)/1 ui-monospace, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--amber);
}

.clock .sub {
  margin-top: 7px;
  font-size: 13px;
  color: var(--muted);
}

.clock.secondary .value {
  font-size: clamp(28px, 6vw, 50px);
  color: var(--clock);
}

.clock.done .value {
  color: var(--good);
}

/* ---------- stat tiles ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 16px;
}

.stat .label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat .value {
  font: 700 30px/1 ui-monospace, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.value-row {
  display: flex;
  align-items: center;
  gap: 11px;
}

.pint-slot {
  display: block;
  flex: none;
  line-height: 0;
}

svg.pint {
  display: block;
  width: 28px;
  height: 45px;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.55));
}

.stat .value.small {
  font-size: 24px;
}

.stat .unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 3px;
}

.stat .note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  min-height: 1.2em;
}

/* ---------- chart ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px 10px;
}

.log-card {
  margin-top: 14px;
}

.card-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.card-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.legend i {
  display: inline-block;
  width: 20px;
  height: 0;
  border-top-width: 2px;
  border-top-style: solid;
  vertical-align: 4px;
  margin-right: 6px;
}

.legend .k-actual i {
  border-color: var(--amber);
  border-top-width: 3px;
}

.legend .k-clock i {
  border-color: var(--clock);
  border-top-style: dashed;
}

.legend .k-proj i {
  border-color: #d98cff;
  border-top-style: dotted;
  border-top-width: 3px;
}

svg.chart {
  display: block;
  width: 100%;
  height: 320px;
}

svg.chart text {
  font: 500 11px ui-sans-serif, system-ui, sans-serif;
  fill: var(--muted);
}

/* ---------- drink log ---------- */

.log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.log li {
  display: grid;
  grid-template-columns: 2.6em 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
}

.log li:last-child {
  border-bottom: 0;
}

.log-n {
  font: 700 12px/1 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.log-time {
  font: 600 17px/1 ui-monospace, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.log-main {
  display: grid;
  justify-items: start;
  gap: 9px;
  min-width: 0;
}

.log-photo-link {
  display: block;
  width: min(240px, 100%);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg);
  line-height: 0;
}

.log-photo {
  display: block;
  width: 100%;
  max-height: 190px;
  object-fit: cover;
}

.log-photo-add {
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--amber);
  font-size: 12px;
}

.log-time em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  margin-left: 7px;
  vertical-align: 2px;
}

.log-gap {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.log-empty {
  margin: 4px 2px 12px;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- admin ---------- */

.admin-actions {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.table-config {
  display: grid;
  grid-template-columns: 1fr minmax(330px, 1.2fr);
  align-items: end;
  gap: 22px;
  margin-bottom: 16px;
  padding-bottom: 16px;
}

.table-config h2 {
  margin: 0 0 4px;
  font-size: 15px;
}

.table-config p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.table-config form {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto;
  gap: 6px 10px;
}

.table-config label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.table-config input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: 600 18px/1 ui-monospace, "SF Mono", Menlo, monospace;
  padding: 12px 14px;
}

.table-config input:focus {
  border-color: var(--amber-dim);
  outline: 2px solid rgba(255, 176, 32, 0.15);
}

.table-config button {
  padding: 12px 16px;
}

.checklist-card {
  margin-bottom: 14px;
  padding: 13px 16px 10px;
}

.checklist-card .card-head {
  justify-content: space-between;
  margin-bottom: 3px;
}

.checklist-save {
  color: var(--muted);
  font-size: 11px;
}

.checklist-items {
  display: grid;
}

.checklist-items label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}

.checklist-items label:last-child {
  border-bottom: 0;
}

.checklist-items input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--amber);
}

.checklist-items input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  padding: 16px 18px;
  transition: transform 0.06s ease, filter 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

button:hover:not(:disabled) {
  filter: brightness(1.15);
}

button:active:not(:disabled) {
  transform: scale(0.985);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.primary {
  background: linear-gradient(180deg, #ffc247, var(--amber));
  border-color: #d98f0d;
  color: #221600;
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 34px 18px;
  box-shadow: 0 10px 26px -12px rgba(255, 176, 32, 0.6);
}

button.primary .hint {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.62;
  margin-top: 7px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.toast {
  margin-bottom: 16px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.toast[data-kind="error"] {
  color: var(--bad);
  border-color: #5e2b23;
  background: #2a1512;
}

.toast[hidden] {
  display: none;
}

/* ---------- restart confirmation ---------- */

dialog {
  max-width: 30rem;
  width: calc(100% - 40px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
  color: var(--ink);
  padding: 22px 24px 20px;
  box-shadow: 0 30px 70px -20px #000;
}

dialog::backdrop {
  background: rgba(6, 4, 2, 0.72);
  backdrop-filter: blur(2px);
}

dialog h2 {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 700;
}

dialog p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
}

.dialog-actions button {
  padding: 13px 14px;
  font-size: 15px;
}

button.danger {
  background: #45170f;
  border-color: #7a2a1c;
  color: #ffb9ac;
  font-weight: 600;
}

button.danger:hover:not(:disabled) {
  background: #5a1d13;
}

button.accent {
  background: var(--amber);
  border-color: #d98f0d;
  color: #221600;
  font-weight: 700;
}

/* ---------- drink photo picker ---------- */

#drink-photo-dialog {
  max-width: 34rem;
}

.photo-picker {
  display: grid;
  gap: 8px;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px dashed var(--amber-dim);
  border-radius: 12px;
  background: var(--panel);
  color: var(--amber);
  font-weight: 700;
}

.photo-picker input {
  width: 100%;
  color: var(--muted);
  font: inherit;
}

.photo-selection {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
}

.photo-selection[hidden] {
  display: none;
}

.photo-selection img {
  display: block;
  width: 110px;
  height: 82px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--line);
}

.photo-dialog-actions {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr 1.25fr;
  gap: 9px;
}

.photo-dialog-actions button {
  min-width: 0;
  padding: 12px 10px;
  font-size: 13px;
}

.file-input-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 480px) {
  .dialog-actions {
    grid-template-columns: 1fr;
  }

  .photo-dialog-actions {
    grid-template-columns: 1fr;
  }
}

/* ---------- offline dot ---------- */

.offline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}

.offline::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bad);
  animation: blink 1.1s steps(1, end) infinite;
}

.offline[hidden] {
  display: none;
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

/* ---------- celebration ---------- */

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
}

#banner {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
  animation: pop 0.7s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

#banner[hidden] {
  display: none;
}

#banner .big {
  font-size: clamp(46px, 13vw, 132px);
  font-weight: 900;
  letter-spacing: 0.03em;
  color: var(--amber);
  text-shadow: 0 0 44px rgba(255, 176, 32, 0.65);
  line-height: 1;
}

#banner .small {
  margin-top: 14px;
  font-size: clamp(15px, 3.4vw, 22px);
  color: var(--ink);
  text-shadow: 0 2px 14px #000;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.55);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 720px) {
  .clocks,
  .stats {
    grid-template-columns: 1fr 1fr;
  }

  svg.chart {
    height: 240px;
  }

  .table-config {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .clocks {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  #banner,
  .offline::before {
    animation: none;
  }
}
