:root {
  --bg: #090b12;
  --panel: rgba(18, 23, 38, 0.94);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f5f7fb;
  --muted: #aeb7ca;
  --accent: #83d6ff;
  --danger: #ff7979;
  --good: #91f0aa;
  --warn: #ffd166;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button, canvas, #stick, #knob { font: inherit; color: inherit; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
#app { position: relative; width: 100vw; height: 100dvh; display: grid; place-items: center; background: radial-gradient(circle at 50% 25%, #24304d 0%, #090b12 60%); }
.screen { display: none; }
.screen.active { display: block; }
.panel { width: min(92vw, 820px); max-height: 92dvh; overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,0.35); }
.brand { color: var(--accent); letter-spacing: 0.12em; font-weight: 800; font-size: 13px; text-transform: uppercase; }
h1, h2 { margin: 10px 0 12px; line-height: 1.15; }
p { color: var(--muted); line-height: 1.7; }
.lead { font-size: 15px; }
.grid { display: grid; gap: 12px; margin: 18px 0; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hero-card, .upgrade-card { border: 1px solid var(--line); background: rgba(255,255,255,0.04); border-radius: 8px; padding: 16px; text-align: left; cursor: pointer; min-height: 112px; }
.hero-card.selected, .hero-card:hover, .upgrade-card:hover { border-color: var(--accent); background: rgba(131,214,255,0.12); }
.hero-img { width: 58px; height: 58px; object-fit: contain; display: block; margin-bottom: 8px; image-rendering: auto; }
.hero-icon { display: block; font-size: 30px; margin-bottom: 8px; }
.hero-img:not([style*="display: none"]) + .hero-icon { display: none; }
.hero-card small, .upgrade-card small { display: block; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.primary, .secondary { border: 0; border-radius: 6px; padding: 12px 22px; cursor: pointer; font-weight: 800; }
.primary { background: var(--accent); color: #06101a; }
.secondary { background: rgba(255,255,255,0.08); border: 1px solid var(--line); }
.score-line { color: var(--muted); margin-top: 16px; font-size: 14px; }
#gameScreen.active { display: grid; place-items: center; width: 100vw; height: 100dvh; position: relative; overflow: hidden; background: #05070c; touch-action: manipulation; }
#game { width: min(100vw, calc(100dvh * 16 / 9)); height: min(100dvh, calc(100vw * 9 / 16)); max-width: 100vw; max-height: 100dvh; display: block; touch-action: none; background: #111827; border-radius: 0; }
#hud { position: fixed; left: calc(var(--game-left, 12px) + 12px); top: calc(var(--game-top, 10px) + 10px); width: calc(var(--game-width, 100vw) - 24px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; pointer-events: none; }
#hud div { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: rgba(0,0,0,0.34); backdrop-filter: blur(10px); }
#hud b { display: block; color: var(--muted); font-size: 10px; letter-spacing: 0.08em; }
#hud span { display: block; font-weight: 800; font-size: 16px; }
#stick { position: fixed; left: 0; top: 0; width: 112px; height: 112px; border-radius: 50%; background: rgba(255,255,255,0.055); border: 1px solid var(--line); display: none; touch-action: none; pointer-events: none; z-index: 7; }
#stick.active { display: block; }
#knob { position: absolute; left: 34px; top: 34px; width: 42px; height: 42px; border-radius: 50%; background: rgba(131,214,255,0.62); box-shadow: 0 0 14px rgba(131,214,255,0.34); }
#pauseBtn { position: fixed; right: calc(100vw - var(--game-left, 0px) - var(--game-width, 100vw) + 86px); bottom: calc(100dvh - var(--game-top, 0px) - var(--game-height, 100dvh) + 12px); border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; background: rgba(0,0,0,0.36); backdrop-filter: blur(10px); cursor: pointer; z-index: 40; font-size: 13px; }
.overlay { display: none; position: fixed; z-index: 10; }
.overlay.active { display: block; }
.result-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
.result-stats div { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: rgba(255,255,255,0.04); }
.result-stats b { display: block; color: var(--muted); font-size: 12px; }
@media (max-width: 680px) {
  .panel { padding: 18px; border-radius: 8px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  #hud { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  #hud div { padding: 5px 6px; border-radius: 6px; }
  #hud b { font-size: 8px; }
  #hud span { font-size: 12px; }
  #stick { width: 92px; height: 92px; }
  #knob { left: 28px; top: 28px; width: 34px; height: 34px; }
  #pauseBtn { right: calc(100vw - var(--game-left, 0px) - var(--game-width, 100vw) + 72px); bottom: calc(100dvh - var(--game-top, 0px) - var(--game-height, 100dvh) + 8px); padding: 7px 10px; font-size: 12px; }
}
.result-stats .wide { grid-column: 1 / -1; word-break: break-word; }

.red-text { color: #ff4b4b; font-weight: 900; }
.upgrade-card img { width: 42px; height: 42px; object-fit: contain; display: block; margin-bottom: 8px; }
.oni-hud { color: #ff4b4b !important; text-shadow: 0 0 10px rgba(255,75,75,0.8); }
.result-panel { position: relative; overflow: hidden; }
.gold-fx { display: none; position: absolute; inset: 0; pointer-events: none; opacity: 0.9; background:
  radial-gradient(circle at 18% 22%, rgba(255, 231, 102, 0.28), transparent 4%),
  radial-gradient(circle at 78% 18%, rgba(255, 209, 102, 0.24), transparent 4%),
  radial-gradient(circle at 48% 8%, rgba(255, 255, 255, 0.20), transparent 3%),
  radial-gradient(circle at 28% 78%, rgba(255, 231, 102, 0.18), transparent 4%),
  radial-gradient(circle at 86% 66%, rgba(255, 209, 102, 0.18), transparent 5%);
  animation: goldPulse 1.4s ease-in-out infinite alternate;
}
.result-panel.fallback-gold .gold-fx { display: block; }
.result-panel.fallback-gold::before { content: ""; position: absolute; top: 14px; right: 18px; width: 68px; height: 52px; border-radius: 10px 10px 14px 14px; background: linear-gradient(to left top, #ffe766, #998100); box-shadow: 0 0 22px rgba(255, 231, 102, 0.45); opacity: 0.88; }
.result-panel.fallback-gold::after { content: "GOLD CHEST"; position: absolute; top: 73px; right: 15px; font-size: 10px; font-weight: 900; color: #ffe766; letter-spacing: 0.06em; }
@keyframes goldPulse { from { transform: translateY(0); opacity: 0.55; } to { transform: translateY(-4px); opacity: 0.95; } }

/* v5.2: upgrade/evolution visibility and mobile result safety */
#upgradeScreen {
  width: min(94vw, 920px);
  max-height: 92dvh;
  overflow: auto;
}
#upgradeHint {
  margin: 4px 0 10px;
  color: var(--warn);
  font-weight: 700;
}
.upgrade-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 188px;
}
.upgrade-card.will-evolve {
  border-color: var(--warn);
  background: rgba(255, 209, 102, 0.14);
  box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.18), 0 14px 40px rgba(255, 209, 102, 0.12);
}
.upgrade-card.has-evo-progress {
  border-color: rgba(131,214,255,0.42);
}
.upgrade-img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  display: block;
}
.upgrade-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.level-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--accent);
  background: rgba(0,0,0,0.22);
  font-weight: 900;
  font-size: 12px;
}
.evo-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 9px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  background: rgba(0,0,0,0.20);
}
.evo-box.ready {
  border-color: rgba(255, 209, 102, 0.75);
  background: rgba(255, 209, 102, 0.14);
}
.evo-box img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.evo-box b {
  display: block;
  color: var(--warn);
  font-size: 12px;
}
.evo-box span, .evo-box small {
  display: block;
  color: var(--text);
  line-height: 1.35;
  font-size: 12px;
}
.evo-box small {
  color: var(--muted);
}
.result-panel {
  overflow: auto;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.result-panel.fallback-gold::after {
  content: "GOLD CHEST";
  top: 70px;
  right: 12px;
  white-space: nowrap;
}
.result-panel > *:not(.gold-fx) {
  position: relative;
  z-index: 1;
}
@media (max-width: 680px) {
  #upgradeScreen { width: 94vw; padding: 14px; }
  .upgrade-card { min-height: 0; padding: 12px; }
  .upgrade-img { width: 44px; height: 44px; }
  .upgrade-title { align-items: flex-start; }
  .level-pill { font-size: 11px; padding: 3px 7px; }
  .evo-box { padding: 8px; }
  .result-panel { width: 94vw; max-height: 88dvh; padding: 16px; }
  .result-panel.fallback-gold::before { width: 52px; height: 40px; top: 10px; right: 12px; opacity: 0.75; }
  .result-panel.fallback-gold::after { top: 54px; right: 8px; font-size: 8px; }
  .result-stats { grid-template-columns: 1fr; gap: 8px; }
  .result-stats div { padding: 9px; }
  .result-panel .actions { position: sticky; bottom: 0; padding: 10px 0 0; background: linear-gradient(to top, rgba(18,23,38,0.98), rgba(18,23,38,0)); }
}

/* v5.5: compact extension selection and clickable gold chest */
#upgradeScreen {
  width: min(96vw, 900px);
  max-height: min(92dvh, 520px);
  padding: 14px;
}
#upgradeScreen h2 {
  margin: 0 0 6px;
  font-size: 20px;
}
#upgradeHint {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.35;
}
#upgradeOptions.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 0;
}
.upgrade-card {
  min-height: 0;
  padding: 9px;
  gap: 5px;
  border-radius: 8px;
}
.upgrade-title {
  gap: 5px;
  align-items: flex-start;
}
.upgrade-title b {
  font-size: 13px;
  line-height: 1.2;
}
.upgrade-img {
  width: 38px;
  height: 38px;
  margin-bottom: 0;
}
.upgrade-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.25;
  margin-top: 0 !important;
}
.level-pill {
  font-size: 10px;
  padding: 2px 5px;
  white-space: nowrap;
}
.evo-box {
  gap: 5px;
  padding: 6px;
  border-radius: 6px;
}
.evo-box img {
  width: 28px;
  height: 28px;
}
.evo-box b,
.evo-box span,
.evo-box small {
  font-size: 10px;
  line-height: 1.25;
}
.gold-chest-btn {
  position: relative;
  z-index: 2;
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 209, 102, 0.65);
  border-radius: 6px;
  padding: 8px 12px;
  color: #ffe766;
  background: rgba(255, 209, 102, 0.12);
  font-weight: 900;
  cursor: pointer;
}
.gold-chest-btn img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.gold-chest-btn:hover { background: rgba(255, 209, 102, 0.20); }
@media (max-width: 680px) {
  #upgradeScreen {
    width: 96vw;
    max-height: 88dvh;
    padding: 10px;
  }
  #upgradeScreen h2 { font-size: 16px; }
  #upgradeHint { font-size: 10px; }
  #upgradeOptions.grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }
  .upgrade-card {
    padding: 6px;
    gap: 4px;
    border-radius: 6px;
  }
  .upgrade-img { width: 30px; height: 30px; }
  .upgrade-title { display: block; }
  .upgrade-title b { display: block; font-size: 11px; }
  .level-pill { display: inline-block; margin-top: 2px; font-size: 9px; padding: 1px 4px; }
  .upgrade-desc { font-size: 9px; line-height: 1.2; -webkit-line-clamp: 2; }
  .evo-box { padding: 4px; gap: 3px; }
  .evo-box img { width: 20px; height: 20px; }
  .evo-box b, .evo-box span, .evo-box small { font-size: 8.5px; line-height: 1.15; }
  .gold-chest-btn { float: none; width: 100%; justify-content: center; margin-bottom: 8px; padding: 8px 10px; }
}

