/* MYRIAD — interface styling. System fonts only; works offline. */
:root {
  --ink: #e8f6ff;
  --ink-dim: #93adc2;
  --ink-faint: #5d7488;
  --glass: rgba(6, 18, 32, 0.62);
  --glass-hi: rgba(18, 44, 70, 0.55);
  --line: rgba(120, 220, 255, 0.18);
  --line-hi: rgba(140, 235, 255, 0.55);
  --glow: #35f0ff;
  --lumen: #35f0ff;
  --vorax: #ff2a44;
  --aurel: #ffc53a;
  --nyx: #9f5bff;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #01060c; color: var(--ink); font-family: var(--font); }
body { user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#gl { position: fixed; inset: 0; display: block; cursor: crosshair; }
body.menu-open canvas#gl { cursor: default; }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ------------------------------------------------------------ screens */
#screens { position: fixed; inset: 0; pointer-events: none; }
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: auto; padding: 16px; animation: fadeIn .5s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.title-wrap { display: flex; flex-direction: column; align-items: center; text-align: center; }
#emblem { width: min(170px, 28vh); height: min(170px, 28vh); overflow: visible; animation: spin 90s linear infinite; filter: drop-shadow(0 0 14px rgba(53, 240, 255, .45)); }
#emblem circle { animation: twinkle 3.2s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes twinkle { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.logo {
  font-weight: 200; font-size: clamp(46px, 10vw, 118px); letter-spacing: .42em; margin-right: -.42em;
  line-height: 1; margin-top: 6px;
  background: linear-gradient(100deg, #9ff8ff 0%, #35f0ff 30%, #ffffff 50%, #9f5bff 72%, #ff2a44 100%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 9s ease-in-out infinite;
  filter: drop-shadow(0 0 22px rgba(53, 240, 255, .35));
}
@keyframes sheen { 0%, 100% { background-position: 0% 0; } 50% { background-position: 100% 0; } }
.tagline { margin: 10px 0 30px; color: var(--ink-dim); letter-spacing: .35em; text-transform: lowercase; font-size: clamp(12px, 1.6vw, 15px); font-weight: 300; }
.menu { display: flex; flex-direction: column; gap: 10px; width: min(420px, 92vw); }
.menu-row { display: flex; gap: 10px; }
.menu-row .mbtn { flex: 1; }
.mbtn {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left;
  padding: 14px 20px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color .25s, background .25s, transform .25s, box-shadow .25s; overflow: hidden;
  animation: rise .6s ease both;
}
.menu .mbtn:nth-child(2) { animation-delay: .06s; } .menu .mbtn:nth-child(3) { animation-delay: .12s; } .menu .menu-row { animation: rise .6s .18s ease both; }
.mbtn b { font-weight: 500; font-size: 18px; letter-spacing: .12em; text-transform: uppercase; }
.mbtn small { color: var(--ink-dim); font-size: 13px; font-weight: 300; }
.mbtn.small { padding: 11px 18px; align-items: center; text-align: center; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; }
.mbtn::before { content: ""; position: absolute; inset: 0; background: radial-gradient(420px 90px at var(--mx, 50%) 50%, rgba(53, 240, 255, .16), transparent 70%); opacity: 0; transition: opacity .3s; }
.mbtn:hover, .mbtn:focus-visible { border-color: var(--line-hi); background: var(--glass-hi); transform: translateY(-1px); box-shadow: 0 0 28px rgba(53, 240, 255, .12); outline: none; }
.mbtn:hover::before { opacity: 1; }
.mbtn.primary { border-color: rgba(53, 240, 255, .45); box-shadow: 0 0 24px rgba(53, 240, 255, .12) inset; }
.mbtn.primary b { color: #bffaff; }
#records { margin-top: 18px; color: var(--ink-faint); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; min-height: 1em; }
.credit { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: var(--ink-faint); font-size: 11px; letter-spacing: .12em; pointer-events: none; }
.wake { position: absolute; top: 18px; left: 0; right: 0; text-align: center; color: var(--ink-dim); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; animation: twinkle 2.6s ease-in-out infinite; pointer-events: none; }

.panel {
  width: min(560px, 94vw); max-height: 94vh; overflow: auto; padding: 26px 28px; border-radius: 20px;
  background: rgba(4, 14, 26, .78); border: 1px solid var(--line);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5), 0 0 60px rgba(53, 240, 255, .05) inset;
  animation: rise .45s ease both;
}
.panel.wide { width: min(860px, 96vw); }
.panel.narrow { width: min(340px, 92vw); }
.panel h2 { font-weight: 200; font-size: 30px; letter-spacing: .3em; text-transform: uppercase; margin-bottom: 18px; }
.field { margin-bottom: 18px; }
.field.row { display: flex; gap: 28px; flex-wrap: wrap; }
.field label { display: block; color: var(--ink-dim); font-size: 11px; letter-spacing: .24em; text-transform: uppercase; margin-bottom: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, .25); flex-wrap: wrap; }
.seg button { padding: 9px 16px; font-size: 14px; color: var(--ink-dim); transition: background .2s, color .2s; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--ink); background: rgba(53, 240, 255, .07); }
.seg button.on { color: #02121c; background: linear-gradient(180deg, #8ff6ff, #35d6ff); font-weight: 600; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.panel > .actions { position: sticky; bottom: -26px; margin: 18px -28px -26px; padding: 14px 28px 20px; background: linear-gradient(180deg, rgba(4, 14, 26, 0), rgba(4, 14, 26, .96) 38%); z-index: 2; }
input[type=range] { width: 100%; accent-color: #35f0ff; }
.seed { display: flex; gap: 8px; align-items: center; }
.seed input { width: 120px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); color: var(--ink); font-family: var(--mono); font-size: 14px; }

.biomes { display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 10px; }
.biome { position: relative; padding: 12px; border-radius: 12px; border: 1px solid var(--line); text-align: left; min-height: 92px; overflow: hidden; transition: border-color .2s, transform .2s; }
.biome::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 20%, rgba(0, 0, 0, .55)); pointer-events: none; }
.biome b { position: relative; z-index: 1; display: block; font-size: 13px; font-weight: 600; letter-spacing: .08em; }
.biome small { position: relative; z-index: 1; display: block; margin-top: 4px; color: rgba(232, 246, 255, .75); font-size: 11px; line-height: 1.35; }
.biome i { position: absolute; right: 10px; bottom: 8px; z-index: 1; font-style: normal; font-size: 10px; letter-spacing: .15em; color: rgba(232, 246, 255, .6); }
.biome:hover { transform: translateY(-2px); border-color: var(--line-hi); }
.biome.on { border-color: #8ff6ff; box-shadow: 0 0 0 1px #8ff6ff inset, 0 0 22px rgba(53, 240, 255, .25); }

.rival-list { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.rival { display: flex; align-items: center; gap: 9px; padding: 7px 12px 7px 8px; border-radius: 999px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); font-size: 12px; }
.rival .orb { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, var(--c) 45%, transparent 72%); box-shadow: 0 0 12px var(--c); }
.rival b { font-weight: 600; letter-spacing: .14em; color: var(--c); }
.rival small { color: var(--ink-dim); }
.rival-list.big { justify-content: center; margin: 20px 0 26px; }
.rival-list.big .rival { font-size: 14px; padding: 9px 16px 9px 10px; }

