/* The House Cup: dark candle-lit Great Hall. Mobile first (390px), one file, no webfonts. */
:root {
  --bg: #090b13; --stone: #121626; --stone2: #1a1f33; --line: rgba(243, 217, 138, .18);
  --gold: #d9a441; --gold2: #f3d98a; --gold3: #8a6420; --ember: #ff9a3c;
  --text: #ece5d3; --muted: #a39b88; --dim: #6f6a5e;
  --parch: #e7d4a6; --parch2: #d6bf8a; --ink: #2b1d0c; --ink2: #5a4324;
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", "DejaVu Serif", Georgia, "Times New Roman", serif;
  --mono: "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --r: 14px; --pad: 16px; --maxw: 1080px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--serif); color: var(--text); background: var(--bg); line-height: 1.45;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(217, 164, 65, .22), transparent 60%),
    radial-gradient(ellipse 60% 40% at 15% 80%, rgba(255, 140, 50, .07), transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 60%, rgba(120, 90, 200, .06), transparent 60%),
    linear-gradient(#090b13, #0d1020 50%, #090b13);
  background-attachment: fixed; overflow-x: hidden; min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold2); }
h1, h2, h3 { font-weight: 600; letter-spacing: .04em; margin: 0; }
h2 { font-size: 1.25rem; text-transform: uppercase; letter-spacing: .14em; color: var(--gold2); }
h2 .sub { display: block; font-size: .72rem; letter-spacing: .06em; text-transform: none; color: var(--muted); margin-top: 4px; }
h2 .sub a { color: var(--gold); }
h2.page-title { text-align: center; font-size: 1.7rem; margin-top: 8px; text-shadow: 0 0 24px rgba(243, 217, 138, .35); }
main { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad) 40px; }
.sec { margin: 34px 0 0; }
.center { text-align: center; }
.tiny { font-size: .8rem; color: var(--muted); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .82em; }
.warn { color: #f08a6a; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code.ca { font-family: var(--mono); font-size: .8em; color: var(--gold2); }
.chip { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; margin: 2px 3px 2px 0; font-size: .78rem; color: var(--gold2); }

/* ---------- floating candles */
.candles { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.candles i {
  position: absolute; width: 5px; height: 22px; border-radius: 2px; left: var(--x); top: var(--y);
  background: linear-gradient(#fff3cf, #e8c983 60%, #c9a35a); opacity: .85;
  animation: float var(--d, 7s) ease-in-out var(--dl, 0s) infinite alternate;
  filter: drop-shadow(0 0 6px rgba(255, 200, 110, .9));
}
.candles i::before {
  content: ""; position: absolute; left: 50%; top: -12px; width: 8px; height: 13px; margin-left: -4px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(ellipse at 50% 70%, #fff8dc, #ffcf5a 45%, rgba(255, 120, 40, .0) 75%);
  animation: flicker 1.6s ease-in-out infinite alternate;
}
.candles i::after {
  content: ""; position: absolute; left: 50%; top: -40px; width: 90px; height: 90px; margin-left: -45px;
  background: radial-gradient(circle, rgba(255, 190, 90, .22), transparent 60%);
}
.candles i:nth-child(1) { --x: 6%; --y: 14%; --d: 8s; }
.candles i:nth-child(2) { --x: 18%; --y: 30%; --d: 6.5s; --dl: -2s; }
.candles i:nth-child(3) { --x: 30%; --y: 9%; --d: 9s; --dl: -4s; }
.candles i:nth-child(4) { --x: 46%; --y: 22%; --d: 7s; --dl: -1s; }
.candles i:nth-child(5) { --x: 62%; --y: 12%; --d: 8.5s; --dl: -3s; }
.candles i:nth-child(6) { --x: 78%; --y: 27%; --d: 6s; --dl: -5s; }
.candles i:nth-child(7) { --x: 92%; --y: 16%; --d: 7.5s; --dl: -2.5s; }
.candles i:nth-child(8) { --x: 10%; --y: 58%; --d: 9.5s; --dl: -1.5s; }
.candles i:nth-child(9) { --x: 38%; --y: 66%; --d: 7s; --dl: -3.5s; }
.candles i:nth-child(10) { --x: 70%; --y: 55%; --d: 8s; --dl: -.5s; }
.candles i:nth-child(11) { --x: 88%; --y: 72%; --d: 6.8s; --dl: -4.5s; }
.candles i:nth-child(12) { --x: 24%; --y: 86%; --d: 9s; --dl: -2.2s; }
.candles i:nth-child(13) { --x: 54%; --y: 90%; --d: 7.3s; --dl: -3.2s; }
.candles i:nth-child(14) { --x: 82%; --y: 88%; --d: 8.2s; --dl: -1.2s; }
@keyframes float { from { transform: translateY(0) rotate(-1deg); } to { transform: translateY(-26px) rotate(1deg); } }
@keyframes flicker { from { transform: scaleX(.9) scaleY(1); opacity: .9; } to { transform: scaleX(1.1) scaleY(1.15); opacity: 1; } }
@media (max-width: 600px) { .candles i:nth-child(n+9) { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; } }

/* ---------- demo ribbon */
.ribbon {
  position: fixed; top: 22px; right: -46px; z-index: 50; transform: rotate(45deg); width: 190px; text-align: center;
  background: #8b1a1a; color: #fff3df; font-size: .72rem; letter-spacing: .22em; font-weight: 700; padding: 6px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .6); border-top: 1px solid rgba(255, 255, 255, .25); border-bottom: 1px solid rgba(0, 0, 0, .4);
  pointer-events: none;
}

/* ---------- header */
.top {
  position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  max-width: var(--maxw); margin: 0 auto; padding: 12px var(--pad) 6px;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--gold2); min-height: 44px; }
.brand img { width: 30px; height: 30px; object-fit: contain; filter: drop-shadow(0 0 6px rgba(243, 217, 138, .6)); }
.brand-t { font-size: 1.05rem; letter-spacing: .12em; text-transform: uppercase; }
.nav { display: flex; gap: 4px; width: 100%; justify-content: space-between; }
.nav a {
  flex: 1; text-align: center; text-decoration: none; color: var(--text); font-size: .82rem; letter-spacing: .06em;
  padding: 10px 4px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .03);
}
.nav a.on { background: linear-gradient(180deg, rgba(217, 164, 65, .35), rgba(217, 164, 65, .15)); color: var(--gold2); border-color: rgba(243, 217, 138, .5); }

/* ---------- hero */
.hero {
  position: relative; margin: 10px calc(-1 * var(--pad)) 0; min-height: 520px; display: flex; align-items: flex-end; overflow: hidden;
  background: #0b0d18 var(--hero) center 38% / cover no-repeat;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(9, 11, 19, .25) 0%, rgba(9, 11, 19, .1) 35%, rgba(9, 11, 19, .82) 70%, #090b13 100%);
}
.hero-ph {
  background:
    radial-gradient(ellipse 70% 45% at 50% 42%, rgba(255, 196, 90, .35), transparent 65%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 46px),
    linear-gradient(180deg, #1a1a2e, #0b0d18 70%);
}
.hero-ph::after {
  content: ""; position: absolute; left: 50%; top: 18%; width: 320px; height: 320px; margin-left: -160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 120, .35), transparent 62%); filter: blur(6px);
}
.hero-inner { position: relative; z-index: 1; width: 100%; text-align: center; padding: 30px var(--pad) 28px; }
.cup-wrap { height: 170px; display: flex; align-items: flex-end; justify-content: center; margin-bottom: 8px; }
.cup { width: 150px; height: 170px; object-fit: contain; animation: hover 5s ease-in-out infinite alternate; filter: drop-shadow(0 0 28px rgba(255, 210, 110, .75)) drop-shadow(0 12px 18px rgba(0, 0, 0, .7)); }
.cup-ph {
  width: 120px; height: 150px; position: relative; display: inline-block;
  background:
    radial-gradient(ellipse 60% 8% at 50% 100%, var(--gold3) 98%, transparent 100%),
    linear-gradient(90deg, transparent 44%, var(--gold) 44% 56%, transparent 56%) 0 60%/100% 32% no-repeat,
    radial-gradient(ellipse 50% 55% at 50% 30%, var(--gold2) 0 48%, var(--gold) 52% 60%, transparent 62%);
  filter: drop-shadow(0 0 26px rgba(255, 210, 110, .7));
}
.cup-ph.small { width: 30px; height: 30px; background: radial-gradient(circle at 50% 40%, var(--gold2) 0 40%, var(--gold) 45% 60%, transparent 63%); filter: none; }
@keyframes hover { from { transform: translateY(0) } to { transform: translateY(-10px) } }
.kicker { margin: 0; font-size: .76rem; letter-spacing: .26em; text-transform: uppercase; color: var(--gold); }
.hero h1 { font-size: 2.5rem; line-height: 1.05; color: #fff6dd; text-shadow: 0 0 30px rgba(243, 217, 138, .55), 0 2px 0 rgba(0, 0, 0, .6); margin: 4px 0 6px; }
.tag { margin: 0; color: var(--text); font-size: .98rem; }
.countdown { display: inline-flex; flex-direction: column; align-items: center; margin: 16px auto 8px; padding: 12px 22px; border: 1px solid var(--line); border-radius: var(--r); background: rgba(10, 12, 22, .72); backdrop-filter: blur(6px); }
.countdown .lbl { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.countdown .clock { font-family: var(--mono); font-size: 2.1rem; font-weight: 700; color: #fff6dd; letter-spacing: .06em; text-shadow: 0 0 18px rgba(255, 200, 110, .55); font-variant-numeric: tabular-nums; }
.pot { margin: 6px 0 12px; font-size: 1rem; color: var(--text); }
.pot b { color: var(--gold2); font-size: 1.25rem; }
.pot small { color: var(--muted); font-size: .78rem; }

/* ---------- buttons */
.btn {
  display: inline-block; text-decoration: none; text-align: center; font-family: inherit; font-size: .95rem; letter-spacing: .04em;
  padding: 13px 18px; min-height: 46px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; line-height: 1.2;
}
.btn.gold { background: linear-gradient(180deg, #f3d98a, #c9962f); color: #2b1d0c; border-color: #f7e4a8; box-shadow: 0 6px 18px rgba(217, 164, 65, .35); font-weight: 700; }
.btn.house { background: linear-gradient(180deg, var(--c1), color-mix(in srgb, var(--c1) 70%, black)); color: #fff; border-color: var(--c2); width: 100%; font-weight: 700; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.btn.ghost { background: rgba(255, 255, 255, .04); color: var(--muted); border-color: var(--line); width: 100%; }
.btn.ghost.small { width: auto; padding: 8px 14px; min-height: 36px; font-size: .82rem; }
.btn.red { background: linear-gradient(180deg, #a52a2a, #6b1414); color: #fff; border-color: #d46a6a; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- hourglasses */
.hourglasses h2 { text-align: center; }
.leaderline { text-align: center; margin: 10px 0 18px; font-size: .95rem; color: var(--text); }
.leaderline b { color: var(--ct, var(--gold2)); text-shadow: 0 0 14px color-mix(in srgb, var(--ct, var(--gold2)) 70%, transparent); }
.hg-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; align-items: end; padding: 18px 0 10px; border-radius: var(--r);
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(0, 0, 0, .25)); border: 1px solid rgba(255, 255, 255, .05); }
.hg { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--text); position: relative; }
.hg-cap, .hg-base { width: 52px; height: 10px; border-radius: 4px; background: linear-gradient(180deg, #f3d98a, #b8862a 60%, #7a5a1a); box-shadow: 0 2px 4px rgba(0, 0, 0, .6); }
.hg-cap { width: 44px; border-radius: 6px 6px 2px 2px; }
.hg-base { width: 60px; height: 12px; border-radius: 3px 3px 8px 8px; }
.hg-tube {
  position: relative; width: 48px; height: 190px; overflow: hidden; margin: -2px 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .11) 40%, rgba(255, 255, 255, .02));
  border: 2px solid rgba(243, 217, 138, .32); border-radius: 10px 10px 12px 12px; box-shadow: inset 0 0 18px rgba(0, 0, 0, .7), 0 0 0 1px rgba(0, 0, 0, .5);
}
.hg-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--fill, 0%); transition: height 2.2s cubic-bezier(.2, .8, .2, 1);
  animation: rise 2.4s cubic-bezier(.2, .8, .2, 1) .15s both;
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, .6) 0 1.5px, transparent 2.5px) 0 0 / 12px 12px,
    radial-gradient(circle, var(--c2) 0 3.5px, transparent 4.5px) 6px 6px / 12px 12px,
    radial-gradient(circle, var(--c1) 0 5px, color-mix(in srgb, var(--c1) 60%, black) 5.5px) 0 0 / 12px 12px;
  box-shadow: 0 -6px 16px color-mix(in srgb, var(--c2) 45%, transparent);
}
.hg-fill::before { content: ""; position: absolute; left: 0; right: 0; top: -3px; height: 6px; background: color-mix(in srgb, var(--c2) 70%, white); opacity: .55; border-radius: 50%; }
.hg-shine { position: absolute; left: 6px; top: 8px; bottom: 8px; width: 7px; border-radius: 4px; background: linear-gradient(180deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, .05)); pointer-events: none; }
.hg-pts { margin-top: 8px; display: flex; align-items: baseline; gap: 3px; }
.hg-num { font-size: 1.35rem; color: #fff6dd; font-variant-numeric: tabular-nums; }
.hg-pts span { font-size: .7rem; color: var(--muted); }
.hg-name { font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ct); text-shadow: 0 0 8px rgba(0, 0, 0, .9); white-space: nowrap; }
.hg.lead .hg-tube { border-color: var(--gold2); box-shadow: inset 0 0 18px rgba(0, 0, 0, .7), 0 0 22px rgba(243, 217, 138, .5); animation: glow 2.4s ease-in-out infinite alternate; }
.hg.lead .hg-num { color: var(--gold2); }
@keyframes rise { from { height: 0; } }
@keyframes glow { from { box-shadow: inset 0 0 18px rgba(0, 0, 0, .7), 0 0 14px rgba(243, 217, 138, .35); } to { box-shadow: inset 0 0 18px rgba(0, 0, 0, .7), 0 0 30px rgba(243, 217, 138, .75); } }

/* ---------- crest cards */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
.hcard {
  display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 14px; border-radius: var(--r); position: relative; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c1) 28%, #10131f), #0f1220 60%); border: 1px solid color-mix(in srgb, var(--c2) 35%, transparent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.hcard::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--c2) 22%, transparent), transparent 55%); pointer-events: none; }
.hcard.lead { border-color: var(--gold2); box-shadow: 0 0 28px rgba(243, 217, 138, .35), 0 10px 30px rgba(0, 0, 0, .45); }
.hcard.lead::after { content: "Leading"; position: absolute; top: 10px; right: -30px; transform: rotate(45deg); width: 110px; text-align: center; background: var(--gold2); color: var(--ink); font-size: .6rem; letter-spacing: .18em; text-transform: uppercase; padding: 3px 0; font-weight: 700; }
.hcard-crest { display: block; align-self: start; }
.crest-img { width: 96px; height: 96px; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)); }
.hcard.lead .crest-img, .house-crest.lead .crest-img { animation: crestglow 2.4s ease-in-out infinite alternate; }
@keyframes crestglow { from { filter: drop-shadow(0 0 8px var(--c2)) drop-shadow(0 6px 10px rgba(0, 0, 0, .7)); } to { filter: drop-shadow(0 0 22px var(--c2)) drop-shadow(0 6px 10px rgba(0, 0, 0, .7)); } }
.crest-ph {
  display: flex; align-items: center; justify-content: center; width: 96px; height: 96px;
  background: linear-gradient(160deg, var(--c1), color-mix(in srgb, var(--c1) 55%, black)); border: 3px solid var(--c2);
  border-radius: 14px 14px 50% 50% / 14px 14px 60% 60%; box-shadow: 0 6px 12px rgba(0, 0, 0, .6), inset 0 0 20px rgba(0, 0, 0, .4);
}
.crest-ph b { font-size: 2.6rem; color: var(--c2); text-shadow: 0 2px 4px rgba(0, 0, 0, .8); }
.crest-img.mini, .crest-ph.mini { width: 26px; height: 26px; border-width: 1px; border-radius: 6px 6px 50% 50% / 6px 6px 60% 60%; }
.crest-ph.mini b { font-size: .9rem; }
.crest-img.big, .crest-ph.big { width: 180px; height: 180px; }
.crest-ph.big b { font-size: 5rem; }
.hcard-body { min-width: 0; }
.hcard-foot { grid-column: 1 / -1; }
.hcard.lead .hcard-head { padding-right: 30px; }
.hcard-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin-bottom: 8px; }
.hcard-head h3 { font-size: 1.2rem; }
.hcard-head h3 a { color: var(--ct); text-decoration: none; text-shadow: 0 0 10px rgba(0, 0, 0, .9); }
.ticker { font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.total { margin-left: auto; font-size: .8rem; color: var(--muted); }
.total b { font-size: 1.3rem; color: #fff6dd; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; margin: 0; }
.stats.wide { grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.stats div { min-width: 0; }
.stats dt { font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats dd { margin: 0; font-size: 1rem; color: #fff6dd; font-variant-numeric: tabular-nums; }
.stats dd.up { color: #8fd98a; }
.stats dd.down { color: #f08a6a; }
.pts-row { list-style: none; margin: 4px 0 10px; padding: 0; display: flex; gap: 5px; }
.pts-row li { flex: 1; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 4px 2px; background: rgba(0, 0, 0, .3); min-width: 0; }
.pts-row li span { display: block; font-size: .6rem; letter-spacing: .04em; text-transform: uppercase; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pts-row li b { font-size: .95rem; color: var(--dim); }
.pts-row li.got { border-color: var(--c2); background: color-mix(in srgb, var(--c1) 45%, rgba(0, 0, 0, .4)); }
.pts-row li.got span { color: var(--text); }
.pts-row li.got b { color: var(--ct); text-shadow: 0 0 8px color-mix(in srgb, var(--c2) 60%, transparent); }

/* ---------- weekly tally */
.week-rows { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r); background: rgba(0, 0, 0, .25); overflow: hidden; }
.week-row { display: grid; grid-template-columns: 30px 1fr auto 34px; align-items: center; gap: 8px; padding: 9px 12px; border-top: 1px solid rgba(255, 255, 255, .05); }
.week-row:first-child { border-top: 0; }
.week-row.lead { background: color-mix(in srgb, var(--c1) 25%, transparent); }
.week-name { font-size: .9rem; color: var(--ct); letter-spacing: .04em; }
.dots { display: flex; gap: 5px; }
.dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .04); position: relative; }
.dot.today { border-color: var(--gold2); box-shadow: 0 0 8px rgba(243, 217, 138, .6); animation: glowdot 1.6s ease-in-out infinite alternate; }
.dot.future { opacity: .35; }
.dot.win { background: radial-gradient(circle at 35% 35%, white, var(--c2) 35%, var(--c1) 80%); border-color: var(--c2); box-shadow: 0 0 8px color-mix(in srgb, var(--c2) 70%, transparent); }
.dot.rolled { background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .15) 0 2px, transparent 2px 5px); }
@keyframes glowdot { from { box-shadow: 0 0 4px rgba(243, 217, 138, .4) } to { box-shadow: 0 0 12px rgba(243, 217, 138, .9) } }
.week-wins { text-align: right; font-size: 1.15rem; color: #fff6dd; }

/* ---------- recent nights / lists */
.peek-list { list-style: none; margin: 12px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r); background: rgba(0, 0, 0, .25); overflow: hidden; }
.peek-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid rgba(255, 255, 255, .05); font-size: .9rem; }
.peek-list li:first-child { border-top: 0; }
.peek-day { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.peek-win { color: var(--ct, var(--text)); font-weight: 600; }
.peek-win.rolled { color: var(--muted); font-style: italic; font-weight: 400; }
.peek-pot { color: var(--gold2); font-variant-numeric: tabular-nums; font-size: .85rem; }

/* ---------- parchment (rules + ledger) */
.parchment {
  margin: 16px auto 0; padding: 26px 20px 30px; color: var(--ink); max-width: 820px; position: relative;
  background: var(--parch) radial-gradient(ellipse at 50% 0%, rgba(255, 250, 230, .55), transparent 60%), var(--parch);
  background-image: radial-gradient(ellipse at 20% 10%, rgba(255, 250, 235, .7), transparent 50%), radial-gradient(ellipse at 90% 90%, rgba(160, 120, 60, .25), transparent 55%), repeating-linear-gradient(0deg, rgba(120, 85, 40, .04) 0 1px, transparent 1px 3px);
  border-radius: 6px; box-shadow: 0 18px 50px rgba(0, 0, 0, .7), inset 0 0 50px rgba(120, 85, 40, .22), inset 0 0 4px rgba(120, 85, 40, .5);
  font-size: 1rem; line-height: 1.55;
}
.parchment.tex { background-image: var(--parch); background-size: 512px; }
.parchment::before, .parchment::after { content: ""; position: absolute; left: 0; right: 0; height: 10px; background: linear-gradient(90deg, #6b4a1e, #d9b56a 30%, #8d6a2f 70%, #6b4a1e); border-radius: 6px; box-shadow: 0 4px 10px rgba(0, 0, 0, .5); }
.parchment::before { top: -6px; }
.parchment::after { bottom: -6px; }
.parchment h3 { font-size: 1.05rem; letter-spacing: .12em; text-transform: uppercase; color: #6b1b12; margin: 20px 0 6px; border-bottom: 1px solid rgba(107, 27, 18, .35); padding-bottom: 3px; }
.parchment h3:first-child { margin-top: 0; }
.parchment p { margin: 6px 0; }
.parchment a { color: #7a2414; }
.parchment b { color: #3a2410; }
.parchment .seal { margin-top: 24px; text-align: center; font-style: italic; color: var(--ink2); }
.rule-table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.rule-table td { padding: 6px 8px; border-bottom: 1px dashed rgba(90, 67, 36, .35); vertical-align: top; }
.rule-table td:first-child { white-space: nowrap; font-weight: 700; color: #6b1b12; width: 1%; }
.house-list { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 6px 12px; }
.house-list li { display: flex; align-items: center; gap: 8px; }
.house-list li i { width: 14px; height: 14px; border-radius: 50%; background: var(--c1); border: 2px solid var(--c2); flex: none; }
.house-list li span { font-family: var(--mono); font-size: .78rem; color: var(--ink2); }
.ledger { width: 100%; border-collapse: collapse; font-size: .85rem; }
.ledger th { text-align: left; font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); padding: 4px 6px; border-bottom: 2px solid rgba(90, 67, 36, .5); }
.ledger td { padding: 7px 6px; border-bottom: 1px dashed rgba(90, 67, 36, .3); vertical-align: middle; white-space: nowrap; }
.ledger tr.rolled td { color: var(--ink2); }
.ledger .note-row td { white-space: normal; font-size: .78rem; color: var(--ink2); border-top: 0; padding-top: 0; }
.ledger .mono { font-size: .78rem; }
.ledger-list { list-style: none; margin: 0; padding: 0; }
.lrow { padding: 10px 0; border-bottom: 1px dashed rgba(90, 67, 36, .35); }
.lrow .l1 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.lrow .lday { font-family: var(--mono); font-size: .8rem; color: var(--ink2); }
.lrow .lpts { margin-left: auto; color: #6b1b12; }
.lrow .l2 { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 4px; font-size: .88rem; font-variant-numeric: tabular-nums; }
.lrow .l2 i { font-style: normal; font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); margin-right: 6px; }
.lrow .l2 a { font-family: var(--mono); font-size: .8rem; }
.lrow.rolled .l1, .lrow.rolled .l2 { color: var(--ink2); }
.lrow .lnote { font-size: .8rem; color: var(--ink2); margin-top: 2px; }
.win-tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--c1); }
.win-tag .crest-ph.mini { background: var(--c1); border-color: var(--c2); }
.win-tag .crest-ph.mini b { color: var(--c2); }

/* ---------- sorting hat */
.sort { text-align: center; }
.hat-stage { margin: 18px auto 10px; min-height: 230px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.hat { width: 200px; height: 190px; object-fit: contain; transform-origin: 50% 90%; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .7)) drop-shadow(0 0 14px rgba(243, 217, 138, .25)); }
.hat.thinking { animation: think 1.1s ease-in-out infinite; }
.hat.decided { animation: decide .7s cubic-bezier(.2, 1.5, .4, 1) 1; }
@keyframes think { 0%, 100% { transform: rotate(-7deg) translateY(0) } 50% { transform: rotate(7deg) translateY(-8px) } }
@keyframes decide { 0% { transform: scale(.9) rotate(0) } 50% { transform: scale(1.12) rotate(-4deg) } 100% { transform: scale(1) rotate(0) } }
.hat-ph { position: relative; width: 200px; height: 190px; }
.hat-ph i { position: absolute; left: 50%; bottom: 40px; width: 0; height: 0; margin-left: -62px; border-left: 62px solid transparent; border-right: 62px solid transparent; border-bottom: 130px solid #4a3418; filter: drop-shadow(0 0 1px #2a1d0c); }
.hat-ph i::after { content: ""; position: absolute; left: -20px; top: 70px; width: 40px; height: 14px; border-radius: 50%; background: #1b1208; opacity: .6; }
.hat-ph b { position: absolute; left: 50%; bottom: 28px; width: 190px; height: 34px; margin-left: -95px; border-radius: 50%; background: radial-gradient(ellipse at 50% 40%, #6a4b22, #3a2810 70%); box-shadow: 0 8px 14px rgba(0, 0, 0, .7); }
.hat-say { margin: 10px 0 0; font-style: italic; color: var(--gold2); min-height: 1.5em; }
.sort-form { display: flex; flex-direction: column; gap: 10px; max-width: 520px; margin: 0 auto; }
.sort-form input, .aform input, .aform textarea, .aform select, .pin-form input {
  width: 100%; font: inherit; font-size: 1rem; padding: 12px 14px; min-height: 48px; border-radius: 12px; color: var(--text);
  background: rgba(0, 0, 0, .45); border: 1px solid var(--line); outline: none;
}
.sort-form input { font-family: var(--mono); font-size: .9rem; text-align: center; }
.sort-form input:focus, .aform input:focus, .aform textarea:focus, .pin-form input:focus { border-color: var(--gold2); box-shadow: 0 0 0 3px rgba(243, 217, 138, .18); }
.sort-result { margin-top: 20px; }
.sorted { padding: 24px 16px 26px; border-radius: var(--r); background: linear-gradient(160deg, color-mix(in srgb, var(--c1) 55%, #0e1120), #0e1120 80%); border: 2px solid var(--c2); box-shadow: 0 0 40px color-mix(in srgb, var(--c2) 40%, transparent); animation: reveal .8s ease-out 1; }
.sorted-crest { display: flex; justify-content: center; margin-bottom: 8px; }
.sorted h3 { font-size: 2.3rem; color: var(--ct); text-shadow: 0 0 24px color-mix(in srgb, var(--c2) 60%, transparent), 0 2px 0 rgba(0, 0, 0, .7); letter-spacing: .1em; text-transform: uppercase; }
.sorted .tag { margin: 8px 0 14px; }
.sorted .tag a { color: var(--ct); }
@keyframes reveal { from { opacity: 0; transform: translateY(14px) scale(.96) } to { opacity: 1; transform: none } }

/* ---------- house page */
.house-hero { margin: 10px calc(-1 * var(--pad)) 0; padding: 26px var(--pad) 26px; text-align: center; position: relative; overflow: hidden;
  background: radial-gradient(ellipse 80% 70% at 50% 20%, color-mix(in srgb, var(--c1) 70%, #0b0d18), #090b13 75%); border-bottom: 1px solid color-mix(in srgb, var(--c2) 40%, transparent); }
.house-hero::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .02) 0 2px, transparent 2px 46px); pointer-events: none; }
.house-hero-inner { position: relative; z-index: 1; }
.house-crest { display: flex; justify-content: center; margin-bottom: 8px; }
.house-crest .crest-img { filter: drop-shadow(0 0 18px var(--c2)) drop-shadow(0 10px 16px rgba(0, 0, 0, .7)); }
.house-hero h1 { font-size: 2.4rem; color: var(--ct); text-shadow: 0 0 26px color-mix(in srgb, var(--c2) 60%, transparent), 0 2px 0 rgba(0, 0, 0, .7); text-transform: uppercase; letter-spacing: .1em; }
.lead-tag { color: var(--gold2); }
.big-pts { margin: 12px 0 16px; }
.big-pts b { display: block; font-size: 3.2rem; line-height: 1; color: #fff6dd; text-shadow: 0 0 24px rgba(243, 217, 138, .4); }
.big-pts span { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.house-hero .btn { max-width: 420px; margin: 0 auto; }
.scorecard { margin-top: 12px; padding: 14px; border-radius: var(--r); border: 1px solid var(--line); background: rgba(0, 0, 0, .25); }

/* ---------- admin */
.admin .aform { margin: 18px 0 0; padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: rgba(0, 0, 0, .3); }
.admin .aform h3 { font-size: 1rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold2); margin-bottom: 10px; }
.admin .aform h3 .sub { display: block; font-size: .72rem; letter-spacing: .04em; text-transform: none; color: var(--muted); }
.admin label { display: block; font-size: .78rem; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; }
.admin label input, .admin label select { margin-top: 4px; }
.admin .row2, .admin .row3, .admin .row4 { display: grid; grid-template-columns: 1fr; gap: 4px 12px; }
.admin fieldset.house-f { border: 1px solid color-mix(in srgb, var(--c2) 40%, transparent); border-left: 4px solid var(--c1); border-radius: 10px; padding: 8px 12px; margin: 0 0 10px; }
.admin legend { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--c2); padding: 0 6px; display: flex; align-items: center; gap: 6px; }
.admin legend i, .admin .row4 label i { width: 10px; height: 10px; border-radius: 50%; background: var(--c1); border: 1px solid var(--c2); display: inline-block; margin-right: 4px; }
.admin .switch { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--text); }
.admin .switch input { width: 22px; height: 22px; accent-color: var(--gold); }
.admin textarea { font-family: var(--mono); font-size: .82rem; resize: vertical; }
.admin .msg, .pin-form .msg { min-height: 1.4em; margin: 8px 0 0; font-size: .85rem; color: var(--gold2); }
.admin .msg.err, .pin-form .msg.err { color: #f08a6a; }
.admin .danger { border-color: rgba(212, 106, 106, .5); }
.admin .aform .btn { margin-top: 6px; }
.pin-form { max-width: 320px; margin: 20px auto; display: flex; flex-direction: column; gap: 10px; }
.pin-form input { text-align: center; font-size: 1.6rem; letter-spacing: .4em; font-family: var(--mono); }

/* ---------- footer */
.foot { position: relative; z-index: 1; text-align: center; padding: 20px var(--pad) 36px; border-top: 1px solid var(--line); margin-top: 30px; }
.foot .disc { margin: 0 auto 6px; font-size: .78rem; color: var(--muted); max-width: 560px; }
.foot .tiny { margin: 0; }

/* ---------- wider screens */
@media (min-width: 560px) {
  .nav { width: auto; }
  .nav a { flex: none; padding: 10px 16px; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .house-list { grid-template-columns: 1fr 1fr; }
  .hg-name { font-size: .72rem; }
  .stats.wide { grid-template-columns: repeat(5, 1fr); }
  .admin .row2 { grid-template-columns: 1fr 2fr; }
  .admin .row3 { grid-template-columns: 1fr 1fr 2fr; }
  .admin .row4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 900px) {
  :root { --pad: 24px; }
  .hero { min-height: 600px; border-radius: 0 0 24px 24px; }
  .hero h1 { font-size: 3.6rem; }
  .cup { width: 200px; height: 220px; }
  .cup-wrap { height: 220px; }
  .hg-tube { width: 70px; height: 260px; }
  .hg-cap { width: 62px; }
  .hg-base { width: 84px; }
  .hg-row { gap: 24px; padding: 28px 40px 18px; }
  .hg-name { font-size: .85rem; }
  .hg-num { font-size: 1.8rem; }
  .hcard { grid-template-columns: 120px 1fr; }
  .crest-img, .crest-ph { width: 120px; height: 120px; }
  .crest-img.mini, .crest-ph.mini { width: 26px; height: 26px; }
  .crest-img.big, .crest-ph.big { width: 220px; height: 220px; }
  .sec { margin-top: 48px; }
  .week-rows, .peek-list { max-width: 760px; margin-left: auto; margin-right: auto; }
}