/* v5.6: compact title/hero selection and confetti fallback */
#startScreen {
  width: min(96vw, 860px);
  max-height: 94dvh;
  overflow: auto;
  padding: 18px;
}
#startScreen .brand { margin-bottom: 4px; font-size: 12px; }
#startScreen h1 { font-size: clamp(25px, 5vw, 42px); margin: 0 0 6px; }
#startScreen .lead { font-size: 14px; line-height: 1.45; margin: 0 0 12px; }
#startScreen .grid.two { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
#startScreen .hero-card { min-height: 0; padding: 9px; border-radius: 6px; text-align: center; }
#startScreen .hero-img { width: 46px; height: 46px; margin: 0 auto 5px; }
#startScreen .hero-icon { font-size: 23px; margin: 0 0 5px; }
#startScreen .hero-card b { display: block; font-size: 12px; line-height: 1.2; }
#startScreen .hero-card small { font-size: 10px; line-height: 1.25; margin-top: 3px; }
#startScreen .actions { gap: 7px; margin-top: 10px; }
#startScreen .actions button { padding: 9px 12px; min-height: 40px; }
#startScreen .score-line { margin-top: 7px; font-size: 12px; }
.local-confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100dvh; pointer-events: none; z-index: 99999; }
@media (max-width: 680px) {
  #startScreen { width: 96vw; max-height: 92dvh; padding: 12px; }
  #startScreen .lead { font-size: 12px; }
  #startScreen .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  #startScreen .hero-card { padding: 7px; }
  #startScreen .hero-img { width: 38px; height: 38px; }
  #startScreen .hero-card b { font-size: 11px; }
  #startScreen .hero-card small { font-size: 9px; }
  #startScreen .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  #startScreen .actions button { padding: 8px 10px; min-height: 36px; font-size: 12px; width: 100%; }
}
@media (max-height: 560px) {
  #startScreen { padding: 10px; }
  #startScreen h1 { font-size: 24px; }
  #startScreen .lead { display: none; }
  #startScreen .hero-img { width: 32px; height: 32px; }
  #startScreen .hero-card small { display: none; }
}

