/* ============================================================
   SIEGE BUDDIES — menu screens, lobby, shop, loadout, challenges
   ============================================================ */

/* ---------- boot ---------- */
#screen-boot { justify-content: center; background: linear-gradient(180deg, #6fb7ef 0%, #3f7fb8 60%, #2b5a86 100%); }
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.boot-logo { width: min(460px, 70vw); filter: drop-shadow(0 12px 24px rgba(0,0,0,.35)); }
.boot-bar { width: min(380px, 60vw); height: 22px; border: 3px solid var(--outline); border-radius: 12px; background: #34210c; overflow: hidden; box-shadow: inset 0 3px 6px rgba(0,0,0,.5); }
.boot-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold-mid), #ffd35c); transition: width .2s ease; }
.boot-tip { color: #eaf6ff; font-weight: 600; text-shadow: 0 2px 3px rgba(0,0,0,.4); }

/* ---------- main menu ---------- */
#screen-menu { justify-content: center; background: linear-gradient(180deg, #79c2f5 0%, #4f97cf 55%, #3a729f 100%); }
#menu-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.menu-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 1; }
.menu-logo { width: min(430px, 58vw, 40vh); filter: drop-shadow(0 12px 22px rgba(0,0,0,.4)); }
.menu-logo.bob { animation: logoBob 3.4s ease-in-out infinite; }
@keyframes logoBob { 0%,100% { transform: translateY(0) rotate(-.5deg);} 50% { transform: translateY(-9px) rotate(.5deg);} }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 8px; }
.menu-row { display: flex; gap: 10px; }
.menu-row .btn { min-width: 152px; }
.crown-badge#menu-crowns { position: absolute; top: -12px; right: -170px; }
.version-tag { position: fixed; bottom: 8px; right: 12px; color: rgba(255,255,255,.55); font-size: .72rem; font-weight: 600; }

