/* =========================================================================
   LAMERK MAYHEM: style.css
   Menus & overlays. Sizes are rem-based and rem scales with the viewport,
   so 1080p / 1440p / 4K all render at identical proportions.
   ========================================================================= */
:root {
  --bg: #070506;
  --bg2: #130a0d;
  --brand: #c8193c;
  --panel: rgba(24, 12, 16, 0.88);
  --panel-2: rgba(40, 18, 25, 0.92);
  --line: rgba(255, 255, 255, 0.11);
  --text: #f8eef0;
  --muted: #b9a2a9;
  --accent: #ff3b5f;
  --accent-2: #ff5e7e;
  --accent-3: #3fe0ff;
  --good: #5fe06a;
  --bad: #ff4d5e;
  --radius: 1rem;
  --shadow: 0 0.6rem 1.8rem rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(.2, .9, .25, 1.15);
  --font-display: "Lilita One", "Arial Black", Impact, sans-serif;
  --font-body: Nunito, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: min(calc(100vh / 67.5), calc(100vw / 120)); }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font-body); font-weight: 700; user-select: none; -webkit-user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; background: var(--bg); }
canvas#game.playing { cursor: none; }
button { font-family: inherit; }

#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
#ui > .menu-bg, #ui > .prompt-bar, #ui > .toast { pointer-events: none; }

