/* Runewars 2D 0.2 design system.
   Direction: a night-sky arena lit by eight runes. Ink on deep indigo, each rune owns one colour and nothing else uses it.
   Type: Palatino for names and titles (carved, ceremonial), system sans for everything you read quickly.
   Motion: strong ease-out, UI under 300 ms, hover gated to real pointers, reduced-motion respected. */
:root {
  color-scheme: dark;
  --bg: #04050f;
  --panel: #0d1133;
  --panel-2: #151a4a;
  --line: #2e347a;
  --ink: #eceaff;
  --mut: #9aa0d0;
  --accent: #6c7cff;
  --water: #2f8cff; --fire: #ff5a2a; --lightning: #ffe01a; --wind: #3fe0d0; --nature: #46c35a; --evil: #8a3cff; --holy: #ffffff; --earth: #b0763a;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --display: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --body: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--body); overflow: hidden; -webkit-user-select: none; user-select: none; }
#frame { position: fixed; inset: 0; }
#stage { position: absolute; left: 50%; top: 50%; width: 1280px; height: 720px; margin: -360px 0 0 -640px; transform: scale(var(--s, 1)); transform-origin: center; background: #05071a; overflow: hidden; }
#cv { position: absolute; inset: 0; width: 1280px; height: 720px; display: block; cursor: crosshair; }
h1, h2, h3 { font-family: var(--display); margin: 0; font-weight: 700; }
h2 { font-size: 30px; letter-spacing: .02em; margin-bottom: 8px; }
h3 { font-size: 18px; margin: 18px 0 4px; }
p { margin: 6px 0; }
.muted { color: var(--mut); } .small { font-size: 13px; }

/* ------- overlays: fade + settle, interruptible transitions (no keyframes) */
.scr { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; pointer-events: none;
  background: rgba(4, 5, 18, .78); transition: opacity 200ms var(--ease), visibility 0s linear 200ms; }
.scr.on { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.scr.thru { background: none; pointer-events: none !important; }
#menu { background: none; justify-content: flex-start; align-items: stretch; }
#menu.on { pointer-events: auto; }
.panel { background: linear-gradient(165deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 18px; padding: 26px 32px; min-width: 340px; max-width: 1180px; max-height: 680px; overflow: auto; text-align: center;
  box-shadow: 0 28px 80px #000c; transform: translateY(10px) scale(.97); transition: transform 240ms var(--ease); }
.scr.on .panel { transform: none; }
.panel.wide { min-width: 560px; }

/* ------- buttons */
.btn { font: 600 15px var(--body); color: var(--ink); background: #232a70; border: 1px solid var(--line); border-radius: 10px; padding: 9px 18px; cursor: pointer; margin: 4px; transition: transform 140ms var(--ease), background-color 160ms ease, border-color 160ms ease, opacity 160ms ease; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.big { display: block; width: 100%; margin: 8px 0; padding: 12px; font-size: 16px; }
.btn.sm { padding: 6px 12px; font-size: 13px; margin: 2px; }
.btn.primary { background: var(--accent); border-color: #9aa5ff; color: #070a22; }
button:focus-visible, select:focus-visible, input:focus-visible, .cd:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { background: #3441b0; border-color: #6c7cff; }
  .btn.primary:hover:not(:disabled) { background: #8e9bff; }
}

/* ------- main menu */
.menu-col { width: 560px; padding: 60px 0 0 96px; }
.logo { display: flex; flex-direction: column; font-size: 116px; line-height: .86; letter-spacing: .04em; font-weight: 700; text-shadow: 0 6px 40px #6c7cff55; }
.logo span:nth-child(2) { margin-left: 50px; }
.logo-bar { display: flex; gap: 5px; width: 360px; margin: 20px 0 22px 6px; }
.logo-bar i { flex: 1; height: 6px; border-radius: 3px; background: var(--c); box-shadow: 0 0 14px var(--c); transform-origin: left; animation: barIn 700ms var(--ease) backwards; }
.logo-bar i:nth-child(2) { animation-delay: 60ms } .logo-bar i:nth-child(3) { animation-delay: 120ms } .logo-bar i:nth-child(4) { animation-delay: 180ms } .logo-bar i:nth-child(6) { animation-delay: 300ms } .logo-bar i:nth-child(7) { animation-delay: 360ms } .logo-bar i:nth-child(8) { animation-delay: 420ms } .logo-bar i:nth-child(5) { animation-delay: 240ms }
@keyframes barIn { from { transform: scaleX(0); opacity: 0; } }
.menu-list { display: flex; flex-direction: column; gap: 8px; width: 400px; }
.mi { position: relative; display: flex; align-items: center; gap: 16px; text-align: left; font: inherit; color: var(--ink); background: none; border: 0; border-radius: 12px; padding: 9px 16px 9px 12px; cursor: pointer; transition: transform 200ms var(--ease), background-color 200ms ease; }
.mi-ico { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #151a4a; border: 1px solid var(--line); opacity: .55; transform: scale(.86); transition: transform 220ms var(--ease), opacity 200ms ease, box-shadow 220ms ease, border-color 200ms ease; }
.mi-ico svg { width: 22px; height: 22px; }
.mi-t b { display: block; font: 700 30px/1.05 var(--display); letter-spacing: .03em; }
.mi:active { transform: scale(.98); }
.mi:focus-visible { outline: none; }
.mi:focus-visible, .mi.hot { background: #ffffff0d; transform: translateX(10px); }
.mi:focus-visible .mi-ico { opacity: 1; transform: scale(1); border-color: var(--rc); box-shadow: 0 0 22px var(--rc); }
@media (hover: hover) and (pointer: fine) {
  .mi:hover { background: #ffffff0d; transform: translateX(10px); }
  .mi:hover .mi-ico { opacity: 1; transform: scale(1); border-color: var(--rc); box-shadow: 0 0 22px var(--rc); }
}
.ver { position: absolute; left: 96px; bottom: 28px; margin: 0; font-size: 12px; color: var(--mut); }
#menu .menu-col, #menu .ver { transform: translateX(-16px); opacity: 0; transition: transform 420ms var(--ease), opacity 320ms ease; }
#menu.on .menu-col, #menu.on .ver { transform: none; opacity: 1; }

/* ------- rune selection */
#cards { display: flex; gap: 18px; justify-content: center; margin: 14px 0 10px; }
.cd { width: 250px; border-radius: 16px; padding: 14px; border: 2px solid #ffffff22; cursor: pointer; text-align: left; background: linear-gradient(170deg, var(--c), var(--c2)); transition: transform 220ms var(--ease), box-shadow 220ms ease, border-color 200ms ease, filter 200ms ease; }
.cd:not(.on) { filter: saturate(.8) brightness(.92); }
.cd:active { transform: scale(.985); }
.cd.on { border-color: #fff; box-shadow: 0 0 34px var(--c); transform: translateY(-8px); filter: none; }
@media (hover: hover) and (pointer: fine) { .cd:not(.on):hover { transform: translateY(-5px); filter: none; } }
.cd .sy { width: 54px; height: 54px; margin: 2px auto 0; display: block; }
.cd b.nm { display: block; text-align: center; font: 700 22px var(--display); letter-spacing: .08em; margin-top: 4px; }
.cd .ds { display: block; text-align: center; opacity: .92; margin: 4px 0 10px; font-size: 12.5px; min-height: 34px; }
.ab { display: block; width: 100%; text-align: left; font: inherit; font-size: 12.5px; color: var(--ink); background: #0008; border: 1px solid transparent; border-radius: 8px; padding: 6px 9px; margin: 4px 0; cursor: pointer; transition: background-color 150ms ease, color 150ms ease, transform 140ms var(--ease); }
.ab:active:not(:disabled) { transform: scale(.98); }
.ab:disabled { cursor: default; opacity: .75; }
.ab.on { background: #fff; color: #0b0e2e; }
.ab small { display: block; opacity: .85; font-size: 11.5px; margin-top: 1px; }
.ab .k { display: inline-block; min-width: 40px; font-weight: 700; }
@media (hover: hover) and (pointer: fine) { .ab:hover:not(:disabled):not(.on) { background: #000b; border-color: #fff6; } }

/* ------- countdown */
#cnum { font: 700 230px/1 var(--display); letter-spacing: .02em; color: #fff; text-shadow: 0 0 60px #6c7cffcc, 0 8px 0 #0006; opacity: 0; }
#cnum.t { animation: cntTick 1000ms var(--ease) both; }
#cnum.go { font-size: 190px; color: #bffcf5; text-shadow: 0 0 70px #3fe0d0, 0 0 20px #fff8, 0 8px 0 #0006; animation: cntGo 900ms var(--ease) both; }
@keyframes cntTick { 0% { opacity: 0; transform: scale(1.7); } 18% { opacity: 1; transform: scale(1); } 70% { opacity: 1; transform: scale(.96); } 100% { opacity: 0; transform: scale(.82); } }
@keyframes cntGo { 0% { opacity: 0; transform: scale(.7); letter-spacing: -.1em; } 22% { opacity: 1; transform: scale(1.12); letter-spacing: .06em; } 100% { opacity: 0; transform: scale(1.5); letter-spacing: .16em; } }

/* ------- practice dock */
#dock { position: absolute; left: 0; right: 0; bottom: 0; height: 104px; display: none; align-items: center; justify-content: space-between; gap: 18px; padding: 0 22px; background: linear-gradient(0deg, #05071aee, #05071acc); border-top: 1px solid var(--line); }
#dock.on { display: flex; }
#dock-slots { display: flex; gap: 12px; }
.ds-slot { width: 218px; background: #0d1133; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; transition: border-color 200ms ease; }
.ds-slot .row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ds-slot .k { font: 700 12px var(--body); color: var(--mut); min-width: 52px; }
.ds-slot select { flex: 1; min-width: 0; }
.ds-slot .an { font-size: 12px; color: var(--ink); min-height: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.stats { font-size: 13px; color: var(--mut); } .stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.dock-btns { display: flex; }

/* ------- settings */
.set-grid { display: grid; grid-template-columns: 170px 1fr; gap: 12px 16px; align-items: center; text-align: left; margin: 14px 0 6px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
select { font: inherit; color: var(--ink); background: #1b2160; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
#kb { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 10px 0 12px; }
#kb .btn { margin: 0; display: flex; justify-content: space-between; text-align: left; }
#kb .btn.listen { background: var(--accent); color: #070a22; }
#kb .btn b { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .scr, .panel, .mi, .mi-ico, .cd, .ab, .btn, #menu .menu-col, #menu .ver { transition-duration: 1ms !important; }
  .logo-bar i { animation: none; }
  #cnum.t, #cnum.go { animation: cntFade 900ms linear both; }
  @keyframes cntFade { 0%, 100% { opacity: 0; } 20%, 70% { opacity: 1; } }
}


/* ------- v0.3: accounts, lobby, legal links */
input { -webkit-user-select: text; user-select: text; }
.tabs { display: flex; gap: 6px; justify-content: center; margin: 12px 0 8px; }
.tab { font: 600 14px var(--body); color: var(--mut); background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 14px; cursor: pointer; transition: color 160ms ease, border-color 160ms ease; }
.tab.on { color: var(--ink); border-color: var(--accent); }
.fld { display: block; text-align: left; font-size: 13px; color: var(--mut); margin: 10px 0; }
.fld input { display: block; width: 100%; margin-top: 4px; font: 16px var(--body); color: var(--ink); background: #080b26; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; transition: border-color 160ms ease, box-shadow 160ms ease; }
.fld input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #6c7cff44; }
.chk { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-size: 13px; margin: 8px 0; color: var(--ink); cursor: pointer; }
.chk input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.chk a, .legal a { color: #b9c1ff; }
.err { min-height: 20px; margin: 8px 0 4px; color: #ff9a9a; font-size: 13px; }
.joinrow { display: flex; gap: 8px; align-items: flex-end; margin: 6px 0; }
.joinrow .grow { flex: 1; margin: 0; }
.joinrow .btn { margin: 0 0 1px; padding: 11px 20px; }
.key { font: 700 46px var(--display); letter-spacing: .18em; padding: 14px 8px; margin: 10px 0; background: #080b26; border: 1px dashed var(--line); border-radius: 14px; color: #fff; -webkit-user-select: text; user-select: text; }
.acctbox { margin-top: 12px; text-align: left; font-size: 13px; color: var(--mut); }
.acctbox summary { cursor: pointer; padding: 6px 0; }
.btn.danger { border-color: #7a2e3a; color: #ffb3bd; }
.legal { position: absolute; right: 36px; bottom: 26px; display: flex; gap: 16px; font-size: 12px; }
.legal a { color: var(--mut); text-decoration: none; transition: color 160ms ease; }
@media (hover: hover) and (pointer: fine) { .legal a:hover { color: var(--ink); text-decoration: underline; } .tab:hover { color: var(--ink); } }
[hidden] { display: none !important; }

/* ------- holy rune = white card: dark ink on the light face */
.cd.lt { border-color: #ffffff88; }
.cd.lt b.nm, .cd.lt .ds { color: #1b2150; }

/* ------- profile button (top-left of the main menu) */
.prof-btn { position: absolute; left: 28px; top: 26px; width: 48px; height: 48px; padding: 0; border-radius: 50%; cursor: pointer; background: #12175a; border: 1.5px solid #6c7cff88;
  display: grid; place-items: center; z-index: 2; transition: transform 200ms var(--ease), box-shadow 200ms ease, border-color 200ms ease, background-color 200ms ease; }
.prof-btn { overflow: hidden; background: radial-gradient(circle at 50% 30%, #3a44b8, #12175a 75%); }
.prof-btn svg { width: 100%; height: 100%; display: block; transition: transform 240ms var(--ease); }
.prof-btn:active { transform: scale(.94); }
.prof-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .prof-btn:hover { transform: scale(1.08); border-color: #aab4ff; background: #1b2275; box-shadow: 0 0 22px #6c7cff88; }
  .prof-btn:hover svg { transform: scale(1.06); }
}
#menu .prof-btn { opacity: 0; transform: translateY(-8px); transition: transform 200ms var(--ease), box-shadow 200ms ease, border-color 200ms ease, background-color 200ms ease, opacity 320ms ease; }
#menu.on .prof-btn { opacity: 1; transform: none; }
@media (hover: hover) and (pointer: fine) { #menu.on .prof-btn:hover { transform: scale(1.08); } }

/* ------- profile panel */
.prof-panel { position: relative; width: 560px; text-align: left; padding: 28px 32px 24px; }
.pf-x { position: absolute; right: 12px; top: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--mut); font-size: 26px; line-height: 1; cursor: pointer; transition: color 150ms ease, background-color 150ms ease, transform 140ms var(--ease); }
.pf-x:active { transform: scale(.92); }
@media (hover: hover) and (pointer: fine) { .pf-x:hover { color: #fff; background: #ffffff14; } }
.pf-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.pf-head h2 { margin: 0; font-size: 32px; letter-spacing: .03em; word-break: break-all; }
.pf-head p { margin: 2px 0 0; }
.pf-avatar { flex: none; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 30% 25%, #4a58d8, #161b66); border: 2px solid #8f9bff; box-shadow: 0 0 26px #6c7cff66; }
.pf-avatar svg { width: 100%; height: 100%; display: block; }
.pf-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pf-stat { background: #0a0d2899; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 8px; text-align: center; }
.pf-stat b { display: block; font: 700 34px/1.1 var(--display); letter-spacing: .02em; }
.pf-stat span { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--mut); }
.pf-stat.w b { color: #8dffb0; } .pf-stat.l b { color: #ff8a98; } .pf-stat.r b { color: #ffd98a; }
.pf-bar { height: 6px; border-radius: 3px; background: #ff5a6a55; margin: 12px 0 2px; overflow: hidden; }
.pf-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #46c35a, #8dffb0); border-radius: 3px; transition: width 520ms var(--ease) 120ms; }
.prof-panel h3 { margin: 16px 0 8px; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; color: var(--mut); font-family: var(--body); }
.pf-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 300px; overflow: auto; }
.pf-row { display: grid; grid-template-columns: 116px 1fr auto; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; background: #0a0d2899; border-left: 4px solid var(--rc);
  opacity: 0; transform: translateY(6px); transition: opacity 260ms ease, transform 260ms var(--ease); transition-delay: calc(var(--i, 0) * 35ms + 100ms); }
#prof.on .pf-row { opacity: 1; transform: none; }
.pf-row.win { --rc: #46c35a; } .pf-row.loss { --rc: #ff5a6a; }
.pf-res { font: 700 13px var(--display); letter-spacing: .14em; color: var(--rc); white-space: nowrap; }
.pf-res::before { content: "\2191"; display: inline-block; margin-right: 8px; font: 700 17px/1 var(--body); vertical-align: -1px; text-shadow: 0 0 10px var(--rc); }
.pf-row.loss .pf-res::before { content: "\2193"; }
.pf-opp { font-weight: 600; word-break: break-all; } .pf-opp small { display: block; font-weight: 400; color: var(--mut); font-size: 11.5px; }
.pf-time { font-size: 12px; color: var(--mut); white-space: nowrap; }
.err { color: #ff8a98; min-height: 1em; }
@media (prefers-reduced-motion: reduce) { .pf-row, .pf-bar i, .prof-btn, #menu .prof-btn { transition-duration: 1ms !important; transition-delay: 0s !important; } }

/* ------- v0.6: viewport-safe layout (iPad address bars, rotation) */
html, body { height: 100dvh; } #frame { height: 100dvh; }
.rot { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 20; display: none; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 999px; background: #151a4aee; border: 1px solid var(--line); color: var(--ink); font-size: 14px; max-width: 92vw; }
.rot.on { display: flex; }
.rot button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #ffffff18; color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; }

/* in-game Menu button: left of the match timer; at least 46 CSS px tall on any screen scale */
.menubtn { position: absolute; left: 480px; top: 10px; height: max(46px, calc(46px / var(--s, 1))); min-width: 108px; padding: 0 18px 0 14px; display: flex; align-items: center; gap: 9px; z-index: 5;
  font: 700 17px var(--body); letter-spacing: .02em; color: var(--ink); background: #0a0d28cc; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; touch-action: manipulation;
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 180ms var(--ease), transform 140ms var(--ease), background-color 150ms ease, border-color 150ms ease, visibility 0s linear 180ms; }
.menubtn.on { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.menubtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.menubtn:active { transform: scale(.96); background: #1b2275; }
.menubtn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .menubtn:hover { background: #151a4a; border-color: #6c7cff; } }

/* ------- v0.6: one-ability selection, confirm bar always on screen */
#sel .panel { display: flex; flex-direction: column; max-height: 696px; padding: 16px 26px 16px; }
#sel h2 { margin-bottom: 2px; } #sel #hint { margin: 2px 0 0; }
#sel #cards { flex: 1 1 auto; min-height: 0; overflow: auto; margin: 10px 0 8px; align-items: stretch; }
#sel .cd { cursor: default; padding: 12px 12px 8px; }
#sel .cd:active { transform: none; }
#sel .cd.on { transform: translateY(-4px); }
#sel .cd.dim { filter: saturate(.7) brightness(.8); }
@media (hover: hover) and (pointer: fine) { #sel .cd:not(.on):hover { transform: none; filter: saturate(.9) brightness(.95); } #sel .cd.dim:hover { filter: saturate(.85) brightness(.9); } }
#sel .cd .ds { min-height: 0; margin: 2px 0 6px; }
#sel .ab { padding: 5px 9px; margin: 3px 0; touch-action: manipulation; }
#sel .ab small { font-size: 11px; line-height: 1.25; }
#sel .ab .cdl { opacity: .7; }
/* already equipped: cannot be picked again, so make it read as "taken" at a glance (v0.7.2) */
#sel .ab.cur { position: relative; cursor: not-allowed; opacity: 1; color: #ffffff8c; border: 1px dashed #ffffffa6;
  background: repeating-linear-gradient(135deg, #000000b8 0 7px, #00000080 7px 14px); filter: grayscale(.85); }
#sel .ab.cur .k, #sel .ab.cur small, #sel .ab.cur .cdl { opacity: .45; }
#sel .ab .eq { float: right; font-style: normal; font-weight: 700; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; margin-top: 1px;
  padding: 1px 7px; border-radius: 999px; background: #fff; color: #0b0e2e; filter: none; }
@media (hover: hover) and (pointer: fine) { #sel .ab.cur:hover { background: repeating-linear-gradient(135deg, #000000b8 0 7px, #00000080 7px 14px); border-color: #ffffffa6; } }
#sel.locked .ab:not(.on) { opacity: .45; }
.selbar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding-top: 10px; border-top: 1px solid var(--line); text-align: left; }
.selinfo { min-width: 0; } .selinfo p { margin: 0; }
.swap { font-size: 17px; } .swap .sk { display: inline-block; min-width: 40px; padding: 1px 7px; border-radius: 6px; background: #ffffff1c; font-weight: 700; text-align: center; }
.swap .old { opacity: .6; text-decoration: line-through; } .swap .ar { opacity: .7; margin: 0 2px; }
#go { flex: none; min-width: 200px; min-height: 48px; font-size: 17px; margin: 0; }
/* confirm button aura in the selected rune's theme color (v0.7.2) */
#go.aura { --gc: #7f8cff; border: 2px solid var(--gc); box-shadow: 0 0 0 2px #0b0e2e, 0 0 14px 3px var(--gc), 0 0 34px 6px color-mix(in srgb, var(--gc) 55%, transparent); animation: go-aura 1.6s ease-in-out infinite; }
#go.aura:disabled { opacity: .85; animation: none; box-shadow: 0 0 0 2px #0b0e2e, 0 0 10px 2px color-mix(in srgb, var(--gc) 70%, transparent); }
@keyframes go-aura {
  0%, 100% { box-shadow: 0 0 0 2px #0b0e2e, 0 0 12px 2px var(--gc), 0 0 26px 4px color-mix(in srgb, var(--gc) 45%, transparent); }
  50% { box-shadow: 0 0 0 2px #0b0e2e, 0 0 20px 5px var(--gc), 0 0 46px 12px color-mix(in srgb, var(--gc) 65%, transparent); }
}
@media (prefers-reduced-motion: reduce) { #go.aura { animation: none; } }
#kb { gap: 6px 10px; } #kmsg { min-height: 1.4em; margin: 0 0 6px; }
@media (prefers-reduced-motion: reduce) { .menubtn, .rot, .ab { transition-duration: 1ms !important; } }

/* ------- v0.7: leaderboard emblem (centre of the spinning rune sigil on the main menu) */
.lb-btn { position: absolute; left: 930px; top: 270px; width: 76px; height: 76px; margin: -38px 0 0 -38px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; z-index: 2; display: grid; place-items: center; color: #ffe9a8;
  background: radial-gradient(circle at 34% 26%, #3a3f9e 0%, #151a62 62%, #0a0d38 100%); box-shadow: 0 0 0 2px #e8b83a, 0 0 0 4px #0a0d38, 0 0 0 5px #ffd54a66, 0 8px 24px #000b, 0 0 26px #ffd54a44;
  transition: transform 220ms var(--ease), box-shadow 220ms ease, opacity 320ms ease; opacity: 0; }
#menu.on .lb-btn { opacity: 1; animation: lbPulse 3.4s ease-in-out infinite; }
.lb-btn .lb-ico { font: 34px/1 "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; filter: drop-shadow(0 0 8px #ffd54a99); transition: transform 240ms var(--ease), filter 220ms ease; }
.lb-btn .lb-ring { position: absolute; inset: 5px; border-radius: 50%; border: 1px dashed #ffd54a88; pointer-events: none; animation: lbSpin 26s linear infinite; }
.lb-btn:active { transform: scale(.94); animation: none; }
.lb-btn:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }
@media (hover: hover) and (pointer: fine) { #menu.on .lb-btn:hover { transform: scale(1.1); animation: none; box-shadow: 0 0 0 2px #ffd54a, 0 0 0 4px #0a0d38, 0 0 0 6px #ffd54a, 0 8px 28px #000b, 0 0 40px #ffd54aaa; } .lb-btn:hover .lb-ico { transform: translateY(-1px) scale(1.08); filter: drop-shadow(0 0 12px #ffd54a); } }
@keyframes lbPulse { 0%, 100% { box-shadow: 0 0 0 2px #e8b83a, 0 0 0 4px #0a0d38, 0 0 0 5px #ffd54a66, 0 8px 24px #000b, 0 0 22px #ffd54a33; } 50% { box-shadow: 0 0 0 2px #f3c84a, 0 0 0 4px #0a0d38, 0 0 0 5px #ffd54a99, 0 8px 24px #000b, 0 0 38px #ffd54a77; } }
@keyframes lbSpin { to { transform: rotate(360deg); } }

/* ------- v0.7: AI difficulty picker */
.diff-panel { width: 640px; }
.diff-panel h2 { font-size: 34px; } .diff-panel h2 { margin-bottom: 18px; }
.diff-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.diff-opt { position: relative; font: inherit; color: var(--ink); text-align: left; padding: 26px 20px; min-height: 96px; display: grid; place-items: center; border-radius: 16px; border: 2px solid var(--line); background: linear-gradient(170deg, var(--dc2, #232a70), #0d1133); cursor: pointer;
  transition: transform 200ms var(--ease), border-color 180ms ease, box-shadow 200ms ease; }
.diff-opt[data-diff=easy] { --dc: #46c35a; --dc2: #17402a; } .diff-opt[data-diff=hard] { --dc: #ff5a2a; --dc2: #4a1a10; }
.diff-opt b { display: block; font: 700 38px var(--display); letter-spacing: .06em; color: var(--dc); text-shadow: 0 0 22px color-mix(in srgb, var(--dc) 55%, transparent); }
.diff-opt .diff-last { display: none; position: absolute; right: 12px; top: 10px; font-style: normal; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--mut); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.diff-opt.last .diff-last { display: block; }
.diff-opt:focus-visible { outline: none; border-color: #fff; box-shadow: 0 0 0 3px #fff3, 0 0 30px var(--dc); transform: translateY(-3px); }
.diff-opt:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .diff-opt:hover { border-color: var(--dc); box-shadow: 0 0 30px var(--dc); transform: translateY(-3px); } }

/* ------- v0.7: settings tip (stays readable when the window is scaled down) */
.fs-tip { grid-column: 1 / -1; margin: -2px 0 0; text-align: left; color: var(--mut); font-size: max(13px, calc(12px / var(--s, 1))); }
.fs-tip kbd { font: 700 .86em var(--body); color: var(--ink); background: #232a70; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; }

/* ------- v0.7: weekly leaderboard */
.lb-panel { position: relative; width: 640px; padding: 22px 30px 18px; }
.lb-panel h2 { font-size: 36px; letter-spacing: .04em; background: linear-gradient(180deg, #fff3b0, #e8b83a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lb-reset { position: absolute; right: 56px; top: 14px; text-align: right; line-height: 1.2; padding: 5px 12px 6px; border-radius: 10px; background: #0a0d2899; border: 1px solid var(--line); }
.lb-reset b { font: 700 20px var(--display); letter-spacing: .06em; font-variant-numeric: tabular-nums; color: #ffe9a8; text-shadow: 0 0 14px #ffd54a55; }
.lb-head, .lb-row { display: grid; grid-template-columns: 52px 1fr 70px 92px; align-items: center; gap: 8px; text-align: left; }
.lb-head { padding: 0 14px; font: 700 11.5px var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--mut); margin-bottom: 4px; }
.lb-head span:nth-child(n+3), .lb-row .lb-w, .lb-row .lb-r { text-align: right; }
.lb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.lb-row { --mc: #3a4190; position: relative; padding: 0 14px; min-height: 38px; border-radius: 10px; background: #0a0d2899; border: 1px solid #2e347a88; font-variant-numeric: tabular-nums;
  opacity: 0; transform: translateY(6px); transition: opacity 260ms ease, transform 260ms var(--ease); transition-delay: calc(var(--i, 0) * 30ms + 80ms); }
#lb.on .lb-row { opacity: 1; transform: none; }
.lb-name { font: 700 17px var(--display); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-w { font: 700 18px var(--display); } .lb-r { font: 700 16px var(--display); color: #cfd6ff; }
.lb-me { font-family: var(--display); }
.lb-row.me { border-color: #8f9bff; box-shadow: inset 0 0 0 1px #8f9bff55; }
.lb-row.me .lb-name::after { content: "you"; margin-left: 8px; font: 700 10px var(--body); letter-spacing: .12em; text-transform: uppercase; color: #9aa5ff; border: 1px solid #9aa5ff88; border-radius: 999px; padding: 1px 6px; vertical-align: 2px; }
/* podium: gold, silver, bronze */
.lb-row.p1, .lb-row.p2, .lb-row.p3 { min-height: 46px; border-color: var(--mc); background: linear-gradient(90deg, color-mix(in srgb, var(--mc) 30%, #0a0d28), #0a0d2899 70%); }
.lb-row.p1 { --mc: #ffd54a; min-height: 54px; box-shadow: 0 0 26px #ffd54a40; } .lb-row.p2 { --mc: #cfd6e6; } .lb-row.p3 { --mc: #d98a4a; }
.lb-row.p1 .lb-name { font-size: 20px; } .lb-row.p2 .lb-name, .lb-row.p3 .lb-name { font-size: 17.5px; }
/* place orbs: the same dark rune orb as the menu sigil, ringed in a rune colour, with a slowly turning dashed inner ring */
.lb-pos { --rc: var(--water); position: relative; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font: 700 16px/1 var(--display); color: color-mix(in srgb, var(--rc) 35%, #fff);
  background: radial-gradient(circle at 34% 26%, color-mix(in srgb, var(--rc) 38%, #1b2060) 0%, #11164f 62%, #0a0d38 100%); border: 2px solid var(--rc); box-shadow: 0 0 12px color-mix(in srgb, var(--rc) 55%, transparent), inset 0 0 8px #0a0d38; text-shadow: 0 0 8px var(--rc); }
.lb-pos::before { content: ""; position: absolute; inset: 2px; border-radius: 50%; border: 1px dashed color-mix(in srgb, var(--rc) 65%, transparent); animation: lbSpin 18s linear infinite; }
.lb-row:nth-child(1) .lb-pos { --rc: var(--lightning); } .lb-row:nth-child(2) .lb-pos { --rc: #dfe6ff; } .lb-row:nth-child(3) .lb-pos { --rc: var(--earth); }
.lb-row:nth-child(4) .lb-pos { --rc: var(--water); } .lb-row:nth-child(5) .lb-pos { --rc: var(--fire); } .lb-row:nth-child(6) .lb-pos { --rc: var(--nature); } .lb-row:nth-child(7) .lb-pos { --rc: var(--wind); } .lb-row:nth-child(8) .lb-pos { --rc: var(--evil); } .lb-row:nth-child(9) .lb-pos { --rc: var(--fire); } .lb-row:nth-child(10) .lb-pos { --rc: var(--nature); }
.lb-row.p1 .lb-pos, .lb-row.p2 .lb-pos, .lb-row.p3 .lb-pos { width: 38px; height: 38px; font-size: 19px; }
.lb-row.p1 .lb-w, .lb-row.p2 .lb-w, .lb-row.p3 .lb-w { color: var(--mc); }
.lb-empty { margin: 26px 0 14px; } .lb-me { margin: 12px 0 0; color: #cfd6ff; }
#lb-guest .btn { margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { .lb-btn, #menu.on .lb-btn, .lb-btn .lb-ring, .lb-pos::before, .lb-row, .diff-opt { animation: none !important; transition-duration: 1ms !important; transition-delay: 0s !important; } }
#lb-main h2 { text-align: left; margin-bottom: 12px; }
.lb-reset { padding: 6px 14px 7px; }
