/* ============================================================
   WHO'S IN?  —  styles
   Warm-ink brand (matches the hub) + per-player colors.
   ============================================================ */

:root {
  --ink:      #15110d;
  --ink-2:    #211a13;
  --ink-3:    #2c231a;
  --paper:    #f4ece0;
  --muted:    #b8a98f;
  --faint:    #6f6552;
  --gold:     #e7b53c;
  --oxblood:  #8a3030;
  --line:     rgba(244, 236, 224, 0.12);
  --radius:   16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }

body {
  min-height: 100dvh;
  background:
    radial-gradient(1100px 520px at 50% -12%, rgba(231, 181, 60, 0.10), transparent 60%),
    var(--ink);
  color: var(--paper);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(14px, 4vw, 24px) 16px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------------- TOP BAR ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar__brand { display: flex; align-items: center; gap: 10px; }
.topbar__home {
  font-size: 30px;
  line-height: 1;
  color: var(--muted);
  text-decoration: none;
  padding: 0 6px 4px 0;
}
.topbar__home:hover { color: var(--paper); }
.topbar__kicker {
  font-family: "Special Elite", monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.topbar__title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 900;
  font-size: 30px;
  line-height: 1;
}

.topbar__brand { min-width: 0; }

.mechip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 14px "Inter", sans-serif;
  color: var(--paper);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  white-space: nowrap;
  max-width: 48vw;
  flex: 0 0 auto;
}
.mechip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mechip__dot {
  flex: 0 0 auto;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--c, var(--gold));
  box-shadow: 0 0 10px var(--c, var(--gold));
}
.mechip--empty { color: var(--gold); border-color: rgba(231, 181, 60, 0.5); border-style: dashed; }

.lede {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.5;
}
.lede strong { color: var(--gold); }

.errbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--paper);
  background: rgba(138, 48, 48, 0.22);
  border: 1px solid rgba(138, 48, 48, 0.6);
  border-radius: 12px;
  padding: 10px 12px;
}
.errbar button {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  padding: 0 4px;
}
.errbar button:hover { color: var(--paper); }

.loading { color: var(--muted); padding: 40px 0; text-align: center; font-family: "Special Elite", monospace; }

/* ---------------- TIMELINE — day carousel ---------------- */
.timeline {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 -16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.timeline__rail {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  /* side padding lets the first & last cards reach center */
  padding: 6px max(16px, calc(50% - min(39vw, 170px)));
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.timeline__rail::-webkit-scrollbar { display: none; }

.day {
  position: relative;
  flex: 0 0 auto;
  width: min(78vw, 340px);
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: clamp(16px, 4.5vw, 26px);
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--paper);
  text-align: left;
  cursor: pointer;
  opacity: 0.45;
  transform: scale(0.9);
  transition: opacity 220ms ease, transform 220ms ease, border-color 200ms ease, box-shadow 220ms ease;
}
.day.is-active {
  opacity: 1;
  transform: scale(1);
  box-shadow: 0 26px 64px -30px rgba(0, 0, 0, 0.85);
}

.day__head { display: flex; flex-direction: column; gap: 1px; }
.day__mon { font-family: "Special Elite", monospace; font-size: clamp(12px, 3.2vw, 14px); letter-spacing: 0.22em; text-transform: uppercase; color: var(--faint); }
.day__num { font-family: "Fraunces", Georgia, serif; font-weight: 900; font-size: clamp(60px, 19vw, 100px); line-height: 0.9; }
.day__wd { font-family: "Fraunces", Georgia, serif; font-weight: 500; font-size: clamp(18px, 5vw, 24px); color: var(--muted); margin-top: 2px; }
.day__today {
  align-self: flex-start;
  margin-top: 10px;
  font-family: "Special Elite", monospace; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink); background: var(--gold); border-radius: 6px; padding: 3px 10px;
}

