/* =========================================================
   Hogwarts Quidditch Arena — theme
   ========================================================= */
:root {
  --ink: #2b1d0e;
  --ink-soft: #5b4630;
  --parch: #f4e9d0;
  --parch-2: #eadbb8;
  --parch-edge: #c9ae7a;
  --night: #141a2e;
  --night-2: #1f2742;
  --gold: #d4a73a;
  --gold-2: #f1cf6b;
  --red: #8b1e1e;
  --green: #2f6b3a;
  --pitch: #3f7a3a;
  --pitch-2: #2f5f2c;
  --radius: 10px;
  --shadow: 0 2px 0 rgba(90, 60, 20, .15), 0 8px 24px rgba(20, 10, 0, .18);
  --f-body: 'Sarabun', system-ui, sans-serif;
  --f-head: 'Chonburi', 'Sarabun', serif;
  --f-latin: 'Cinzel', 'Chonburi', serif;

  --gryffindor: #7f0909; --gryffindor-2: #ffc500;
  --slytherin: #1a472a;  --slytherin-2: #aaaaaa;
  --ravenclaw: #0e1a40;  --ravenclaw-2: #946b2d;
  --hufflepuff: #ecb939; --hufflepuff-2: #372e29;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #231c2c; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(241, 207, 107, .18), transparent 70%),
    linear-gradient(180deg, var(--night) 0, var(--night-2) 340px, #2a2233 900px, #231c2c 100%);
  background-repeat: no-repeat;
  min-height: 100vh;
}
a { color: #7a3b12; }
a:hover { color: var(--red); }
h1, h2, h3 { font-family: var(--f-head); font-weight: 400; line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
.muted { color: var(--ink-soft); opacity: .85; }
.small { font-size: .88rem; }
.center { text-align: center; }
code, pre { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; }
.code { background: #fff8; padding: 12px; border-radius: 8px; overflow: auto; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(10, 12, 24, .92), rgba(20, 26, 46, .85));
  border-bottom: 2px solid var(--gold);
  color: #f3e6c4;
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--gold-2); text-decoration: none; font-family: var(--f-latin); font-weight: 800; letter-spacing: .04em; font-size: 1.05rem; }
.brand:hover { color: #fff3c4; }
.brand-snitch {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff6c9, var(--gold) 55%, #8a6414);
  box-shadow: -12px 0 0 -7px #f5ecd4, 12px 0 0 -7px #f5ecd4, 0 0 12px rgba(241, 207, 107, .7);
  position: relative;
}
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav > a { color: #f3e6c4; text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 600; }
.nav > a:hover { background: rgba(241, 207, 107, .14); color: #fff; }
.nav > a.active { background: var(--gold); color: var(--night); }
.nav-user { margin-left: auto; font-size: .92rem; color: #d9cba6; }
.nav-user a { color: var(--gold-2); }
.nav-user .role { color: #bba98a; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--gold); color: var(--gold-2); border-radius: 8px; font-size: 1.2rem; padding: 2px 10px; cursor: pointer; }

/* ---------- page ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 16px 40px; }
.wrap.narrow, .card.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.wrap > h1, .page-title { color: var(--gold-2); text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; color: var(--gold-2); text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.foot { text-align: center; color: #8e7f63; font-family: var(--f-latin); font-size: .8rem; letter-spacing: .08em; padding: 24px 12px 32px; }

.card {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, .45), transparent 60%),
    linear-gradient(180deg, var(--parch), var(--parch-2));
  border: 1px solid var(--parch-edge);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  position: relative;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

/* ---------- forms ---------- */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
input, select, textarea {
  font: inherit; color: var(--ink);
  background: #fffaf0;
  border: 1px solid var(--parch-edge);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  min-width: 0;
}
input[type=checkbox], input[type=radio] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
textarea { min-height: 80px; resize: vertical; }
.form.compact { gap: 8px; }
.form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.form.inline > * { width: auto; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700;
  background: linear-gradient(180deg, #a3262a, #7a1519);
  color: #fff4d6;
  border: 1px solid #5a0e10;
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 2px 0 rgba(0, 0, 0, .2);
  transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.1); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.5); }
.btn-block { width: 100%; }
.btn-small { padding: 5px 10px; font-size: .88rem; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--parch-edge); box-shadow: none; }
.btn-ghost:hover { background: rgba(0, 0, 0, .05); color: var(--ink); }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #3a2605; border-color: #9a7420; }
.btn-danger { background: linear-gradient(180deg, #5b2a2a, #3b1414); }
.btn-quaffle { background: linear-gradient(180deg, #b6452d, #8a2e1c); }
.btn-bludger { background: linear-gradient(180deg, #4a4a52, #26262c); }
.btn-snitch { background: linear-gradient(180deg, var(--gold-2), #b8871f); color: #3a2605; border-color: #8a6414; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash-ok { background: #e3f1dc; border-color: #9cc58a; color: #264d1a; }
.flash-err { background: #f7dede; border-color: #d59a9a; color: #6e1616; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid rgba(120, 90, 40, .25); vertical-align: middle; }
th { font-family: var(--f-head); font-weight: 400; font-size: .92rem; color: var(--ink-soft); white-space: nowrap; }
tr:hover td { background: rgba(255, 255, 255, .25); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.mini th, table.mini td { padding: 4px 8px; font-size: .9rem; }
table.mini tr.ok td { color: #1e5220; }
table.mini tr.no td { color: #7b2a2a; opacity: .75; }

/* ---------- badges / houses ---------- */
.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; background: #ddd0b0; color: var(--ink); white-space: nowrap; }
.badge.house-gryffindor { background: var(--gryffindor); color: var(--gryffindor-2); }
.badge.house-slytherin  { background: var(--slytherin);  color: #d8d8d8; }
.badge.house-ravenclaw  { background: var(--ravenclaw);  color: #d9b77a; }
.badge.house-hufflepuff { background: var(--hufflepuff); color: var(--hufflepuff-2); }
.badge.st-live { background: #b3261e; color: #fff; }
.badge.st-scheduled { background: #3a4a7a; color: #fff; }
.badge.st-finished { background: #6b5b3e; color: #fff; }
.badge.st-cancelled { background: #888; color: #fff; }
.badge.pos { background: #efe2c2; border: 1px solid var(--parch-edge); }

.house-pick { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.house-pick legend { font-weight: 600; margin-bottom: 6px; }
.house-opt { display: block !important; cursor: pointer; }
.house-opt input { position: absolute; opacity: 0; }
.house-opt span { display: block; padding: 10px; border-radius: 8px; text-align: center; font-weight: 700; border: 2px solid transparent; opacity: .75; transition: .15s; }
.house-opt input:checked + span { opacity: 1; border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(212, 167, 58, .35); transform: scale(1.03); }
.house-opt input:focus-visible + span { outline: 2px solid var(--gold); }
.house-opt.house-gryffindor span { background: var(--gryffindor); color: var(--gryffindor-2); }
.house-opt.house-slytherin span  { background: var(--slytherin); color: #e5e5e5; }
.house-opt.house-ravenclaw span  { background: var(--ravenclaw); color: #e0c28a; }
.house-opt.house-hufflepuff span { background: var(--hufflepuff); color: var(--hufflepuff-2); }

.login-hero { min-height: 70vh; display: grid; place-items: center; }
.page-login .card h1 { font-size: 2rem; }

/* ---------- dashboard ---------- */
.house-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.hcard { border-radius: var(--radius); padding: 14px; color: #fff; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hcard .an { font-size: 2rem; line-height: 1; }
.hcard .hn { font-family: var(--f-head); font-size: 1.1rem; margin-top: 6px; }
.hcard .hp2 { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hcard .hs { font-size: .85rem; opacity: .9; }
.hcard.house-gryffindor { background: linear-gradient(135deg, #9b1111, #5c0606); color: #ffe39a; }
.hcard.house-slytherin  { background: linear-gradient(135deg, #245c37, #11301c); color: #e4e4e4; }
.hcard.house-ravenclaw  { background: linear-gradient(135deg, #1b2b63, #0a1230); color: #e5c790; }
.hcard.house-hufflepuff { background: linear-gradient(135deg, #f2c94c, #c99a1f); color: #2e241c; }
.hcard .rank { position: absolute; top: 10px; right: 12px; font-family: var(--f-latin); font-size: 1.4rem; opacity: .6; }

.match-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.match-item { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 12px 14px; background: rgba(255, 255, 255, .35); border: 1px solid rgba(160, 120, 60, .3); border-radius: 10px; text-decoration: none; color: inherit; }
.match-item:hover { background: rgba(255, 255, 255, .6); color: inherit; }
.match-item .side-a { text-align: right; }
.match-item .mid { text-align: center; min-width: 110px; }
.match-item .sc { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.match-item .meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; color: var(--ink-soft); border-top: 1px dashed rgba(120, 90, 40, .3); padding-top: 6px; flex-wrap: wrap; }
.match-item.is-live { border-color: #c0392b; box-shadow: 0 0 0 2px rgba(192, 57, 43, .25); }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #e0302a; margin-right: 6px; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.8); } }

/* ---------- arena ---------- */
.arena-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.arena-title { color: var(--gold-2); margin: 0; text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.arena-head .muted { color: #cbbd9c; margin: 2px 0 0; }
.status-pill { padding: 6px 14px; border-radius: 999px; font-weight: 700; background: #3a4a7a; color: #fff; white-space: nowrap; }
.status-pill.st-live { background: #c0392b; animation: pulse 2s infinite; }
.status-pill.st-finished { background: #6b5b3e; }

.scoreboard { display: grid; grid-template-columns: 1fr minmax(0, 2fr) 1fr; gap: 12px; align-items: stretch; margin-bottom: 18px; }
.team { border-radius: var(--radius); padding: 14px 10px; text-align: center; box-shadow: var(--shadow); position: relative; display: flex; flex-direction: column; justify-content: center; }
.team.house-gryffindor { background: linear-gradient(160deg, #a51515, #5c0606); color: #ffd966; }
.team.house-slytherin  { background: linear-gradient(160deg, #2a6b40, #11301c); color: #e8e8e8; }
.team.house-ravenclaw  { background: linear-gradient(160deg, #22357a, #0a1230); color: #e5c790; }
.team.house-hufflepuff { background: linear-gradient(160deg, #f5d05a, #c99a1f); color: #2e241c; }
.team .crest { font-size: 2.2rem; line-height: 1; }
.team .tname { font-family: var(--f-head); font-size: 1.1rem; }
.team .score { font-family: var(--f-latin); font-weight: 800; font-size: 3.2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.team .score.bump { animation: bump .7s ease; }
@keyframes bump { 0% { transform: scale(1); } 30% { transform: scale(1.35); text-shadow: 0 0 20px currentColor; } 100% { transform: scale(1); } }
.team .dazed { font-size: .8rem; background: rgba(0, 0, 0, .3); border-radius: 999px; padding: 1px 8px; margin: 4px auto 0; animation: wobble 1.5s infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }

.pitch {
  position: relative; min-height: 150px; border-radius: 80px / 60px; overflow: hidden;
  background:
    repeating-linear-gradient(90deg, transparent 0 40px, rgba(255, 255, 255, .04) 40px 80px),
    radial-gradient(ellipse at center, var(--pitch), var(--pitch-2));
  border: 3px solid rgba(255, 255, 255, .55);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .35), var(--shadow);
}
.midline { position: absolute; left: 50%; top: 0; bottom: 0; border-left: 2px dashed rgba(255, 255, 255, .35); }
.midline::after { content: ''; position: absolute; left: -26px; top: 50%; margin-top: -25px; width: 50px; height: 50px; border: 2px solid rgba(255, 255, 255, .35); border-radius: 50%; }
.hoops { position: absolute; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.hoops-a { left: 10px; }
.hoops-b { right: 10px; }
.hoops i { display: block; width: 18px; height: 18px; border: 3px solid var(--gold-2); border-radius: 50%; box-shadow: 0 0 6px rgba(241, 207, 107, .6); }
.hoops i.tall { width: 24px; height: 24px; }
.ball { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; opacity: 0; transition: opacity .3s; }
.ball.b-quaffle { opacity: 1; background: radial-gradient(circle at 35% 35%, #e46b4d, #8a2e1c); animation: toss 1.6s ease-in-out infinite; }
.ball.b-bludger { opacity: 1; background: radial-gradient(circle at 35% 35%, #777, #1a1a1a); animation: bludge 1.1s ease-in-out infinite; }
@keyframes toss { 0%, 100% { transform: translate(-30px, 8px); } 50% { transform: translate(30px, -22px); } }
@keyframes bludge { 0% { transform: translate(-60px, 20px); } 25% { transform: translate(40px, -30px); } 50% { transform: translate(70px, 25px); } 75% { transform: translate(-20px, -15px); } 100% { transform: translate(-60px, 20px); } }
.snitch { position: absolute; left: 50%; top: 40%; opacity: 0; pointer-events: none; }
.snitch span { display: block; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6c9, var(--gold) 60%, #8a6414); box-shadow: -11px -3px 0 -5px #fff, 11px -3px 0 -5px #fff, 0 0 14px 4px rgba(255, 220, 120, .8); }
.snitch.show { opacity: 1; animation: flit 3.4s linear infinite; }
@keyframes flit {
  0% { transform: translate(-120px, 30px); } 15% { transform: translate(60px, -40px); } 30% { transform: translate(140px, 20px); }
  45% { transform: translate(-20px, 45px); } 60% { transform: translate(-150px, -30px); } 75% { transform: translate(20px, -50px); }
  90% { transform: translate(100px, 40px); } 100% { transform: translate(-120px, 30px); }
}
.burst { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-latin); font-weight: 800; font-size: 2.6rem; color: #fff; text-shadow: 0 0 20px rgba(0, 0, 0, .8), 0 0 40px var(--gold); opacity: 0; pointer-events: none; letter-spacing: .06em; }
.burst.go { animation: burst 1.8s ease forwards; }
.burst-save { color: #bfe3ff; }
.burst-bludger { color: #ddd; }
.burst-snitch { color: var(--gold-2); }
@keyframes burst { 0% { opacity: 0; transform: scale(.4); } 15% { opacity: 1; transform: scale(1.15); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.3); } }

.arena-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.play-card { min-height: 360px; }
.play-card[data-kind="quaffle"][data-state="open"] { box-shadow: 0 0 0 3px rgba(182, 69, 45, .6), var(--shadow); }
.play-card[data-kind="bludger"][data-state="open"] { box-shadow: 0 0 0 3px rgba(40, 40, 40, .6), var(--shadow); }
.play-card[data-kind="snitch"][data-state="open"] { box-shadow: 0 0 0 3px rgba(212, 167, 58, .9), 0 0 30px rgba(241, 207, 107, .5), var(--shadow); }
.play-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kind-badge { font-family: var(--f-head); padding: 4px 14px; border-radius: 999px; background: #d9c9a2; }
.kb-quaffle { background: #8a2e1c; color: #ffe8d6; }
.kb-bludger { background: #26262c; color: #eee; }
.kb-snitch { background: var(--gold); color: #3a2605; }
.play-no { color: var(--ink-soft); font-size: .9rem; }
.timer { margin-left: auto; display: flex; align-items: baseline; gap: 4px; font-family: var(--f-latin); }
.timer b { font-size: 2rem; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.timer small { font-family: var(--f-body); color: var(--ink-soft); }
.timer.hurry b { color: #b3261e; animation: pulse .6s infinite; }
.timebar { height: 6px; background: rgba(0, 0, 0, .1); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.timebar div { height: 100%; width: 0; background: linear-gradient(90deg, #b3261e, var(--gold)); transition: width .2s linear; }
.who { font-size: .9rem; color: var(--ink-soft); margin: 4px 0 10px; }
.question { font-family: var(--f-body); font-weight: 700; font-size: 1.35rem; margin: 6px 0 16px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 10px; text-align: left;
  font: inherit; font-size: 1.02rem; color: var(--ink);
  background: #fffaf0; border: 2px solid var(--parch-edge); border-radius: 10px;
  padding: 12px; cursor: pointer; min-height: 58px; transition: .12s;
}
.choice:not(:disabled):hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(120, 80, 20, .2); }
.choice:disabled { cursor: default; }
.choice .ck { flex: 0 0 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--night-2); color: var(--gold-2); font-family: var(--f-latin); font-weight: 800; }
.choice.mine { border-color: #3a4a7a; background: #e6ebf8; }
.choice.correct { border-color: #2f7d32; background: #dff1db; }
.choice.correct .ck { background: #2f7d32; color: #fff; }
.choice.wrong { border-color: #b3261e; background: #f7dede; }
.choice.key { outline: 2px dashed #2f7d32; outline-offset: 2px; }
.my-status { margin: 12px 0 0; font-weight: 600; min-height: 1.6em; }
.result { margin-top: 12px; border-top: 1px dashed var(--parch-edge); padding-top: 10px; }
.res-line { margin: 0 0 8px; }

.side .card { margin-bottom: 18px; }
.ref-panel { border: 2px solid #3a4a7a; }
.ref-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ref-row .btn { flex: 1 1 auto; }
.ref-panel details { margin: 8px 0; }
.ref-panel summary { cursor: pointer; font-weight: 600; }
.ref-answers ul { padding-left: 18px; margin: 4px 0; }

.feed { list-style: none; margin: 0; padding: 0; max-height: 440px; overflow-y: auto; display: grid; gap: 6px; }
.feed .ev { padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .45); border-left: 4px solid var(--parch-edge); font-size: .95rem; animation: slidein .35s ease; }
.feed .ev-goal { border-left-color: #b6452d; background: #fbe6dc; font-weight: 600; }
.feed .ev-save { border-left-color: #3a6ea5; background: #e0ebf6; }
.feed .ev-bludger { border-left-color: #222; background: #e6e6e6; }
.feed .ev-snitch { border-left-color: var(--gold); background: #fff2c4; font-weight: 700; }
.feed .ev-end { border-left-color: var(--red); background: #f6e3c0; font-weight: 700; }
.feed .ev-foul { border-left-color: #d8a200; }
@keyframes slidein { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

.rosters { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.roster h3 { margin-bottom: 8px; }
.roster.house-gryffindor { border-top: 6px solid var(--gryffindor); }
.roster.house-slytherin  { border-top: 6px solid var(--slytherin); }
.roster.house-ravenclaw  { border-top: 6px solid var(--ravenclaw); }
.roster.house-hufflepuff { border-top: 6px solid var(--hufflepuff); }
.roster ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.roster li { display: grid; grid-template-columns: 28px 1fr auto; gap: 6px; align-items: center; padding: 5px 8px; border-radius: 6px; transition: .2s; }
.roster li.on { background: rgba(212, 167, 58, .28); box-shadow: inset 3px 0 0 var(--gold); font-weight: 700; }
.roster li.res { opacity: .6; }
.roster .pp { font-size: .82rem; color: var(--ink-soft); }
.rules ul { margin: 8px 0 0; padding-left: 20px; }
.rules summary { cursor: pointer; font-family: var(--f-head); }

.arena.finished .scoreboard .team { opacity: .75; }
.arena.finished[data-winner] .team { transition: .4s; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1f2742; color: #f3e6c4; padding: 10px 18px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); z-index: 100; transition: opacity .5s, transform .5s; border: 1px solid var(--gold); }
.toast.err { background: #6e1616; }
.toast.out { opacity: 0; transform: translate(-50%, 10px); }

/* ---------- roster editor ---------- */
.slots { display: grid; gap: 8px; }
.slot { display: grid; grid-template-columns: 130px 1.2fr 1fr 70px; gap: 8px; align-items: center; }
.slot .sl { font-weight: 600; }
.counter { font-size: .85rem; }
.counter.ok { color: #2f7d32; }
.counter.bad { color: #b3261e; }

.q-item { border-bottom: 1px dashed rgba(120, 90, 40, .3); padding: 10px 0; }
.q-item:last-child { border-bottom: 0; }
.q-item .qt { font-weight: 600; }
.q-item ol { margin: 4px 0; padding-left: 22px; list-style: upper-alpha; }
.q-item li.ans { color: #2f7d32; font-weight: 700; }
.q-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pill-snitch { background: var(--gold); color: #3a2605; }


/* =========================================================
   Arena v2
   ========================================================= */
.head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.clock { font-family: var(--f-latin); font-weight: 800; font-size: 1.5rem; color: var(--gold-2); background: rgba(0,0,0,.35); border: 1px solid rgba(241,207,107,.4); border-radius: 10px; padding: 2px 12px; font-variant-numeric: tabular-nums; }
.weather-pill { background: rgba(255,255,255,.12); color: #f3e6c4; border-radius: 999px; padding: 4px 12px; font-weight: 600; }
.status-pill.st-paused { background: #6b5b3e; }
.team-flags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 4px; min-height: 22px; }
.flag { font-size: .78rem; background: rgba(0,0,0,.3); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.house-hufflepuff .flag { background: rgba(255,255,255,.35); }

/* pitch */
.zone-lines { position: absolute; inset: 0; display: flex; justify-content: space-evenly; pointer-events: none; }
.zone-lines i { width: 0; border-left: 2px dashed rgba(255,255,255,.28); }
.zone-lines::after { content: ''; position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border: 2px solid rgba(255,255,255,.3); border-radius: 50%; }
.hoops i { transition: .3s; }
.hoops.target i { border-color: #fff; box-shadow: 0 0 12px #fff; animation: pulse 1s infinite; }
.hoops i.guard { background: rgba(80,160,255,.55); border-color: #9cd0ff; }
.hoops i.scored { background: #e46b4d; border-color: #ffd0c0; box-shadow: 0 0 18px #ff7a4d; transform: scale(1.3); }
.hoops i.saved { background: #6fb7ff; border-color: #fff; box-shadow: 0 0 18px #6fb7ff; transform: scale(1.3); }
.quaffle { position: absolute; top: 50%; left: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e98a6c, #8a2e1c); box-shadow: 0 2px 6px rgba(0,0,0,.5);
  transition: left .9s cubic-bezier(.4,1.4,.5,1); z-index: 3; }
.quaffle.held { animation: bob 1.4s ease-in-out infinite; }
.quaffle .qlabel { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .72rem; font-weight: 700; color: #fff; background: rgba(0,0,0,.55); padding: 0 6px; border-radius: 6px; }
@keyframes bob { 0%,100% { margin-top: -11px; } 50% { margin-top: -19px; } }
.bludger { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #888, #111); z-index: 2; }
.bludger.b1 { left: 30%; top: 22%; animation: drift1 7s ease-in-out infinite; }
.bludger.b2 { left: 65%; top: 70%; animation: drift2 8s ease-in-out infinite; }
.bludger.active { animation-duration: 1.3s; box-shadow: 0 0 10px rgba(255,60,60,.8); }
@keyframes drift1 { 0%,100% { transform: translate(0,0); } 33% { transform: translate(90px,40px); } 66% { transform: translate(-60px,50px); } }
@keyframes drift2 { 0%,100% { transform: translate(0,0); } 33% { transform: translate(-110px,-40px); } 66% { transform: translate(50px,-60px); } }
.pitch.rogue .bludger { background: radial-gradient(circle at 35% 35%, #c55, #300); animation-duration: .9s; }
.snitch.show { animation: flit 3.4s linear infinite; }
[data-weather="fog"] .pitch::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 60%, rgba(230,230,240,.65), rgba(200,200,215,.35)); z-index: 4; pointer-events: none; animation: fogmove 8s ease-in-out infinite alternate; }
@keyframes fogmove { from { transform: translateX(-4%); } to { transform: translateX(4%); } }
[data-weather="storm"] .pitch::before { content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: repeating-linear-gradient(105deg, transparent 0 9px, rgba(190,210,255,.35) 9px 10px); animation: rain .35s linear infinite; }
[data-weather="storm"] .pitch { filter: brightness(.75) saturate(.8); }
@keyframes rain { from { background-position: 0 0; } to { background-position: -20px 60px; } }
[data-weather="wind"] .pitch::before { content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 22px, rgba(255,255,255,.18) 22px 23px); background-size: 200% 100%; animation: wind 1.2s linear infinite; }
@keyframes wind { from { background-position: 0 0; } to { background-position: -120px 0; } }
.arena.cold .pitch, .arena.cold .scoreboard .team { filter: saturate(.3) brightness(.7); transition: filter .8s; }
.burst.b-save { color: #bfe3ff; } .burst.b-steal { color: #ffe08a; } .burst.b-bludger { color: #ddd; }
.burst.b-snitch { color: var(--gold-2); } .burst.b-dementor { color: #c8d4ff; }

/* crowd */
.crowd { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin: -6px 0 16px; }
.cheer { display: flex; align-items: center; gap: 8px; }
.cheer-b { justify-content: flex-end; }
.meter { flex: 1; height: 10px; border-radius: 999px; background: rgba(255,255,255,.15); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; transition: width .4s; background: var(--gold); }
.cheer-a .meter i { background: linear-gradient(90deg, var(--gold), #fff3b0); }
.cheer-b .meter { direction: rtl; }
.cheer-btn.pop { animation: pop .3s; }
@keyframes pop { 50% { transform: scale(1.15); } }
.crowd-mid { display: flex; flex-direction: column; align-items: center; gap: 2px; color: #e6d7b4; font-size: .88rem; text-align: center; }

/* prediction & final */
.predict-row { display: flex; gap: 10px; flex-wrap: wrap; }
.predict-row .btn { flex: 1 1 160px; }
.pbtn.picked { outline: 3px solid var(--gold-2); outline-offset: 2px; }
.house-bg-gryffindor { background: linear-gradient(180deg, #a51515, #6e0a0a) !important; color: #ffd966 !important; border-color: #4a0505 !important; }
.house-bg-slytherin  { background: linear-gradient(180deg, #2a6b40, #154025) !important; color: #eee !important; border-color: #0c2515 !important; }
.house-bg-ravenclaw  { background: linear-gradient(180deg, #22357a, #0e1a40) !important; color: #e5c790 !important; border-color: #070d22 !important; }
.house-bg-hufflepuff { background: linear-gradient(180deg, #f5d05a, #c99a1f) !important; color: #2e241c !important; border-color: #8a6a14 !important; }
.final-banner { text-align: center; border-radius: var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow); background: linear-gradient(180deg, var(--parch), var(--parch-2)); }
.fb-title { font-family: var(--f-head); font-size: 1.8rem; }
.fb-score { font-family: var(--f-latin); font-size: 2.4rem; font-weight: 800; }

/* play card */
.kb-faceoff { background: #8a2e1c; color: #ffe8d6; }
.kb-short { background: #b6452d; color: #fff1e6; }
.kb-long { background: var(--gold); color: #3a2605; }
.big-line { font-size: 1.2rem; font-weight: 700; margin: 6px 0 12px; }
.big-line.scored { color: #b3261e; font-size: 1.8rem; }
.big-line.saved { color: #1f5fa8; font-size: 1.8rem; }
.question.fog { transition: filter .2s; }
.pass-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pass-choice .btn { flex-direction: column; padding: 14px; font-size: 1.1rem; }
.pass-choice small { font-weight: 400; font-size: .8rem; opacity: .9; }
.hoop-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.hoop-btn { font: inherit; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: 12px; border: 2px solid var(--parch-edge); background: #fffaf0; cursor: pointer; color: var(--ink); transition: .12s; }
.hoop-btn i { width: 34px; height: 34px; border: 5px solid var(--gold); border-radius: 50%; }
.hoop-btn:hover { transform: translateY(-2px); border-color: var(--gold); }
.hoop-btn.sel { background: #dbeafe; border-color: #1f5fa8; }
.hoop-btn.sel i { border-color: #1f5fa8; background: rgba(80,160,255,.3); }
.starfish { margin: 4px 0 10px; }
.duel { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; text-align: center; gap: 8px; margin: 8px 0; }
.duel b { display: block; font-size: 1.2rem; }
.duel small { color: var(--ink-soft); }
.duel span { font-size: 1.8rem; }
.tend { color: var(--ink-soft); }
.my-status .go { color: #b3261e; }

/* role card */
.role-card { border: 2px solid var(--gold); }
.role-head { margin-bottom: 10px; }
.rh-pos { font-family: var(--f-head); font-size: 1.1rem; }
.rh-broom { font-size: .9rem; color: var(--ink-soft); }
.rh-status { font-size: .9rem; color: #8b1e1e; font-weight: 600; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--parch-edge); border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.seg-btn { font: inherit; font-weight: 700; border: 0; padding: 8px; background: #fffaf0; cursor: pointer; color: var(--ink); }
.seg-btn.active { background: var(--night-2); color: var(--gold-2); }
.targets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.tgt { font: inherit; text-align: left; border: 1px solid var(--parch-edge); background: #fffaf0; border-radius: 8px; padding: 6px 8px; cursor: pointer; color: var(--ink); font-size: .9rem; }
.tgt small { display: block; color: var(--ink-soft); font-size: .75rem; }
.tgt.sel { background: #26262c; color: #fff; border-color: #000; }
.tgt.sel small { color: #ccc; }
.tgt.holder { border-color: #b6452d; }
.powerbar { position: relative; height: 18px; border-radius: 999px; margin: 6px 0 10px; background: linear-gradient(90deg, #6b6b6b, #d4a73a 40%, #f1cf6b 50%, #d4a73a 60%, #6b6b6b); overflow: hidden; }
.powerbar .pz { position: absolute; left: 40%; width: 20%; top: 0; bottom: 0; border-left: 2px solid #fff; border-right: 2px solid #fff; opacity: .7; }
.powerbar i { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; background: #111; box-shadow: 0 0 4px #fff; left: 0; }
.blud-last div { padding: 3px 0; border-bottom: 1px dashed rgba(120,90,40,.25); }
.clues { padding-left: 0; list-style: none; margin: 6px 0 10px; display: grid; gap: 6px; }
.clues li { background: #fff6dc; border: 1px dashed var(--gold); border-radius: 8px; padding: 8px 10px; font-style: italic; }
.abilities { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; border-top: 1px dashed var(--parch-edge); padding-top: 10px; }
.owner-panel { border: 2px solid var(--gold); background: linear-gradient(180deg, #fff6d6, #f3e2a8); }
.owner-panel ul { padding-left: 18px; margin: 4px 0; }
.ref-label { font-size: .8rem; font-weight: 700; color: var(--ink-soft); margin: 8px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.roster li { grid-template-columns: 28px 1fr auto; }
.roster .pn small, .roster .pp small { display: block; font-size: .74rem; color: var(--ink-soft); font-weight: 400; }
.roster .pp { text-align: right; }
.roster li.me { outline: 2px dashed var(--gold); }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; }
.dementor-ov { background: radial-gradient(ellipse at center, rgba(20,24,40,.82), rgba(0,0,0,.95)); animation: chill 1s ease; }
@keyframes chill { from { opacity: 0; } to { opacity: 1; } }
.ov-box { max-width: 420px; width: 100%; text-align: center; color: #dfe6ff; }
.ov-box h2 { color: #c8d4ff; font-size: 1.8rem; text-shadow: 0 0 20px #7f9cff; }
.ov-box input { text-align: center; font-size: 1.2rem; margin-bottom: 10px; }
.ov-count { font-family: var(--f-latin); font-size: 1.4rem; color: #fff; }
.dementor-banner { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 80; background: #141a2e; color: #dfe6ff; border: 2px solid #7f9cff; border-radius: 12px; padding: 10px 16px; box-shadow: 0 0 30px rgba(127,156,255,.5); max-width: calc(100% - 32px); text-align: center; }
.rogue-banner { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 80; background: #5a0e10; color: #fff; border: 2px solid #ff6b6b; border-radius: 12px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.5); animation: shake .4s; max-width: calc(100% - 32px); }
@keyframes shake { 25% { transform: translate(-52%, 0); } 75% { transform: translate(-48%, 0); } }
.stat { display: inline-block; width: 70px; height: 8px; background: rgba(0,0,0,.1); border-radius: 999px; overflow: hidden; vertical-align: middle; }
.stat i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #b6452d); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .arena-grid { grid-template-columns: 1fr; }
  .house-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3, .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  body { font-size: 15px; }
  .topbar { padding: 8px 16px; }
  .nav-toggle { display: block; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; }
  .nav-open .nav { display: flex; }
  .nav-user { margin: 6px 0 0; }
  .wrap { padding: 16px 16px 32px; }
  .grid2, .grid3, .grid4, .rosters { grid-template-columns: minmax(0, 1fr); }
  .scoreboard { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .pitch { grid-column: 1 / -1; order: 3; min-height: 72px; border-radius: 50px / 36px; }
  .hoops i { width: 12px; height: 12px; border-width: 2px; }
  .hoops i.tall { width: 16px; height: 16px; }
  .hoops { gap: 3px; }
  .midline::after { width: 34px; height: 34px; left: -18px; margin-top: -17px; }
  .team { padding: 8px; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 8px; }
  .team .crest { font-size: 1.4rem; }
  .team .tname { font-size: .95rem; }
  .team .score { font-size: 2.2rem; flex-basis: 100%; }
  .arena-title { font-size: 1.3rem; }
  .arena-head { margin-bottom: 8px; }
  .play-card { padding: 16px; min-height: 0; }
  .choices { grid-template-columns: 1fr; }
  .crowd { grid-template-columns: 1fr 1fr; }
  [data-role="beater"] .arena-grid .side, [data-role="seeker"] .arena-grid .side { order: -1; }
  .crowd-mid { grid-column: 1 / -1; order: 3; }
  .pass-choice { grid-template-columns: 1fr; }
  .targets { grid-template-columns: 1fr; }
  .clock { font-size: 1.2rem; }
  .question { font-size: 1.15rem; }
  .slot { grid-template-columns: 1fr; }
  .match-item .mid { min-width: 80px; }
  .burst { font-size: 1.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* =========================================================
   THEME v3 — Wizarding World (dark, gold, starlit)
   Overrides the parchment look above. Logic/classes unchanged.
   ========================================================= */
:root {
  --ink: #ece3cf;
  --ink-soft: #b9ae93;
  --parch: #1a1f3a;
  --parch-2: #10142b;
  --parch-edge: rgba(216, 176, 74, .38);
  --night: #07080f;
  --night-2: #12162e;
  --gold: #d8b04a;
  --gold-2: #f3d98b;
  --gold-3: #fff1c2;
  --red: #b3262b;
  --pitch: #1f5a35;
  --pitch-2: #0f3320;
  --surface: linear-gradient(180deg, rgba(27, 32, 62, .90), rgba(13, 16, 34, .94));
  --surface-solid: #12162e;
  --field: rgba(6, 8, 18, .55);
  --hair: rgba(216, 176, 74, .28);
  --shadow: 0 1px 0 rgba(255, 241, 194, .06) inset, 0 10px 32px rgba(0, 0, 0, .45);
  --f-body: 'Sarabun', 'Noto Sans Thai', system-ui, sans-serif;
  --f-head: 'Noto Serif Thai', 'Cinzel', Georgia, serif;
  --f-latin: 'Cinzel', 'Noto Serif Thai', Georgia, serif;
  --f-deco: 'Cinzel Decorative', 'Cinzel', serif;
  --f-script: 'Cormorant Garamond', Georgia, serif;
}

html { background: #07080f; }
body {
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 50% -160px, rgba(216, 176, 74, .20), transparent 70%),
    radial-gradient(700px 500px at 88% 8%, rgba(88, 70, 160, .22), transparent 70%),
    radial-gradient(700px 500px at 6% 30%, rgba(30, 70, 120, .20), transparent 70%),
    linear-gradient(180deg, #06070d 0, #0b0e1f 420px, #0a0c1a 100%);
  background-repeat: no-repeat;
  background-color: #07080f;
  position: relative;
}

/* starfield + castle silhouette (pure CSS/SVG, fixed behind content) */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 27% 62%, #f3d98b 60%, transparent 62%),
    radial-gradient(1.4px 1.4px at 41% 11%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 55% 47%, #cfe0ff 60%, transparent 62%),
    radial-gradient(1.3px 1.3px at 68% 24%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 79% 71%, #f3d98b 60%, transparent 62%),
    radial-gradient(1.2px 1.2px at 91% 38%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 5% 83%, #cfe0ff 60%, transparent 62%),
    radial-gradient(1.1px 1.1px at 36% 90%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 96% 92%, #fff 60%, transparent 62%);
  background-size: 620px 520px;
  opacity: .55;
  animation: twinkle 7s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .32; } to { opacity: .7; } }
body::after {
  content: ''; position: fixed; left: 0; right: 0; bottom: 0; height: 240px; z-index: 0; pointer-events: none;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 240' preserveAspectRatio='xMidYMax slice'><g fill='%2312172e'><path d='M0 240V190l30-6v-40h14v-22l8-12 8 12v22h14v40l26 6v-30h20v-46l10-16 10 16v46h20v30l40 4v-64h16v-30l9-24 9 24v30h16v64l50-2v-40h22v-70l12-30 12 30v70h22v40l70 8v-52h18v-26l8-20 8 20v26h18v52l60-4v-30h16v-70l14-40 14 40v70h16v30l90 6v-36h20v-56l10-22 10 22v56h20v36l70 2v-44h18v-84l8-46 8 46v84h18v44l60 0V150h14v-28l10-24 10 24v28h14v70l80-4v-40h24v-60l12-34 12 34v60h24v40l70 2V240z'/></g><g fill='%23d8b04a' opacity='.55'><rect x='131' y='154' width='3' height='5'/><rect x='484' y='120' width='3' height='5'/><rect x='728' y='104' width='3' height='5'/><rect x='851' y='96' width='3' height='5'/><rect x='1023' y='108' width='3' height='5'/><rect x='300' y='134' width='3' height='5'/></g></svg>") center bottom / cover no-repeat;
  opacity: .9;
}
.topbar, .wrap, .foot { position: relative; z-index: 1; }
.topbar { position: sticky; z-index: 30; }

a { color: var(--gold-2); text-decoration-color: rgba(243, 217, 139, .4); text-underline-offset: 3px; }
a:hover { color: var(--gold-3); }
h1, h2, h3 { font-family: var(--f-head); font-weight: 700; letter-spacing: .01em; color: var(--gold-2); }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.32rem; }
h3 { font-size: 1.1rem; }
.muted { color: var(--ink-soft); }
.code { background: var(--field); border: 1px solid var(--hair); }

/* ---------- header ---------- */
.topbar {
  padding: 10px 24px; gap: 22px;
  background: linear-gradient(180deg, rgba(5, 6, 13, .96), rgba(10, 12, 26, .90));
  border-bottom: 1px solid var(--hair);
  box-shadow: 0 1px 0 rgba(216, 176, 74, .18), 0 10px 30px rgba(0, 0, 0, .5);
}
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .8; }
.brand { gap: 12px; font-family: var(--f-deco); font-weight: 700; font-size: 1.02rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-2); text-shadow: 0 0 18px rgba(216, 176, 74, .35); }
.brand small { display: block; font-family: var(--f-script); font-style: italic; font-weight: 500; text-transform: none; letter-spacing: .06em; font-size: .78rem; color: var(--ink-soft); text-shadow: none; margin-top: -2px; }
.brand-mark { width: 44px; height: 30px; flex: none; filter: drop-shadow(0 0 8px rgba(243, 217, 139, .55)); }
.brand-mark .wing { animation: wingbeat 1.4s ease-in-out infinite; transform-origin: 50% 50%; }
.brand-mark .wing.r { animation-delay: .08s; }
@keyframes wingbeat { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.72); } }
.nav > a { font-family: var(--f-latin); font-size: .82rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #d9cfb6; padding: 8px 12px; border-radius: 2px; position: relative; }
.nav > a::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 1px; background: var(--gold); transform: scaleX(0); transition: transform .25s; }
.nav > a:hover { background: transparent; color: var(--gold-3); }
.nav > a:hover::after, .nav > a.active::after { transform: scaleX(1); }
.nav > a.active { background: transparent; color: var(--gold-2); text-shadow: 0 0 12px rgba(243, 217, 139, .5); }
.nav-user { color: #cfc4a8; font-size: .88rem; }
.nav-user a { color: var(--gold-2); }
.nav-toggle { border-color: var(--hair); border-radius: 4px; }

/* ---------- page furniture ---------- */
.wrap { max-width: 1200px; padding-bottom: 260px; }
.wrap > h1, .page-title, .page-head h1, .arena-title {
  color: var(--gold-2); font-family: var(--f-head); font-weight: 700;
  text-shadow: 0 2px 18px rgba(216, 176, 74, .28);
}
.page-head { padding-bottom: 12px; margin-bottom: 20px; position: relative; }
.page-head::after {
  content: '✦'; position: absolute; left: 0; right: 0; bottom: -10px; height: 20px; text-align: center; color: var(--gold); font-size: .8rem; line-height: 20px;
  background: linear-gradient(90deg, transparent, var(--hair) 18%, transparent 46%, transparent 54%, var(--hair) 82%, transparent) center / 100% 1px no-repeat;
}
.foot { color: #6f6a5a; font-family: var(--f-script); font-style: italic; font-size: 1rem; letter-spacing: .04em; padding-bottom: 150px; margin-top: -220px; }

.card {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: 6px;
  box-shadow: var(--shadow);
  color: var(--ink);
  backdrop-filter: blur(3px);
}
.card::before, .card::after { content: ''; position: absolute; width: 14px; height: 14px; pointer-events: none; border: 1px solid var(--gold); opacity: .75; }
.card::before { top: 5px; left: 5px; border-right: 0; border-bottom: 0; }
.card::after { bottom: 5px; right: 5px; border-left: 0; border-top: 0; }
.card > h2:first-child, .card > h3:first-child { color: var(--gold-2); }

/* ---------- forms ---------- */
input, select, textarea { color: var(--ink); background: var(--field); border: 1px solid var(--hair); border-radius: 4px; }
input::placeholder, textarea::placeholder { color: #857c67; }
select option { background: #12162e; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(216, 176, 74, .22); }
.form label { color: #e2d8c0; }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--f-body); font-weight: 700; letter-spacing: .02em;
  background: linear-gradient(180deg, #f6dd8f, #d8b04a 55%, #b48a2a);
  color: #2a1c05; border: 1px solid #f3d98b; border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4), 0 4px 14px rgba(216, 176, 74, .22), inset 0 1px 0 rgba(255, 255, 255, .5);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}
.btn:hover { color: #1c1203; filter: brightness(1.08); box-shadow: 0 0 0 1px rgba(0, 0, 0, .4), 0 6px 22px rgba(243, 217, 139, .38), inset 0 1px 0 rgba(255, 255, 255, .6); }
.btn-ghost { background: rgba(255, 255, 255, .02); color: var(--gold-2) !important; border-color: var(--hair); box-shadow: none; text-shadow: none; }
.btn-ghost:hover { background: rgba(216, 176, 74, .12); color: var(--gold-3) !important; border-color: var(--gold); box-shadow: none; }
.btn-gold, .btn-snitch { background: linear-gradient(180deg, #fff1c2, #e5bd55 55%, #b48a2a); color: #2a1c05; border-color: #fff1c2; }
.btn-danger { background: linear-gradient(180deg, #8f2226, #5a1216); color: #ffe4d8; border-color: #c5595e; text-shadow: none; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.btn-quaffle { background: linear-gradient(180deg, #c95a3c, #8a2e1c); color: #fff1e6; border-color: #e58c72; text-shadow: none; }
.btn-bludger { background: linear-gradient(180deg, #4d5060, #1f2029); color: #eee; border-color: #7b7f92; text-shadow: none; }

.flash-ok { background: rgba(48, 110, 62, .25); border-color: #4c9a5c; color: #bfe8c6; }
.flash-err { background: rgba(160, 36, 40, .25); border-color: #c5595e; color: #ffc9c9; }

/* ---------- tables ---------- */
th, td { border-bottom: 1px solid rgba(216, 176, 74, .16); }
th { font-family: var(--f-latin); font-size: .78rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
tr:hover td { background: rgba(216, 176, 74, .06); }
table.mini tr.ok td { color: #9fe0a8; }
table.mini tr.no td { color: #e59a9a; opacity: .8; }

/* ---------- badges ---------- */
.badge { background: rgba(255, 255, 255, .09); color: var(--ink); border: 1px solid rgba(255, 255, 255, .14); }
.badge.house-gryffindor { background: linear-gradient(180deg, #a01515, #6a0808); color: #ffd966; border-color: #d9a441; }
.badge.house-slytherin  { background: linear-gradient(180deg, #23663b, #123420); color: #e4e4e4; border-color: #9aa9a0; }
.badge.house-ravenclaw  { background: linear-gradient(180deg, #223a86, #0d1738); color: #e6c98f; border-color: #a58347; }
.badge.house-hufflepuff { background: linear-gradient(180deg, #f5d05a, #c99a1f); color: #2e241c; border-color: #fff1c2; }
.badge.pos { background: rgba(216, 176, 74, .12); border-color: var(--hair); color: var(--gold-2); }
.house-opt span { border-radius: 4px; }

/* ---------- login ---------- */
.login-hero { position: relative; }
.page-login .card { text-align: center; padding: 34px 30px; }
.page-login .card h1 { font-family: var(--f-deco); font-size: 1.7rem; letter-spacing: .08em; text-transform: uppercase; line-height: 1.25; }
.page-login .card form { text-align: left; }
.page-login .card::before, .page-login .card::after { width: 22px; height: 22px; }

/* ---------- dashboard: house cards ---------- */
.house-cards { gap: 14px; }
.hcard { border-radius: 4px; padding: 16px 16px 14px; border: 1px solid rgba(255, 255, 255, .18); box-shadow: 0 10px 30px rgba(0, 0, 0, .5), inset 0 0 0 4px rgba(0, 0, 0, .18), inset 0 0 0 5px rgba(255, 255, 255, .14); }
.hcard::before { content: ''; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 68%); pointer-events: none; }
.hcard .an { font-size: 2.2rem; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); }
.hcard .hn { font-family: var(--f-head); font-weight: 700; }
.hcard .rank { font-family: var(--f-deco); opacity: .55; }
.hcard.house-hufflepuff { color: #2a2018; }

.match-item { background: rgba(255, 255, 255, .04); border: 1px solid var(--hair); border-radius: 4px; }
.match-item:hover { background: rgba(216, 176, 74, .09); border-color: var(--gold); }
.match-item .meta { color: var(--ink-soft); border-top-color: var(--hair); }
.match-item.is-live { border-color: #e0483f; box-shadow: 0 0 0 1px rgba(224, 72, 63, .5), 0 0 24px rgba(224, 72, 63, .25); }

/* ---------- arena ---------- */
.team { border-radius: 4px; border: 1px solid rgba(255, 255, 255, .18); box-shadow: 0 10px 30px rgba(0, 0, 0, .5), inset 0 0 0 4px rgba(0, 0, 0, .16), inset 0 0 0 5px rgba(255, 255, 255, .12); }
.team .tname { font-family: var(--f-head); font-weight: 700; }
.team .score { font-family: var(--f-deco); text-shadow: 0 2px 14px rgba(0, 0, 0, .55); }
.team.house-hufflepuff { color: #2a2018; }
.pitch {
  border: 2px solid rgba(243, 217, 139, .55); border-radius: 90px / 64px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 248, 220, .18), transparent 55%),
    repeating-linear-gradient(90deg, transparent 0 40px, rgba(255, 255, 255, .035) 40px 80px),
    radial-gradient(ellipse at center, #257044, #0c2c1a 92%);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .5), 0 12px 36px rgba(0, 0, 0, .5), 0 0 40px rgba(216, 176, 74, .12);
}
.hoops i { border-color: var(--gold-2); box-shadow: 0 0 10px rgba(243, 217, 139, .8), inset 0 0 6px rgba(243, 217, 139, .5); }
.status-pill { border-radius: 3px; font-family: var(--f-latin); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; border: 1px solid rgba(255, 255, 255, .2); }
.clock { border-radius: 3px; border-color: var(--hair); font-family: var(--f-deco); background: rgba(0, 0, 0, .5); box-shadow: inset 0 0 12px rgba(216, 176, 74, .12); }
.weather-pill { border-radius: 3px; background: rgba(255, 255, 255, .07); border: 1px solid var(--hair); }
.arena-head .muted { color: #b9ae93; }

.play-card { min-height: 360px; }
.kind-badge { font-family: var(--f-head); border-radius: 3px; background: rgba(255, 255, 255, .1); color: var(--ink); letter-spacing: .02em; }
.timer { font-family: var(--f-deco); color: var(--gold-2); }
.timebar { background: rgba(255, 255, 255, .1); }
.question { color: #fff6df; }
.choice { color: var(--ink); background: rgba(255, 255, 255, .04); border: 1px solid var(--hair); border-radius: 4px; }
.choice:not(:disabled):hover { border-color: var(--gold-2); background: rgba(216, 176, 74, .12); box-shadow: 0 6px 20px rgba(0, 0, 0, .4), 0 0 0 1px rgba(243, 217, 139, .4); }
.choice .ck { background: linear-gradient(180deg, #f6dd8f, #b48a2a); color: #2a1c05; font-family: var(--f-deco); border-radius: 3px; }
.choice.mine { background: rgba(88, 110, 200, .25); border-color: #7f97e6; }
.choice.correct { background: rgba(48, 130, 66, .3); border-color: #5fc072; }
.choice.correct .ck { background: #5fc072; color: #06210d; }
.choice.wrong { background: rgba(170, 40, 44, .3); border-color: #d9686c; }
.choice.key { outline-color: #5fc072; }
.result, .abilities { border-top-color: var(--hair); }
.who, .play-no, .timer small, .tend, .duel small { color: var(--ink-soft); }
.big-line.scored { color: #ff8f78; }
.big-line.saved { color: #8cc4ff; }
.my-status .go { color: #ff8f78; }

.ref-panel { border: 1px solid #7f97e6; }
.owner-panel { border: 1px solid var(--gold); background: linear-gradient(180deg, rgba(216, 176, 74, .16), rgba(216, 176, 74, .05)); }
.role-card { border: 1px solid var(--gold); box-shadow: var(--shadow), 0 0 30px rgba(216, 176, 74, .12); }
.rh-status { color: #ff9c8a; }

.feed .ev { background: rgba(255, 255, 255, .05); border-left-color: rgba(216, 176, 74, .5); border-radius: 3px; }
.feed .ev-goal { background: rgba(201, 90, 60, .22); border-left-color: #ff8f78; color: #ffe6dc; }
.feed .ev-save { background: rgba(70, 130, 200, .2); border-left-color: #6fb0ff; }
.feed .ev-bludger { background: rgba(255, 255, 255, .08); border-left-color: #999; }
.feed .ev-snitch { background: rgba(243, 217, 139, .2); border-left-color: var(--gold-2); color: var(--gold-3); }
.feed .ev-end { background: rgba(179, 38, 43, .22); border-left-color: #ff7a7f; }
.feed { scrollbar-width: thin; scrollbar-color: var(--gold) transparent; }

.roster li.on { background: rgba(216, 176, 74, .18); box-shadow: inset 3px 0 0 var(--gold); }
.roster li.me { outline-color: var(--gold); }
.roster .pp, .roster .pn small, .roster .pp small { color: var(--ink-soft); }
.rules summary { font-family: var(--f-head); color: var(--gold-2); }

.hoop-btn, .tgt, .seg-btn { background: rgba(255, 255, 255, .04); color: var(--ink); border: 1px solid var(--hair); }
.hoop-btn { border-radius: 6px; }
.hoop-btn i { border-color: var(--gold-2); }
.hoop-btn:hover, .tgt:hover { border-color: var(--gold-2); background: rgba(216, 176, 74, .12); }
.hoop-btn.sel { background: rgba(80, 150, 255, .2); border-color: #7fb4ff; }
.hoop-btn.sel i { border-color: #7fb4ff; }
.seg { border-color: var(--hair); border-radius: 4px; }
.seg-btn.active { background: linear-gradient(180deg, #f6dd8f, #b48a2a); color: #2a1c05; }
.tgt.sel { background: #05060c; color: #fff; border-color: var(--gold-2); box-shadow: 0 0 0 1px var(--gold-2); }
.tgt small { color: var(--ink-soft); }
.clues li { background: rgba(216, 176, 74, .1); border-color: var(--gold); color: #f7ecc8; font-family: var(--f-script); font-size: 1.12rem; }
.blud-last div { border-bottom-color: var(--hair); }
.ref-label { color: var(--gold); }

.final-banner { background: var(--surface); border: 1px solid var(--gold); box-shadow: var(--shadow), 0 0 40px rgba(216, 176, 74, .2); border-radius: 6px; }
.fb-title { font-family: var(--f-head); color: var(--gold-2); }
.fb-score { font-family: var(--f-deco); color: var(--gold-3); }

.q-item { border-bottom-color: var(--hair); }
.q-item li.ans { color: #8fe3a0; }
.stat { background: rgba(255, 255, 255, .12); }
.toast { background: #10142b; color: var(--gold-2); border-radius: 3px; }
.crowd-mid { color: var(--ink-soft); }
.meter { background: rgba(255, 255, 255, .1); }
.slot .sl { color: var(--gold-2); }
.counter.ok { color: #8fe3a0; }
.counter.bad { color: #ff9c8a; }
.small a, .muted a { color: var(--gold-2); }

@media (max-width: 680px) {
  .topbar { padding: 8px 14px; gap: 10px; }
  .brand { font-size: .82rem; letter-spacing: .08em; }
  .brand-mark { width: 36px; height: 24px; }
  .brand small { display: none; }
  .nav > a { padding: 10px 6px; }
  .nav > a::after { left: 6px; right: 6px; }
  h1 { font-size: 1.5rem; }
  .wrap { padding-bottom: 200px; }
  body::after { height: 150px; }
  .foot { margin-top: -180px; }
}

/* v3 fixes */
.grid2 > *, .grid3 > *, .grid4 > *, .rosters > * { min-width: 0; }
.match-item { min-width: 0; }
.match-item .side-a, .match-item .side-b { min-width: 0; overflow-wrap: anywhere; }
.nav { gap: 0; }
.nav > a { padding: 8px 10px; letter-spacing: .07em; font-size: .78rem; }
.nav-user { white-space: nowrap; }
@media (max-width: 680px) { .match-item { grid-template-columns: 1fr; text-align: center; } .match-item .side-a { text-align: center; } }