/* v5.7: guaranteed confetti overlay for GoldChest fallback */
.local-confetti {
  position: fixed;
  inset: 0;
  z-index: 999999;
  pointer-events: none;
}


/* v5.8: automatic GoldChest and topmost confetti */
.gold-chest-btn { display: none !important; }
#confetti-canvas, .local-confetti {
  z-index: 2147483647 !important;
  pointer-events: none !important;
  position: fixed !important;
}

/* v5.9 result build icon UI */
.result-stats .build-box { padding-bottom: 10px; }
.build-icons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.build-icon { width: 58px; min-height: 66px; border: 1px solid rgba(255,255,255,0.12); border-radius: 6px; background: rgba(255,255,255,0.045); display: grid; place-items: center; padding: 5px 4px 4px; position: relative; overflow: hidden; }
.build-icon img { width: 32px; height: 32px; object-fit: contain; display: block; }
.build-icon em { position: absolute; top: 3px; right: 3px; min-width: 24px; padding: 1px 4px; border-radius: 6px; background: rgba(0,0,0,0.72); color: #fff0a6; font-style: normal; font-size: 9px; font-weight: 900; line-height: 1.3; text-align: center; }
.build-icon small { width: 100%; display: block; margin-top: 3px; color: rgba(255,255,255,0.78); font-size: 8px; line-height: 1.1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.build-icon.awakened { border-color: rgba(255, 215, 102, 0.8); box-shadow: 0 0 14px rgba(255, 215, 102, 0.24); background: linear-gradient(160deg, rgba(255,215,102,0.17), rgba(255,255,255,0.04)); }
.build-icon.awakened em { background: #ffe066; color: #261d00; }
@media (max-width: 640px) {
  .build-icons { gap: 6px; }
  .build-icon { width: 50px; min-height: 60px; border-radius: 6px; }
  .build-icon img { width: 28px; height: 28px; }
  .build-icon small { font-size: 7px; }
  .build-icon em { font-size: 8px; }
}


/* v6.0 audio controls */
#audioBtn { position: fixed; touch-action: manipulation; right: calc(100vw - var(--game-left, 0px) - var(--game-width, 100vw) + 12px); bottom: calc(100dvh - var(--game-top, 0px) - var(--game-height, 100dvh) + 12px); border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; background: rgba(0,0,0,0.36); backdrop-filter: blur(10px); cursor: pointer; font-size: 13px; z-index: 40; }
.audio-panel { display: none; touch-action: auto; position: fixed; right: calc(100vw - var(--game-left, 0px) - var(--game-width, 100vw) + 12px); bottom: calc(100dvh - var(--game-top, 0px) - var(--game-height, 100dvh) + 58px); z-index: 41; width: 190px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(10, 14, 26, 0.92); box-shadow: 0 12px 36px rgba(0,0,0,0.35); backdrop-filter: blur(12px); }
.audio-panel.active { display: grid; gap: 8px; }
.audio-panel label { display: grid; grid-template-columns: 38px 1fr; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.audio-panel input[type=range] { width: 100%; touch-action: auto; }
.audio-panel button { touch-action: manipulation; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: rgba(255,255,255,0.08); font-size: 12px; }
@media (max-width: 680px) {
  #audioBtn { right: calc(100vw - var(--game-left, 0px) - var(--game-width, 100vw) + 8px); bottom: calc(100dvh - var(--game-top, 0px) - var(--game-height, 100dvh) + 8px); padding: 7px 10px; font-size: 12px; }
  .audio-panel { width: 168px; bottom: calc(100dvh - var(--game-top, 0px) - var(--game-height, 100dvh) + 50px); right: calc(100vw - var(--game-left, 0px) - var(--game-width, 100vw) + 8px); padding: 8px; }
}


/* v6.2 mobile audio control fixes */
#audioBtn, .audio-panel { z-index: 2147483600 !important; pointer-events: auto !important; }
.audio-panel, .audio-panel * { -webkit-user-select: auto; user-select: auto; -webkit-touch-callout: default; }
.audio-panel input[type=range] { touch-action: pan-x !important; -webkit-user-select: auto; user-select: auto; accent-color: #83d6ff; }
.audio-panel button, #audioBtn { touch-action: manipulation !important; }

/* v6.10 leaderboard */
#startScreen .actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 680px) {
  #startScreen .actions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  #startScreen .actions button { padding: 8px 6px; font-size: 11px; }
}
.leaderboard-panel { width: min(640px, 94vw); max-height: 88dvh; overflow: auto; }
.leaderboard-list, .leaderboard-mini { margin-top: 10px; }
.leaderboard-table { width: 100%; border-collapse: collapse; overflow: hidden; border-radius: 6px; border: 1px solid var(--line); background: rgba(255,255,255,0.035); }
.leaderboard-table th, .leaderboard-table td { padding: 9px 8px; border-bottom: 1px solid rgba(255,255,255,0.08); text-align: left; font-size: 13px; }
.leaderboard-table th { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.leaderboard-table td:first-child, .leaderboard-table th:first-child { width: 42px; text-align: center; }
.leaderboard-table td:nth-child(3), .leaderboard-table th:nth-child(3) { text-align: right; }
.ranking-submit { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,0.04); }
.ranking-submit h3 { margin: 0 0 8px; font-size: 15px; }
.ranking-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.ranking-form input { min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; color: var(--text); background: rgba(0,0,0,0.24); font: inherit; }
.ranking-form button:disabled { opacity: .55; cursor: wait; }
.ranking-message { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.ranking-message.error { color: #ff9a9a; }
@media (max-width: 640px) {
  .leaderboard-table th, .leaderboard-table td { padding: 7px 5px; font-size: 11px; }
  .leaderboard-table th { font-size: 9px; }
  .ranking-submit { padding: 9px; }
  .ranking-form { grid-template-columns: 1fr; }
}


/* v6.11 slow field and cleaner result UI */
.result-panel {
  width: min(620px, 94vw);
  max-height: 88dvh;
}
.result-panel h2 {
  margin-bottom: 6px;
}
#resultSummary {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.result-stats {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.result-stats div {
  padding: 9px 10px;
  border-radius: 6px;
}
.result-stats b {
  margin-bottom: 3px;
  font-size: 10px;
  letter-spacing: .05em;
}
.result-score-main {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 2px 10px;
  background: linear-gradient(135deg, rgba(131,214,255,.14), rgba(255,209,102,.08)) !important;
  border-color: rgba(131,214,255,.30) !important;
}
.result-score-main b {
  grid-column: 1 / -1;
}
.result-score-main strong {
  font-size: 34px;
  line-height: .95;
  color: #fff0a6;
  letter-spacing: .02em;
}
.result-score-main span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.result-stats .build-box {
  padding: 8px 10px 10px;
}
.build-icons {
  gap: 6px;
  margin-top: 6px;
}
.build-icon {
  width: 50px;
  min-height: 56px;
}
.build-icon img {
  width: 28px;
  height: 28px;
}
.ranking-submit {
  margin-top: 10px;
  padding: 10px;
}
.ranking-submit h3 {
  font-size: 13px;
  margin-bottom: 6px;
}
.leaderboard-mini .leaderboard-table th,
.leaderboard-mini .leaderboard-table td {
  padding: 6px 5px;
  font-size: 11px;
}
@media (max-width: 680px) {
  .result-panel { width: 94vw; max-height: 88dvh; padding: 14px; }
  .result-stats { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .result-score-main strong { font-size: 28px; }
  .result-score-main span { font-size: 11px; }
  .result-stats div { padding: 8px; }
  .result-stats b { font-size: 9px; }
  .build-icon { width: 46px; min-height: 54px; }
  .build-icon img { width: 26px; height: 26px; }
  .ranking-submit { padding: 8px; margin-top: 8px; }
}

/* v6.13: hero detail panel */
.hero-detail {
  margin: 8px 0 6px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.22);
  border-radius: 6px;
  text-align: left;
}
.hero-detail-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 5px; }
.hero-detail-head b { font-size: 13px; }
.hero-detail-head span { color: var(--muted); font-size: 11px; }
.hero-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin-bottom: 5px; }
.hero-stats span { display: block; padding: 3px 4px; border-radius: 4px; background: rgba(255,255,255,0.06); font-size: 10px; text-align: center; white-space: nowrap; }
.hero-skill { color: #e9f7ff; font-size: 11px; line-height: 1.35; display: flex; align-items: center; gap: 8px; padding: 5px 6px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.05); border-radius: 6px; }
.hero-skill-icon { width: 30px; height: 30px; object-fit: contain; flex: 0 0 auto; border-radius: 4px; background: rgba(0,0,0,0.22); border: 1px solid rgba(255,255,255,0.13); }
.hero-skill b { display: block; font-size: 10px; color: var(--muted); margin-bottom: 1px; }
.hero-skill span { display: block; }
@media (max-width: 680px) {
  .hero-detail { margin-top: 6px; padding: 7px; }
  .hero-detail-head b { font-size: 12px; }
  .hero-detail-head span { font-size: 10px; }
  .hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
  .hero-stats span { font-size: 9px; padding: 2px 3px; }
  .hero-skill { font-size: 10px; gap: 6px; padding: 4px 5px; }
  .hero-skill-icon { width: 26px; height: 26px; }
}
@media (max-height: 560px) {
  .hero-detail { display: none; }
}
