/* ── Padel Club design system — PS1-on-cream (spec §8) ─────────────── */

:root {
  /* canvas */
  --paper: #f4f1e8;
  --ink: #16162a;
  --panel: #fffdf6;

  /* action/status colors — status ONLY, never player accents (CONTEXT.md) */
  --cobalt: #2d4de0;      /* structure */
  --sour: #c4f000;        /* IN / go / primary action */
  --magenta: #ff2d78;     /* OUT / alert accent */
  --tangerine: #ff6b1a;   /* booked-court signal */
  --violet: #7b3ff2;      /* secondary structure */

  /* identity palette — player accents ONLY */
  --id-cobalt: #2d4de0;
  --id-violet: #7b3ff2;
  --id-teal: #0e9594;
  --id-gold: #d98e04;
  --id-crimson: #c1121f;
  --id-indigo: #4338ca;

  --bevel-light: rgba(255, 255, 255, 0.75);
  --bevel-dark: rgba(22, 22, 42, 0.28);
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);

  --font-head: "Archivo Black", "Archivo", system-ui, sans-serif;
  --font-body: "Archivo", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  /* no hover states; taps only (spec §8) */
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 96px;
  min-height: 100dvh;
}

h1, h2, h3, .head { font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.02em; }

button { font: inherit; color: inherit; }

/* ── bevel chrome ──────────────────────────────────────────────────── */

.bevel {
  background: var(--panel);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -2px 0 var(--bevel-dark), var(--shadow);
  border-radius: 6px;
}

.btn {
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -2px 0 var(--bevel-dark), var(--shadow-sm);
  font-family: var(--font-head);
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  padding: 10px 14px;
  transition: transform 60ms linear, box-shadow 60ms linear;
}
/* physical press-in (spec §8) */
.btn:active {
  transform: translate(3px, 3px);
  box-shadow: inset 2px 2px 0 var(--bevel-dark), 0 0 0 var(--ink);
}
.btn:disabled { opacity: 0.45; cursor: default; }

.btn-primary { background: var(--sour); }
.btn-big {
  width: 100%;
  padding: 16px;
  font-size: 20px;
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -2px 0 var(--bevel-dark), var(--shadow);
}
.btn-big:active { transform: translate(4px, 4px); box-shadow: inset 2px 2px 0 var(--bevel-dark); }

/* ── header ────────────────────────────────────────────────────────── */

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.logo {
  font-family: var(--font-head);
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.22em; /* letters overlap, matching og.jpg */
  padding-right: 0.22em;   /* reclaim the last letter's pull-in */
}
.logo b {
  font-weight: normal;
  display: inline-block;   /* per-letter tilt + bounce need a box */
  -webkit-text-stroke: 1px var(--ink);
  paint-order: stroke fill;
  text-shadow: 2px 2px 0 var(--ink);
}
/* same tilt/bounce pattern as the OG image, scaled to logo size */
.lg0 { transform: rotate(-3deg) translateY(-1px); }
.lg1 { transform: rotate(5deg)  translateY(2px); }
.lg2 { transform: rotate(-4deg) translateY(-1px); }
.lg3 { transform: rotate(6deg)  translateY(2px); }
.lg4 { transform: rotate(-6deg) translateY(-2px); }
.lg5 { transform: rotate(4deg)  translateY(1px); }
/* dark colors (cobalt/violet) go to simple letterforms; open ones stay bright */
.lg0 { color: var(--tangerine); }
.lg1 { color: var(--magenta); }
.lg2 { color: var(--id-teal); }
.lg3 { color: var(--sour); }
.lg4 { color: var(--violet); }
.lg5 { color: var(--cobalt); }
/* icon buttons: kill .btn padding so the glyph truly centers */
.gear, .back, .x {
  padding: 0;
  line-height: 1;
  display: grid;
  place-items: center;
}
.gear, .back { width: 44px; height: 44px; font-size: 20px; }

/* ── schedule ──────────────────────────────────────────────────────── */

.week-label {
  font-family: var(--font-head);
  font-size: 13px;
  color: var(--cobalt);
  margin: 22px 0 10px;
  letter-spacing: 0.08em;
}

.card { padding: 14px; margin-bottom: 14px; position: relative; }