.day__players {
  list-style: none;
  flex: 0 0 auto;
  display: flex; flex-direction: column;
  gap: clamp(11px, 3vw, 16px);
  padding: clamp(20px, 6vw, 34px) 0 0;
}
.dp { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 12px; }
.dp__dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--c); }
.dp__name { font: 600 clamp(16px, 4.4vw, 19px) "Inter", sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp__status { font: 700 13px "Inter", sans-serif; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.dp--up .dp__dot { background: var(--c); box-shadow: 0 0 10px var(--c); }
.dp--up .dp__status { color: var(--c); }
.dp--down .dp__dot { background: transparent; border-color: var(--oxblood); }
.dp--down .dp__name { color: var(--muted); }
.dp--down .dp__status { color: var(--oxblood); }
.dp--unknown .dp__dot { border-color: var(--faint); opacity: 0.6; }
.dp--unknown .dp__name { color: var(--muted); }

.day__foot {
  margin-top: auto;
  padding-top: clamp(12px, 3vw, 16px);
  border-top: 1px solid var(--line);
  font: 600 clamp(13px, 3.6vw, 15px) "Inter", sans-serif;
  color: var(--muted);
}
.day__foot.is-on { color: var(--gold); }
.day__foot-star { color: var(--gold); }
.day__quiet { color: var(--faint); font-weight: 500; }

.day.is-today {
  border-color: rgba(231, 181, 60, 0.5);
  background: linear-gradient(180deg, rgba(231, 181, 60, 0.10), var(--ink-2));
}
.day.is-today .day__num { color: var(--gold); }
.day.is-today.is-active { box-shadow: 0 0 0 1.5px var(--gold), 0 26px 64px -28px rgba(231, 181, 60, 0.5); }
.day.is-on.is-active { box-shadow: 0 0 0 1.5px rgba(231, 181, 60, 0.7), 0 26px 66px -26px rgba(231, 181, 60, 0.6); }

/* jump-to-today button */
.todaybtn {
  align-self: center;
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 13.5px "Inter", sans-serif;
  color: var(--ink);
  background: var(--gold);
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  box-shadow: 0 12px 30px -12px rgba(231, 181, 60, 0.7);
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.todaybtn__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.todaybtn.is-here {
  background: var(--ink-2);
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
}
.todaybtn.is-here .todaybtn__dot { background: var(--gold); box-shadow: 0 0 8px var(--gold); }

/* ---------------- SHEETS (picker + day detail) ---------------- */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(8, 6, 4, 0.66);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  animation: fade 160ms ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
  animation: rise 200ms cubic-bezier(.2,.9,.2,1) both;
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.sheet__close {
  margin-top: 16px;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  font: 600 14px "Inter", sans-serif;
  cursor: pointer;
}

/* picker */
.picker__title { font-family: "Fraunces", serif; font-weight: 600; font-size: 24px; }
.picker__sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.picker__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.picker__chip {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
  padding: 16px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--ink-3);
  color: var(--paper);
  font: 600 16px "Inter", sans-serif;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease;
}
.picker__chip:hover { transform: translateY(-2px); }
.picker__chip.is-me { border-color: var(--c); }
.picker__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.picker__dot { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; background: var(--c); box-shadow: 0 0 12px var(--c); }

/* day detail */
.day__head { display: flex; align-items: flex-start; justify-content: space-between; }
.day__wd { font-family: "Fraunces", serif; font-weight: 600; font-size: 24px; line-height: 1; }
.day__date { color: var(--muted); font-size: 14px; margin-top: 4px; font-family: "Special Elite", monospace; letter-spacing: 0.05em; }
.day__x {
  background: var(--ink-3); border: 1px solid var(--line); color: var(--muted);
  width: 34px; height: 34px; border-radius: 50%; font-size: 15px; cursor: pointer;
}
.day__x:hover { color: var(--paper); }

.day__status {
  margin: 14px 0 16px;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--ink-3);
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}
.day__need { color: var(--paper); }
.day__status.is-on {
  color: var(--ink);
  background: linear-gradient(120deg, var(--gold), #f3cd6b);
  border-color: var(--gold);
  font-size: 15px;
  box-shadow: 0 12px 30px -14px rgba(231, 181, 60, 0.8);
}
.day__status.is-on strong { letter-spacing: 0.04em; }
.day__status-star { margin-right: 4px; }

.quad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.quad {
  --c: var(--gold);
  position: relative;
  border-radius: 16px;
  padding: 13px 13px 12px;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  border: 1.5px solid var(--line);
  background: var(--ink-3);
  transition: border-color 140ms ease, background 140ms ease;
}
.quad__head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.quad__name { font: 600 15px "Inter", sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.quad__you {
  flex: 0 0 auto;
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink); background: var(--c); border-radius: 4px; padding: 2px 5px;
}

.quad__face { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: auto 0; }
.quad__glyph { font-size: 30px; line-height: 1; filter: saturate(1.1); }
.quad__glyph--q { color: var(--faint); font-weight: 700; }
.quad__label { font-size: 11.5px; color: var(--muted); }

/* vote-state treatments — instantly distinguishable */
.quad--up {
  border-color: var(--c);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--c) 26%, var(--ink-3)), var(--ink-3));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent) inset;
}
.quad--up .quad__label { color: var(--paper); }
.quad--down {
  border-color: rgba(138, 48, 48, 0.6);
  background: repeating-linear-gradient(135deg, var(--ink-3), var(--ink-3) 8px, rgba(138,48,48,0.10) 8px, rgba(138,48,48,0.10) 16px);
}
.quad--down .quad__glyph { filter: grayscale(0.4) brightness(0.85); }
.quad--unknown { border-style: dashed; opacity: 0.92; }

.quad.is-me { box-shadow: 0 0 0 2px var(--c); }

.quad__controls { display: flex; gap: 8px; margin-top: 10px; }
.vote {
  flex: 1;
  padding: 9px 0;
  font-size: 19px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}
.vote:active { transform: scale(0.94); }
.vote--up.active   { background: color-mix(in srgb, var(--c) 30%, var(--ink-2)); border-color: var(--c); }
.vote--down.active { background: rgba(138, 48, 48, 0.30); border-color: var(--oxblood); }

.quad__claim {
  margin-top: 10px;
  padding: 8px;
  font: 600 12px "Inter", sans-serif;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.quad__claim:hover { color: var(--paper); border-color: var(--muted); }

.day__hint { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--muted); }

@media (max-width: 360px) {
  .cell { width: 50px; }
  .quad { min-height: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-backdrop { animation: none; }
  .cell, .quad, .vote, .picker__chip { transition: none; }
}
