*, *::before, *::after { box-sizing: border-box; }
:root {
  --bg: #0a1020; --glow: #1f3a6e; --panel: #131c33; --line: #26324f;
  --gold: #e8c766; --silver: #cfd6e2; --pitch: #17603a; --chip: #0b1222;
  --text: #eef1f7; --muted: #9fb0cf; --bad: #ff6b81; --good: #45d483;
  /* brushed-metal gold: one fixed highlight band, it never moves */
  --gold-metal: linear-gradient(135deg, #a77f25 0%, #e8c766 28%, #fff1b8 46%, #e8c766 60%, #b8902d 100%);
  --metal-edge: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -1px 0 rgba(90,60,10,.35);
}
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px;
  background: radial-gradient(120% 70% at 50% -10%, var(--glow) 0%, transparent 60%), var(--bg);
  background-repeat: no-repeat;
}
a { color: var(--gold); }
h1 { font-size: 22px; font-weight: 900; margin: 8px 0 14px; }
h2 { font-size: 17px; font-weight: 900; margin: 22px 0 10px; }
.wrap { max-width: 480px; margin: 0 auto; padding: 0 18px 32px; }

.bar { display: flex; justify-content: space-between; align-items: center; max-width: 480px; margin: 0 auto; padding: 14px 18px 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.brand { font-weight: 900; letter-spacing: .1em; color: var(--gold); text-decoration: none; }
.brand .word { background: var(--gold-metal); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.prog { height: 4px; margin: 0 18px; border-radius: 2px; background: rgba(255,255,255,.1); }
.prog i { display: block; height: 100%; border-radius: 2px; background: var(--gold-metal); }

.panel { display: block; background: var(--panel); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; margin: 0 0 12px; color: var(--text); text-decoration: none; }
a.panel { font-weight: 700; }
.links { display: flex; flex-direction: column; }
form.panel label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
input, select { display: block; width: 100%; margin-top: 6px; padding: 12px; font-size: 16px; color: var(--text); background: var(--chip); border: 1px solid var(--line); border-radius: 10px; }
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
button { font: inherit; cursor: pointer; }
.primary { width: 100%; padding: 13px; font-weight: 900; color: #1b1405; background: var(--gold-metal); box-shadow: var(--metal-edge); border: 0; border-radius: 12px; }
.ghost { padding: 11px 16px; font-weight: 700; color: var(--text); background: var(--panel); border: 1.5px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.error { color: var(--bad); font-weight: 700; margin: 0 0 12px; }
.ok { color: var(--good); font-weight: 700; margin: 0 0 12px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
code { overflow-wrap: anywhere; }  /* long links wrap on a phone */

/* front page: two big buttons; Kayıt ol greys out while no join link is active */
.welcome { text-align: center; padding: 18vh 0 28px; }
.welcome-ball { font-size: 56px; line-height: 1; margin-bottom: 14px; }
.welcome h1 { font-size: 26px; margin: 0; }
.cta { display: block; width: 100%; text-align: center; text-decoration: none; margin: 0 0 12px; }
.ghost.cta { padding: 13px; }
.cta.off { opacity: .5; cursor: default; }
.cta small { display: block; margin-top: 2px; font-size: 12px; font-weight: 700; color: var(--muted); }

/* team panels: solid navy, gold/silver as accents only */
.team { position: relative; border-radius: 16px; padding: 8px; cursor: pointer; background: var(--panel); border: 1.5px solid var(--line); }
.team.gold { border-color: rgba(232,199,102,.55); }
.team.silver { border-color: rgba(200,210,225,.4); }
.team.sel { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.thead { display: flex; justify-content: space-between; align-items: center; margin: 0 2px 6px; }
.badge { font-size: 12px; font-weight: 900; letter-spacing: .08em; padding: 3px 10px; border-radius: 999px; color: #1b1405; }
.gold .badge { background: var(--gold-metal); box-shadow: var(--metal-edge); }
.silver .badge { background: var(--silver); color: #151a22; }
.tap { font-size: 11px; color: var(--muted); font-weight: 600; }
.sel .tap { color: var(--gold); }

/* pitch: goal always at the bottom, attacking up */
.pitch, .field { position: relative; border-radius: 10px; background: var(--pitch); overflow: hidden; }
.pitch::before, .field::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(180deg, rgba(255,255,255,.045) 0 12.5%, transparent 12.5% 25%); }
.pitch .ln, .field .ln { position: absolute; border: 1.5px solid rgba(255,255,255,.3); }
.ln.box18 { left: 24%; right: 24%; bottom: -2px; height: 18%; border-bottom: none; }
.ln.arc { left: 50%; top: -16%; width: 32%; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%; }

/* chip: position circle on top of a name pill. max-width (inline, % of pitch) comes from
   grid.chip_room so same-line neighbours never overlap; long names end in an ellipsis. */
.chip { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; width: max-content; z-index: 1; }
.chip b { position: relative; z-index: 1; flex: none; min-width: 20px; height: 20px; padding: 0 4px; margin-bottom: -4px; border-radius: 999px; border: 1.5px solid var(--chip); font-size: 9px; font-weight: 900; display: flex; align-items: center; justify-content: center; color: #1b1405; }
.gold .chip b { background: var(--gold-metal); }
.silver .chip b { background: var(--silver); color: #151a22; }
.chip span { display: block; max-width: 100%; padding: 4px 4px 2px; border-radius: 999px; background: var(--chip); border: 1px solid rgba(255,255,255,.18); font-size: 12px; font-weight: 700; line-height: 13px; letter-spacing: -.2px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip small { display: block; max-width: 100%; margin-top: 2px; padding: 0 5px; border-radius: 999px; background: rgba(11,18,34,.85); font-size: 9.5px; font-weight: 800; line-height: 12px; color: #f6de8d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip span.split { display: flex; }
.chip .nm, .chip .sf { font-style: normal; }
.chip .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chip .sf { flex: none; white-space: pre; }
.chip.me span { background: var(--gold-metal); border-color: #fff3c4; color: #1b1405; }
.chip.me b { background: #1b1405 !important; color: var(--gold) !important; border-color: var(--gold); }

/* orientation prompt: pages declare data-orient="portrait" or "landscape" */
.rotate { display: none; position: fixed; inset: 0; z-index: 100; align-items: center; justify-content: center; text-align: center; padding: 24px; background: var(--bg); color: var(--gold); font-size: 22px; font-weight: 900; }
@media (orientation: landscape) { body[data-orient="portrait"] .rotate { display: flex; } }
@media (orientation: portrait) { body[data-orient="landscape"] .rotate { display: flex; } }

/* phase 1 grid */
/* a container, so each role tag fits its lane (a fifth of the pitch): tags on the outer lanes stay inside */
.pitch.grid { height: 62vh; min-height: 380px; max-height: 560px; max-width: 360px; margin: 0 auto 10px; container-type: inline-size; }
.spot { position: absolute; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); background: transparent; color: #fff; font-size: 11px; font-weight: 900; padding: 0; z-index: 1; }
.spot.love { background: var(--good); border-color: #fff; color: #06240f; }
.spot.hate { background: var(--bad); border-color: #fff; color: #3a0610; }
.legend { display: flex; justify-content: center; gap: 14px; font-size: 13px; margin: 0 0 10px; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; border: 1px solid rgba(255,255,255,.5); }
.legend .l::before { background: var(--good); } .legend .o::before { background: transparent; } .legend .h::before { background: var(--bad); }
.hint { text-align: center; font-size: 13px; color: var(--muted); }

/* phase 2: landscape, two teams side by side */
/* compact chrome so the pitches keep enough height for the chips (lines are 14% apart) */
body[data-orient="landscape"] .bar { max-width: none; padding: 6px 12px 0; }
body[data-orient="landscape"] .wrap { max-width: none; padding: 0 8px 8px; }
.p2-title { text-align: center; font-size: 16px; margin: 0 0 4px; }
.p2 { display: flex; align-items: stretch; }
.p2 .team { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 6px; }
.p2 .thead { margin-bottom: 4px; }
.p2 .pitch { flex: 1 0 auto; height: calc(100vh - 100px); height: calc(100dvh - 100px); min-height: 200px; }
.p2.hist { margin-bottom: 12px; }
.p2.hist .pitch { height: 260px; flex: none; }
.p2 .vs { width: 26px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; color: var(--muted); letter-spacing: .1em; }
.thead .ghost { margin: 0; padding: 4px 10px; font-size: 12px; }

/* phase 3: portrait swipe card */
.p3-title { text-align: center; font-size: 22px; margin: 12px 0 10px; }
body[data-orient="portrait"] .wrap { padding-left: 12px; padding-right: 12px; }
.swipe { cursor: grab; touch-action: pan-y; user-select: none; margin: 4px 4px 0; padding: 6px; transform: rotate(-2deg); box-shadow: 0 14px 30px rgba(0,0,0,.45); }
.swipe .pitch { height: min(52vh, 380px); }
.stamp { position: absolute; top: 46px; padding: 3px 10px; border: 3px solid; border-radius: 8px; font-weight: 900; font-size: 18px; letter-spacing: .05em; background: var(--bg); z-index: 2; opacity: 0; pointer-events: none; }
.stamp.yes { right: 18px; transform: rotate(10deg); color: var(--good); border-color: var(--good); }
.stamp.no { left: 18px; transform: rotate(-10deg); color: var(--bad); border-color: var(--bad); }
.acts { display: flex; justify-content: center; gap: 44px; margin-top: 22px; }
.btn { width: 72px; height: 72px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 24px; font-weight: 900; line-height: 1; }
.btn small { font-size: 11px; font-weight: 700; margin-top: 2px; }
.btn.no { background: var(--panel); border: 1.5px solid rgba(255,107,129,.6); color: var(--bad); }
.btn.yes { background: var(--gold-metal); box-shadow: var(--metal-edge), 0 6px 18px rgba(232,199,102,.25); border: 0; color: #1b1405; }
.p3-hist { cursor: default; margin-bottom: 12px; }
.p3-hist .pitch { height: 300px; }
.p3-hist .tap { font-size: 13px; font-weight: 900; }
.p3-hist .tap.yes { color: var(--good); } .p3-hist .tap.no { color: var(--bad); }

/* match day, bets, board */
.match .team { cursor: default; margin-bottom: 10px; }
.team.stack .pitch { height: 300px; }
.betform { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.betform input[type=number] { width: 90px; }
.board { list-style: none; margin: 0; padding: 4px 14px; }
.board li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.board li:last-child { border-bottom: 0; }
.pick { display: block; padding: 6px 0; }
.spot { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.spot .rl { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 3px; display: flex; width: max-content; max-width: 60px; max-width: min(64px, calc(20cqw - 6px)); font-style: normal; font-size: 9px; font-weight: 800; color: #fff; background: var(--chip); border-radius: 999px; padding: 1px 6px; white-space: nowrap; pointer-events: none; }
.spot .rl span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.spot .rl b { flex: none; margin-left: 3px; font-weight: 800; }
.shade { position: fixed; inset: 0; z-index: 20; background: rgba(5,8,16,.55); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
.shade.open { opacity: 1; visibility: visible; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 480px; margin: 0 auto; max-height: 85vh; overflow-y: auto; background: var(--panel); border-top: 1.5px solid var(--line); border-radius: 18px 18px 0 0; padding: 10px 14px 18px; transform: translateY(100%); visibility: hidden; transition: transform .25s, visibility .25s; }
.sheet.open { transform: translateY(0); visibility: visible; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: #3a4766; margin: 0 auto 10px; }
.sheet .sh-title b { font-size: 17px; }
.sheet .rrow { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.sheet .rrow .nm { flex: 1; font-weight: 700; font-size: 14px; }
.sheet .q { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--gold); color: var(--gold); font-size: 12px; font-weight: 900; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.sheet .st { min-width: 104px; text-align: center; font-size: 11.5px; font-weight: 800; padding: 6px 8px; border-radius: 999px; border: 1.5px solid rgba(255,255,255,.6); background: transparent; color: var(--text); }
.sheet .st.love { background: var(--good); color: #06240f; border-color: var(--good); }
.sheet .st.hate { background: var(--bad); color: #3a0610; border-color: var(--bad); }
.sheet .ency { display: block; margin-top: 10px; text-align: center; font-size: 13px; font-weight: 800; color: #1b1405; background: var(--gold-metal); box-shadow: var(--metal-edge); border-radius: 10px; padding: 10px; text-decoration: none; }
.sheet .note { font-size: 12px; color: var(--muted); text-align: center; margin: 10px 0 4px; }

/* role encyclopedia */
.gold-text { background: var(--gold-metal); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.tags { font-size: 12px; font-weight: 700; color: var(--muted); margin: 0 0 10px; }
.crumb { font-size: 13px; font-weight: 700; margin: 4px 0 8px; }
.role h1 { margin: 2px 0 4px; font-size: 26px; }
.role-svg { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto; border-radius: 10px; }
.key { font-size: 12px; color: var(--muted); text-align: center; margin: 8px 0 12px; }
.key span { white-space: nowrap; } .key .k-zone { display: block; margin-top: 2px; } .key .k-pass { color: #f6de8d; } .key .k-run { color: #fff; }
.role-text { font-size: 15px; line-height: 1.5; margin: 0; color: #d8deea; }
.back { text-align: center; font-size: 14px; font-weight: 700; }
.ency-hint { text-align: left; }
.ency-row h2 { margin: 18px 0 2px; }
.ency-list { padding: 2px 14px; }
.ency-list a { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.ency-list a:last-child { border-bottom: 0; }
.ency-list b { font-size: 15px; font-weight: 900; }
.ency-list small { font-size: 11px; font-weight: 700; color: var(--muted); text-align: right; }