.howto .how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.how h3 { font-weight: 500; letter-spacing: .2em; text-transform: uppercase; font-size: 14px; margin: 10px 0 6px; }
.how p { color: var(--ink-dim); font-size: 13.5px; line-height: 1.55; }
.how em { color: var(--ink); font-style: normal; }
.how-ico { height: 64px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); position: relative; overflow: hidden; }
.how-ico::before, .how-ico::after { content: ""; position: absolute; border-radius: 50%; }
.how-ico.mouse::before { width: 14px; height: 14px; left: 62%; top: 38%; border: 2px solid var(--lumen); box-shadow: 0 0 12px var(--lumen); }
.how-ico.mouse::after { width: 44px; height: 24px; left: 16%; top: 30%; background: radial-gradient(circle, var(--lumen) 0 1.5px, transparent 2px) 0 0 / 6px 6px; filter: drop-shadow(0 0 4px var(--lumen)); animation: flow 2.4s ease-in-out infinite alternate; }
@keyframes flow { to { transform: translateX(26px); } }
.how-ico.convert::before { width: 60px; height: 40px; left: 12%; top: 12px; background: radial-gradient(circle, var(--lumen) 0 1.5px, transparent 2px) 0 0 / 6px 6px; }
.how-ico.convert::after { width: 50px; height: 40px; left: 48%; top: 12px; background: radial-gradient(circle, var(--vorax) 0 1.5px, transparent 2px) 0 0 / 6px 6px; animation: shrink 2s ease-in-out infinite; }
@keyframes shrink { 50% { transform: translateX(14px) scale(.6); opacity: .6; } }
.how-ico.vent::before { width: 40px; height: 40px; left: calc(50% - 20px); top: 12px; border: 2px dashed var(--aurel); animation: spin 8s linear infinite; }
.how-ico.vent::after { width: 12px; height: 12px; left: calc(50% - 6px); top: 26px; background: #fff; box-shadow: 0 0 16px var(--aurel), 0 0 30px var(--aurel); }
.how-ico.win::before { width: 38px; height: 38px; left: calc(50% - 19px); top: 13px; background: conic-gradient(var(--lumen) 0 80%, var(--vorax) 80% 90%, var(--nyx) 90%); box-shadow: 0 0 18px rgba(53, 240, 255, .5); }
.keys { margin-top: 22px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 20px; color: var(--ink-dim); font-size: 13px; }
kbd { display: inline-block; min-width: 26px; padding: 2px 8px; margin-right: 6px; border-radius: 6px; border: 1px solid var(--line-hi); background: rgba(53, 240, 255, .08); color: var(--ink); font-family: var(--mono); font-size: 12px; text-align: center; }

.depth-card { text-align: center; max-width: 640px; animation: rise .8s ease both; }
.depth-meter { width: 3px; height: 90px; margin: 0 auto 18px; background: rgba(255, 255, 255, .1); position: relative; border-radius: 2px; overflow: hidden; }
.depth-meter i { position: absolute; left: 0; right: 0; top: 0; background: linear-gradient(#35f0ff, #b86bff); box-shadow: 0 0 10px #35f0ff; transition: height 1.4s cubic-bezier(.2, .8, .2, 1); }
.depth-num { color: var(--ink-dim); letter-spacing: .4em; font-size: 13px; }
.depth-card h2 { font-weight: 200; font-size: clamp(34px, 6vw, 64px); letter-spacing: .22em; margin: 8px 0 12px; text-transform: uppercase; }
.depth-card .mbtn { display: inline-flex; margin: 0 auto; }
.depth-blurb { color: var(--ink-dim); font-size: 16px; font-weight: 300; font-style: italic; }

.results { text-align: center; }
.res-kicker { color: var(--ink-dim); letter-spacing: .4em; font-size: 12px; }
.results h2 { font-size: clamp(34px, 6vw, 56px); margin: 6px 0 4px; }
.results h2.win { color: #bffaff; text-shadow: 0 0 30px rgba(53, 240, 255, .6); }
.results h2.lose { color: #ffb3c4; text-shadow: 0 0 30px rgba(255, 46, 99, .45); }
#res-sub { color: var(--ink-dim); font-weight: 300; margin-bottom: 16px; }
.chart-wrap { position: relative; height: 170px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: rgba(0, 0, 0, .35); }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-label { position: absolute; left: 12px; top: 8px; font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: rgba(255, 255, 255, .55); }
#res-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 13px; }
#res-table th { color: var(--ink-faint); font-weight: 500; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; padding: 6px 8px; text-align: right; }
#res-table th:first-child, #res-table td:first-child { text-align: left; }
#res-table td { padding: 8px; text-align: right; border-top: 1px solid rgba(120, 220, 255, .08); font-family: var(--mono); font-size: 12.5px; color: var(--ink-dim); }
#res-table td.name { font-family: var(--font); font-weight: 600; letter-spacing: .14em; }
#res-table tr.dead td.name::after { content: " ✕"; color: var(--ink-faint); font-weight: 400; }
#res-table tr.winner td.name::after { content: " ♛"; }

/* ------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud-top { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
#hud-left { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px; border-radius: 12px; background: rgba(2, 10, 18, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); min-width: 150px; }
#hud-mode { font-size: 11px; letter-spacing: .3em; color: var(--ink-dim); }
#hud-biome { font-size: 14px; letter-spacing: .12em; font-weight: 300; }
#hud-right { display: flex; gap: 8px; pointer-events: auto; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; background: rgba(2, 10, 18, .5); border: 1px solid var(--line); color: var(--ink); font-size: 16px; display: grid; place-items: center; backdrop-filter: blur(6px); transition: border-color .2s; }
.icon-btn:hover { border-color: var(--line-hi); }
#btn-pause::before { content: ""; width: 10px; height: 12px; border-left: 3px solid currentColor; border-right: 3px solid currentColor; }
#btn-mute::before { content: "♪"; }
#btn-mute.muted::before { content: "♪"; opacity: .3; }
#popbar-wrap { flex: 0 1 560px; display: flex; flex-direction: column; align-items: stretch; gap: 5px; padding: 8px 14px 7px; border-radius: 14px; background: rgba(2, 10, 18, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#pop-names { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; letter-spacing: .16em; }
#pop-names span { display: flex; gap: 6px; align-items: baseline; color: var(--c); font-weight: 600; transition: opacity .4s; white-space: nowrap; }
#pop-names span em { font-style: normal; font-family: var(--mono); font-weight: 400; color: var(--ink); letter-spacing: 0; }
#pop-names span.dead { opacity: .3; text-decoration: line-through; }
#popbar { height: 8px; border-radius: 6px; overflow: hidden; display: flex; background: rgba(255, 255, 255, .06); }
#popbar i { display: block; height: 100%; background: var(--c); box-shadow: 0 0 10px var(--c); transition: flex-grow .35s ease; flex-basis: 0; }
#popbar i + i { border-left: 1px solid rgba(0, 0, 0, .6); }
#hud-status { display: flex; justify-content: center; gap: 14px; font-size: 12px; font-family: var(--mono); color: var(--ink-dim); }
#hud-dom { color: #fff; font-family: var(--font); letter-spacing: .2em; font-size: 11px; }
#hud-dom:empty { display: none; }
#hud-time.low { color: #ff8aa5; }

#feed { position: absolute; left: 14px; bottom: 16px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; max-width: min(360px, 44vw); }
#feed div { padding: 6px 12px; border-radius: 10px; background: rgba(2, 10, 18, .55); backdrop-filter: blur(4px); border-left: 3px solid var(--c, #fff); animation: rise .35s ease both; transition: opacity .8s; }
#feed div b { color: var(--c); letter-spacing: .1em; font-weight: 600; }

#announce { position: absolute; left: 0; right: 0; top: 34%; text-align: center; pointer-events: none; }
#announce div { display: inline-block; font-weight: 200; font-size: clamp(30px, 6vw, 72px); letter-spacing: .3em; margin-right: -.3em; text-transform: uppercase; color: #fff; text-shadow: 0 0 30px var(--c, #35f0ff), 0 0 70px var(--c, #35f0ff); animation: announce 2.4s ease both; }
#announce div small { display: block; font-size: 14px; letter-spacing: .4em; font-weight: 400; margin-top: 10px; color: var(--ink-dim); text-shadow: none; }
@keyframes announce { 0% { opacity: 0; transform: scale(1.25); filter: blur(8px); } 15% { opacity: 1; transform: none; filter: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(.96); } }

#hint { position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; bottom: 112px; max-width: min(560px, 90vw); padding: 12px 20px; border-radius: 14px; background: rgba(2, 14, 24, .75); border: 1px solid rgba(53, 240, 255, .35); backdrop-filter: blur(8px); font-size: 14.5px; text-align: center; line-height: 1.5; box-shadow: 0 0 30px rgba(53, 240, 255, .15); animation: rise .4s ease both; }
#hint b { color: #bffaff; font-weight: 600; }
#hint kbd { font-size: 11px; }

#abilities { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 12px; pointer-events: auto; }
.ability { position: relative; width: 78px; height: 82px; padding-top: 12px; border-radius: 18px; background: rgba(2, 12, 22, .62); border: 1px solid var(--line); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; transition: border-color .2s, box-shadow .2s, transform .15s; }
.ability svg { width: 30px; height: 30px; fill: none; stroke: var(--lumen); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 5px var(--lumen)); }
.ability .ab-key { position: absolute; top: 6px; left: 0; right: 0; font-size: 8.5px; letter-spacing: .14em; color: var(--ink-faint); font-family: var(--mono); }
.ability .ab-name { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; margin-top: 3px; color: var(--ink-dim); }
.ability .cd { position: absolute; inset: 0; background: conic-gradient(rgba(1, 6, 12, .78) calc(var(--p, 0) * 1turn), transparent 0); pointer-events: none; }
.ability.ready { border-color: rgba(53, 240, 255, .5); box-shadow: 0 0 18px rgba(53, 240, 255, .18); }
.ability.active { border-color: #fff; box-shadow: 0 0 26px rgba(53, 240, 255, .6); }
.ability.flash { transform: scale(1.08); }
.ability:active { transform: scale(.96); }

/* bot names + speech */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.blabel { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: 3px; transition: opacity .4s; white-space: nowrap; }
.blabel .nm { font-size: 10px; letter-spacing: .28em; font-weight: 700; color: var(--c); text-shadow: 0 0 8px var(--c), 0 1px 2px #000; }
.blabel .say { font-size: 13px; font-style: italic; padding: 4px 10px; border-radius: 10px; background: rgba(2, 10, 18, .75); border: 1px solid var(--c); color: #fff; opacity: 0; transform: translateY(4px) scale(.9); transition: opacity .25s, transform .25s; }
.blabel.talking .say { opacity: 1; transform: none; }

#danger { position: fixed; inset: 0; pointer-events: none; box-shadow: inset 0 0 160px rgba(255, 30, 80, .55); opacity: 0; transition: opacity .6s; }
#err { position: fixed; left: 10px; bottom: 10px; max-width: 70vw; color: #ffb3c4; font: 12px var(--mono); white-space: pre-wrap; pointer-events: none; }
#err:empty { display: none; }
#err { background: rgba(40, 0, 10, .8); padding: 8px 10px; border-radius: 8px; }

.fatal { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--ink-dim); }
.fatal h2 { font-weight: 200; letter-spacing: .3em; color: var(--ink); margin-bottom: 10px; }

@media (max-height: 780px) {
  .panel { padding: 18px 24px 26px; }
  .panel h2 { font-size: 24px; margin-bottom: 10px; }
  .field { margin-bottom: 12px; }
  .field label { margin-bottom: 6px; }
  .biome { min-height: 64px; padding: 10px; }
  .biome small { display: none; }
  .rival-list { margin-top: 8px; }
  .seg button { padding: 7px 14px; }
  .how p { font-size: 12.5px; }
  .how-ico { height: 48px; }
}
@media (max-width: 720px) {
  #hud-left { display: none; }
  .ability { width: 64px; height: 64px; }
  #popbar-wrap { flex-basis: 100%; }
  #pop-names { font-size: 9px; }
  #feed { bottom: 96px; font-size: 11px; }
  #hint { bottom: 96px; font-size: 13px; }
}
