/* Moonlit observatory: centered heroes, one continuous mat, quiet modern chrome. */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --glow-gold: 0 0 20px #e5b67430;
  --glow-mana: 0 0 18px #68cce63d;
}
body { background: #080f1c; }

.bg-layer .bg-glow, .bg-layer .floating-orbs { display: none; }
#screenGame { --battle-width: 1200px; color: #e1e9f2; }
#screenGame.active { padding: 12px 0 !important; }
#screenGame::after { display: none; }
#screenGame.active .game-wrapper,
#screenGame.active .game-wrapper.with-mechanics {
  max-width: min(var(--battle-width), calc(100vw - 32px)) !important;
  min-height: 820px; height: max(100%, 820px) !important;
  grid-template-rows: 44px 108px minmax(128px, 1fr) 44px minmax(128px, 1fr) 108px minmax(132px, 1fr);
  padding: 12px 24px 16px !important; gap: 4px !important;
  border: 1px solid #9cb4ce33; border-radius: 28px;
  background: linear-gradient(155deg, #172536f5, #0c1522f5 48%, #182432f5) !important;
  box-shadow: 0 22px 70px #0008, inset 0 1px #d5e6ff14;
  isolation: isolate;
}
#screenGame.active .game-wrapper.with-tutorial-info {
  min-height: 888px; height: max(100%, 888px) !important;
  grid-template-rows: 44px 68px 108px minmax(128px, 1fr) 44px minmax(128px, 1fr) 108px minmax(132px, 1fr);
}
#screenGame .arena-surface {
  grid-column: 1; grid-row: enemy-board-start / player-board-end;
  position: relative; z-index: 0; pointer-events: none;
  margin: -8px 8px; border: 1px solid #c5d9e94d; border-radius: 36px;
  background:
    radial-gradient(ellipse at 50% 48%, #82929b99, transparent 68%),
    radial-gradient(ellipse at 4% 0%, #78c3d755, transparent 47%),
    radial-gradient(ellipse at 96% 100%, #d6b88733, transparent 47%),
    repeating-linear-gradient(140deg, #ffffff02 0 1px, transparent 1px 8px),
    linear-gradient(160deg, #344d61, #526777 52%, #31475a);
  box-shadow: inset 0 0 0 7px #0e21394d, inset 0 0 55px #00152966, 0 10px 25px #0005;
}
#screenGame .arena-surface::before {
  content: ""; position: absolute; inset: 10px; border: 1px solid #cadfe61c; border-radius: 28px;
}
#screenGame .arena-surface::after {
  content: ""; position: absolute; width: 170px; height: 170px; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(45deg); border: 1px solid #c4e4ec12; border-radius: 28px;
  box-shadow: 0 0 0 18px #c4e4ec05, 0 0 0 38px #c4e4ec04;
}
#screenGame .game-header {
  position: relative; z-index: 3; padding: 0 4px 8px; flex-wrap: nowrap; gap: 12px;
  border-bottom: 1px solid #b3c8df14;
}
#screenGame .logo {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-display); font-size: 17px; font-weight: 750;
  text-transform: uppercase; letter-spacing: .12em; text-shadow: none; color: #eef4fd;
}
#screenGame .logo-mark { width: 23px; height: 23px; flex-shrink: 0; color: #9bd9d0; }
#screenGame .btn-icon { width: 34px; height: 34px; border-radius: 10px; border-color: #c3d4e624; background: #ffffff08; font-size: 18px; }
#screenGame .mode-badge { background: #c7d7ee0a; border: 1px solid #bdcfe221; border-radius: 8px; font-size: 10px; letter-spacing: .02em; color: #aabbcf; }
#screenGame .turn-info { border: 1px solid #a5bed822; border-radius: 10px; background: #0a132080; padding: 6px 10px; gap: 12px; font-size: 12px; font-weight: 650; box-shadow: none; }
#screenGame #turnNumber { color: #859bb4; font-size: 10px; font-variant-numeric: tabular-nums; }
#screenGame #turnLabel.player-turn { color: #9fe7d9; }
#screenGame #turnLabel.enemy-turn { color: #dcb0aa; }
#screenGame .hero-zone {
  display: grid; grid-template-columns: minmax(0, 1fr) 96px 112px 96px minmax(0, 1fr);
  grid-template-rows: 108px; gap: 10px; padding: 0 32px; align-items: center; position: relative; z-index: 3;
}
#screenGame .hero-zone > .hero-portrait { grid-column: 3; grid-row: 1; justify-self: center; }
#screenGame .hero-zone > .mana-bar { grid-column: 1 / 3; grid-row: 1; justify-self: start; margin: 0; }
#screenGame .hero-zone > .deck-zone { grid-column: 5; grid-row: 1; justify-self: end; margin: 0; }
#screenGame .hero-zone > .hero-power-wrap { grid-column: 4; grid-row: 1; justify-self: start; }
#screenGame #playerHero, #screenGame #enemyHero {
  display: grid; grid-template-columns: 1fr; grid-template-rows: 76px 14px;
  width: 108px; min-width: 0; max-width: 108px; height: 104px; padding: 5px 7px;
  gap: 3px; align-items: center; justify-items: center; overflow: visible;
  border: 1px solid #a7c3d86b !important; border-radius: 48px 48px 18px 18px !important;
  background: linear-gradient(160deg, #375268, #0c1c2b 75%) !important;
  box-shadow: 0 7px 15px #0006, inset 0 1px #d8efff33 !important;
}
#screenGame .hero-zone .hero-avatar { grid-column: 1; grid-row: 1; filter: none; }
#screenGame .hero-zone .hero-avatar-image {
  width: 76px; height: 76px; border-radius: 40px 40px 15px 15px;
  border: 1px solid #c6d8e65c; box-shadow: 0 2px 10px #0005;
}
#screenGame .hero-zone .hero-name { grid-column: 1; grid-row: 2; max-width: 88px; font-size: 10px; font-weight: 650; color: #d6e1ed; opacity: 1; }
#screenGame .hero-zone .hero-hp {
  grid-column: auto; grid-row: auto; position: absolute; right: -8px; bottom: 14px;
  width: 30px; height: 32px; margin: 0; border-radius: 12px;
  border: 2px solid #dfdbcd; background: linear-gradient(145deg, #ef7c79, #9e3048) !important;
  box-shadow: 0 3px 7px #0007 !important; font-size: 16px; font-weight: 750; font-variant-numeric: tabular-nums;
}
#screenGame #playerHero.hero-turn-active:not(.targetable):not(.battle-attack-target),
#screenGame #enemyHero.hero-turn-active:not(.targetable):not(.battle-attack-target) {
  border-color: #9de9df !important;
  box-shadow: 0 0 0 2px #8de8d84d, 0 0 26px #66d9c53b, 0 7px 18px #0007 !important;
}
#screenGame .hero-turn-active .hero-avatar-image { border-color: #aaf5e2; filter: brightness(1.08); }
#screenGame .hero-portrait.targetable { outline: 3px solid #ffaaa0 !important; outline-offset: 3px; }
#screenGame .hero-zone .hero-power-wrap { width: 96px; flex-direction: row; gap: 5px; }
#screenGame .hero-zone .hero-power-btn {
  width: 62px; height: 62px; padding: 4px; border: 1px solid #9cc3de7a;
  background: radial-gradient(circle at 40% 25%, #365f7b, #15283a 75%); box-shadow: 0 5px 14px #0004;
}
#screenGame .hero-power-btn .hp-label { font-size: 8px; letter-spacing: .02em; }
#screenGame .hero-power-btn .hp-icon { font-size: 22px; }
#screenGame .hero-power-btn .hp-cost { width: 20px; height: 20px; font-size: 11px; border: 1px solid #c1dff7; }
#screenGame .hero-power-btn.mode-heal { background: radial-gradient(circle at 40% 25%, #33675c, #142d32 75%); border-color: #83d6bc8c; }
#screenGame .mana-bar { gap: 8px; padding: 8px 10px; border-radius: 10px; background: #0a1423b3; border: 1px solid #8db1d63d; box-shadow: inset 0 1px #ffffff08; }
#screenGame .mana-crystals { max-width: 152px; gap: 4px; }
#screenGame .crystal { width: 10px; height: 14px; border: 0 !important; background: linear-gradient(135deg, #c8efff, #4b9ae0) !important; box-shadow: 0 0 8px #70c3ff59 !important; }
#screenGame .crystal.spent { background: #263d55 !important; box-shadow: none !important; opacity: .7; }
#screenGame .mana-text { min-width: 30px; font-size: 12px; font-weight: 700; color: #b4d9fa; text-shadow: none; font-variant-numeric: tabular-nums; }
#screenGame .deck-stack { width: 42px; height: 58px; }
#screenGame .deck-zone { gap: 5px; }
#screenGame .deck-stack .card-back {
  border: 1px solid #81a4bc; background: url('assets/ui/card-back.svg') center / cover no-repeat;
  border-radius: 8px; box-shadow: 2px 3px 8px #0006;
}
#screenGame .deck-stack .card-back::before, #screenGame .deck-stack .card-back::after { display: none; }
#screenGame .deck-count { right: -5px; bottom: -4px; min-width: 22px; padding: 2px 4px; font-size: 11px; background: #14283b; color: #dbe8f4; border: 1px solid #91b7cf6b; border-radius: 7px; }
#screenGame .deck-label { font-size: 9px; color: #94a8be; opacity: 1; font-weight: 500; }
#screenGame.active .board { position: relative; z-index: 1; margin: 0 62px; padding: 12px !important; background: none; border: 0; border-radius: 14px; }
#screenGame .board-divider { position: relative; z-index: 2; margin: 0; padding: 0 150px; justify-content: center; gap: 20px; height: auto !important; min-height: 44px; background: none !important; box-shadow: none; }
#screenGame .divider-text { color: #d2e4ef; opacity: .4; font-size: 9px; font-weight: 650; letter-spacing: .24em; }
#screenGame .divider-line { background: linear-gradient(90deg, transparent, #cae9f733, transparent); }
#screenGame .turn-timer-visual { position: absolute; left: 20px; top: 50%; width: 36px; height: 36px; margin: 0; transform: translateY(-50%); }
#screenGame .timer-ring { width: 100%; height: 100%; }
#screenGame .timer-paw { font-size: 12px; }
#screenGame #endTurnBtn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%); margin: 0;
  width: 112px; min-height: 46px; padding: 8px !important;
  border: 1px solid #f1cd8d; border-radius: 13px;
  background: linear-gradient(145deg, #f1c67f, #c9924a); color: #36230f;
  box-shadow: 0 4px 12px #0005, 0 0 20px #d8ae6233;
  font-size: 11px !important; line-height: 1.15; font-weight: 800; letter-spacing: .04em;
}
#screenGame #endTurnBtn:hover:not(:disabled) { transform: translateY(-50%); filter: brightness(1.1); }
#screenGame #endTurnBtn:active:not(:disabled) { transform: translateY(-50%) scale(.98); }
#screenGame #endTurnBtn:disabled { background: #263646; color: #7b91a8; border-color: #718ba633; opacity: .75; box-shadow: none; filter: none; }
#screenGame #endTurnBtn::before { display: none; }
#screenGame.active .hand-zone { position: relative; z-index: 2; margin: 0 40px; background: radial-gradient(ellipse at 50% 100%, #79b8d40c, transparent 70%); border-radius: 20px; }
#screenGame #turnBanner { border-color: #9ae2dd !important; background: linear-gradient(145deg, #223c50f5, #102334f5) !important; box-shadow: 0 12px 35px #0007, 0 0 30px #6fd8cf26 !important; color: #d9f7f1; border-radius: 18px; }
#screenGame #turnBanner .turn-banner-text { font-family: var(--font-display); font-weight: 700; letter-spacing: .02em; text-shadow: none; }
#screenGame .turn-banner-icon svg { display: block; width: 28px; height: 28px; }
#screenGame .battle-info { border-color: #a0c5e326; background: #0c1928db; }
#screenGame .battle-log {
  width: 176px; max-width: calc(100% - 24px); border: 1px solid #a2bed92e; border-radius: 15px;
  background: #101d2dee; color: #d9e5f1; box-shadow: 0 12px 35px #0005;
  backdrop-filter: blur(16px);
}
#screenGame .battle-log summary { padding: 12px; font-size: 12px; font-weight: 600; gap: 8px; }
#screenGame .battle-log summary:hover { background: #a6dbf608; }
#screenGame .battle-log-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
#screenGame .battle-log-mark { width: 14px; height: 14px; color: #88cbbf; flex-shrink: 0; }
#screenGame .battle-log-arrow { color: #7390aa; }
#screenGame #battleLogCount { padding: 2px 5px; min-width: 20px; border-radius: 5px; background: #8bbec713; color: #9ebdce; font-size: 10px; font-weight: 650; text-align: center; font-variant-numeric: tabular-nums; }
#screenGame .battle-log[open] { width: 304px; }
#screenGame .battle-log .game-log, #screenGame .battle-log .game-log:hover {
  padding: 6px 8px 10px; max-height: min(520px, 70dvh) !important;
  border-top: 1px solid #a2bed918; background: none; opacity: 1;
  backdrop-filter: none; font-size: 12px; line-height: 1.5;
}
#screenGame .game-log .log-entry { margin: 0; padding: 10px 5px; border: 0; background: none; }
#screenGame .game-log .log-event { display: grid; grid-template-columns: 23px minmax(0, 1fr); gap: 8px; border-bottom: 1px solid #c9e4fa0b; }
#screenGame .log-event-icon { display: flex; align-items: center; justify-content: center; width: 23px; height: 23px; border-radius: 7px; background: #8ea9c313; color: #8da4bc; font-size: 14px; }
#screenGame .log-event-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 3px; color: #6f8ca7; font-size: 9px; font-weight: 650; letter-spacing: .035em; }
#screenGame .log-event-meta time { color: #56728c; font-weight: 500; letter-spacing: 0; font-variant-numeric: tabular-nums; }
#screenGame .log-event-text { margin: 0; color: #c1d0df; font-size: 11px; font-weight: 450; line-height: 1.5; overflow-wrap: anywhere; }
#screenGame .log-event.combat .log-event-icon { background: #f29a8b14; color: #e8a094; }
#screenGame .log-event.play .log-event-icon { background: #73d5bd13; color: #87d8c6; }
#screenGame .log-event.turn .log-event-icon { background: #e6bf7c13; color: #dfbd86; }
#screenGame .log-event.turn .log-event-text { color: #d7c29c; font-weight: 600; }
#screenGame .log-count { color: #8fd2c3; font-size: 10px; padding: 1px 4px; border-radius: 4px; background: #6acbb815; }
#screenGame .log-empty { color: #7993aa; padding: 18px 12px; font-size: 12px; }
@media (min-width: 1600px) {
  #screenGame .battle-log { top: 24px; }
  #screenGame .battle-log[open] { width: min(304px, calc((100vw - var(--battle-width)) / 2 - 24px)); }
}
@media (max-width: 900px) {
  #screenGame .hero-zone { padding: 0 12px; grid-template-columns: minmax(0, 1fr) 80px 112px 80px minmax(0, 1fr); }
  #screenGame .mana-crystals { max-width: 90px; gap: 3px; }
  #screenGame .hero-zone .hero-power-wrap { width: 80px; }
  #screenGame .hero-zone .hero-power-btn { width: 52px; height: 52px; }
  #screenGame.active .board { margin: 0 44px; }
  #screenGame.active .hand-zone { margin: 0 12px; }
}
@media (max-width: 640px) {
  #screenGame.active { padding: 6px 0 !important; }
  #screenGame.active .game-wrapper, #screenGame.active .game-wrapper.with-mechanics {
    max-width: calc(100vw - 12px) !important; min-height: 860px;
    height: max(100%, 860px) !important; padding: 10px 8px 14px !important; border-radius: 20px;
    grid-template-rows: auto 92px minmax(128px, 1fr) 44px minmax(128px, 1fr) 92px minmax(132px, 1fr);
  }
  #screenGame.active .game-wrapper.with-tutorial-info { min-height: 928px; height: max(100%, 928px) !important; grid-template-rows: auto 68px 92px minmax(128px, 1fr) 44px minmax(128px, 1fr) 92px minmax(132px, 1fr); }
  #screenGame .game-header { gap: 6px; flex-wrap: wrap; }
  #screenGame .logo { font-size: 12px; letter-spacing: .08em; }
  #screenGame .mode-badge { max-width: 95px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #screenGame .turn-info { margin-left: auto; font-size: 10px; padding: 5px 6px; gap: 6px; }
  #screenGame .hero-zone { grid-template-columns: minmax(0, 1fr) 52px 88px 52px minmax(0, 1fr); grid-template-rows: 92px; gap: 5px; padding: 0 4px; }
  #screenGame #playerHero, #screenGame #enemyHero { width: 84px; max-width: 84px; height: 88px; grid-template-rows: 60px 12px; padding: 5px; gap: 2px; border-radius: 38px 38px 14px 14px !important; }
  #screenGame .hero-zone .hero-avatar-image { width: 60px; height: 60px; border-radius: 30px 30px 12px 12px; }
  #screenGame .hero-zone .hero-name { max-width: 68px; font-size: 8px; }
  #screenGame .hero-zone .hero-hp { width: 25px; height: 27px; font-size: 13px; right: -5px; bottom: 12px; border-radius: 9px; }
  #screenGame .hero-zone .hero-power-wrap { width: 52px; flex-direction: column; gap: 2px; }
  #screenGame .hero-zone .hero-power-btn { width: 44px; height: 44px; }
  #screenGame .hero-power-btn .hp-icon { font-size: 17px; }
  #screenGame .hero-power-btn .hp-label { font-size: 6px; }
  #screenGame .mana-crystals { display: none; }
  #screenGame .mana-bar { padding: 7px; }
  #screenGame .mana-text { font-size: 11px; }
  #screenGame .deck-stack { width: 29px; height: 41px; }
  #screenGame .deck-label { font-size: 7px; }
  #screenGame.active .board { margin: 0 7px; }
  #screenGame .arena-surface { margin-left: 0; margin-right: 0; border-radius: 22px; }
  #screenGame .board-divider { padding: 0 100px 0 55px; gap: 6px; }
  #screenGame .divider-text { font-size: 7px; letter-spacing: .06em; }
  #screenGame #endTurnBtn { width: 86px; right: 2px; min-height: 40px; font-size: 9px !important; padding: 5px !important; }
  #screenGame .turn-timer-visual { left: 9px; width: 30px; height: 30px; }
  #screenGame.active .hand-zone { margin: 0; }
}