/* ---------- mode select ---------- */
.mode-cards { display: grid; grid-template-columns: repeat(2, minmax(240px, 340px)); gap: 18px; margin-top: 24px; padding: 10px; }
.mode-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 22px 18px; cursor: pointer; text-align: center;
  border: 4px solid var(--outline); border-radius: 18px;
  color: var(--cream);
  box-shadow: 0 7px 0 rgba(0,0,0,.3), inset 0 3px 0 rgba(255,255,255,.25);
  transition: transform .1s ease, filter .12s ease;
  background: linear-gradient(180deg, var(--wood-hi), var(--wood-mid));
}
.mode-card:hover { transform: translateY(-4px) scale(1.02); filter: brightness(1.1); }
.mode-card:active { transform: translateY(2px); }
.mode-card:focus-visible { outline: none; box-shadow: var(--focus-ring), 0 7px 0 rgba(0,0,0,.3); }
.mode-card.blue-card { background: linear-gradient(180deg, #57b4f5, var(--blue-dark)); }
.mode-card.red-card { background: linear-gradient(180deg, #f2695a, var(--red-dark)); }
.mode-card.gold-card { background: linear-gradient(180deg, #ffd35c, #b06f10); color: #4a2b04; text-shadow: 0 1px 0 rgba(255,255,255,.3); }
.mode-card.green-card { background: linear-gradient(180deg, #8bd95f, #3d7c21); }
.mode-name { font-family: var(--font-display); font-weight: 800; font-size: calc(1.3rem * var(--text-scale)); text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.mode-desc { font-size: calc(.9rem * var(--text-scale)); opacity: .95; font-weight: 600; }
.mode-icon { width: 74px; height: 74px; background-size: contain; background-repeat: no-repeat; background-position: center; }

/* ---------- online ---------- */
.online-inner { width: min(760px, 94%); display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.online-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.online-cols .col { gap: 12px; align-items: center; text-align: center; }
.online-cols p { font-weight: 600; opacity: .9; min-height: 2.6em; }

/* ---------- lobby ---------- */
.lobby-inner { width: min(1080px, 96%); flex: 1; display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; padding: 10px 0 20px; overflow-y: auto; }
.lobby-left, .lobby-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.room-code-panel { display: flex; align-items: center; gap: 14px; justify-content: center; }
.room-code { font-family: var(--font-display); font-size: 2rem; font-weight: 800; letter-spacing: .35em; color: var(--gold); text-shadow: 0 2px 0 rgba(0,0,0,.4); user-select: text; }
.player-card {
  display: flex; align-items: center; gap: 12px;
  border: 4px solid var(--outline); border-radius: 14px; padding: 10px 14px; margin-bottom: 10px;
  box-shadow: 0 5px 0 rgba(0,0,0,.28);
}
.player-card.team-0 { background: linear-gradient(180deg, #57b4f5, var(--blue-dark)); }
.player-card.team-1 { background: linear-gradient(180deg, #f2695a, var(--red-dark)); }
.player-card.empty { background: linear-gradient(180deg, #6a707a, #464b54); opacity: .8; }
.player-card .avatar { width: 52px; height: 52px; flex: 0 0 auto; }
.player-card .pname { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.player-card .psub { font-size: .8rem; font-weight: 600; opacity: .92; }
.player-card .pright { margin-left: auto; text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.ready-chip { font-weight: 800; font-size: .8rem; border: 2px solid var(--outline); border-radius: 999px; padding: 2px 12px 3px; background: #5b5f66; }
.ready-chip.on { background: var(--green); color: #fff; }
.ping-chip { font-size: .72rem; font-weight: 700; opacity: .95; }
.ping-good { color: #baffb0; } .ping-ok { color: #ffe08a; } .ping-bad { color: #ffb3a8; }

/* settings form rows (lobby + local) */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 2px; border-bottom: 1px dashed rgba(0,0,0,.2); }
.set-row:last-child { border-bottom: none; }
.set-row > span { font-weight: 700; }
.set-row .set-val { color: var(--gold); font-weight: 800; min-width: 64px; text-align: right; }
.set-row select, .set-row input[type="range"] { max-width: 180px; }
.set-row.changed > span::after { content: " ★"; color: var(--gold); }

/* level picker */
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.level-tile {
  border: 3px solid var(--outline); border-radius: 12px; overflow: hidden; cursor: pointer;
  background: #24384f; padding: 0; position: relative;
  box-shadow: 0 4px 0 rgba(0,0,0,.3);
  transition: transform .08s ease;
}
.level-tile:hover { transform: translateY(-2px); }
.level-tile:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.level-tile canvas, .level-tile img { display: block; width: 100%; height: 84px; object-fit: cover; }
.level-tile .lname { display: block; font-weight: 700; font-size: .78rem; padding: 4px 6px 6px; color: var(--cream); background: rgba(0,0,0,.35); }
.level-tile.selected { box-shadow: 0 0 0 4px var(--gold), 0 4px 0 rgba(0,0,0,.3); }
.level-tile.selected::after { content: "✔"; position: absolute; top: 4px; right: 6px; color: var(--gold); font-weight: 900; font-size: 1.2rem; text-shadow: 0 2px 2px rgba(0,0,0,.6); }
.level-tile.locked { filter: grayscale(.8) brightness(.6); }
.level-tile .lrandom { display: grid; place-items: center; height: 84px; font-size: 2rem; }

/* ---------- setup screens ---------- */
.setup-inner { width: min(860px, 94%); display: flex; flex-direction: column; gap: 14px; padding: 12px 0 26px; overflow-y: auto; }

/* ---------- shop ---------- */
.tab-bar { display: flex; gap: 8px; margin: 10px 0 4px; flex-wrap: wrap; justify-content: center; }
.tab-btn {
  font-family: var(--font-display); font-weight: 800; color: var(--cream);
  background: linear-gradient(180deg, #6d451c, #4a2c0e);
  border: 3px solid var(--outline); border-radius: 12px 12px 0 0;
  padding: 8px 18px 9px; cursor: pointer;
}
.tab-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tab-btn.active { background: linear-gradient(180deg, var(--wood-hi), var(--wood-mid)); color: var(--gold); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 14px; }
.shop-card {
  display: flex; flex-direction: column; gap: 6px; padding: 12px;
  border: 4px solid var(--outline); border-radius: 14px;
  background: linear-gradient(180deg, var(--wood-hi), var(--wood-mid));
  box-shadow: 0 5px 0 rgba(0,0,0,.25);
  position: relative;
}
.shop-card .icon-box { width: 64px; height: 64px; align-self: center; background: rgba(0,0,0,.22); border-radius: 12px; border: 2px solid rgba(0,0,0,.3); display: grid; place-items: center; }
.shop-card .icon-box img, .shop-card .icon-box canvas { width: 54px; height: 54px; image-rendering: auto; }
.shop-card h3 { font-family: var(--font-display); font-size: 1.02rem; color: #ffe9bd; text-align: center; }
.shop-card .desc { font-size: .8rem; font-weight: 600; opacity: .92; flex: 1; }
.shop-card .statline { font-size: .72rem; color: #ffd98a; font-weight: 700; }
.shop-card .price-row { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.shop-card .owned-chip { font-weight: 800; color: #baffb0; }
.shop-card .equipped-chip { font-weight: 800; color: var(--gold); }
.shop-card.locked-req { opacity: .75; }
.shop-card .req-note { font-size: .72rem; color: #ffb4a8; font-weight: 700; }
.shop-card .lvl-pips { color: var(--gold); letter-spacing: 2px; font-size: .8rem; }

/* ---------- loadout ---------- */
.loadout-section { margin-bottom: 18px; }
.loadout-section h2 { font-family: var(--font-display); color: #ffe9bd; margin: 10px 4px; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pick-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px;
  border: 3px solid var(--outline); border-radius: 12px; cursor: pointer;
  background: linear-gradient(180deg, var(--wood-hi), var(--wood-mid));
  color: var(--cream); box-shadow: 0 4px 0 rgba(0,0,0,.25);
  transition: transform .08s ease;
}
.pick-card:hover { transform: translateY(-2px); }
.pick-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.pick-card.selected { box-shadow: 0 0 0 4px var(--gold), 0 4px 0 rgba(0,0,0,.25); }
.pick-card.locked { filter: grayscale(.75) brightness(.7); cursor: not-allowed; }
.pick-card img, .pick-card canvas { width: 46px; height: 46px; }
.pick-card .pc-name { font-weight: 800; font-size: .82rem; text-align: center; }
.pick-card .pc-sub { font-size: .68rem; font-weight: 600; opacity: .9; text-align: center; }
.loadout-summary { position: sticky; top: 0; z-index: 5; margin-bottom: 12px; }

/* ---------- challenges ---------- */
.challenge-card {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-bottom: 10px;
  border: 4px solid var(--outline); border-radius: 14px;
  background: linear-gradient(180deg, var(--wood-hi), var(--wood-mid));
  box-shadow: 0 4px 0 rgba(0,0,0,.25);
}
.challenge-card.done { background: linear-gradient(180deg, #74a83e, #47702a); }
.challenge-card.daily { box-shadow: 0 0 0 3px var(--gold), 0 4px 0 rgba(0,0,0,.25); }
.challenge-card .ch-body { flex: 1; }
.challenge-card h3 { font-family: var(--font-display); font-size: 1rem; color: #ffe9bd; }
.challenge-card .ch-desc { font-size: .82rem; font-weight: 600; opacity: .92; }
.ch-progress { height: 12px; border-radius: 8px; background: rgba(0,0,0,.35); border: 2px solid var(--outline); overflow: hidden; margin-top: 6px; }
.ch-progress > div { height: 100%; background: linear-gradient(90deg, var(--gold-mid), #ffd35c); }
.ch-reward { font-weight: 800; color: var(--gold); white-space: nowrap; }
.ch-done-mark { font-size: 1.6rem; }
.daily-head { font-family: var(--font-display); color: var(--gold); margin: 8px 4px; text-shadow: 0 2px 0 rgba(0,0,0,.4); }

/* ---------- stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.stat-card { padding: 14px; text-align: center; }
.stat-card .stat-num { font-family: var(--font-display); font-size: 1.7rem; font-weight: 800; color: var(--gold); text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.stat-card .stat-name { font-weight: 700; font-size: .85rem; opacity: .95; }

/* ---------- settings ---------- */
.settings-section { margin-bottom: 16px; }
.settings-section h2 { font-family: var(--font-display); color: #ffe9bd; margin-bottom: 8px; }
.settings-section .set-row { padding: 8px 4px; }

/* ---------- howto & credits ---------- */
.howto h2, .credits h2 { font-family: var(--font-display); color: var(--gold); margin: 18px 0 8px; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.howto p, .credits p, .howto li, .credits li { line-height: 1.55; font-weight: 500; }
.howto ul, .credits ul { margin: 6px 0 6px 24px; }
.howto .keycap, kbd.keycap {
  display: inline-block; background: var(--cream); color: var(--ink); border: 2px solid var(--outline);
  border-radius: 6px; padding: 0 8px 2px; font-family: var(--font-display); font-weight: 700; font-size: .82em;
  box-shadow: 0 2px 0 var(--outline); margin: 0 2px;
}
.howto-panel { margin-bottom: 14px; }
.credits .lib-license { font-size: .75rem; opacity: .8; user-select: text; }