/* ---------- animated background over the attract-mode canvas ---------- */
.menu-bg { position: fixed; inset: 0; background: radial-gradient(ellipse at 20% 10%, rgba(200, 25, 60, 0.35), transparent 60%), radial-gradient(ellipse at 90% 90%, rgba(200, 25, 60, 0.22), transparent 55%), linear-gradient(180deg, rgba(7, 5, 6, 0.9), rgba(7, 5, 6, 0.97)); transition: opacity .5s; overflow: hidden; }
.menu-bg.hidden { opacity: 0; }
.bg-grid { position: absolute; inset: -50%; background-image: linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px); background-size: 4rem 4rem; transform: rotate(-8deg); animation: gridmove 30s linear infinite; }
@keyframes gridmove { to { background-position: 4rem 8rem; } }
.bg-blob { position: absolute; width: 44rem; height: 44rem; border-radius: 50%; opacity: .16; animation: blob 18s ease-in-out infinite alternate; }
.bg-blob.b1 { background: radial-gradient(circle, #c8193c, transparent 65%); left: -15rem; top: 45%; }
.bg-blob.b2 { background: radial-gradient(circle, #ff3b5f, transparent 65%); right: -13rem; top: -15rem; animation-delay: -6s; }
.bg-blob.b3 { background: radial-gradient(circle, #7a0f25, transparent 65%); left: 40%; bottom: -21rem; animation-delay: -11s; }
.lowfx .bg-blob, .lowfx .bg-grid, .lowfx .end-rays { animation: none; }
.lowfx .overlay { backdrop-filter: none; }
.lowfx .screen.active, .lowfx .overlay.active { animation-duration: .15s; }
@keyframes blob { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(6rem,-4rem) scale(1.25); } }

/* ---------- screens ---------- */
.screen, .overlay { position: fixed; inset: 0; display: none; opacity: 0; }
.screen.active, .overlay.active { display: flex; animation: scrIn .38s var(--ease) forwards; }
.screen.leaving { display: flex; animation: scrOut .22s ease forwards; pointer-events: none; }
@keyframes scrIn { from { opacity: 0; transform: translateY(1.2rem) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes scrOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-.8rem); } }
.screen { flex-direction: column; padding: 2.2rem 3rem 4.5rem; }

.scr-head { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.4rem; }
.scr-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 2.8rem; margin: 0; letter-spacing: .04em; text-shadow: 0 .2rem 0 rgba(0,0,0,.3); display: flex; align-items: baseline; gap: 1rem; }
.scr-head h2 small { font-family: var(--font-body); font-size: 1.1rem; color: var(--muted); letter-spacing: 0; text-shadow: none; }
.head-hint { margin-left: auto; color: var(--muted); font-size: 1rem; }
.cheat-head h2 { color: #ff6b7d; }

/* ---------- buttons ---------- */
.btn, .back-btn, .mini-btn { cursor: pointer; border: 1px solid var(--line); color: var(--text); background: var(--panel-2); border-radius: .8rem; padding: .9rem 1.6rem; font-family: var(--font-display); font-size: 1.35rem; letter-spacing: .05em; box-shadow: 0 .25rem 0 rgba(0,0,0,.3); transition: transform .15s var(--ease), background .15s, box-shadow .15s, color .15s; outline: none; position: relative; }
.back-btn { font-size: 1.1rem; padding: .6rem 1.1rem; background: rgba(255,255,255,.08); }
.mini-btn { font-size: .85rem; padding: .35rem .8rem; margin-left: .8rem; vertical-align: middle; }
.btn.primary { background: linear-gradient(180deg, #e8264d, #a8112f); color: #fff; border-color: transparent; }
.btn.big { font-size: 2rem; padding: 1.1rem 2rem; width: 100%; }
.nav.focused, .btn:hover, .back-btn:hover, .mini-btn:hover { transform: translateY(-.12rem); box-shadow: 0 .35rem 0 rgba(0,0,0,.3), 0 0 0 .2rem #fff, 0 0 1.2rem rgba(255,59,95,.55); }
.btn:active, .nav.pressed { transform: translateY(.1rem) scale(.98); box-shadow: 0 .1rem 0 rgba(0,0,0,.35); }
.btn:disabled, .btn.disabled { opacity: .4; filter: grayscale(1); cursor: not-allowed; }

/* ---------- LaMerk brand ---------- */
.brand { display: inline-flex; flex-direction: column; align-items: center; }
.brand-logo { width: 26rem; height: auto; mix-blend-mode: screen; }
.brand-logo.keyed { mix-blend-mode: normal; filter: drop-shadow(0 0 1.8rem rgba(200,25,60,.45)); }
.brand-sub { margin-top: -1.6rem; font-family: var(--font-display); font-size: 3.4rem; letter-spacing: .5em; padding-left: .5em; color: #fff; text-shadow: 0 .3rem 0 #5a0718, 0 0 1.6rem rgba(255,59,95,.5); }
.brand.big .brand-logo { width: 38rem; }
.brand.big .brand-sub { font-size: 4.6rem; margin-top: -2.2rem; }
.site-link { color: var(--accent); text-decoration: none; font-weight: 800; }
.site-link:hover { text-decoration: underline; }

/* ---------- title ---------- */
#scr-title { flex-direction: row; align-items: stretch; padding: 3rem 4rem; }
.title-wrap { display: flex; flex-direction: column; justify-content: center; width: 46rem; }
.logo { margin-bottom: .6rem; }
.tagline { color: var(--muted); font-size: 1.25rem; margin: 1.2rem 0 0 .3rem; }
.main-menu { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; max-width: 44rem; }
.menu-btn { display: flex; align-items: center; gap: 1rem; text-align: left; padding: .85rem 1.2rem; font-size: 1.45rem; }
.menu-btn svg { width: 2rem; height: 2rem; flex-shrink: 0; }
.menu-btn small { display: block; font-family: var(--font-body); font-size: .85rem; color: var(--muted); letter-spacing: 0; margin-top: .1rem; font-weight: 700; }
.menu-btn.hero { grid-column: span 2; font-size: 2.2rem; padding: 1.1rem 1.4rem; background: linear-gradient(180deg, #e8264d, #a8112f); color: #fff; border-color: transparent; }
.menu-btn.hero small { color: rgba(255,255,255,.8); font-size: 1rem; }
.menu-btn.cheat { color: #ff9aa6; }
.title-side { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
#title-hero { width: 30rem; height: 35.8rem; filter: drop-shadow(0 1.5rem 2rem rgba(0,0,0,.5)); }
.hero-caption { font-family: var(--font-display); font-size: 2rem; text-align: center; margin-top: -1rem; text-shadow: 0 .25rem 0 rgba(0,0,0,.5); }
.hero-caption small { display: block; font-family: var(--font-body); font-size: 1.05rem; color: var(--muted); text-shadow: none; }
.stats-chip { position: absolute; right: 2rem; top: 1.6rem; background: var(--panel); border: 2px solid var(--line); padding: .5rem 1rem; border-radius: 2rem; color: var(--muted); font-size: .95rem; }
.stats-chip b { color: var(--accent); }

/* ---------- lobby ---------- */
.lobby-grid { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; min-height: 0; }
.slot { position: relative; border-radius: 1.4rem; background: var(--panel); border: .2rem solid var(--line); display: flex; flex-direction: column; overflow: hidden; transition: transform .25s var(--ease), border-color .2s; box-shadow: var(--shadow); }
.slot.joined { border-color: var(--pc); }
.slot.ready { transform: translateY(-.4rem); }
.slot.empty { justify-content: center; align-items: center; border-style: dashed; }
.lobby-grid.many { grid-template-rows: 1fr 1fr; gap: .8rem; }
.lobby-grid.many .slot-tag, .lobby-grid.many .slot-dev { display: none; }
.lobby-grid.many .slot-prof { font-size: 1.2rem; }
.lobby-grid.many .slot-num { font-size: 1.5rem; }
.lobby-grid.many .slot-rows { gap: .2rem; }
.lobby-grid.many .slot-row { padding: .15rem .4rem; }
.lobby-grid.many .ready-bar { padding: .4rem; font-size: 1rem; margin: 0 .6rem .6rem; }
.lobby-grid.many .join-msg { font-size: 1.1rem; }
.slot .join-msg { text-align: center; color: var(--muted); font-family: var(--font-display); font-size: 1.6rem; animation: pulse 1.6s ease-in-out infinite; line-height: 1.5; }
.slot .join-msg .keycap, .slot .join-msg .padbtn { vertical-align: middle; }
@keyframes pulse { 50% { opacity: .45; } }
.slot-head { display: flex; flex-direction: column; align-items: flex-start; padding: .7rem 1rem .1rem; }
.slot-num { font-family: var(--font-display); font-size: 2.2rem; color: var(--pc); text-shadow: 0 .2rem 0 rgba(0,0,0,.4); }
.slot-dev { color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: .4rem; }
.slot-preview { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--pc) 35%, transparent), transparent 65%); }
.slot-preview canvas { width: 100%; height: 100%; object-fit: contain; }
.slot-info { padding: .2rem 1rem .6rem; text-align: center; }
.slot-prof { font-family: var(--font-display); font-size: 1.7rem; line-height: 1.1; }
.slot-tag { color: var(--muted); font-size: .95rem; min-height: 1.3rem; }
.slot-rows { padding: 0 .8rem .6rem; display: flex; flex-direction: column; gap: .4rem; }
.slot-row { display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.05); border-radius: .6rem; padding: .35rem .5rem; border: .15rem solid transparent; transition: border-color .15s, background .15s; }
.slot-row.sel { border-color: var(--pc); background: rgba(255,255,255,.1); }
.slot-row .lbl { color: var(--muted); font-size: .8rem; width: 4.2rem; }
.slot-row .val { flex: 1; text-align: center; font-family: var(--font-display); font-size: 1.1rem; }
.arrow { cursor: pointer; width: 2rem; height: 2rem; border: none; border-radius: .5rem; background: rgba(255,255,255,.1); color: #fff; font-family: var(--font-display); font-size: 1.2rem; }
.arrow:hover { background: var(--pc); color: #111; }
.swatches { display: flex; gap: .25rem; justify-content: center; flex-wrap: wrap; flex: 1; }
.sw { width: 1.25rem; height: 1.25rem; border-radius: 50%; border: .15rem solid rgba(0,0,0,.4); cursor: pointer; position: relative; }
.sw.on { outline: .18rem solid #fff; outline-offset: .1rem; }
.sw.taken { opacity: .25; }
.sw.locked::after { content: "🔒"; position: absolute; inset: -.1rem; font-size: .7rem; display: flex; align-items: center; justify-content: center; }
.ready-bar { margin: 0 .8rem .8rem; padding: .7rem; border-radius: .8rem; text-align: center; font-family: var(--font-display); font-size: 1.3rem; background: rgba(255,255,255,.08); cursor: pointer; border: none; color: #fff; }
.slot.ready .ready-bar { background: var(--good); color: #0e2a10; }
.slot .ready-stamp { position: absolute; top: 38%; left: 50%; transform: translate(-50%,-50%) rotate(-12deg) scale(0); font-family: var(--font-display); font-size: 3rem; color: var(--good); border: .35rem solid var(--good); padding: .1rem 1rem; border-radius: .6rem; background: rgba(10,30,12,.6); transition: transform .3s var(--ease); pointer-events: none; }
.slot.ready .ready-stamp { transform: translate(-50%,-50%) rotate(-12deg) scale(1); }
.leave-btn { position: absolute; top: .7rem; right: .7rem; background: rgba(255,255,255,.08); border: none; color: var(--muted); border-radius: .5rem; cursor: pointer; font-size: .8rem; padding: .25rem .5rem; }
.lobby-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 1.2rem; }
.lobby-status { font-family: var(--font-display); font-size: 1.5rem; color: var(--muted); }
.lobby-status b { color: var(--accent); }

/* ---------- glyphs ---------- */
.keycap { display: inline-flex; align-items: center; justify-content: center; min-width: 1.9rem; height: 1.9rem; padding: 0 .45rem; border-radius: .4rem; background: #f1f1f5; color: #1a1626; font-family: var(--font-display); font-size: .95rem; box-shadow: 0 .2rem 0 #9d9db1; margin: 0 .15rem; }
.padbtn { display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; color: #10131a; font-family: var(--font-display); font-size: 1rem; box-shadow: 0 .15rem 0 rgba(0,0,0,.4); margin: 0 .15rem; }
.padbtn.A { background: #5fe06a; } .padbtn.B { background: #ff4d5e; } .padbtn.X { background: #3fa7ff; } .padbtn.Y { background: #ffd23f; }
.padbtn.pill { width: auto; padding: 0 .55rem; border-radius: .6rem; background: #c9c9d6; font-size: .8rem; }
.prompt-bar { position: fixed; left: 0; right: 0; bottom: 0; height: 3.4rem; display: flex; align-items: center; justify-content: flex-end; gap: 1.6rem; padding: 0 2.4rem; background: linear-gradient(0deg, rgba(10,8,20,.9), transparent); font-size: 1rem; color: var(--muted); transition: opacity .3s; }
.prompt-bar.hidden { opacity: 0; }
.prompt-bar span { display: inline-flex; align-items: center; gap: .35rem; }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 1.2rem; padding: 1.2rem 1.4rem; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 .8rem; font-family: var(--font-display); font-weight: 400; font-size: 1.4rem; letter-spacing: .06em; color: var(--accent); }

/* ---------- play screen: worker + mode + map + rules ---------- */
.play-wrap { flex: 1; display: grid; grid-template-columns: 27rem 1fr 27rem; gap: 1.6rem; min-height: 0; }
.play-col { display: flex; flex-direction: column; gap: .8rem; min-height: 0; }
.sec-title { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: .1em; color: var(--muted); display: flex; align-items: center; gap: .6rem; }
.sec-title .mini-btn { margin-left: auto; }
.sec-note { font-family: var(--font-body); letter-spacing: 0; font-size: .95rem; color: var(--text); opacity: .8; }
.crew-list { flex: 1; display: flex; flex-direction: column; gap: .8rem; min-height: 0; }
.crew-card { flex: 1; min-height: 0; display: flex; flex-direction: column; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); border-top: .3rem solid var(--pc); padding: .8rem; box-shadow: var(--shadow); }
.crew-top { display: flex; align-items: baseline; gap: .7rem; }
.crew-top .pn { font-family: var(--font-display); font-size: 1.6rem; color: var(--pc); }
.crew-top .dev { color: var(--muted); font-size: .85rem; }
.crew-preview { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 75%, color-mix(in srgb, var(--pc) 30%, transparent), transparent 62%); }
.crew-preview canvas { height: 100%; max-width: 100%; aspect-ratio: 1; object-fit: contain; }
.crew-name { text-align: center; font-family: var(--font-display); font-size: 1.7rem; line-height: 1.1; margin-bottom: .5rem; }
.crew-name small { display: block; font-family: var(--font-body); font-size: .9rem; color: var(--muted); font-weight: 700; margin-top: .15rem; }
.crew-row { display: flex; align-items: center; gap: .4rem; padding: .3rem; border-radius: .7rem; background: rgba(255,255,255,.04); border: .15rem solid transparent; margin-top: .35rem; }
.crew-row .val { flex: 1; text-align: center; font-family: var(--font-display); font-size: 1.1rem; }
.crew-row.focused { border-color: var(--accent); background: rgba(255,210,63,.07); box-shadow: none; transform: none; }
.crew-list.multi .crew-card { padding: .5rem .7rem; }
.crew-list.multi .crew-name { font-size: 1.2rem; margin-bottom: .2rem; }
.crew-list.multi .crew-name small { display: none; }
.crew-list.multi .crew-top .pn { font-size: 1.2rem; }
.crew-list.quad { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; }
.crew-list.quad .crew-top .dev { display: none; }
.crew-list.quad .crew-name { font-size: 1rem; }
.crew-list.quad .crew-row .val .sw { display: inline-block; vertical-align: middle; }
.crew-list.octo .crew-preview, .crew-list.octo .crew-rec, .crew-list.octo .crew-top .pn { display: none; }
.crew-list.octo .crew-card { padding: .35rem .5rem; }
.crew-list.octo .crew-row { margin-top: .2rem; padding: .1rem; }
.crew-rec { text-align: center; font-size: .78rem; color: var(--muted); margin: .2rem 0 0; }
.name-val { cursor: text; }
.name-input { flex: 1; min-width: 0; text-align: center; font-family: var(--font-display); font-size: 1.1rem; color: var(--text); background: rgba(0,0,0,.35); border: .12rem solid var(--accent); border-radius: .5rem; padding: .2rem .4rem; outline: none; }
.records { margin-top: .9rem; width: 100%; }
.rec-title { font-family: var(--font-display); color: var(--accent); letter-spacing: .08em; font-size: 1rem; margin-bottom: .3rem; }
.rec { display: flex; justify-content: space-between; gap: .6rem; font-size: .9rem; padding: .2rem 0; border-top: 1px solid var(--line); }
.rec span { color: var(--muted); }

.mode-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: .6rem; }
.mode-tile { cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .45rem; padding: .8rem .3rem .7rem; border-radius: var(--radius); background: var(--panel); border: .18rem solid transparent; text-align: center; font-family: var(--font-display); font-size: .95rem; line-height: 1.1; transition: transform .18s var(--ease), border-color .15s, background .15s; }
.mode-tile .icon { width: 3.2rem; height: 3.2rem; border-radius: .9rem; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--mc) 70%, #1a1430); }
.mode-tile .icon svg { width: 2rem; height: 2rem; }
.mode-tile.selected { border-color: var(--mc); background: color-mix(in srgb, var(--mc) 22%, rgba(24,19,48,.92)); }
.mode-tile.selected .icon { background: var(--mc); }
.mode-tile.focused, .map-tile.focused { transform: translateY(-.2rem); box-shadow: 0 0 0 .2rem var(--accent); }
.mode-info { border-radius: var(--radius); padding: .9rem 1.2rem; background: linear-gradient(100deg, color-mix(in srgb, var(--mc) 26%, rgba(24,19,48,.92)), var(--panel) 70%); border: 1px solid var(--line); }
.mi-head { display: flex; align-items: center; gap: .8rem; }
.mi-head b { font-family: var(--font-display); font-weight: 400; font-size: 1.7rem; }
.mi-head em { font-style: normal; font-size: .75rem; letter-spacing: .1em; padding: .15rem .5rem; border-radius: .4rem; background: rgba(255,255,255,.1); color: var(--muted); }
.mode-info p { margin: .25rem 0 .55rem; color: #d8d2f2; font-size: 1.05rem; }
.mi-rules { display: flex; flex-wrap: wrap; gap: .4rem; }
.mi-rules span { font-size: .85rem; padding: .25rem .6rem; border-radius: 1rem; background: rgba(255,255,255,.07); color: #cfc8ee; }

.map-strip { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: 1fr 1fr; gap: .6rem; }
.map-tile { cursor: pointer; position: relative; min-height: 0; border-radius: var(--radius); overflow: hidden; background: var(--panel); border: .2rem solid transparent; transition: transform .18s var(--ease), border-color .15s; }
.map-tile .thumb { position: absolute; inset: 0; }
.map-tile .thumb canvas { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 2.5s ease; }
.map-tile:hover .thumb canvas, .map-tile.focused .thumb canvas { transform: scale(1.1); }
.map-tile .thumb.rnd { display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 4rem; color: rgba(255,255,255,.3); background: repeating-linear-gradient(45deg, #2a2350, #2a2350 1.5rem, #231d44 1.5rem, #231d44 3rem); }
.map-tile span { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.4rem .6rem .45rem; font-family: var(--font-display); font-size: .9rem; line-height: 1.1; background: linear-gradient(0deg, rgba(10,8,20,.92), transparent); }
.map-tile.selected { border-color: var(--accent); }
.map-tile.selected::after { content: "✔"; position: absolute; top: .5rem; right: .5rem; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1rem; }

.side-col .panel h3 { margin-bottom: .6rem; }
.side-col .roster-panel { flex: 1; min-height: 0; overflow-y: auto; }
.opt-list { display: flex; flex-direction: column; gap: .4rem; }
.opt { display: flex; align-items: center; justify-content: space-between; padding: .35rem .5rem .35rem .8rem; border-radius: .7rem; background: rgba(255,255,255,.04); border: .15rem solid transparent; transition: border-color .15s, background .15s; }
.opt.focused { border-color: var(--accent); background: rgba(255,210,63,.08); box-shadow: none; transform: none; }
.opt label { font-size: 1rem; color: #e3def8; }
.cycler { display: flex; align-items: center; gap: .4rem; }
.cycler .v { min-width: 8.5rem; text-align: center; font-family: var(--font-display); font-size: 1.15rem; }
.roster { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: flex; align-items: center; gap: .45rem; padding: .3rem .8rem .3rem .35rem; border-radius: 2rem; background: rgba(255,255,255,.07); font-size: .95rem; }
.chip b { font-family: var(--font-display); font-weight: 400; }
.chip i { width: 1.3rem; height: 1.3rem; border-radius: 50%; display: inline-block; }
.chip.bot { color: var(--muted); }

/* ---------- settings ---------- */
.tabs { display: flex; gap: .6rem; margin-bottom: 1rem; }
.tab { cursor: pointer; padding: .6rem 1.3rem; border-radius: .8rem; background: rgba(255,255,255,.06); font-family: var(--font-display); font-size: 1.2rem; border: none; color: #fff; transition: background .15s, transform .15s; }
.tab.on { background: var(--accent); color: #fff; }
.settings-body { flex: 1; overflow-y: auto; max-width: 70rem; }
.set-row { display: flex; align-items: center; justify-content: space-between; padding: .7rem .9rem; border-radius: .8rem; border: .15rem solid transparent; }
.set-row + .set-row { margin-top: .3rem; }
.set-row.focused { border-color: var(--accent); background: rgba(255,210,63,.06); box-shadow: none; transform: none; }
.set-row .l { font-size: 1.15rem; }
.set-row .l small { display: block; color: var(--muted); font-size: .85rem; font-weight: 700; }
.slider { width: 22rem; height: 1rem; border-radius: 1rem; background: rgba(255,255,255,.12); position: relative; cursor: pointer; }
.slider .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 1rem; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.slider .knob { position: absolute; top: 50%; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #fff; transform: translate(-50%,-50%); box-shadow: 0 .2rem .4rem rgba(0,0,0,.4); }
.slider-wrap { display: flex; align-items: center; gap: 1rem; }
.slider-wrap .num { width: 3.5rem; text-align: right; font-family: var(--font-display); font-size: 1.2rem; }
.toggle { width: 4.4rem; height: 2.2rem; border-radius: 2rem; background: rgba(255,255,255,.14); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.toggle::after { content: ""; position: absolute; top: .25rem; left: .25rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); }
.toggle.on { background: var(--good); }
.toggle.on::after { transform: translateX(2.2rem); }
.keybind { min-width: 8rem; padding: .5rem 1rem; border-radius: .6rem; background: #f1f1f5; color: #1a1626; font-family: var(--font-display); font-size: 1.1rem; text-align: center; cursor: pointer; box-shadow: 0 .2rem 0 #9d9db1; border: none; }
.keybind.listening { background: var(--accent); animation: pulse 0.8s infinite; }
.danger { background: #5a1a28 !important; color: #ffb3bd !important; }

/* ---------- cheats ---------- */
.cheat-wrap { flex: 1; display: grid; grid-template-columns: 1.15fr 1fr; gap: 1.2rem; min-height: 0; overflow: hidden; }
.cheat-col { display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; min-height: 0; padding-right: .4rem; }
.cheat-banner { background: repeating-linear-gradient(-45deg, #ffd23f, #ffd23f 1rem, #1a1626 1rem, #1a1626 2rem); padding: .3rem; border-radius: 1rem; }
.cheat-banner div { background: #2a0f18; border-radius: .8rem; padding: .7rem 1rem; color: #ffb3bd; font-size: 1rem; }
.cheat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.cheat { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .55rem .8rem; border-radius: .7rem; background: rgba(255,255,255,.05); cursor: pointer; border: .15rem solid transparent; }
.cheat .n { font-size: 1rem; }
.cheat .n small { display: block; color: var(--muted); font-size: .75rem; }
.cheat .toggle { transform: scale(.8); }
.cheat.focused { border-color: #ff6b7d; background: rgba(255,107,125,.08); box-shadow: none; transform: none; }
.spawn-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .45rem; }
.spawn-item { cursor: pointer; border-radius: .7rem; background: rgba(255,255,255,.06); border: .15rem solid transparent; padding: .4rem .2rem; display: flex; flex-direction: column; align-items: center; gap: .15rem; font-size: .7rem; color: #ddd; text-align: center; line-height: 1.1; }
.spawn-item canvas { width: 3rem; height: 3rem; }
.spawn-item.focused, .spawn-item:hover { border-color: #ff6b7d; background: rgba(255,107,125,.12); box-shadow: none; }
.spawn-item.disabled { opacity: .35; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn-row .btn { font-size: 1rem; padding: .6rem 1rem; }

/* ---------- controls ---------- */
.controls-wrap { flex: 1; display: grid; grid-template-columns: 1fr 1.2fr; gap: 1.2rem; min-height: 0; }
.ctl-list { display: grid; grid-template-columns: auto 1fr; gap: .55rem 1.2rem; align-items: center; font-size: 1.1rem; }
.ctl-list .k { text-align: right; white-space: nowrap; }
.pad-diagram { width: 100%; max-height: 22rem; }
.ctl-note { color: var(--muted); font-size: .95rem; margin-top: 1rem; line-height: 1.4; }

/* ---------- credits ---------- */
.credits { flex: 1; overflow-y: auto; max-width: 64rem; margin: 0 auto; text-align: center; font-size: 1.15rem; line-height: 1.6; color: #d8d2f2; }
.credits h3 { font-family: var(--font-display); font-weight: 400; color: var(--accent); font-size: 1.8rem; margin: 1.6rem 0 .3rem; }
.credits .fine { color: var(--muted); font-size: .95rem; }

/* ---------- overlays ---------- */
.overlay { align-items: center; justify-content: center; background: rgba(10,8,20,.62); backdrop-filter: blur(.25rem); }
.pause-card { width: 30rem; background: var(--panel); border: 1px solid var(--line); border-radius: 1.6rem; padding: 2rem; text-align: center; box-shadow: var(--shadow); }
.pause-card h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 3.4rem; color: var(--accent); }
.pause-card .sub { margin: 0 0 1.2rem; color: var(--muted); }
.pause-menu { display: flex; flex-direction: column; gap: .6rem; }
.pause-menu .btn { width: 100%; }
.end-card { --wc: #ffd23f; position: relative; width: min(84rem, 94vw); max-height: 94vh; overflow: auto; background: linear-gradient(180deg, color-mix(in srgb, var(--wc) 16%, #1b1636), #15112b 45%); border: 1px solid var(--line); border-radius: 1.8rem; padding: 0 2.2rem 1.8rem; box-shadow: 0 2rem 5rem rgba(0,0,0,.6); }
.end-hero { position: relative; text-align: center; margin: 0 -2.2rem; overflow: hidden; border-radius: 1.8rem 1.8rem 0 0; }
.end-rays { position: absolute; left: 50%; top: 62%; width: 90rem; height: 90rem; transform: translate(-50%, -50%); background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--wc) 16%, transparent) 0 8deg, transparent 8deg 20deg); mask-image: radial-gradient(circle, #000 10%, transparent 55%); -webkit-mask-image: radial-gradient(circle, #000 10%, transparent 55%); animation: rays 40s linear infinite; pointer-events: none; }
@keyframes rays { to { transform: translate(-50%, -50%) rotate(360deg); } }
.end-banner { position: relative; padding-top: 1.6rem; }
.end-kicker { display: inline-block; font-family: var(--font-display); font-size: .95rem; letter-spacing: .3em; color: var(--muted); padding: .25rem .9rem; border-radius: 2rem; background: rgba(255,255,255,.06); }
#end-podium { position: relative; display: block; width: 100%; height: auto; aspect-ratio: 1200 / 370; margin-top: -.5rem; }
#end-title { margin: .4rem 0 0; font-family: var(--font-display); font-weight: 400; font-size: 4.6rem; line-height: 1; -webkit-text-stroke: .25rem #1a1030; paint-order: stroke fill; text-shadow: 0 .4rem 0 #1a1030, 0 0 3rem color-mix(in srgb, var(--wc) 50%, transparent); animation: stampIn .6s var(--ease); }
@keyframes stampIn { from { transform: scale(2.2) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
#end-sub { margin: .5rem 0 0; color: #d8d2f2; font-size: 1.2rem; }
.awards { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .8rem; margin: 1rem 0 1.2rem; }
.award { display: flex; align-items: center; gap: .8rem; background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 1rem; padding: .7rem 1rem; font-size: .95rem; color: #d8d2f2; animation: scrIn .5s var(--ease) both; }
.award .ic { flex-shrink: 0; width: 2.6rem; height: 2.6rem; border-radius: .8rem; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; background: color-mix(in srgb, var(--ac) 25%, transparent); border: 1px solid color-mix(in srgb, var(--ac) 50%, transparent); }
.award b { color: var(--ac); font-family: var(--font-display); font-weight: 400; font-size: 1.05rem; letter-spacing: .04em; display: block; }
.end-table-wrap { border-radius: 1rem; border: 1px solid var(--line); overflow: hidden; }
.end-table { width: 100%; border-collapse: collapse; font-size: 1.05rem; }
.end-table th { color: var(--muted); font-size: .8rem; text-align: center; padding: .6rem .5rem; letter-spacing: .08em; background: rgba(255,255,255,.04); }
.end-table th:first-child, .end-table td:first-child { text-align: left; padding-left: 1rem; }
.end-table td { padding: .5rem; text-align: center; border-top: 1px solid var(--line); font-family: var(--font-display); font-size: 1.15rem; }
.end-table td.rk { width: 3rem; color: var(--muted); }
.end-table tr.win td { background: color-mix(in srgb, var(--wc) 10%, transparent); }
.end-table tr.win td.rk { color: var(--wc); }
.end-table .pn { display: flex; align-items: center; gap: .6rem; font-size: 1.2rem; }
.end-table .pn i { width: .9rem; height: .9rem; border-radius: 50%; display: inline-block; }
.end-table .pn small { font-family: var(--font-body); font-size: .85rem; color: var(--muted); }
.end-actions { display: flex; justify-content: center; gap: 1rem; margin-top: 1.4rem; }

.toast { position: fixed; top: 1.5rem; left: 50%; transform: translate(-50%, calc(-100% - 2rem)); opacity: 0; background: var(--brand); color: #fff; padding: .8rem 1.6rem; border-radius: 1rem; font-family: var(--font-display); font-size: 1.3rem; box-shadow: var(--shadow); transition: transform .35s var(--ease), opacity .2s; z-index: 50; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.6); z-index: 40; }
.modal.show { display: flex; }
.modal-card { background: var(--panel-2); padding: 2rem 3rem; border-radius: 1.4rem; text-align: center; border: .2rem solid var(--accent); }
.modal-card h3 { font-family: var(--font-display); font-weight: 400; font-size: 2rem; margin: 0 0 .5rem; }
.loading { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; flex-direction: column; background: var(--bg); z-index: 60; font-family: var(--font-display); font-size: 1.6rem; color: var(--muted); }
.loading.show { display: flex; }
.spinner { width: 4rem; height: 4rem; border-radius: 50%; border: .5rem solid rgba(255,255,255,.1); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: .6rem; } ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 1rem; } ::-webkit-scrollbar-track { background: transparent; }

@media (max-aspect-ratio: 4/3) {
  .main-menu { grid-template-columns: 1fr; }
  .menu-btn.hero { grid-column: span 1; }
  .title-side { display: none; }
  .lobby-grid { grid-template-columns: repeat(2, 1fr); }
  .play-wrap { grid-template-columns: 1fr 1fr; overflow-y: auto; }
  .crew-col { grid-row: span 2; }
  .mode-strip { grid-template-columns: repeat(4, 1fr); }
}
