:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f3f0df;
  background: #0f110d;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(8,10,7,.36), rgba(8,10,7,.5)),
    url('battle-bg-q85.webp?v=12') center center / cover fixed no-repeat;
}
button { font: inherit; }
.game-shell { width: min(1180px, 100%); min-height: 100vh; margin: 0 auto; padding: 20px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.eyebrow { margin: 0 0 6px; color: #d4d9b3; font-size: 12px; font-weight: 800; letter-spacing: .18em; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(30px, 5vw, 54px); text-shadow: 0 2px 6px rgba(0,0,0,.8); }
.run-status { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.run-status span { padding: 8px 10px; border: 1px solid rgba(120,130,100,.5); border-radius: 999px; background: rgba(15,18,13,.78); color: #e7ead8; font-size: 13px; backdrop-filter: blur(3px); }
.battle-view { display: grid; gap: 18px; min-height: calc(100vh - 120px); grid-template-rows: minmax(310px, 1fr) auto; }
.enemy-zone { position: relative; display: grid; place-items: center; padding: 22px; border: 1px solid rgba(120,130,100,.35); border-radius: 28px; overflow: hidden; background: rgba(13,16,12,.12); backdrop-filter: blur(1px); }
.enemy-zone::after { display: none; }
.enemy-zone::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.03), rgba(0,0,0,.16)); }
.intent { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); z-index: 3; padding: 10px 14px; border-radius: 999px; background: rgba(13,15,12,.82); border: 1px solid rgba(110,120,90,.55); font-weight: 800; font-size: 14px; backdrop-filter: blur(3px); }
.enemy-card { position: relative; z-index: 2; width: min(280px, 80vw); text-align: center; padding: 26px; border-radius: 24px; background: rgba(23,26,20,.72); border: 1px solid rgba(110,120,90,.5); box-shadow: 0 28px 55px rgba(0,0,0,.3); backdrop-filter: blur(3px); }
.enemy-emoji { font-size: 90px; filter: drop-shadow(0 12px 20px rgba(0,0,0,.35)); }
.enemy-card h2 { margin: 8px 0 14px; font-size: 25px; }
.hp-row { display: flex; justify-content: space-between; font-size: 13px; color: #d4d7c7; }
.bar { height: 10px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: rgba(9,10,8,.88); }
.bar-fill { width: 100%; height: 100%; border-radius: inherit; background: #9aaa5d; transition: width .25s ease; }
.summons { position: absolute; right: 18px; bottom: 18px; z-index: 3; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: 45%; }
.summon-chip { padding: 8px 10px; border-radius: 14px; background: rgba(23,26,20,.8); border: 1px solid rgba(110,120,90,.5); font-size: 12px; backdrop-filter: blur(3px); }
.player-zone { padding: 2px 0 0; }
.player-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-bottom: 10px; }
.stat-card { padding: 10px 12px; border-radius: 14px; background: rgba(23,26,20,.76); border: 1px solid rgba(100,110,85,.45); backdrop-filter: blur(3px); }
.stat-card span { display: block; color: #c2c8b5; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.stat-card strong { display: block; margin-top: 2px; font-size: 18px; }
.energy strong { color: #f2d46f; }
.poison strong { color: #b9a9f0; }
.combat-log { min-height: 24px; margin: 8px 0 10px; color: #ecefdf; font-size: 13px; text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,.9); }
.hand-controls { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px; align-items: end; margin-top: 18px; }
.hand { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: stretch; justify-content: center; overflow: visible; padding: 6px 2px 12px; }
.card { width: 100%; min-width: 0; min-height: 206px; display: flex; flex-direction: column; padding: 12px; border-radius: 16px; border: 1px solid rgba(120,130,100,.55); background: linear-gradient(180deg, rgba(36,41,31,.9), rgba(21,24,18,.9)); color: #f3f0df; text-align: left; cursor: pointer; transition: transform .14s ease, border-color .14s ease, opacity .14s ease; box-shadow: 0 10px 24px rgba(0,0,0,.24); backdrop-filter: blur(3px); }
.card:hover { transform: translateY(-5px); border-color: #b8c47c; }
.card:disabled { cursor: not-allowed; opacity: .42; transform: none; }
.card-cost { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #d5b853; color: #17130b; font-weight: 900; }
.card-type { margin-top: 10px; color: #c5cbb7; font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.card h3 { margin: 5px 0 8px; font-size: clamp(14px, 1.6vw, 18px); }
.card p { margin: auto 0 0; color: #e0e4d3; line-height: 1.35; font-size: clamp(10px, 1.15vw, 12px); }
.controls { display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; padding-bottom: 12px; }
.controls .primary-button, .controls .secondary-button { width: 100%; }
.primary-button, .secondary-button { min-height: 46px; padding: 0 18px; border-radius: 14px; cursor: pointer; font-weight: 850; }
.primary-button { border: 1px solid #b6c373; background: rgba(154,170,93,.92); color: #11130d; }
.secondary-button { border: 1px solid rgba(100,110,85,.5); background: rgba(23,26,20,.82); color: #e8e8dc; backdrop-filter: blur(3px); }
.overlay-panel { min-height: calc(100vh - 120px); display: grid; place-items: center; align-content: center; text-align: center; padding: 30px 16px; border: 1px solid rgba(100,110,85,.45); border-radius: 28px; background: rgba(18,20,15,.82); backdrop-filter: blur(4px); }
.overlay-panel h2 { font-size: clamp(30px, 6vw, 52px); margin-bottom: 10px; }
.reward-cards { width: 100%; display: flex; gap: 12px; justify-content: center; overflow-x: auto; padding: 18px 0 22px; }
.reward-cards .card { flex: 0 0 170px; width: 170px; }
.deck-list { display: grid; gap: 8px; }
.deck-row { display: flex; justify-content: space-between; gap: 20px; padding: 10px 12px; border-radius: 12px; background: rgba(27,31,24,.86); }
.hidden { display: none !important; }
dialog { width: min(560px, calc(100vw - 28px)); max-height: 80vh; overflow: auto; border: 1px solid #4b523e; border-radius: 22px; padding: 18px; background: rgba(17,20,15,.94); color: #f3f0df; }
dialog::backdrop { background: rgba(0,0,0,.7); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.dialog-head h2 { margin: 0; }
.icon-button { width: 38px; height: 38px; border-radius: 50%; border: 1px solid #3d4335; background: #191c16; color: white; cursor: pointer; font-size: 24px; }

@media (orientation: landscape) and (max-height: 700px) {
  body { background-attachment: scroll; }
  .game-shell { width: 100%; max-width: none; padding: 10px 14px; }
  .topbar { margin-bottom: 8px; }
  h1 { font-size: clamp(22px, 3vw, 34px); }
  .battle-view { gap: 8px; min-height: auto; grid-template-rows: minmax(185px, 1fr) auto; }
  .enemy-zone { min-height: 185px; padding: 10px; border-radius: 18px; }
  .enemy-card { width: min(210px, 30vw); padding: 12px; }
  .enemy-emoji { font-size: 52px; }
  .enemy-card h2 { margin: 2px 0 8px; font-size: 18px; }
  .intent { top: 8px; padding: 6px 10px; font-size: 12px; }
  .player-stats { margin-bottom: 5px; gap: 6px; }
  .stat-card { padding: 6px 8px; }
  .stat-card strong { font-size: 15px; }
  .combat-log { margin: 3px 0 5px; min-height: 18px; font-size: 11px; }
  .hand-controls { grid-template-columns: minmax(0,1fr) 130px; gap: 8px; margin-top: 26px; }
  .hand { gap: 7px; padding: 3px 0 7px; }
  .card { min-height: 150px; padding: 8px; border-radius: 12px; }
  .card-cost { width: 24px; height: 24px; font-size: 12px; }
  .card-type { margin-top: 6px; font-size: 8px; }
  .card h3 { margin: 3px 0 5px; font-size: clamp(12px, 1.5vw, 16px); }
  .card p { font-size: clamp(9px, 1vw, 11px); }
  .controls { gap: 8px; padding-bottom: 7px; }
  .primary-button, .secondary-button { min-height: 36px; padding: 0 12px; }
}

@media (max-width: 700px) and (orientation: portrait) {
  .game-shell { padding: 12px; }
  .topbar { align-items: flex-start; }
  .battle-view { min-height: calc(100vh - 96px); }
  .enemy-zone { min-height: 330px; border-radius: 22px; }
  .player-stats { grid-template-columns: repeat(2, 1fr); }
  .hand-controls { display: block; margin-top: 14px; }
  .hand { display: flex; gap: 10px; justify-content: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; }
  .card { flex: 0 0 min(46vw, 165px); width: auto; min-height: 190px; scroll-snap-align: center; }
  .controls { margin-top: 10px; flex-direction: row; padding-bottom: 0; }
  .controls .primary-button, .controls .secondary-button { flex: 1; }
  .reward-cards .card { flex-basis: min(46vw, 165px); width: auto; }
}
