* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #120e20; color: #fff; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; overflow: hidden; overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; image-rendering: pixelated; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; padding: max(18px, env(safe-area-inset-top)) 18px 18px; overflow-y: auto; touch-action: pan-y;
  background: radial-gradient(ellipse at 50% 20%, #3a2b6b 0%, #1b1530 60%, #120e20 100%); }
.screen.themed.has-art {
  background: var(--menu-bg) center / cover no-repeat, #1b1530;
  image-rendering: pixelated;
}
.screen.overlay { background: rgba(14, 10, 28, 0.82); justify-content: center; }
.hidden { display: none !important; }
.logo { text-align: center; margin-top: 5vh; }
.logo h1 { font-size: 46px; margin: 10px 0 4px; letter-spacing: 2px; color: #ffd447; text-shadow: 0 4px 0 #b4561c, 0 8px 0 #1b1420; font-weight: 900; }
.logo .sub { margin: 0 auto; color: #c9bfe6; font-size: 13px; }
.tagline { padding: 8px 16px; max-width: 320px; }
body.has-menu-art .tagline {
  background: var(--tagline-plate) center / 100% 100% no-repeat;
  min-height: 28px; display: flex; align-items: center; justify-content: center;
  color: #f4efe4; text-shadow: 0 1px 0 #1b1420;
}
.pup { width: 96px; height: 96px; margin: 0 auto; image-rendering: pixelated; background-size: contain; background-repeat: no-repeat; background-position: center; }
.btns { display: flex; flex-direction: column; gap: 10px; width: min(320px, 86vw); margin-top: 4vh; }
.menu-btns { margin-top: 3vh; gap: 8px; }
button { font: inherit; font-weight: 800; font-size: 18px; color: #fff; background: #4a3a86; border: 3px solid #1b1420; border-radius: 14px; padding: 14px 16px; box-shadow: 0 4px 0 #1b1420; cursor: pointer; }
button.big { background: #ff8a2b; font-size: 22px; padding: 18px; }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 #1b1420; }
button:focus-visible, button.padfocus { outline: 4px solid #ffd447; outline-offset: 2px; }

/* Art Studio plates: blank 9-ish stretch + live accessible text */
body.has-menu-art button.plate-play, body.has-menu-art button.big.plate-play {
  background: var(--btn-play) center / 100% 100% no-repeat;
  border: none; box-shadow: none; border-radius: 0; color: #fff7e4;
  text-shadow: 0 2px 0 #6a2e10; padding: 16px 18px; image-rendering: pixelated;
}
body.has-menu-art button.plate-play:active { background-image: var(--btn-play-pressed); transform: translateY(2px); }
body.has-menu-art button.plate-sec {
  background: var(--btn-secondary) center / 100% 100% no-repeat;
  border: none; box-shadow: none; border-radius: 0; color: #f3ead8;
  text-shadow: 0 2px 0 #1b1420; padding: 12px 16px; image-rendering: pixelated;
}
body.has-menu-art button.plate-sec:active { background-image: var(--btn-secondary-pressed); transform: translateY(2px); }
body.has-menu-art .crest.plate-crest {
  background: var(--crest-panel) center / 100% 100% no-repeat;
  border: none; box-shadow: none; border-radius: 0; min-height: 118px;
  image-rendering: pixelated;
}
body.has-menu-art .crest.plate-crest:active, body.has-menu-art .crest.plate-crest.selected {
  background-image: var(--crest-panel-selected);
}
body.has-menu-art .twists-head, body.has-menu-art .clan-head {
  background: var(--twists-header, var(--clan-crest-header)) center / 100% 100% no-repeat;
  min-height: 36px; padding: 8px 16px; text-shadow: 0 2px 0 #1b1420; image-rendering: pixelated;
}
body.has-menu-art .howto-list, body.has-menu-art .tut-card.plate-twists {
  background: var(--twists-panel) center / 100% 100% no-repeat, rgba(40,30,70,0.72);
  image-rendering: pixelated;
}

.extras { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; width: min(340px, 90vw); margin-top: 14px; }
.extras .texty { background: transparent; border: none; box-shadow: none; color: #ffe6a8; font-size: 14px; padding: 4px 6px; text-decoration: underline; text-underline-offset: 3px; }
.bones { margin-top: 16px; font-weight: 800; color: #ffe6a8; text-align: center; }
.bones small, .rating-chip { color: #c9bfe6; font-weight: 500; }
.hint, .note { color: #e8dff6; font-size: 13px; text-align: center; max-width: 340px; text-shadow: 0 1px 2px #1b1420; }
header { width: 100%; display: flex; align-items: center; gap: 12px; }
header h2 { margin: 0; font-size: 22px; }
.back { font-size: 15px; padding: 8px 12px; background: #2e2550; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 420px; padding-bottom: 20px; }
.card { background: #2e2550; border: 3px solid #1b1420; border-radius: 12px; padding: 8px; position: relative; }
.card canvas { width: 56px; height: 56px; image-rendering: pixelated; display: block; margin: 0 auto; }
.card h3 { margin: 4px 0 2px; font-size: 14px; text-align: center; }
.card .type { font-size: 10px; text-transform: uppercase; color: #c9bfe6; text-align: center; letter-spacing: 1px; }
.card .cost { position: absolute; top: 6px; left: 6px; width: 26px; height: 26px; border-radius: 50%; background: #b45cff; border: 2px solid #fff; display: grid; place-items: center; font-weight: 900; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 1px 6px; font-size: 11px; margin: 6px 0 0; }
.card dt { color: #9e93c2; } .card dd { margin: 0; text-align: right; font-weight: 700; }
.card p { font-size: 10.5px; color: #c9bfe6; margin: 6px 0 0; }
.card.in-deck { outline: 3px solid #ffd447; }
.card.clan-lock { outline: 2px dashed #7dffb3; }
.clan-tag { position: absolute; top: -8px; right: 6px; background: #5a3d86; font-size: 10px; padding: 2px 6px; border-radius: 8px; font-weight: 800; }
.opts { display: flex; flex-direction: column; gap: 12px; width: min(340px, 90vw); margin-top: 24px; }
.opts button { text-align: left; background: #2e2550; }
.opts b { float: right; color: #ffd447; }
#result h2 { font-size: 44px; margin: 0; color: #ffd447; text-shadow: 0 4px 0 #1b1420; }
#result.lose h2 { color: #ff8a8a; }
.respaws { font-size: 34px; margin: 10px; letter-spacing: 6px; }
#pauseBtn { position: fixed; top: 52px; right: 8px; width: 36px; height: 36px; padding: 0; font-size: 14px; border-radius: 10px; background: rgba(40,30,70,0.85); z-index: 5; }
#pause h2 { font-size: 36px; margin: 0; }

.logo-title.logo-img { width: min(340px, 88vw); height: calc(min(340px, 88vw) * 150 / 450); margin: 8px auto 4px; background-size: contain; background-repeat: no-repeat; background-position: center; text-indent: -9999px; overflow: hidden; text-shadow: none; font-size: 0; }
.pup.hidden { display: none; }
#resTitle.banner-img { width: min(336px, 90vw); height: calc(min(336px, 90vw) * 88 / 336); margin: 0 auto; background-size: contain; background-repeat: no-repeat; background-position: center; text-indent: -9999px; overflow: hidden; text-shadow: none; font-size: 0; color: transparent; }
.card canvas { width: 72px; height: 84px; image-rendering: pixelated; display: block; margin: 0 auto; }

.howto-list { max-width: 340px; margin: 12px auto; text-align: left; font-size: 13px; background: rgba(40,30,70,0.72); border-radius: 12px; padding: 14px 14px 14px 32px; }
.howto-list li { margin: 8px 0; }
.crests { gap: 12px; }
.crest { display: flex; flex-direction: column; align-items: center; padding: 14px 12px 16px; min-width: 260px; }
.crest .crest-img { width: 48px; height: 48px; image-rendering: pixelated; object-fit: contain; }
.crest span { font-size: 34px; } .crest small { opacity: 0.9; font-weight: 400; }
.crest .clan-card { font-size: 11px; font-style: normal; color: #ffe6a8; margin-top: 4px; font-weight: 700; }
.card.rival { outline: 2px solid #ffd447; position: relative; }
.rivalBadge { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); background: #ff8a3c; color: #fff; font-size: 10px; font-weight: 900; padding: 2px 6px; border-radius: 8px; white-space: nowrap; z-index: 2; }

.ladder-elo { font-size: 42px; margin: 18px 0 6px; color: #ffd447; text-shadow: 0 3px 0 #1b1420; font-weight: 900; }
.recents { list-style: none; padding-left: 14px; }
.shop-item { text-align: center; }
.shop-item .icon { font-size: 28px; }
.shop-item button { margin-top: 8px; width: 100%; font-size: 14px; }
.shop-item.owned { outline: 2px solid #7dffb3; }
.shop-item.equipped { outline: 3px solid #ffd447; }

.field { display: flex; flex-direction: column; gap: 6px; width: min(320px, 86vw); margin-top: 16px; font-weight: 700; color: #ffe6a8; font-size: 13px; }
.field input, .join-row input {
  font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 3px solid #1b1420;
  background: rgba(20,14,40,0.8); color: #fff; text-transform: uppercase; letter-spacing: 2px;
}
.join-row { display: flex; gap: 8px; width: min(320px, 86vw); margin-top: 12px; align-items: center; }
.join-row input { flex: 1; min-width: 0; }
.join-row button { padding: 10px 12px; font-size: 14px; }

.tut-card { width: min(340px, 90vw); padding: 22px 18px; border-radius: 16px; background: rgba(30,22,56,0.94); text-align: center; }
.tut-step { color: #ffd447; font-weight: 900; letter-spacing: 2px; margin: 0 0 8px; }
.tut-card h2 { margin: 0 0 10px; font-size: 22px; }
.tut-card p { color: #e8dff6; line-height: 1.4; }
.tut-nav { width: 100%; margin-top: 16px; }

.foot-note { margin-top: auto; padding-top: 16px; color: #ffe6a8; }
#multiStatus { min-height: 2.4em; font-weight: 700; color: #ffe6a8; }

.mp-block { width: min(320px, 86vw); margin-top: 18px; padding-top: 12px; border-top: 2px solid rgba(255,230,168,0.18); }
.mp-head { margin: 0 0 6px; font-size: 16px; letter-spacing: 1px; color: #ffd447; text-shadow: 0 2px 0 #1b1420; }
.mp-block .btns { width: 100%; margin-top: 8px; }
.mp-block .note { margin-top: 0; }
#cancelFindBtn:not(.hidden) { display: inline-flex; }

/* ---- Ecosystem slice: hub return + mobile nav polish ---- */
.hub-row {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 10px 16px; margin: 14px 0 4px; width: min(340px, 92vw);
}
.hub-row.compact { margin-top: 18px; margin-bottom: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
a.hub-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px; padding: 10px 16px;
  font-weight: 800; font-size: 15px; color: #ffe6a8; text-decoration: none;
  background: rgba(46, 37, 80, 0.85); border: 2px solid #1b1420; border-radius: 12px;
  box-shadow: 0 3px 0 #1b1420; -webkit-tap-highlight-color: transparent;
}
a.hub-link:active { transform: translateY(2px); box-shadow: 0 1px 0 #1b1420; }
a.hub-link.alt { background: transparent; border-style: dashed; box-shadow: none; color: #c9bfe6; font-size: 13px; min-height: 44px; }
a.hub-link:focus-visible { outline: 4px solid #ffd447; outline-offset: 2px; }

.extras { gap: 10px 12px; width: min(360px, 94vw); margin-top: 16px; padding-bottom: 4px; }
.extras .texty {
  background: rgba(46, 37, 80, 0.55); border: 2px solid rgba(27, 20, 32, 0.85); box-shadow: 0 2px 0 #1b1420;
  color: #ffe6a8; font-size: 14px; font-weight: 800; text-decoration: none;
  min-height: 44px; min-width: 44px; padding: 10px 14px; border-radius: 12px;
}
.extras .texty:active { transform: translateY(2px); box-shadow: 0 0 0 #1b1420; }

.screen.themed { padding-bottom: max(28px, calc(16px + env(safe-area-inset-bottom))); }
#menu.screen { overflow-y: auto; }
#menu.screen > * { flex-shrink: 0; }
#menu #padHint { margin-top: 8px; margin-bottom: 4px; padding-bottom: 8px; }
@media (max-height: 900px) {
  #menu .logo { margin-top: 8px; }
  #menu .menu-btns { margin-top: 10px; }
  #menu .extras { margin-top: 10px; }
  #menu .bones { margin-top: 8px; }
  #menu .hub-row { margin-top: 8px; margin-bottom: 2px; }
}
header .back { min-height: 44px; min-width: 44px; padding: 10px 14px; font-size: 15px; }
.menu-btns button, .btns button, .mp-block .btns button { min-height: 48px; }
.join-row { gap: 10px; width: min(340px, 92vw); flex-wrap: wrap; }
.join-row input { min-height: 48px; flex: 1 1 120px; font-size: 16px; }
.join-row button { min-height: 48px; min-width: 72px; padding: 12px 14px; font-size: 15px; flex: 0 0 auto; }
.field input { min-height: 48px; font-size: 16px; }
.shop-item button { min-height: 44px; font-size: 15px; padding: 12px 10px; }
.shop-copy { margin: 8px auto 14px; max-width: 360px; }
.ladder-badge {
  margin: 10px 0 0; padding: 8px 12px; border-radius: 10px;
  background: rgba(255, 212, 71, 0.12); border: 2px dashed rgba(255, 212, 71, 0.55);
  color: #ffd447; font-size: 12px; font-weight: 800; letter-spacing: 0.4px; text-align: center;
  max-width: 340px;
}
#multi .mp-block, #shop .shop-grid, #ladder .recents { padding-bottom: 4px; }
@media (max-width: 380px) {
  .logo h1 { font-size: 38px; }
  .extras { width: 96vw; }
  a.hub-link.alt { width: 100%; }
}
