/* Rune arena. Load after polish.css. Original UI; all effects stay local. */
:root {
  --rune-gold: #e4c47f;
  --rune-red: #f29688;
  --rune-blue: #91d5ff;
  --rune-green: #a2dfa7;
  --rune-purple: #c6b0f3;
}

/* A third house joins the original lapis-and-gold tablet frames. */
.deck-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.deck-choice { min-width: 0; padding: 20px 17px; gap: 15px; }
.deck-choice .deck-illustration { width: 83px; min-width: 83px; }
.deck-choice h3 { font-size: 24px; }
.deck-choice.astral { background: linear-gradient(120deg, #3b2b50e8, #201f36e8); }
.deck-choice.astral:hover, .deck-choice.astral.chosen {
  background: linear-gradient(120deg, #514067, #29243c);
  border-color: #c9acdf;
}
.deck-choice.astral .eyebrow { color: #d4b8ed; }
.card.astral {
  --card-edge: #a58bbf;
  --card-tint: #d9c6df;
  border-color: var(--card-edge);
  background: radial-gradient(ellipse at 35% 17%, #fff2da9c, transparent 65%), linear-gradient(130deg, #e3d6c8, #b8a2ba 65%, #d9c1c2);
}
.card.astral .cost { background: radial-gradient(circle at 35% 25%, #a28ac9, #584577 50%, #302e4f 85%); }
.unit.astral { background: linear-gradient(130deg, #60516f, #302b43); border-color: #b6a0c8; }
.rune-listener {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  max-width: 100%; padding: 3px 5px; margin: 3px auto;
  border: 1px solid #68536a60; border-radius: 3px;
  background: #5b416113; color: #4a3652;
  font: 600 9px/1.3 var(--sans); overflow-wrap: anywhere;
}
.rune-listener svg { width: 14px; height: 14px; flex: 0 0 14px; }
.unit .rune-listener { position: absolute; right: -5px; top: 23px; margin: 0; padding: 3px; background: #282238; color: #dfc7ff; border-color: #aa8ed1; z-index: 3; }
.hand-card .rune-listener { padding: 1px 3px; font-size: 7px; margin: 1px auto; }
.hand-card .rune-listener svg { width: 11px; height: 11px; flex-basis: 11px; }

/* Three-digit health and long resonance rules need tablet space, not circles. */
.card .card-stats { gap: 5px; font-variant-numeric: tabular-nums; }
.card .card-stats span:first-child, .card .card-stats span:last-child {
  min-width: 59px; min-height: 28px; padding: 5px 7px; border-radius: 5px;
  font: 700 12px/1.2 var(--sans); white-space: nowrap;
}
.card.spell .card-stats span, .card.trap .card-stats span { min-width: 0; font-size: 11px; }
.card-text { overflow-wrap: anywhere; }
.hand { min-height: 270px; justify-content: flex-start; justify-content: safe center; gap: 10px; }
.hand-card { flex: 0 0 143px; width: 143px; min-width: 143px; max-width: 143px; }
.hand-card .card { height: auto; min-height: 244px; }
.hand-card .card-name { min-height: 40px; font-size: 12px; line-height: 1.2; }
.hand-card .card-type { font-size: 7px; line-height: 1.45; }
.hand-card .card-text { min-height: 72px; font-size: 10px; line-height: 1.45; padding: 3px 4px 7px; }
.hand-card .card-art { aspect-ratio: 1.6; }
.hand-card .card-stats span:first-child, .hand-card .card-stats span:last-child { min-width: 53px; min-height: 25px; padding: 4px 5px; font-size: 10px; }
.unit .stats { font-variant-numeric: tabular-nums; }
.unit .stats b { min-width: 27px; padding-inline: 3px; border-radius: 5px; font: 700 12px/1 var(--sans); }
.unit .stats b:last-child { border-radius: 5px; }
.modal > .card { width: min(290px, 100%); height: auto; min-height: 370px; }
.modal > .card .card-name { font-size: 21px; line-height: 1.25; min-height: 58px; }
.modal > .card .card-text { font-size: 13px; line-height: 1.6; min-height: 90px; padding: 7px 9px 12px; }
.modal > .card .card-type { font-size: 9px; line-height: 1.5; }
.modal > .card .rune-listener { font-size: 11px; padding: 5px 7px; }
.modal > .card .card-stats span { font-size: 14px; padding: 7px 10px; }
.zone-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; margin-top: 22px; padding-inline: 2px; }
.zone-cards > div { min-width: 0; }
.zone-cards .card { width: 100%; margin: 0; height: auto; min-height: 300px; }
.zone-cards .card-text { font-size: 11px; line-height: 1.5; }
.zone-cards .card-name { min-height: 48px; }
.zone-cards > p { grid-column: 1 / -1; }

/* The three engines occupy the left edge; the combat log stays on the right. */
.battle-layout { grid-template-columns: 180px minmax(0, 1fr) 220px; max-width: 1770px; gap: 18px; }
.rune-rail {
  min-width: 0; display: flex; flex-direction: column; align-self: start; gap: 9px;
  padding: 15px 11px; position: relative; border: 1px solid #b79b6048; border-radius: 12px;
  background: linear-gradient(155deg, #253249ed, #121b2aef 70%);
  box-shadow: inset 0 0 0 3px #111a29, inset 0 0 0 4px #a98b4c1b, 0 7px 24px #0004;
}
.rune-rail h3 { font: 20px/1.15 var(--serif); color: #e8d0a1; text-align: center; margin: 1px 0 6px; }
.rune-rail > .eyebrow { text-align: center; font-size: 7px; letter-spacing: 1.6px; color: #aeb9ca; }
.rune-rail > p, .rune-rail > small { color: #a7b6c8; font-size: 10px; text-align: center; line-height: 1.5; margin: 0; }
.rune-die {
  --die-light: #f9b5a2; --die-mid: #8b443f; --die-deep: #371f2d;
  width: 100%; min-width: 0; min-height: 118px; padding: 9px 7px;
  position: relative; display: grid; grid-template-columns: 58px minmax(0, 1fr);
  align-items: center; gap: 4px 8px; text-align: left;
  border: 1px solid #c78d8060; border-radius: 8px; color: #f1ded2;
  background: linear-gradient(135deg, #652c332b, #121c2a 74%);
  box-shadow: inset 0 1px #fff0dd0d, 0 3px 8px #0003; cursor: pointer;
}
.rune-die.blue { --die-light: #b1e5ff; --die-mid: #32628e; --die-deep: #14263f; border-color: #77b2d75c; background: linear-gradient(135deg, #284e6b55, #121c2a 74%); }
.rune-die.green { --die-light: #c2edb3; --die-mid: #45704e; --die-deep: #1a302e; border-color: #86b48c60; background: linear-gradient(135deg, #36594055, #121c2a 74%); }
.rune-die:hover { border-color: var(--die-light); background-color: #314153; box-shadow: inset 0 1px #fff0dd0d, 0 0 16px #c6ad5a16; transform: translateY(-1px); }
.rune-die:active { transform: translateY(1px); }
.rune-die > button { display: contents; }
.die-shape {
  position: relative; isolation: isolate; width: 56px; height: 56px; padding: 13px;
  display: grid; place-items: center; color: #fff3cd;
  background: linear-gradient(145deg, var(--die-light), var(--die-mid) 35%, var(--die-deep) 86%);
  filter: drop-shadow(0 4px 3px #0008); grid-row: span 2;
}
.die-shape::before { content: ''; position: absolute; z-index: -1; inset: 3px; border: 1px solid #fff4d784; pointer-events: none; }
.die-shape::after { content: ''; position: absolute; inset: 6px; z-index: -1; background: linear-gradient(142deg, #fff8dd1d, transparent 40%, #0005); pointer-events: none; }
.die-shape.d6 { border-radius: 9px; box-shadow: inset 0 0 0 1px var(--die-light), inset 0 0 0 4px #37262777; }
.die-shape.d6::before { border-radius: 5px; }
.die-shape.d6::after { border-radius: 3px; }
.die-shape.d8 { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); width: 61px; height: 65px; padding: 18px; }
.die-shape.d8::before { inset: 9px; transform: rotate(45deg); }
.die-shape.d8::after { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.die-shape.d20 { clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); width: 61px; height: 65px; padding: 17px; }
.die-shape.d20::before { inset: 10px; clip-path: polygon(50% 0, 100% 75%, 0 75%); background: #ffedb31b; }
.die-shape.d20::after { inset: 1px; background: conic-gradient(from 30deg, #fff3bd33 0 60deg, #0002 60deg 120deg, transparent 120deg 180deg, #fff3bd22 180deg 240deg, #0002 240deg 300deg, transparent 300deg); }
.rune-face { width: 100%; height: 100%; display: grid; place-items: center; position: relative; z-index: 1; font-size: 24px; line-height: 1; }
.rune-face svg, svg.rune-face { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 2px 1px #0009); }
.die-label { display: block; align-self: end; color: var(--die-light); font: 600 12px/1.35 var(--serif); }
.die-result { display: block; align-self: start; font-size: 9px; line-height: 1.5; color: #b7c1ce; overflow-wrap: anywhere; }
.rune-die small { font-size: 9px; color: #b7c1ce; line-height: 1.5; }
.dice-help { border: 1px solid #b59b6555; padding: 8px 5px; border-radius: 4px; color: #ddc79d; background: #1d2b3d; font-size: 10px; min-height: 35px; }
.dice-help:hover { border-color: #dbc083; background: #2c3c50; }
.roll-history { padding: 7px 0 0; border-top: 1px solid #ad96583d; color: #aab9c9; font-size: 10px; line-height: 1.55; }
.roll-history:empty { display: none; }
.roll-history p { margin: 5px 0; padding: 0 0 5px; border-bottom: 1px solid #ad965818; overflow-wrap: anywhere; }
.roll-history strong { color: #e3c990; font-weight: 600; }
.roll-history svg { width: 15px; height: 15px; vertical-align: middle; margin-right: 3px; }
.roll-history > div { display: flex; align-items: center; gap: 5px; margin: 6px 0; padding-bottom: 6px; border-bottom: 1px solid #ad965818; }
.roll-history > div > svg { flex: 0 0 17px; height: 17px; }
.roll-history > div small { display: block; color: #7f93a8; font-size: 8px; line-height: 1.5; text-transform: capitalize; }
.graveyard-summary { display: grid; gap: 6px; padding-top: 7px; border-top: 1px solid #ad96583d; }
.graveyard-summary button { padding: 8px 6px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 3px 7px; border: 1px solid #9b8d6633; border-radius: 4px; font-size: 9px; color: #afbdca; background: #111b2a; text-align: left; }
.graveyard-summary button:hover { border-color: #cbb078; color: #e8d5b2; }
.graveyard-summary b, .graveyard-summary strong { color: #dccaab; font-size: 10px; font-weight: 600; }

/* Every face is inspectable. Rules, shape, and colour stay explicit. */
.dice-details { max-width: 960px; }
.dice-details h2 { color: #ead3a6; padding-right: 20px; }
.dice-details > p { color: #bdc9d4; max-width: 70ch; }
.dice-color-roster { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 19px; }
.dice-color-roster > *, .dice-color-roster .pill { padding: 7px 11px; min-height: 32px; border: 1px solid #c5ab684d; border-radius: 4px; color: #ddcda9; background: #172437; font-size: 11px; }
.dice-color-roster .red { border-color: #d58d7d88; color: #f5b7a8; }
.dice-color-roster .blue { border-color: #78b4d988; color: #a5dbf8; }
.dice-color-roster .green { border-color: #84ba8988; color: #b5e2b3; }
.dice-color-roster .active, .dice-color-roster [aria-selected=true] { background: #344152; box-shadow: inset 0 -2px #ddbd75; }
.rune-roster { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rune-entry { display: grid; grid-template-columns: 37px minmax(0, 1fr); gap: 2px 11px; padding: 12px; border: 1px solid #a59b7840; border-radius: 6px; background: linear-gradient(140deg, #28384a, #192536); min-width: 0; }
.rune-entry > svg, .rune-entry > .rune-face { width: 34px; height: 34px; color: #e4c47f; grid-row: span 3; padding: 3px; align-self: center; }
.rune-entry strong, .rune-entry h3 { color: #ecd8ae; font: 600 15px/1.3 var(--serif); margin: 0; }
.rune-entry > div { min-width: 0; }
.rune-entry > div > b { display: block; color: #ecd8ae; font: 600 15px/1.3 var(--serif); }
.rune-entry > div > small { display: block; }
.rune-entry p, .rune-entry small { font-size: 11px; line-height: 1.55; margin: 2px 0 0; color: #bfccd8; overflow-wrap: anywhere; }
.rune-entry .rune-name { color: #eed9ac; }
.rune-entry .rune-rule { color: #bfccd8; font-size: 11px; line-height: 1.55; }

/* The name forge runs on-device; errors and cancellation stay readable. */
.forge-panel { position: relative; margin: 0 0 24px; padding: 23px; border: 1px solid #b39ac66b; border-radius: 7px; background: radial-gradient(ellipse at 100% 0, #61446a45, transparent 60%), linear-gradient(125deg, #252f43, #1a2333); }
.forge-panel h3 { color: #e4c8ec; margin: 0 0 10px; }
.forge-panel p { color: #bdc4d6; font-size: 12px; line-height: 1.65; }
.forge-panel .form-grid { gap: 15px 18px; }
.forge-panel > label, .forge-panel .form-grid > label { display: flex; flex-direction: column; gap: 7px; color: #cdb7da; font-size: 11px; line-height: 1.5; }
.forge-panel .form-grid { margin-top: 15px; }
.forge-panel .form-grid output { display: inline; font-weight: 700; }
#forge-theme { display: block; min-height: 77px; resize: vertical; width: 100%; margin-top: 7px; padding: 11px 12px; color: #eee0ed; background: #101728; border: 1px solid #a68dbb73; border-radius: 4px; font: 13px/1.6 var(--sans); }
.forge-panel input[type=range] { width: 100%; margin: 0; }
.forge-panel input[type=range] { padding: 5px 0; height: 32px; accent-color: #d7b7ed; cursor: pointer; box-shadow: none; background: transparent; }
.forge-panel output { font-variant-numeric: tabular-nums; color: #e9cdf3; }
.forge-panel .actions { margin-top: 15px; }
#forge-generate { background: linear-gradient(#d7bee4, #a591be); color: #231d32; border-color: #e5cbee; box-shadow: inset 0 1px #fff4fc55, 0 3px 0 #58456b; }
#forge-cancel { border-color: #ab93bb80; color: #dac4e7; }
.forge-status { min-height: 21px; margin: 13px 0 0; color: #c6bcda; font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.forge-status.error, .forge-status[data-state=error] { color: #f6b6a8; }
.forge-status[data-state=loading]::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #7c6b92; border-top-color: #ead2f5; margin-right: 7px; vertical-align: -2px; animation: forge-orbit 1.1s linear infinite; }
#forge-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.name-suggestion { text-align: left; padding: 12px; border: 1px solid #b89cca60; border-radius: 5px; background: #1a2336; color: #eddbed; font: 600 14px/1.4 var(--serif); min-width: 0; overflow-wrap: anywhere; }
.name-suggestion:hover { border-color: #d7b9e8; background: #3c3451; transform: translateY(-1px); }
.name-suggestion small { display: block; color: #adaac3; font: 10px/1.5 var(--sans); margin-top: 4px; }
.rune-fields { margin-top: 24px; padding-top: 20px; border-top: 1px solid #b39d6244; }
.rune-fields h3 { color: #e2cb9d; font-size: 21px; margin-bottom: 13px; }
.rune-fields .form-grid { align-items: start; }

/* Event-driven effects use a transparent overlay, never a full-screen flash. */
#spell-fx { position: fixed; inset: 0; z-index: 75; pointer-events: none; overflow: hidden; contain: layout style paint; }
.spell-flare, .rune-burst { --fx-color: #f1b26f; position: absolute; left: var(--fx-x, 50%); top: var(--fx-y, 45%); width: 150px; height: 150px; margin: -75px 0 0 -75px; display: grid; place-items: center; color: var(--fx-color); pointer-events: none; isolation: isolate; animation: spell-impact 760ms ease-out both; }
.spell-flare::before, .spell-flare::after, .rune-burst::before, .rune-burst::after { content: ''; position: absolute; inset: 8%; border: 2px solid currentColor; border-radius: 50%; z-index: -1; }
.spell-flare::before { background: radial-gradient(circle, currentColor 0 1%, transparent 3% 37%, currentColor 39% 40%, transparent 42%); opacity: .75; box-shadow: 0 0 22px currentColor, inset 0 0 24px currentColor; }
.spell-flare::after { inset: 27%; transform: rotate(45deg); border-radius: 5px; box-shadow: 0 0 11px currentColor; }
.spell-flare > svg, .rune-burst > svg { width: 62px; height: 62px; filter: drop-shadow(0 0 9px currentColor); }
.spell-flare > span, .spell-flare > b { font: 700 34px/1 var(--serif); text-shadow: 0 2px 3px #070a13, 0 0 16px currentColor; }
.spell-flare > .spell-orbit { position: absolute; inset: 14%; border: 1px solid currentColor; border-radius: 50%; box-shadow: 0 0 17px currentColor; opacity: .65; }
.spell-flare > .spell-sigil { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; transform: translate(-50%, -50%); }
.spell-flare > .spell-sigil svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 0 8px currentColor); }
.spell-flare > b { position: absolute; top: calc(100% - 15px); left: 50%; width: max-content; max-width: 250px; padding: 5px 9px; border-radius: 4px; transform: translateX(-50%); background: #0d1326dd; color: #fff0d5; border: 1px solid #d5b67c55; font: 600 14px/1.3 var(--serif); text-align: center; text-shadow: 0 1px 3px #000; }
.spell-flare.damage { --fx-color: #ff9a72; animation-name: spell-strike; }
.spell-flare.damage::after { inset: 22% 44%; border: 0; border-radius: 0; background: linear-gradient(transparent, #fff2c9 22% 77%, transparent); box-shadow: 0 0 18px #ff714b; transform: rotate(35deg) scaleY(1.9); }
.spell-flare.heal { --fx-color: #a8e8b2; animation-name: spell-rise; animation-duration: 950ms; }
.spell-flare.heal::after { border: 0; border-radius: 0; background: linear-gradient(transparent 37%, currentColor 37% 63%, transparent 63%), linear-gradient(90deg, transparent 37%, currentColor 37% 63%, transparent 63%); transform: none; box-shadow: none; }
.spell-flare.buff { --fx-color: #ffdb84; animation-name: spell-rise; animation-duration: 900ms; }
.spell-flare.summon { --fx-color: #d2b5fa; animation-name: spell-gate; animation-duration: 950ms; }
.spell-flare.summon::before { border-radius: 20%; transform: rotate(45deg); }
.spell-flare.freeze { --fx-color: #aee9ff; animation-duration: 950ms; }
.spell-flare.freeze::after { inset: 15%; border-radius: 0; background: repeating-conic-gradient(from 0deg, transparent 0 58deg, currentColor 59deg 61deg, transparent 62deg 120deg); border: 0; clip-path: polygon(50% 0, 63% 26%, 94% 25%, 79% 50%, 94% 75%, 63% 74%, 50% 100%, 37% 74%, 6% 75%, 21% 50%, 6% 25%, 37% 26%); transform: none; }
.spell-flare.draw { --fx-color: #b3d4ff; animation-name: spell-draw; animation-duration: 800ms; }
.spell-flare.draw::after { inset: 27% 32%; border-radius: 3px; background: #182e4c; box-shadow: 7px -5px 0 -1px #182e4c, 7px -5px 0 1px currentColor, 14px -10px 0 -1px #182e4c, 14px -10px 0 1px currentColor; transform: rotate(-10deg); }
.spell-flare.roll, .rune-burst { --fx-color: #e8c88b; animation: rune-radiate 950ms ease-out both; }
.rune-burst::before, .spell-flare.roll::before { inset: 5%; border-width: 1px; background: repeating-conic-gradient(currentColor 0 1deg, transparent 2deg 30deg); mask-image: radial-gradient(transparent 0 41%, #000 42% 58%, transparent 59%); }
.rune-burst::after, .spell-flare.roll::after { inset: 18%; border-radius: 0; transform: rotate(45deg); background: none; }
.spell-flare.trap, .spell-flare.death { --fx-color: #ce9ee6; animation-name: spell-gate; animation-duration: 800ms; }
.spell-flare.energy, .spell-flare.armor { --fx-color: #e6d099; }
.spell-flare.silence { --fx-color: #cbb1ec; }
.spell-flare.splash { --fx-color: #e9917c; animation-name: spell-strike; }
.die-rolling .die-shape, .die-shape.die-rolling { animation: die-tumble 680ms ease-in-out both; }
.die-landed .die-shape, .die-shape.die-landed { animation: die-settle 700ms ease-out both; }
.rune-die.die-landed { border-color: var(--die-light); }
@keyframes forge-orbit { to { transform: rotate(360deg); } }
@keyframes spell-impact { 0% { opacity: 0; transform: scale(.15) rotate(-20deg); } 30% { opacity: .95; transform: scale(.85) rotate(0); } 65% { opacity: .8; } 100% { opacity: 0; transform: scale(1.55) rotate(18deg); } }
@keyframes spell-strike { 0% { opacity: 0; transform: scale(.3) rotate(-25deg); } 25% { opacity: 1; transform: scale(1.04) rotate(4deg); } 65% { opacity: .75; transform: scale(.9) rotate(0); } 100% { opacity: 0; transform: scale(1.3) rotate(9deg); } }
@keyframes spell-rise { 0% { opacity: 0; transform: translateY(25px) scale(.4); } 30% { opacity: .95; transform: translateY(0) scale(.8); } 100% { opacity: 0; transform: translateY(-55px) scale(1.2); } }
@keyframes spell-gate { 0% { opacity: 0; transform: scale(.1, .7) rotate(-25deg); } 35% { opacity: 1; transform: scale(1.05, .85) rotate(0); } 100% { opacity: 0; transform: scale(1.6, .45) rotate(25deg); } }
@keyframes spell-draw { 0% { opacity: 0; transform: translate(50px, -45px) scale(.5) rotate(22deg); } 45% { opacity: 1; transform: translate(0, 0) scale(.9) rotate(0); } 100% { opacity: 0; transform: translate(-30px, 30px) scale(1.1) rotate(-12deg); } }
@keyframes rune-radiate { 0% { opacity: 0; transform: scale(.2) rotate(-40deg); } 35% { opacity: 1; transform: scale(.9) rotate(0); } 100% { opacity: 0; transform: scale(1.55) rotate(30deg); } }
@keyframes die-tumble { 0% { transform: rotate(0) scale(1); } 30% { transform: translateY(-6px) rotate(65deg) scale(.9); } 65% { transform: translateY(3px) rotate(-36deg) scale(1.05); } 100% { transform: rotate(0) scale(1); } }
@keyframes die-settle { 0% { transform: scale(1.22); filter: drop-shadow(0 0 12px var(--die-light)); } 50% { transform: scale(.96); filter: drop-shadow(0 0 5px var(--die-light)); } 100% { transform: scale(1); filter: drop-shadow(0 4px 3px #0008); } }

@media (min-width: 1440px) { .battle-layout { grid-template-columns: 190px minmax(0, 1fr) 230px; } }
@media (min-width: 1500px) { .battle-layout { max-width: 1810px; } }
@media (max-width: 1320px) and (min-width: 1051px) {
  .battle-layout { grid-template-columns: 145px minmax(0, 1fr) 180px; gap: 12px; padding-inline: 12px; }
  .rune-rail { padding: 12px 8px; }
  .rune-die { grid-template-columns: 46px minmax(0, 1fr); gap: 4px 7px; min-height: 105px; padding: 7px 5px; }
  .die-shape { width: 45px; height: 45px; padding: 11px; }
  .die-shape.d8, .die-shape.d20 { width: 48px; height: 53px; padding: 14px; }
  .die-label { font-size: 11px; }
  .die-result { font-size: 8px; }
  .deck-choice { display: block; }
  .deck-choice .deck-illustration { float: right; margin: 8px 0 12px 13px; }
}
@media (max-width: 1050px) {
  .battle-layout { grid-template-columns: 140px minmax(0, 1fr); max-width: 1200px; gap: 12px; padding-inline: 10px; }
  .battle-aside { display: none; }
  .rune-rail { padding: 12px 8px; }
  .rune-rail h3 { font-size: 18px; }
  .rune-die { grid-template-columns: 44px minmax(0, 1fr); gap: 4px 6px; padding: 8px 5px; min-height: 102px; }
  .die-shape { width: 44px; height: 44px; padding: 10px; }
  .die-shape.d8, .die-shape.d20 { width: 47px; height: 51px; padding: 13px; }
  .die-label { font-size: 11px; }
  .die-result { font-size: 8px; }
  .deck-choice { display: block; padding: 18px 15px; }
  .deck-choice .deck-illustration { margin: 5px 0 14px; width: 83px; min-width: 83px; }
  .deck-choice h3 { font-size: 22px; }
  .deck-meta { gap: 7px; }
}
@media (max-width: 720px) {
  .deck-grid { grid-template-columns: 1fr; }
  .deck-choice { display: flex; padding: 18px; gap: 18px; }
  .deck-choice .deck-illustration { width: 94px; min-width: 94px; margin: 0; }
  .deck-choice h3 { font-size: 25px; }
  .battle-layout { display: flex; flex-direction: column; padding: 8px; gap: 10px; }
  .field-wrap { width: 100%; }
  .rune-rail { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 9px; border-radius: 8px; }
  .rune-rail h3 { grid-column: 1 / -1; margin: 0 0 1px; font-size: 16px; text-align: left; }
  .rune-rail > .eyebrow { grid-column: 1 / -1; text-align: left; font-size: 6px; }
  .rune-rail > p, .rune-rail > small { grid-column: 1 / -1; text-align: left; font-size: 9px; }
  .rune-die { min-height: 74px; grid-template-columns: 36px minmax(0, 1fr); padding: 7px 5px; gap: 3px 5px; }
  .die-shape { width: 34px; height: 34px; padding: 8px; }
  .die-shape.d8, .die-shape.d20 { width: 37px; height: 40px; padding: 10px; }
  .die-shape.d8::before { inset: 7px; }
  .die-shape.d20::before { inset: 6px; }
  .die-label { font-size: 10px; line-height: 1.25; }
  .die-result, .rune-die small { font-size: 8px; line-height: 1.4; }
  .dice-help { grid-column: 1 / -1; min-height: 30px; padding: 5px; font-size: 9px; }
  .roll-history { grid-column: 1 / -1; display: flex; gap: 9px; flex-wrap: wrap; padding: 3px 0 0; font-size: 8px; }
  .roll-history p { flex: 1; min-width: 90px; margin: 2px 0; padding-bottom: 2px; }
  .roll-history > div { flex: 1; min-width: 85px; margin: 2px 0; padding-bottom: 2px; }
  .graveyard-summary { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; padding-top: 5px; gap: 6px; }
  .graveyard-summary button { font-size: 8px; padding: 6px; }
  .graveyard-summary strong, .graveyard-summary b { font-size: 9px; }
  .rune-roster { grid-template-columns: 1fr; gap: 8px; }
  .rune-entry { padding: 10px; }
  .dice-details .dice-color-roster { gap: 6px; }
  .dice-color-roster > *, .dice-color-roster .pill { padding: 6px 8px; font-size: 10px; }
  .forge-panel { padding: 18px 15px; margin-bottom: 20px; }
  .forge-panel .form-grid { gap: 14px 12px; }
  #forge-results { grid-template-columns: 1fr; }
  .name-suggestion { padding: 11px; font-size: 14px; }
  .rune-fields .form-grid { grid-template-columns: 1fr; }
  .hand { min-height: 264px; gap: 9px; }
  .hand-card { flex: 0 0 135px; width: 135px; min-width: 135px; max-width: 135px; }
  .hand-card .card { height: auto; min-height: 240px; }
  .hand-card .card-name { min-height: 39px; font-size: 12px; }
  .hand-card .card-text { min-height: 73px; font-size: 10px; line-height: 1.4; }
  .hand-card .card-stats span:first-child, .hand-card .card-stats span:last-child { min-width: 49px; font-size: 9px; }
  .unit .stats b { min-width: 20px; padding-inline: 1px; font-size: 10px; }
  .modal > .card { width: min(270px, 100%); }
  .modal > .card .card-name { font-size: 19px; }
  .modal > .card .card-text { font-size: 13px; line-height: 1.55; }
  .zone-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .zone-cards .card { min-height: 290px; }
  .zone-cards .card-text { font-size: 10px; }
  .zone-cards .card-stats span:first-child, .zone-cards .card-stats span:last-child { min-width: 44px; font-size: 9px; padding-inline: 4px; }
  .spell-flare, .rune-burst { width: 110px; height: 110px; margin: -55px 0 0 -55px; }
  .spell-flare > svg, .rune-burst > svg { width: 48px; height: 48px; }
  .spell-flare > span { font-size: 27px; }
  .spell-flare > .spell-sigil { width: 42px; height: 42px; }
  .spell-flare > b { max-width: 210px; font-size: 12px; top: calc(100% - 9px); }
}
@media (max-width: 380px) {
  .rune-die { display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 3px; min-height: 100px; }
  .die-label, .die-result { align-self: center; }
  .die-shape { flex-shrink: 0; }
  .graveyard-summary { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .spell-flare, .rune-burst { animation: none !important; opacity: .8; }
  .spell-flare::before, .spell-flare::after, .rune-burst::before, .rune-burst::after { box-shadow: none; }
  .die-rolling .die-shape, .die-shape.die-rolling, .die-landed .die-shape, .die-shape.die-landed, .forge-status[data-state=loading]::before { animation: none !important; }
  .rune-die:hover, .rune-die:active, .name-suggestion:hover { transform: none; }
}

.spell-projectile{position:absolute;width:18px;height:18px;border-radius:50%;background:#ffe7b4;box-shadow:0 0 12px 6px #ff9c5b,0 0 35px 11px #ffc48688;pointer-events:none}.spell-projectile.heal,.spell-projectile.buff{background:#d8ffdd;box-shadow:0 0 12px 6px #6bda89,0 0 35px 11px #86ffa588}.spell-projectile.freeze,.spell-projectile.draw{background:#d2f2ff;box-shadow:0 0 12px 6px #68b8ff,0 0 35px 11px #758dff88}@media(prefers-reduced-motion:reduce){.spell-projectile{display:none}}