.card-toprow { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-day { font-family: var(--font-head); font-size: 13px; color: var(--violet); }
.card-time {
  font-family: var(--font-head);
  font-size: 40px;
  line-height: 1;
  margin: 2px 0 2px;
  text-shadow: 3px 3px 0 rgba(22, 22, 42, 0.14); /* scoreboard offset */
}
.card-loc { font-size: 14px; font-weight: 700; }

/* rotated ink-stamp court status */
.stamp {
  font-family: var(--font-head);
  font-size: 11px;
  padding: 4px 8px;
  border: 2px solid currentColor;
  border-radius: 4px;
  transform: rotate(6deg);
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.stamp-ok { color: var(--tangerine); }
.stamp-need { color: var(--magenta); }
.stamp-over { color: var(--magenta); }
.stamp-none { color: rgba(22, 22, 42, 0.4); }

.card-mid { display: flex; align-items: center; justify-content: space-between; margin: 10px 0; gap: 8px; }

/* roster strip: overlapping face tiles */
.strip { display: flex; }
.strip .tile { margin-left: -8px; }
.strip .tile:first-child { margin-left: 0; }
.tile {
  width: 40px; height: 40px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 2px 2px 0 var(--ink);
  overflow: hidden;
  position: relative;
  flex: none;
  display: grid; place-items: center;
  font-family: var(--font-head);
  font-size: 14px;
  color: #fff;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .tag {
  position: absolute; right: -1px; bottom: -1px;
  font-size: 8px; line-height: 1;
  padding: 2px 3px;
  background: var(--ink); color: #fff;
  border-top-left-radius: 4px;
}
.tile-more { background: var(--ink); color: #fff; font-size: 12px; }
.tile-lg { width: 56px; height: 56px; font-size: 20px; border-radius: 10px; }

@keyframes pulse { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.pulse { animation: pulse 340ms ease-out; }

.count-chip { text-align: right; flex: none; }
.count-chip .n { font-family: var(--font-head); font-size: 26px; line-height: 1; display: block; }
.count-chip .lbl { font-size: 11px; font-weight: 700; color: rgba(22, 22, 42, 0.6); text-transform: uppercase; }

/* inline RSVP row */
.rsvp-row { display: flex; gap: 8px; margin-top: 12px; }
.rsvp-row .btn { flex: 1; font-size: 13px; padding: 10px 4px; }
.rsvp-in.on { background: var(--sour); }
.rsvp-out.on { background: var(--magenta); color: #fff; }
.rsvp-maybe.on { background: var(--violet); color: #fff; }

/* ── forms ─────────────────────────────────────────────────────────── */

.field { margin-bottom: 16px; }
.field label { display: block; font-family: var(--font-head); font-size: 12px; margin-bottom: 6px; text-transform: uppercase; }
input[type="text"], input[type="time"], input[type="date"], input[type="url"],
input[type="password"], input[type="tel"], textarea {
  width: 100%;
  font: inherit;
  font-weight: 700;
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: inset 2px 2px 0 var(--bevel-dark);
  -webkit-appearance: none;
  appearance: none;
}
input:focus, textarea:focus { outline: 3px solid var(--cobalt); outline-offset: 1px; }
.input-time { font-family: var(--font-head); font-size: 28px; text-align: center; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 2px 2px 0 var(--ink);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 12px;
  cursor: pointer;
}
.chip.on { background: var(--cobalt); color: #fff; }
.chip:active { transform: translate(2px, 2px); box-shadow: none; }

/* ── game detail ───────────────────────────────────────────────────── */

.detail-time { font-family: var(--font-head); font-size: 52px; line-height: 1; text-shadow: 4px 4px 0 rgba(22,22,42,0.14); }
.detail-sub { font-weight: 700; margin: 6px 0 2px; }
.detail-by { font-size: 12px; color: rgba(22,22,42,0.55); }

.panel { padding: 14px; margin: 16px 0; }
.panel h3 { font-size: 13px; margin-bottom: 10px; }

.booking-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.booking-row .who { flex: 1; font-weight: 700; }
.booking-row .x { width: 34px; height: 34px; font-size: 14px; }
.booking-row .cost { font-family: var(--font-head); font-size: 14px; }
.cost-wrap { display: flex; align-items: center; gap: 3px; font-weight: 700; }
.cost-input {
  width: 76px;
  font-family: var(--font-head);
  font-size: 15px;
  text-align: center;
  padding: 8px 6px;
}
.split-line {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px dashed rgba(22, 22, 42, 0.18);
  font-size: 13px;
}
.split-line b { font-family: var(--font-head); color: var(--tangerine); }

.roster-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.roster-row .nm { flex: 1; font-weight: 700; }
.roster-row .st { font-family: var(--font-head); font-size: 11px; }
.roster-row .rank { text-align: right; flex: none; }
.roster-row .rank .ord { display: block; font-family: var(--font-head); font-size: 13px; color: var(--cobalt); }
.roster-row .rank .at { font-size: 10px; font-weight: 700; color: rgba(22, 22, 42, 0.5); }
.roster-row.me { background: rgba(196, 240, 0, 0.25); border-radius: 6px; padding-left: 6px; padding-right: 6px; }
.roster-note { font-size: 11px; color: rgba(22,22,42,0.55); }

.group-h { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 4px; }
.group-h h3 { font-size: 13px; }
.group-h .cnt { font-family: var(--font-head); font-size: 13px; color: var(--cobalt); }

/* bottom-pinned your-status bar */
.statusbar {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: 12px;
  width: min(456px, calc(100vw - 24px));
  padding: 10px;
  z-index: 10;
  background: var(--panel);
}
.statusbar .rsvp-row { margin-top: 0; }

/* ── onboarding ────────────────────────────────────────────────────── */

.face-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.face-cell { display: grid; place-items: center; gap: 6px; padding: 12px 6px; cursor: pointer; text-align: center; }
.face-cell .nm { font-weight: 700; font-size: 13px; }

.pin-input { font-family: var(--font-head); font-size: 32px; text-align: center; letter-spacing: 0.4em; }

/* ── misc ──────────────────────────────────────────────────────────── */

.empty { text-align: center; padding: 36px 20px; color: rgba(22,22,42,0.6); }
.empty .big { font-family: var(--font-head); font-size: 18px; color: var(--ink); margin-bottom: 8px; }

.note { font-size: 12px; color: rgba(22,22,42,0.55); margin-top: 8px; }
.err { color: var(--magenta); font-weight: 700; font-size: 13px; margin-top: 8px; }

#toast {
  position: fixed;
  left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: 84px;
  background: var(--ink); color: #fff;
  font-family: var(--font-head);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms, transform 160ms;
  z-index: 50;
  max-width: calc(100vw - 32px);
  text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-act {
  background: var(--sour); color: var(--ink);
  border: 2px solid var(--paper); border-radius: 4px;
  font-family: var(--font-head); font-size: 12px;
  padding: 4px 10px; margin-left: 10px; cursor: pointer;
}

.row { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }
.mt { margin-top: 16px; }
