/* =====================================================================
   Platform 10 — The Riddle Run — OSRS-inspired theme
   ===================================================================== */
:root {
  --bg: #14100c;
  --bg-2: #1d1711;
  --stone: #2a221a;
  --stone-edge: #4a3b2a;
  --parchment: #d9c59b;
  --parchment-2: #cdb584;
  --parchment-dark: #b89c69;
  --ink: #2b1d10;
  --ink-soft: #5a4631;
  --gold: #e8b63a;
  --gold-2: #ffd766;
  --gold-dark: #9a7217;
  --osrs-yellow: #ffff00;
  --osrs-white: #ffffff;
  --osrs-stack-green: #00ff00;
  --osrs-orange: #ff981f;
  --green: #4fc960;
  --green-dark: #1f7a2d;
  --red: #e2453b;
  --red-dark: #8c1f18;
  --discord: #5865f2;
  --text: #ece2cb;
  --muted: #a99a80;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.4);
  --font-head: "Cinzel", "Trajan Pro", Georgia, serif;
  --font-body: "Crimson Pro", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(232,182,58,.07), transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(232,182,58,.05), transparent 50%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}
.bg-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,.6) 100%);
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* ---------- Top bar ---------- */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1.25rem;
  background: linear-gradient(#2d251b, #1b1510);
  border-bottom: 2px solid var(--stone-edge);
  box-shadow: 0 2px 0 #0a0806, 0 6px 18px rgba(0,0,0,.5);
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--gold-2); }
.brand:hover { text-decoration: none; }
.brand-emblem { width: 46px; height: 46px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.7)); transition: transform .2s ease, filter .2s ease; }
.brand:hover .brand-emblem { transform: scale(1.06) rotate(-4deg); filter: drop-shadow(0 2px 2px rgba(0,0,0,.7)) drop-shadow(0 0 8px rgba(232,182,58,.45)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; font-family: var(--font-head); }
.brand-top { font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.brand-bottom { font-size: 1.2rem; font-weight: 700; text-shadow: 0 2px 0 #000; }
.topnav { display: flex; align-items: center; gap: .9rem; }
.nav-link { font-family: var(--font-head); font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text); padding: .4rem .7rem; border-radius: 6px; }
.nav-link:hover, .nav-link.active { color: var(--gold-2); background: rgba(232,182,58,.1); text-decoration: none; }
.user-bar { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: .15rem .95rem; }
.user-link {
  appearance: none; background: none; border: 0; padding: 0; margin: 0; min-height: 0;
  font-family: var(--font-body); font-size: .92rem; font-weight: 400; letter-spacing: 0;
  color: var(--muted); cursor: pointer; line-height: 1.2;
}
.user-link strong { color: var(--text); font-weight: 600; }
.user-link:hover, .user-link:hover strong { color: var(--gold-2); }
.user-logout { color: var(--muted); }
.tz-card {
  max-width: 480px;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tz-card > h3,
.tz-card > .muted,
.tz-card > .modal-actions { flex-shrink: 0; }
.tz-card > .field {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: .55rem;
}
.tz-combo {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
.tz-combo-q {
  width: 100%; font-family: var(--font-body); font-size: 1.05rem; color: var(--text);
  background: rgba(0,0,0,.45); border: 1px solid var(--stone-edge); border-radius: 6px;
  padding: .55rem 2.3rem .55rem .75rem; min-height: 44px; outline: none; color-scheme: dark;
  appearance: none; -webkit-appearance: none; flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23e8b63a' d='M1 1.2L6 6.5 11 1.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .85rem center;
}
.tz-combo-q::placeholder { color: #8a7a62; }
.tz-combo-q:focus { border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(232,182,58,.2); }
.tz-combo-list {
  position: relative; left: auto; right: auto; top: auto; z-index: 1;
  flex: 1 1 auto; min-height: 4.5rem; max-height: 11.5rem;
  overflow: auto; margin: 6px 0 0; padding: .3rem;
  list-style: none; background: #1d1711; border: 1px solid var(--gold-dark); border-radius: 8px;
  box-shadow: 0 8px 18px rgba(0,0,0,.35);
  scrollbar-width: thin; scrollbar-color: #6a5640 #1d1711;
}
.tz-combo-list::-webkit-scrollbar { width: 8px; }
.tz-combo-list::-webkit-scrollbar-track { background: #1d1711; }
.tz-combo-list::-webkit-scrollbar-thumb { background: #6a5640; border-radius: 8px; }
.tz-combo-list[hidden] { display: none !important; }
.tz-combo-group {
  font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  padding: .45rem .6rem .2rem;
}
.tz-combo-item {
  display: block; width: 100%; text-align: left; padding: .38rem .6rem; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); font-family: var(--font-body); font-size: .95rem; cursor: pointer;
}
.tz-combo-item small { display: block; color: var(--muted); font-size: .78rem; margin-top: .08rem; }
.tz-combo-item:hover, .tz-combo-item.is-active { background: rgba(232,182,58,.16); color: var(--gold-2); }
.tz-combo-item.is-selected { color: var(--gold-2); }
.tz-combo-empty { padding: .7rem .65rem; color: var(--muted); font-size: .9rem; }
.tz-banner {
  position: fixed; left: 50%; transform: translateX(-50%); top: 4.7rem; z-index: 60;
  display: flex; flex-wrap: wrap; gap: .65rem 1rem; align-items: center; justify-content: space-between;
  width: min(38rem, calc(100% - 1.6rem)); padding: .75rem 1rem;
  background: #2a2118; border: 1px solid var(--gold-dark); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.5);
}
.tz-banner[hidden] { display: none !important; }
.tz-banner p { margin: 0; font-size: .95rem; color: var(--text); }
.tz-banner-actions { display: flex; gap: .4rem; flex-shrink: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--gold-dark); background: #000; }
.user-name { font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-form { display: inline; margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-head); font-weight: 700; font-size: .95rem; letter-spacing: .04em;
  padding: .65rem 1.2rem; border-radius: 8px; border: 2px solid transparent; cursor: pointer;
  text-decoration: none; transition: transform .08s ease, box-shadow .15s ease, filter .15s ease;
  user-select: none; -webkit-tap-highlight-color: transparent; min-height: 44px;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary {
  color: #2a1d08; background: linear-gradient(#ffd766, #d9a52b); border-color: #7d5a10;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 3px 0 #6b4c0d, 0 6px 14px rgba(0,0,0,.4);
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
}
.btn-primary:active { box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 1px 0 #6b4c0d; transform: translateY(2px); }
.btn-secondary,
.notice-card .btn-ghost,
.parchment .btn-ghost {
  color: #f4ead0;
  background: linear-gradient(#6a5640, #3f3224);
  border-color: #2b1d10;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 3px 0 #1a120c, 0 6px 12px rgba(0,0,0,.3);
  text-shadow: 0 1px 0 rgba(0,0,0,.5);
}
.btn-secondary:hover,
.notice-card .btn-ghost:hover,
.parchment .btn-ghost:hover { background: linear-gradient(#7a644c, #4a3b2c); }
.btn-secondary:active,
.notice-card .btn-ghost:active,
.parchment .btn-ghost:active {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 1px 0 #1a120c;
  transform: translateY(2px);
}
.parchment .btn-ghost.btn-sm,
.notice-card .btn-ghost.btn-sm {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 2px 0 #1a120c, 0 4px 8px rgba(0,0,0,.25);
}
.btn-ghost { color: var(--text); background: rgba(255,255,255,.04); border-color: var(--stone-edge); }
.btn-ghost:hover { background: rgba(255,255,255,.08); }
.btn-danger { color: #fff; background: linear-gradient(#e2453b, #a52a22); border-color: #5a140f; }
.btn-danger.btn-ghost { background: transparent; color: #ff8a80; border-color: #6b2a24; }
.btn-sm { padding: .4rem .8rem; font-size: .8rem; min-height: 36px; }
.btn-lg { padding: .9rem 1.6rem; font-size: 1.1rem; }
.icon-btn { width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--stone-edge); background: rgba(0,0,0,.25); color: var(--text); cursor: pointer; font-size: 1rem; }
.icon-btn:hover { background: rgba(232,182,58,.15); color: var(--gold-2); }

/* ---------- Layout ---------- */
.page { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.footer { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: .6rem; padding: 1rem; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--stone-edge); background: rgba(0,0,0,.3); }
.footer-brand { display: inline-flex; align-items: center; gap: .45rem; }
.footer-logo { width: 22px; height: 22px; object-fit: contain; opacity: .85; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }

/* Logo used inside parchment panels / headings */
.panel-logo { display: block; margin: 0 auto .5rem; width: 72px; height: auto; filter: drop-shadow(0 3px 3px rgba(0,0,0,.35)); }
.panel-logo-sm { width: 48px; margin-bottom: .25rem; }
.heading-logo { display: flex; align-items: center; gap: .6rem; }
.heading-logo img { width: 40px; height: auto; filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.centered { display: flex; justify-content: center; align-items: center; min-height: 50vh; }

/* ---------- Parchment panels ---------- */
.parchment {
  position: relative; color: var(--ink);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.02 .04' numOctaves='4' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .1 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E"),
    linear-gradient(160deg, var(--parchment), var(--parchment-2) 60%, var(--parchment-dark));
  border: 3px solid #5a4327;
  outline: 2px solid #2b1d10;
  border-radius: 6px;
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow), inset 0 0 60px rgba(90,60,20,.25);
}
.parchment::before, .parchment::after {
  content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--gold-dark); pointer-events: none;
}
.parchment::before { top: 6px; left: 6px; border-right: 0; border-bottom: 0; }
.parchment::after { bottom: 6px; right: 6px; border-left: 0; border-top: 0; }
.parchment-sm { max-width: 560px; }
.heading { font-family: var(--font-head); font-weight: 700; margin: 0 0 .6rem; letter-spacing: .02em; }
.parchment .heading { color: var(--ink); }
.lead { font-size: 1.15rem; margin: 0 0 1rem; }
.parchment .muted { color: var(--ink-soft); }
.fade-in { animation: fadeUp .5s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Hero ---------- */
.hero {
  border-radius: 14px; overflow: hidden; border: 3px solid var(--stone-edge); outline: 2px solid #0a0806;
  box-shadow: var(--shadow); margin-bottom: 2rem;
}
.hero-img { display: block; width: 100%; height: auto; }
.is-guest .hero { margin-bottom: 1.4rem; }
.is-guest .hero-img {
  max-height: min(320px, 42vh);
  object-fit: cover;
  object-position: center;
}
.sign-in {
  display: flex; justify-content: center; position: relative; z-index: 2;
  margin: 0 auto 2.5rem; padding: 0 .4rem;
}
.sign-in-card {
  width: min(26.5rem, 100%);
  background: #2a221a;
  border: 2px solid var(--stone-edge);
  border-radius: 12px;
  padding: 1.35rem 1.4rem 1.2rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.sign-in-card .panel-logo { width: 52px; margin-bottom: .25rem; }
.sign-in-card .heading { color: var(--gold-2); margin-bottom: .3rem; font-size: 1.35rem; }
.sign-in-card .lead { color: var(--muted); font-size: 1.02rem; margin: 0 0 1rem; }
.btn-oauth { width: 100%; }
.icon-discord { flex-shrink: 0; }
.sign-in-note { margin: .7rem 0 0; }

/* ---------- Event grid ---------- */
.events-loading { display: flex; align-items: center; gap: .8rem; color: var(--muted); padding: 2rem 0; justify-content: center; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(232,182,58,.25); border-top-color: var(--gold); animation: spin .8s linear infinite; }
.spinner-sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.event-group { margin-bottom: 2rem; }
.group-title { font-family: var(--font-head); font-size: 1.1rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); display: flex; align-items: center; gap: .6rem; margin: 0 0 .9rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-live { background: var(--green); box-shadow: 0 0 0 0 rgba(79,201,96,.6); animation: pulse 1.6s ease-out infinite; }
.dot-upcoming { background: var(--gold); }
.dot-ended { background: var(--muted); }
@keyframes pulse { to { box-shadow: 0 0 0 10px rgba(79,201,96,0); } }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.event-card {
  display: block; color: var(--text); background: linear-gradient(160deg, var(--stone), #1f1913);
  border: 2px solid var(--stone-edge); border-radius: var(--radius); padding: 1.1rem 1.2rem;
  box-shadow: 0 4px 14px rgba(0,0,0,.4); transition: transform .15s ease, border-color .15s ease, box-shadow .15s;
  animation: fadeUp .45s ease both;
}
.event-card:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--gold-dark); box-shadow: 0 10px 24px rgba(0,0,0,.55), 0 0 0 1px rgba(232,182,58,.25); }
.event-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; }
.event-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .3rem; flex-shrink: 0; }
.event-name { font-family: var(--font-head); font-size: 1.15rem; margin: 0; color: var(--gold-2); }
.badge { font-family: var(--font-head); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; padding: .25rem .55rem; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.badge-live { color: var(--green); border-color: var(--green-dark); background: rgba(79,201,96,.1); }
.badge-upcoming { color: var(--gold); border-color: var(--gold-dark); background: rgba(232,182,58,.1); }
.badge-ended, .badge-draft { color: var(--muted); border-color: var(--stone-edge); }
.badge-team { color: var(--gold-2); border-color: var(--gold-dark); background: rgba(232,182,58,.12); }
.badge-published { color: var(--green); border-color: var(--green-dark); }
.event-desc { color: var(--muted); margin: .4rem 0 .8rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 1.4em; }
.event-meta { display: flex; justify-content: space-between; gap: .6rem 1.4rem; margin-bottom: .8rem; align-items: start; }
.meta-item { display: flex; flex-direction: column; line-height: 1.2; flex: 0 0 auto; }
.meta-time { flex: 1 1 auto; min-width: 0; }
.meta-prize-value { white-space: nowrap; }
.meta-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.meta-value, .meta-clues { color: var(--text); font-size: 1rem; }

/* Coin prize: 10m+ uses the same green as the Live pill */
.prize { display: inline-flex; align-items: center; gap: .3rem; line-height: 1; vertical-align: middle; }
.prize-icon, .prize-coins { width: 22px; height: 22px; flex-shrink: 0; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0,0,0,.7)); }
.prize-bonds .prize-icon { width: 20px; height: 24px; }
.prize-amount {
  font-family: Arial Black, Arial, sans-serif;
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: .02em;
  text-transform: lowercase;
  text-shadow: 0 1px 0 #000, 1px 1px 0 rgba(0,0,0,.65);
}
.prize-sm .prize-icon, .prize-sm .prize-coins { width: 18px; height: 18px; }
.prize-sm .prize-amount { font-size: 1.05rem; }
.prize-lg .prize-icon, .prize-lg .prize-coins { width: 32px; height: 32px; }
.prize-lg .prize-amount { font-size: 1.75rem; }
/* Card / table: same type as the other meta values, just coloured */
.prize-meta .prize-icon, .prize-meta .prize-coins { width: 1.15em; height: 1.15em; }
.prize-meta .prize-amount {
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: lowercase;
  text-shadow: none;
}
.osrs-qty-green { color: var(--green); }
.osrs-qty-white { color: var(--osrs-white); }
.osrs-qty-yellow { color: var(--osrs-yellow); }
.play-prize {
  display: inline-flex; align-items: center; flex-wrap: nowrap; gap: .45rem;
  margin: .45rem 0 .75rem; padding: .42rem 1.25rem;
  border: 1px solid var(--stone-edge); border-radius: 999px;
  background: rgba(0,0,0,.32);
  width: fit-content;
  max-width: none;
  flex: 0 0 auto;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: visible;
}
.play-prize .prize { display: contents; }
.play-prize .prize-amount,
.play-prize .prize-icon {
  flex: 0 0 auto;
}
.play-prize .prize-amount { font-size: 1.05rem; }
.play-prize-label {
  font-family: var(--font-head); font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
  flex: 0 0 auto;
}
.meta-value.live-countdown { color: var(--gold-2); font-variant-numeric: tabular-nums; }
.progress-bar { height: 8px; border-radius: 4px; background: rgba(0,0,0,.4); border: 1px solid var(--stone-edge); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dark), var(--gold-2)); transition: width .6s ease; }
.progress-fill.complete { background: linear-gradient(90deg, var(--green-dark), var(--green)); }
.event-progress-text { font-size: .85rem; color: var(--muted); margin-top: .4rem; }
.empty-state { margin: 2rem auto; text-align: center; }
.how-to { margin-top: 2.5rem; }
.how-to-details { padding-top: 1.05rem; padding-bottom: 1.05rem; }
.how-to-summary {
  font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; letter-spacing: .02em;
  color: var(--ink); cursor: pointer; user-select: none; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.how-to-summary::-webkit-details-marker, .how-to-summary::marker { display: none; content: none; }
.how-to-chevron {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 8px;
  border: 2px solid #7d5a10;
  background: linear-gradient(#ffd766, #d9a52b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 2px 0 #6b4c0d;
  display: grid; place-items: center;
  transition: filter .15s ease, box-shadow .15s ease, transform .15s ease;
}
.how-to-chevron::before {
  content: ""; width: 9px; height: 9px;
  border-right: 3px solid #2a1d08; border-bottom: 3px solid #2a1d08;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .28s ease;
}
.how-to-summary:hover .how-to-chevron { filter: brightness(1.08); }
.how-to-summary:active .how-to-chevron { transform: translateY(1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 1px 0 #6b4c0d; }
.how-to-details.is-open .how-to-chevron::before,
.how-to-details[open]:not(.js-ready) .how-to-chevron::before { transform: rotate(225deg) translate(-2px, -2px); }
.how-to-summary:hover { color: #1a1208; }
.how-to-summary:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 4px; border-radius: 4px; }
.how-to-body { overflow: hidden; }
.how-to-details.js-ready .how-to-body { height: 0; opacity: 0; }
.how-to-body-inner { padding-top: .55rem; }
.how-to-details.is-open .steps li { animation: howToIn .35s ease both; }
.how-to-details.is-open .steps li:nth-child(2) { animation-delay: .05s; }
.how-to-details.is-open .steps li:nth-child(3) { animation-delay: .1s; }
.how-to-details.is-open .steps li:nth-child(4) { animation-delay: .15s; }
.how-to-details.is-open .steps li:nth-child(5) { animation-delay: .2s; }
.how-to-details.is-open .steps li:nth-child(6) { animation-delay: .25s; }
@keyframes howToIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .how-to-body, .how-to-chevron::before, .how-to-details.is-open .steps li { transition: none !important; animation: none !important; }
}
.steps { margin: 0; padding-left: 1.3rem; }
.steps li { margin-bottom: .5rem; }
.steps li:last-child { margin-bottom: 0; }

/* ---------- Play page ---------- */
.page-event .page { max-width: 1400px; }
.play-stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.play-stage.has-dock {
  grid-template-columns: minmax(0, 1fr) 720px minmax(0, 1fr);
  column-gap: 3rem;
}
.play-stage.has-dock .play-main { grid-column: 2; width: 100%; }
.play-stage.has-dock .team-dock {
  grid-column: 3;
  justify-self: start;
  width: 280px;
  max-width: 100%;
  margin-left: .25rem;
}
.back-link { display: inline-block; margin-bottom: 1rem; color: var(--muted); font-family: var(--font-head); font-size: .85rem; letter-spacing: .06em; }
.play-head {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; margin-bottom: 1.5rem;
}
.play-title { font-family: var(--font-head); color: var(--gold-2); font-size: clamp(1.6rem, 5vw, 2.4rem); margin: 0 0 .3rem; text-shadow: 0 2px 0 #000; }
.play-desc { color: var(--muted); margin: 0 auto; max-width: 640px; white-space: pre-line; }
.state-panel { width: min(720px, 100%); max-width: 720px; margin: 0 auto; text-align: center; animation: fadeUp .5s ease both; }
.state-panel .spinner { margin: 0 auto .6rem; }
.seal { color: #7a2a1e; filter: drop-shadow(0 3px 0 rgba(0,0,0,.25)); margin-bottom: .4rem; animation: sway 3s ease-in-out infinite; }
@keyframes sway { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.countdown { display: flex; justify-content: center; gap: .6rem; margin: 1.2rem 0; }
.cd-unit { display: flex; flex-direction: column; align-items: center; min-width: 72px; padding: .6rem .4rem; border-radius: 8px; background: rgba(43,29,16,.9); color: var(--gold-2); border: 2px solid var(--gold-dark); box-shadow: inset 0 0 12px rgba(0,0,0,.6); }
.cd-num { font-family: var(--font-head); font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.cd-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-top: .3rem; }
.cd-num.tick { animation: tick .3s ease; }
@keyframes tick { 0% { transform: translateY(-4px); opacity: .5; } 100% { transform: none; opacity: 1; } }

.scroll-wrap { width: min(720px, 100%); max-width: 720px; margin: 0 auto; }
.progress-track { display: flex; gap: 6px; justify-content: center; margin-bottom: 1rem; flex-wrap: wrap; }
.track-step { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--stone-edge); background: rgba(0,0,0,.4); color: var(--muted); display: grid; place-items: center; font-family: var(--font-head); font-size: .75rem; font-weight: 700; transition: all .3s ease; }
.track-step.done { background: var(--green-dark); border-color: var(--green); color: #fff; }
.track-step.current { background: var(--gold-dark); border-color: var(--gold-2); color: #fff; box-shadow: 0 0 12px rgba(232,182,58,.6); transform: scale(1.12); }

.scroll { position: relative; transform-origin: top center; }
.scroll.unroll { animation: unroll .7s cubic-bezier(.2,.8,.2,1) both; }
@keyframes unroll { 0% { opacity: 0; transform: scaleY(.05) translateY(-20px); } 60% { opacity: 1; } 100% { transform: none; } }
.scroll.rollup { animation: rollup .45s ease-in both; }
@keyframes rollup { to { opacity: 0; transform: scaleY(.05) translateY(-20px); } }
.scroll-roll {
  height: 26px; border-radius: 13px; margin: 0 -10px; position: relative; z-index: 2;
  background: linear-gradient(#8f6b3b, #c9a56a 40%, #6d4c24); border: 2px solid #3b2812;
  box-shadow: 0 4px 10px rgba(0,0,0,.5);
}
.scroll-roll::before, .scroll-roll::after { content: ""; position: absolute; top: 2px; width: 16px; height: 18px; border-radius: 4px; background: linear-gradient(#5a3b1a, #2b1d10); }
.scroll-roll::before { left: -10px; } .scroll-roll::after { right: -10px; }
.scroll-roll-bottom { margin-top: -4px; }
.scroll-roll-top { margin-bottom: -4px; }
.scroll-body {
  position: relative; z-index: 1; color: var(--ink); padding: 2.2rem 2rem 2rem;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.02 .04' numOctaves='4' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .1 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--parchment-2), var(--parchment) 20%, var(--parchment) 80%, var(--parchment-2));
  border-left: 3px solid #5a4327; border-right: 3px solid #5a4327;
  box-shadow: inset 0 0 50px rgba(90,60,20,.3), inset 0 20px 20px -20px rgba(0,0,0,.4), inset 0 -20px 20px -20px rgba(0,0,0,.4);
  transition: box-shadow .4s ease;
}
.scroll.correct .scroll-body { box-shadow: inset 0 0 50px rgba(90,60,20,.3), 0 0 0 4px rgba(79,201,96,.7), 0 0 40px rgba(79,201,96,.6); }
.scroll.wrong { animation: shake .5s cubic-bezier(.36,.07,.19,.97) both; }
.scroll.wrong .scroll-body { box-shadow: inset 0 0 50px rgba(90,60,20,.3), 0 0 0 4px rgba(226,69,59,.6), 0 0 30px rgba(226,69,59,.5); }
@keyframes shake { 10%,90% { transform: translateX(-2px); } 20%,80% { transform: translateX(4px); } 30%,50%,70% { transform: translateX(-7px); } 40%,60% { transform: translateX(7px); } }
.riddle-kicker { font-family: var(--font-head); font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft); text-align: center; }
.riddle-title { font-family: var(--font-head); text-align: center; margin: .3rem 0 1.2rem; font-size: 1.5rem; color: var(--ink); }
.riddle-title:empty { display: none; }
.riddle-text { white-space: pre-line; font-size: 1.2rem; line-height: 1.6; text-align: center; font-style: italic; margin: 0 auto 1.6rem; max-width: 560px; }
.riddle-clues {
  max-width: 560px; margin: -0.6rem auto 1.4rem; padding: .85rem 1rem .75rem;
  border: 1px solid rgba(90,67,39,.45); border-radius: 8px;
  background: rgba(90,60,20,.08); text-align: left;
}
.riddle-clues[hidden] { display: none !important; }
.riddle-clues-title {
  font-family: var(--font-head); font-size: .78rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-soft); margin: 0 0 .45rem; text-align: center;
}
.riddle-clues-list { margin: 0; padding: 0 0 0 1.15rem; display: flex; flex-direction: column; gap: .4rem; }
.riddle-clues-list li { color: var(--ink); line-height: 1.45; }
.riddle-clues-next { margin: .55rem 0 0; text-align: center; }
.answer-form { max-width: 560px; margin: 0 auto; }
.answer-row { display: flex; gap: .6rem; }
.check-row { display: flex; flex-direction: column; align-items: center; gap: .45rem; text-align: center; }
.check-row .btn-submit { min-width: 160px; }
.check-team-note { margin: 0; max-width: 28em; color: var(--ink-soft); }
.answer-input {
  flex: 1; min-width: 0; font-family: var(--font-body); font-size: 1.15rem; padding: .75rem 1rem; border-radius: 8px;
  border: 2px solid #6b4f2a; background: rgba(255,250,235,.85); color: var(--ink); outline: none;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.2); transition: border-color .15s, box-shadow .15s; min-height: 48px;
}
.answer-input::placeholder { color: #8a7657; }
.answer-input:focus { border-color: var(--gold-dark); box-shadow: inset 0 2px 6px rgba(0,0,0,.2), 0 0 0 3px rgba(232,182,58,.35); }
.answer-input.ok { border-color: var(--green-dark); background: rgba(220,255,225,.9); }
.answer-input.bad { border-color: var(--red-dark); background: rgba(255,225,222,.9); }
.btn-submit { position: relative; min-width: 120px; }
.btn-submit.loading .btn-label { visibility: hidden; }
.btn-submit.loading .btn-spinner { position: absolute; display: block !important; border-color: rgba(42,29,8,.25); border-top-color: #2a1d08; }
.answer-feedback { min-height: 1.6em; margin-top: .6rem; text-align: center; font-weight: 600; font-size: 1.05rem; }
.answer-feedback.ok { color: var(--green-dark); animation: popIn .35s ease; }
.answer-feedback.bad { color: var(--red-dark); animation: popIn .35s ease; }
.answer-feedback.has-hint {
  text-align: left; font-weight: 500; font-size: .98rem; line-height: 1.45;
  max-width: 36em; margin-left: auto; margin-right: auto;
}
.check-fail-copy { display: block; margin-bottom: .55rem; white-space: pre-wrap; }
.answer-feedback.has-hint .lock-note { display: block; font-weight: 700; }
.lock-note { display: block; margin-top: .25rem; font-weight: 400; color: var(--ink-soft); }
.lock-time { font-family: var(--font-head); color: var(--red-dark); font-variant-numeric: tabular-nums; }
.scroll.locked-out .answer-input { background: rgba(200,185,150,.6); color: var(--ink-soft); cursor: not-allowed; }
.scroll.locked-out .btn-submit { filter: grayscale(.6); }
@keyframes popIn { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

.completed .trophy { color: var(--gold-dark); filter: drop-shadow(0 0 14px rgba(232,182,58,.7)); animation: float 2.4s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.position-big { font-family: var(--font-head); font-size: 2.2rem; color: var(--gold-dark); display: inline-block; vertical-align: middle; }
.fx-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 50; width: 100%; height: 100%; }

.leaderboard { max-width: 620px; margin: 2rem auto 0; }
.lb-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.lb-row { display: flex; align-items: center; gap: .8rem; padding: .55rem .9rem; border-radius: 8px; background: rgba(0,0,0,.3); border: 1px solid var(--stone-edge); animation: fadeUp .4s ease both; }
.lb-row.me { border-color: var(--gold-dark); background: rgba(232,182,58,.08); }
.lb-pos { font-family: var(--font-head); font-weight: 700; width: 2.2rem; color: var(--gold); }
.lb-row:nth-child(1) .lb-pos { color: #ffd700; } .lb-row:nth-child(2) .lb-pos { color: #c0c0c0; } .lb-row:nth-child(3) .lb-pos { color: #cd7f32; }
.lb-name { flex: 1; font-weight: 600; }
.lb-time { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.face-stack { display: inline-flex; align-items: center; }
.face-stack img { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--gold-dark); object-fit: cover; margin-left: -8px; background: #000; }
.face-stack img:first-child { margin-left: 0; }
.cell-team { display: flex; flex-direction: column; gap: .2rem; min-width: 12rem; }
.cell-team .face-stack { margin: .15rem 0; }

.team-lobby { text-align: left; }
.team-lobby .heading, .team-lobby .lead { text-align: center; }
.team-create { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin: 1rem 0 .4rem; }
.team-create .field { flex: 1; min-width: 12rem; margin-bottom: 0; }
.team-lobby input[type=text], .team-lobby input[type=search],
.team-dock input[type=text], .team-dock input[type=search] {
  font-family: var(--font-body); font-size: 1rem; width: 100%;
  padding: .5rem .7rem; border-radius: 6px; border: 2px solid var(--stone-edge);
  background: rgba(255,255,255,.55); color: var(--ink); outline: none;
}
.team-lobby .field > span, .team-dock .field > span { font-size: .85rem; color: var(--ink-soft); }
.invite-list, .pending-out, .team-roster { list-style: none; margin: 0; padding: 0; }
.invite-row { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .45rem 0; border-top: 1px solid rgba(43,29,16,.15); flex-wrap: wrap; }
.team-dock { position: sticky; top: 1rem; padding: .9rem 1rem !important; }
.team-dock-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .6rem; }
.team-dock-tz { margin: -.3rem 0 .7rem; }
.team-dock-name { font-family: var(--font-head); font-size: 1.05rem; margin: 0; color: var(--ink); }
.team-dock-size { font-size: .85rem; color: var(--ink-soft); }
.team-rename { display: flex; gap: .35rem; margin-bottom: .6rem; }
.roster-row { display: flex; align-items: center; gap: .45rem; padding: .28rem 0; }
.roster-row .avatar { width: 26px; height: 26px; }
.avatar-empty { display: inline-block; width: 26px; height: 26px; border-radius: 50%; background: #3a3228; border: 2px solid var(--gold-dark); }
.roster-name { flex: 1; color: var(--ink); font-weight: 600; }
.crown { color: #9a7217; margin-right: .25rem; }
.team-invite { position: relative; margin: .7rem 0 .4rem; }
.typeahead { list-style: none; margin: .25rem 0 0; padding: 0; position: absolute; left: 0; right: 0; z-index: 5;
  background: #f3e6c4; border: 1px solid var(--stone-edge); border-radius: 6px; max-height: 220px; overflow: auto; box-shadow: var(--shadow); }
.typeahead-item { display: flex; align-items: center; gap: .45rem; width: 100%; text-align: left; padding: .4rem .55rem;
  border: 0; background: none; cursor: pointer; font: inherit; color: var(--ink); }
.typeahead-item:hover { background: rgba(232,182,58,.25); }
.typeahead-item .avatar { width: 22px; height: 22px; }
.team-dock-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0 .7rem; }
.team-chat { border-top: 1px solid rgba(43,29,16,.18); padding-top: .65rem; }
.team-chat-title { font-family: var(--font-head); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 .4rem; color: var(--ink-soft); }
.team-chat-log { height: 180px; overflow: auto; background: rgba(43,29,16,.08); border-radius: 6px; padding: .4rem .5rem; font-size: .9rem; }
.chat-row { margin-bottom: .35rem; color: var(--ink); }
.chat-row.mine .chat-who { color: var(--gold-dark); }
.chat-who { font-weight: 700; margin-right: .35rem; }
.team-chat-form { display: flex; gap: .35rem; margin-top: .4rem; }
.team-size-row { margin-top: .7rem; }
.team-size-label { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; }
.seg-btn:disabled { opacity: .45; cursor: not-allowed; }
.invite-body, .confirm-body { white-space: pre-wrap; margin: 0 0 .8rem; }

/* ---------- Toasts ---------- */
.toast-root { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; z-index: 100; width: min(92vw, 420px); }
.toast { padding: .7rem 1rem; border-radius: 8px; background: #2a221a; border: 2px solid var(--stone-edge); color: var(--text); box-shadow: var(--shadow); animation: fadeUp .3s ease; font-weight: 600; }
.toast.error { border-color: var(--red-dark); color: #ffb3ad; }
.toast.ok { border-color: var(--green-dark); color: #b8f2c0; }
.solve-toasts {
  position: fixed; top: 4.6rem; left: 50%; transform: translateX(-50%);
  z-index: 120; display: flex; flex-direction: column; gap: .4rem;
  width: min(92vw, 380px); pointer-events: none;
}
.solve-toast {
  padding: .42rem .85rem; border-radius: 8px;
  background: rgba(42, 34, 26, .94); border: 1px solid var(--gold-dark);
  color: var(--text); box-shadow: var(--shadow);
  font-size: .95rem; font-weight: 600; text-align: center;
  animation: fadeDown .25s ease;
}
.solve-toast b { color: var(--gold-2); font-weight: 700; }
.solve-toast.out { opacity: 0; transition: opacity .25s ease; }
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Admin ---------- */
.page-admin .page {
  max-width: none;
  width: 100%;
  padding: 1rem clamp(1rem, 1.6vw, 1.75rem) 1.5rem;
}
.admin { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
#view-editor { max-width: 1080px; }
.admin-side { position: sticky; top: 1rem; background: rgba(0,0,0,.3); border: 2px solid var(--stone-edge); border-radius: var(--radius); padding: 1rem; }
.admin-side-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.admin-side-head h2 { font-family: var(--font-head); font-size: 1rem; letter-spacing: .12em; text-transform: uppercase; margin: 0; color: var(--gold); }
.admin-event-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; max-height: 70vh; overflow: auto; }
.admin-event-list a { display: flex; flex-direction: column; gap: .1rem; padding: .5rem .6rem; border-radius: 6px; color: var(--text); border: 1px solid transparent; }
.admin-event-list a:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.admin-event-list a.active { border-color: var(--gold-dark); background: rgba(232,182,58,.1); }
.admin-event-list .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-event-list .s { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.admin-side-foot { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--stone-edge); display: flex; flex-direction: column; gap: .2rem; }
.subhead { font-family: var(--font-head); font-size: 1.05rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); margin: 1.4rem 0 .7rem; }
.notice-compose { margin: 1rem 0 1.6rem; max-width: 640px; }
.admin .notice-compose input[type=text],
.admin .notice-compose textarea {
  color: var(--ink); background: rgba(255,255,255,.38); border-color: #5a4327;
}
.admin .notice-compose input:focus,
.admin .notice-compose textarea:focus { border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(154,114,23,.25); }
.notice-compose .field > span { color: var(--ink-soft); }
.notice-compose-foot { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-top: .2rem; }
.notice-admin-list { display: flex; flex-direction: column; gap: .7rem; max-width: 720px; }
.notice-admin-item {
  background: rgba(0,0,0,.3); border: 1px solid var(--stone-edge); border-radius: 8px;
  padding: .85rem 1rem;
}
.notice-admin-item.is-retracted { opacity: .62; }
.notice-admin-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-bottom: .35rem; }
.notice-admin-head strong { font-family: var(--font-head); color: var(--gold-2); letter-spacing: .03em; }
.notice-admin-body { margin: 0 0 .65rem; white-space: pre-wrap; line-height: 1.45; }
.notice-admin-foot { display: flex; justify-content: space-between; align-items: center; gap: .8rem; }
.admin-side-link {
  display: block; padding: .5rem .6rem; border-radius: 6px; color: var(--text);
  font-family: var(--font-head); font-size: .85rem; letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid transparent;
}
.admin-side-link:hover { background: rgba(255,255,255,.05); text-decoration: none; color: var(--gold-2); }
.admin-side-link.active { border-color: var(--gold-dark); background: rgba(232,182,58,.1); color: var(--gold-2); }
.admin-main { min-width: 0; }
.admin-view { animation: fadeUp .3s ease both; }
.admin .heading { color: var(--gold-2); }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.view-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: .85rem; color: var(--muted); letter-spacing: .04em; }
.save-status { min-height: 1.4em; font-size: .9rem; color: var(--muted); margin-bottom: .6rem; }
.save-status.dirty { color: var(--osrs-orange); }
.save-status.ok { color: var(--green); }
.save-status.err { color: #ff8a80; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin: 1rem 0 1.2rem; }
.stat { background: rgba(0,0,0,.3); border: 1px solid var(--stone-edge); border-radius: 8px; padding: .7rem .9rem; }
.stat .v { font-family: var(--font-head); font-size: 1.6rem; color: var(--gold-2); line-height: 1.1; }
.stat .l { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--stone-edge); border-radius: 8px; background: rgba(0,0,0,.25); }
#view-progress .table-wrap { width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid rgba(255,255,255,.06); white-space: nowrap; }
.table-progress { width: 100%; }
.table-progress th, .table-progress td { padding: .55rem .7rem; }
.table-progress .col-r { padding: .45rem .28rem; text-align: center; width: 2.4rem; }
.table-progress td:nth-child(2) { white-space: normal; }
.table th { font-family: var(--font-head); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: rgba(0,0,0,.3); position: sticky; top: 0; }
.table tbody tr:hover { background: rgba(232,182,58,.06); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .ok { color: var(--green); } .table .bad { color: #ff8a80; }
.cell-user { display: flex; align-items: center; gap: .5rem; }
.cell-user img { width: 26px; height: 26px; border-radius: 50%; }
.cell-user small { color: var(--muted); }
.pos-1 { color: #ffd700; font-weight: 700; } .pos-2 { color: #c0c0c0; font-weight: 700; } .pos-3 { color: #cd7f32; font-weight: 700; }
.rc { display: inline-block; min-width: 26px; height: 26px; line-height: 24px; text-align: center; border-radius: 6px; border: 1px solid var(--stone-edge); font-size: .8rem; }
.rc.done { background: rgba(79,201,96,.15); border-color: var(--green-dark); color: var(--green); }
.rc.cur { background: rgba(232,182,58,.15); border-color: var(--gold-dark); color: var(--gold-2); }
.lock-badge { font-size: .75rem; color: #ff8a80; margin-left: .3rem; font-variant-numeric: tabular-nums; }
.link-btn { background: none; border: 0; color: var(--gold-2); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.card { background: rgba(0,0,0,.3); border: 1px solid var(--stone-edge); border-radius: var(--radius); padding: 1rem 1.1rem; }
.card-wide { grid-column: 1 / -1; }
.card-title { font-family: var(--font-head); font-size: .95rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin: 0 0 .8rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.field > span { font-size: .85rem; letter-spacing: .04em; color: var(--muted); }
.field small { color: var(--muted); opacity: .8; }
.admin input[type=text], .admin input[type=number], .admin input[type=search], .admin input[type=datetime-local], .admin textarea, .admin select {
  font-family: var(--font-body); font-size: 1rem; color: var(--text); background: rgba(0,0,0,.35); border: 1px solid var(--stone-edge); border-radius: 6px; padding: .55rem .7rem; width: 100%; outline: none; min-height: 42px;
}
.admin textarea { resize: vertical; line-height: 1.45; }
.admin input:focus, .admin textarea:focus, .admin select:focus { border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(232,182,58,.2); }
.admin input.invalid { border-color: var(--red); }
.prize-block .seg { margin: .35rem 0 .55rem; }
.prize-block .seg-btn { flex: 1 1 9rem; }
.prize-field { display: flex; align-items: center; gap: .65rem; }
.prize-field > .prize-icon, .prize-field > .prize-coins { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
.prize-field input { flex: 1; max-width: 11rem; font-family: ui-monospace, Consolas, monospace !important; letter-spacing: .04em; }
.prize-preview { min-height: 1.4em; }
.admin input[type=datetime-local] { color-scheme: dark; }
.seg { display: flex; gap: .4rem; flex-wrap: wrap; }
.seg-btn { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding: .55rem .8rem; border-radius: 6px; border: 1px solid var(--stone-edge); background: rgba(0,0,0,.3); color: var(--text); cursor: pointer; font-family: var(--font-head); font-size: .9rem; text-align: left; }
.seg-btn small { font-family: var(--font-body); color: var(--muted); font-size: .8rem; }
.seg-btn.active { border-color: var(--gold); background: rgba(232,182,58,.15); color: var(--gold-2); }
.tz-preview { font-size: .9rem; color: var(--muted); line-height: 1.6; padding: .6rem .8rem; border-radius: 6px; background: rgba(255,255,255,.03); border: 1px dashed var(--stone-edge); }
.tz-preview b { color: var(--text); }
.riddle-list { display: flex; flex-direction: column; gap: .8rem; margin-top: .6rem; }
.riddle-card { border: 1px solid var(--stone-edge); border-left: 4px solid var(--gold-dark); border-radius: 8px; padding: .8rem; background: rgba(0,0,0,.25); display: flex; flex-direction: column; gap: .5rem; animation: fadeUp .25s ease both; }
.riddle-card-head { display: flex; align-items: center; gap: .6rem; }
.riddle-index { font-family: var(--font-head); font-weight: 700; color: var(--gold-2); width: 2rem; text-align: center; }
.riddle-actions { display: flex; gap: .3rem; }
.r-text { font-size: 1.05rem; }
.r-answers { font-family: ui-monospace, Consolas, monospace; font-size: .95rem; }
.r-kind-field { margin: 0; }
.r-kind .seg-btn { align-items: center; padding: .45rem .55rem; font-size: .8rem; }
.r-check { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .8rem; }
.r-check .r-check-hint, .r-team-check { grid-column: 1 / -1; margin: 0; }
.r-check .field { margin-bottom: 0; }
.r-team-check { display: flex; flex-direction: column; gap: .45rem; padding-top: .15rem; }
.r-team-check[hidden] { display: none !important; }
.r-team-check > span { font-size: .85rem; color: var(--muted); }
.r-team-check-mode .seg-btn { flex: 1 1 12rem; }
.r-team-check-hint { margin: 0; line-height: 1.45; }
.r-team-check-hint[hidden] { display: none !important; }
.riddle-card.invalid { border-left-color: var(--red); }
.r-clues { display: flex; flex-direction: column; gap: .45rem; padding-top: .2rem; border-top: 1px dashed var(--stone-edge); }
.r-clues-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.r-clues-head span { font-size: .9rem; color: var(--text); }
.r-clues-head small { color: var(--muted); font-weight: 400; }
.r-clue-list { display: flex; flex-direction: column; gap: .45rem; }
.r-clue-row { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) 34px; gap: .5rem; align-items: end; }
.r-clue-row .field { margin: 0; }
.r-clue-after-wrap { display: flex; align-items: center; gap: .35rem; }
.r-clue-after { width: 4.2rem; }
.r-clue-after-wrap .small { white-space: nowrap; }
.toggle { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex-shrink: 0; }
.toggle:has(#logs-live:checked) .live-dot {
  background: var(--green); box-shadow: 0 0 8px rgba(79,201,96,.7); animation: livePulse 1.6s ease infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

.logs-toolbar { display: flex; flex-wrap: wrap; gap: .7rem 1rem; justify-content: space-between; align-items: center; margin: .5rem 0 1rem; }
.logs-filters { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  font-family: var(--font-head); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--stone-edge);
  background: rgba(0,0,0,.3); color: var(--muted); cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--gold-dark); }
.chip.active { color: var(--gold-2); border-color: var(--gold-dark); background: rgba(232,182,58,.15); }
.logs-search { margin: 0; min-width: min(100%, 18rem); flex: 1 1 16rem; max-width: 22rem; }
.logs-search input { min-height: 38px; }

.log-feed { border: 1px solid var(--stone-edge); border-radius: 8px; background: rgba(0,0,0,.28); overflow: hidden; }
.log-day {
  padding: .4rem .9rem; font-family: var(--font-head); font-size: .72rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--gold); background: rgba(0,0,0,.4);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.log-row {
  display: grid; grid-template-columns: 6.8rem 5.2rem minmax(0, 1fr); gap: .65rem; align-items: baseline;
  padding: .48rem .9rem; border-bottom: 1px solid rgba(255,255,255,.05); border-left: 3px solid transparent;
}
.log-row:last-child { border-bottom: 0; }
.log-row:hover { background: rgba(232,182,58,.06); }
.log-row-ok { border-left-color: var(--green-dark); }
.log-row-warn { border-left-color: var(--osrs-orange); }
.log-row-error { border-left-color: var(--red); background: rgba(226,69,59,.07); }
.log-time {
  font-variant-numeric: tabular-nums; font-size: .8rem; color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
}
.log-badge {
  font-family: var(--font-head); font-size: .65rem; letter-spacing: .08em; text-transform: uppercase;
  padding: .18rem .45rem; border-radius: 999px; border: 1px solid; text-align: center; white-space: nowrap;
}
.log-b-ok { color: var(--green); border-color: var(--green-dark); background: rgba(79,201,96,.1); }
.log-b-warn { color: var(--osrs-orange); border-color: #a86212; background: rgba(255,152,31,.1); }
.log-b-error { color: #ffb3ad; border-color: var(--red-dark); background: rgba(226,69,59,.12); }
.log-b-check { color: #7ec8e3; border-color: #3a6d82; background: rgba(126,200,227,.1); }
.log-b-start { color: var(--gold-2); border-color: var(--gold-dark); background: rgba(232,182,58,.12); }
.log-b-rsn { color: #c4b5fd; border-color: #6d5aad; background: rgba(139,92,246,.12); }
.log-b-hs { color: var(--muted); border-color: var(--stone-edge); background: rgba(255,255,255,.04); }
.log-b-login { color: var(--muted); border-color: var(--stone-edge); }
.log-b-info { color: var(--text); border-color: var(--stone-edge); }
.log-msg { white-space: normal; line-height: 1.4; overflow-wrap: anywhere; }
.log-quote { color: var(--gold-2); font-style: italic; }
.log-row.is-new { animation: logIn 1.8s ease; }
@keyframes logIn {
  from { background: rgba(232,182,58,.2); }
  to { background: transparent; }
}
.logs-more { display: flex; justify-content: center; padding: .9rem 0 .2rem; }
#logs-empty { padding: 1.4rem .4rem; text-align: center; }
.modal { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.7); display: grid; place-items: center; padding: 1rem; }
.modal-card { background: #2a221a; border: 2px solid var(--stone-edge); border-radius: 10px; padding: 1.3rem 1.5rem; max-width: 440px; width: 100%; box-shadow: var(--shadow); animation: popIn .2s ease; }
.modal-card h3 { font-family: var(--font-head); margin: 0 0 .5rem; color: var(--gold-2); }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.tz-card .modal-actions { margin-top: .7rem; }
.notice-card {
  max-width: 480px; color: var(--ink);
  background:
    linear-gradient(160deg, var(--parchment), var(--parchment-2) 60%, var(--parchment-dark));
  border: 3px solid #5a4327; outline: 2px solid #2b1d10;
}
.notice-card h3 { color: var(--ink); text-align: center; letter-spacing: .04em; margin-bottom: .35rem; }
.notice-kicker {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-head); font-size: .72rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--gold-dark); margin-bottom: .55rem;
}
.notice-kicker img { width: 28px; height: auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.notice-body { white-space: pre-wrap; font-size: 1.08rem; line-height: 1.5; margin: .2rem 0 .85rem; }
.notice-card .notice-by { color: var(--ink-soft); text-align: center; margin: 0; }
.notice-card .modal-actions { justify-content: center; }
.rsn-card { max-width: 480px; }
.rsn-card .field { display: flex; flex-direction: column; gap: .3rem; margin: .8rem 0; }
.rsn-card .field > span { font-size: .85rem; color: var(--muted); }
.rsn-card input[type=text] {
  font-family: var(--font-body); font-size: 1.05rem; color: var(--text); background: rgba(0,0,0,.35);
  border: 1px solid var(--stone-edge); border-radius: 6px; padding: .55rem .7rem; width: 100%; outline: none; min-height: 42px;
}
.rsn-card input:focus { border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(232,182,58,.2); }
.rsn-preview-name { display: flex; align-items: center; gap: .5rem; margin: .4rem 0 .6rem; font-size: 1.15rem; }
.osrs-skills {
  width: 240px; max-width: 100%; margin: .2rem auto .7rem;
  background: #3a3a3a; border: 2px solid #111; box-shadow: inset 0 0 0 1px #5c5c5c;
  font-family: Tahoma, Arial, sans-serif; user-select: none;
}
.osrs-skills-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.osrs-skill {
  display: flex; align-items: center; justify-content: flex-start; gap: 4px;
  padding: 4px 4px 4px 3px; min-height: 36px;
  border-right: 1px solid #1a1a1a; border-bottom: 1px solid #1a1a1a;
  background: #494949;
}
.osrs-skill:nth-child(3n) { border-right: 0; }
.osrs-skill:nth-last-child(-n+3) { border-bottom: 0; }
.osrs-skill img { width: 25px; height: 25px; object-fit: contain; flex-shrink: 0; image-rendering: pixelated; }
.osrs-skill-lvls {
  position: relative; flex: 0 0 28px; width: 28px; height: 30px;
  color: #ffff00; font-weight: 700; font-size: 12px; line-height: 1;
  text-shadow: 1px 1px 0 #000; font-variant-numeric: tabular-nums;
}
.osrs-skill-lvls::before {
  content: ""; position: absolute; left: 1px; right: 1px; top: 50%; height: 1px;
  background: #000; transform: rotate(-40deg);
}
.osrs-lv-cur { position: absolute; top: 1px; left: 0; }
.osrs-lv-base { position: absolute; right: 0; bottom: 0; }
.osrs-skills-total {
  text-align: center; color: #ffff00; font-weight: 700; font-size: 13px;
  padding: 5px 4px 6px; text-shadow: 1px 1px 0 #000; border-top: 1px solid #1a1a1a;
  background: #2f2f2f;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .play-stage.has-dock { grid-template-columns: minmax(0, 1fr); }
  .play-stage.has-dock .play-main,
  .play-stage.has-dock .team-dock {
    grid-column: auto;
    justify-self: center;
    width: min(720px, 100%);
    max-width: min(720px, 100%);
  }
  .team-dock { position: static; margin-left: 0; }
}
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .admin-side { position: static; }
  .admin-event-list { max-height: 220px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .log-row { grid-template-columns: 5.4rem 4.8rem minmax(0, 1fr); padding: .45rem .7rem; gap: .45rem; }
  .logs-search { max-width: none; }
  body { font-size: 17px; }
  .topbar { padding: .5rem .8rem; }
  .brand-top { display: none; }
  .user-name { display: none; }
  .parchment { padding: 1.3rem 1.1rem; }
  .scroll-body { padding: 1.6rem 1.1rem 1.4rem; }
  .riddle-text { font-size: 1.1rem; }
  .answer-row { flex-direction: column; }
  .btn-submit { width: 100%; }
  .r-check { grid-template-columns: 1fr; }
  .r-clue-row { grid-template-columns: 1fr 34px; }
  .r-clue-text-field { grid-column: 1 / -1; grid-row: 2; }
  .r-clue-del { grid-column: 2; grid-row: 1; }
  .user-bar { gap: .1rem .7rem; }
  .user-link { font-size: .85rem; }
  .cd-unit { min-width: 62px; }
  .cd-num { font-size: 1.5rem; }
  .is-guest .hero-img { max-height: min(220px, 34vh); object-position: center; }
  .view-head { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
