:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
  background: #080d18;
  color: #f1f5ff;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 77% 17%, rgba(39, 95, 174, .2), transparent 38%),
    linear-gradient(135deg, #080d18, #121d2d 62%, #0b101b);
}

.eyebrow { color: #71b8d8; font-size: .76rem; font-weight: 700; letter-spacing: .16em; }
.muted, .welcome > p:last-child, .panel > p:last-child { color: #a8b8cb; line-height: 1.7; }

.auth-page { display: grid; place-items: center; padding: 1.5rem; }
.auth-card {
  width: min(100%, 450px);
  padding: clamp(1.8rem, 5vw, 3rem);
  border: 1px solid #38506a;
  border-radius: 18px;
  background: rgba(14, 25, 41, .92);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
}
.auth-card h1 { margin: .5rem 0; font-size: clamp(2rem, 5vw, 2.7rem); }
.auth-form { display: grid; gap: .8rem; margin-top: 1.8rem; }
.auth-form label { font-size: .9rem; }
.auth-form input {
  width: 100%; padding: .8rem 1rem; border: 1px solid #53677c; border-radius: 9px;
  background: #0b1523; color: #fff;
}
.auth-form input:focus-visible, button:focus-visible { outline: 2px solid #8bd1f2; outline-offset: 2px; }
.auth-form button {
  margin-top: .7rem; padding: .88rem 1.1rem; border: 0; border-radius: 9px;
  background: #87d2f0; color: #0a1b2d; font-weight: 800; cursor: pointer;
}
.auth-form button:hover { background: #b1e7f8; }
.form-error { color: #ffaaaa; }

.app-shell { display: flex; min-height: 100vh; }
.rail {
  position: sticky; top: 0; align-self: flex-start; height: 100vh;
  display: flex; flex-direction: column; gap: .75rem; width: 225px;
  padding: 2rem 1.4rem; border-right: 1px solid #294057;
  background: rgba(7, 15, 27, .8); overflow-y: auto; scrollbar-width: thin;
}
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { font-size: 1.55rem; font-weight: 900; letter-spacing: .12em; }
.brand, .rail-nav a { color: inherit; text-decoration: none; }
.rail-note { color: #90a9be; font-size: .85rem; }
.rail-toggle { display: none; padding: .55rem .8rem; border: 1px solid #45617a; border-radius: 9px; background: #15283e; color: #e6f2fb; cursor: pointer; }
.rail-nav { display: grid; gap: 1.1rem; margin-top: 1rem; }
.rail-nav__group { display: grid; gap: .18rem; }
.rail-nav__group h2 { margin: .2rem .8rem .4rem; color: #86abc4; font-size: .73rem; font-weight: 800; letter-spacing: .08em; }
.rail-nav a { padding: .55rem .8rem; border-radius: 9px; color: #c8d9eb; font-size: .92rem; }
.rail-nav a:hover, .rail-nav a:focus-visible, .rail-nav a[aria-current="page"] { background: #20374f; color: #fff; }
.main-stage { flex: 1; min-width: 0; padding: 1.7rem clamp(1.2rem, 5vw, 5rem); }
.topbar { display: flex; justify-content: space-between; align-items: center; }
.text-button { border: 0; background: transparent; color: #d6e3ef; cursor: pointer; }
.welcome { max-width: 760px; margin: 7rem 0 3rem; }
.welcome h1 { font-size: clamp(2rem, 4.5vw, 3.7rem); line-height: 1.15; margin: .65rem 0; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; max-width: 960px; }
.dashboard-welcome { margin: 2.5rem 0 1.5rem; }
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; max-width: 960px; margin-bottom: 1.5rem; }
.status-card { min-width: 0; display: flex; flex-direction: column; padding: 1.25rem; border: 1px solid #34475e; border-radius: 14px; background: linear-gradient(145deg, #172c42, #101e30); overflow-wrap: anywhere; }
.status-card h2 { margin: 0 0 .7rem; color: #a8bfd3; font-size: .9rem; }
.status-card strong { font-size: clamp(1.1rem, 2vw, 1.5rem); color: #e6f6ff; font-variant-numeric: tabular-nums; }
.status-card p { margin: .6rem 0 0; color: #b7cadd; line-height: 1.5; }
.status-card a { color: #97ddf7; font-weight: 700; padding-top: 1rem; margin-top: auto; }
.dashboard-grid .action-link + .action-link { margin-left: 1rem; }
@media (max-width: 700px) {
  .status-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-welcome { margin-top: 1.5rem; }
}
.panel {
  min-height: 180px; padding: 1.5rem; border: 1px solid #34475e;
  border-radius: 14px; background: rgba(18, 31, 49, .82);
}
.panel h2 { margin: .8rem 0; }
.panel + .panel { margin-top: 1rem; }
.action-notices { margin-top: 1.5rem; padding: .8rem 1rem; border: 1px solid #578798; border-radius: 9px; background: #132d3c; color: #c4effa; }
.action-notices p { margin: .3rem 0; }
:where(.panel, .unit-info) input:not([type="hidden"]):not([type="checkbox"]),
:where(.panel, .unit-info) textarea, :where(.panel, .unit-info) select {
  min-width: 0; max-width: 100%; width: 100%; padding: .7rem;
  border: 1px solid #53677c; border-radius: 9px; background: #0b1523; color: #fff;
}
:where(.panel, .unit-info) button { max-width: 100%; padding: .75rem 1rem; border: 0; border-radius: 9px; background: #8cd5ef; color: #0b2133; font-weight: 800; cursor: pointer; }
:where(.panel, .unit-info) form + form { margin-top: .6rem; }
.main-stage :is(input, textarea, select):focus-visible { outline: 2px solid #8bd1f2; outline-offset: 2px; }
.action-link { display: inline-block; margin-top: .6rem; color: #97ddf7; font-weight: 700; }
.panel-button { border: 0; border-radius: 9px; padding: .75rem 1rem; background: #8cd5ef; color: #0b2133; font-weight: 800; cursor: pointer; }
.panel form:has(#defender_id) { display: grid; gap: .7rem; max-width: 420px; margin-top: 1.2rem; }
.panel form:has(#defender_id) select { width: 100%; padding: .75rem; border: 1px solid #53677c; border-radius: 9px; background: #0b1523; color: #fff; }
.panel form:has(#defender_id) button { margin-top: .6rem; padding: .85rem; border: 0; border-radius: 9px; background: #8cd5ef; color: #0b2133; font-weight: 800; cursor: pointer; }
.simulator-form { display: grid; gap: .7rem; max-width: 420px; }
.simulator-form select { width: 100%; padding: .75rem; border: 1px solid #53677c; border-radius: 9px; background: #0b1523; color: #fff; }
.profile-form { max-width: 650px; padding: 1.5rem; border: 1px solid #34475e; border-radius: 14px; background: rgba(18, 31, 49, .82); }
.profile-form p { display: grid; gap: .45rem; }
.profile-form input, .profile-form textarea, .auth-form select { width: 100%; padding: .7rem; border: 1px solid #53677c; border-radius: 9px; background: #0b1523; color: #fff; }
.profile-form input[type=checkbox] { width: auto; }
.profile-form select { width: 100%; padding: .7rem; border: 1px solid #53677c; border-radius: 9px; background: #0b1523; color: #fff; }
.preset-row { display: grid; gap: .55rem; padding: 1rem 0; border-top: 1px solid #304860; }
.preset-row form { margin: 0; }

.catalog-head { margin: 3.4rem 0 1.8rem; max-width: 790px; }
.catalog-head h1 { font-size: clamp(2.25rem, 4vw, 3.8rem); margin: .4rem 0; }
.catalog-head > p:not(.eyebrow) { color: #b5c8d9; }
.catalog-search { margin-top: 2rem; display: grid; gap: .6rem; }
.catalog-search label { color: #d7e5f2; font-weight: 700; }
.search-row { display: flex; gap: .6rem; }
.search-row input { flex: 1; min-width: 0; padding: .85rem 1rem; border: 1px solid #48657f; border-radius: 9px; background: #0b1523; color: #fff; }
.search-row button { border: 0; border-radius: 9px; padding: .7rem 1.35rem; background: #8cd5ef; color: #0b2133; font-weight: 800; cursor: pointer; }
.catalog-count { margin: 0 0 1.1rem; color: #a8bbcd; font-size: .9rem; }
.unit-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.unit-card { min-width: 0; overflow: hidden; border: 1px solid #344b63; border-radius: 13px; background: #121e30; }
.unit-thumb { position: relative; display: grid; place-items: center; height: 190px; overflow: hidden; background: radial-gradient(circle at 50% 35%, #274663 0%, #15283e 54%, #0c1625 100%); }
.unit-thumb::after { content: ""; position: absolute; inset: auto 0 0; height: 1px; background: linear-gradient(90deg, transparent, #61b6d9, transparent); }
.unit-thumb img { z-index: 1; max-width: 92%; max-height: 92%; object-fit: contain; filter: drop-shadow(0 12px 15px rgba(0, 0, 0, .58)); }
.unit-fallback { position: absolute; color: #6988a4; font-weight: 900; letter-spacing: .3em; }
.unit-thumb.image-unavailable img { display: none; }
.unit-info { padding: 1rem; min-width: 0; overflow-wrap: anywhere; }
.unit-info form { display: grid; gap: .5rem; }
.unit-info .eyebrow { margin: 0; }
.unit-info h2 { min-height: 3.3em; margin: .45rem 0 .9rem; font-size: 1.05rem; line-height: 1.4; overflow-wrap: anywhere; }
.unit-info dl { display: flex; gap: .75rem; margin: 0; border-top: 1px solid #304860; padding-top: .75rem; }
.unit-info dl div { flex: 1; min-width: 0; }
.unit-info dt { color: #91a9be; font-size: .75rem; }
.unit-info dd { margin: .2rem 0 0; font-weight: 800; }
.item-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.item-card { min-width: 0; padding: 1.3rem; border: 1px solid #344b63; border-radius: 13px; background: linear-gradient(160deg, #17283d, #101b2b); }
.item-card .eyebrow { margin: 0; }
.item-card h2 { margin: .65rem 0 1rem; font-size: 1.17rem; line-height: 1.4; overflow-wrap: anywhere; }
.item-description { color: #bbcad8; line-height: 1.5; }
.item-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin: 0; padding-top: 1rem; border-top: 1px solid #304860; }
.item-card dt { color: #91a9be; font-size: .75rem; }
.item-card dd { margin: .2rem 0 0; font-weight: 800; }
.empty-state { grid-column: 1 / -1; padding: 3rem; text-align: center; color: #c2d0dc; border: 1px dashed #53677c; border-radius: 12px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 1.5rem; padding: 2rem 0; }
.pagination a { color: #a7e0f5; font-weight: 700; }

.preview-head { max-width: 850px; margin: 3.4rem 0 2rem; }
.preview-head h1 { font-size: clamp(2.25rem, 4vw, 3.8rem); margin: .4rem 0; }
.preview-head > p:not(.eyebrow) { color: #b5c8d9; line-height: 1.7; }
.battle-scene { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 1rem; max-width: 1150px; min-height: 440px; overflow: hidden; padding: 2rem; border: 1px solid #42617a; border-radius: 18px; background: radial-gradient(circle at 50% 110%, #355877, transparent 55%), linear-gradient(170deg, #121e31 5%, #172d47 55%, #091321 100%); box-shadow: 0 25px 70px rgba(0, 0, 0, .25); }
.battle-scene::before { content: ""; position: absolute; inset: -30%; z-index: -1; opacity: .35; background: repeating-linear-gradient(108deg, transparent 0 68px, rgba(116, 196, 235, .11) 70px, transparent 73px); animation: scene-drift 16s linear infinite; }
.battle-scene__horizon { position: absolute; inset: auto 0 0; height: 27%; background: linear-gradient(transparent, rgba(7, 13, 23, .83)); border-top: 1px solid rgba(130, 211, 243, .12); }
.battle-actor { position: relative; z-index: 1; display: grid; justify-items: center; gap: 1rem; min-width: 0; margin: 0; }
.battle-actor__frame { display: grid; place-items: center; width: min(100%, 340px); height: 285px; background: radial-gradient(circle, rgba(101, 170, 216, .15), transparent 65%); }
.battle-actor img { display: block; max-width: 90%; max-height: 256px; width: auto; height: auto; object-fit: contain; filter: drop-shadow(0 20px 20px rgba(0, 0, 0, .65)); }
.battle-actor figcaption { display: grid; gap: .3rem; width: 100%; max-width: 320px; padding: .7rem 1rem; border: 1px solid rgba(123, 181, 218, .3); border-radius: 9px; background: rgba(8, 20, 35, .75); }
.battle-actor figcaption strong { overflow-wrap: anywhere; }
.battle-scene__versus { z-index: 1; align-self: center; color: #a7dff1; font-size: clamp(1.5rem, 4vw, 3rem); font-weight: 900; letter-spacing: .12em; text-shadow: 0 0 30px #53b8df; }
.preview-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; max-width: 1150px; margin: 1.4rem 0 3rem; }
.preview-controls button { padding: .9rem 1.2rem; border: 0; border-radius: 9px; background: #8cd5ef; color: #0b2133; font-weight: 800; cursor: pointer; }
.preview-controls button:disabled { opacity: .55; cursor: wait; }
.preview-controls select { padding: .6rem .7rem; border: 1px solid #53677c; border-radius: 9px; background: #0b1523; color: #fff; }
.preview-controls label { color: #c6d8e7; font-size: .9rem; }
.preview-controls .motion-choice { display: inline-flex; align-items: center; gap: .3rem; }
.preview-controls input[type="checkbox"] { accent-color: #8cd5ef; }
.preview-controls p { flex-basis: 100%; margin: 0; color: #b5c8d9; }
@keyframes scene-drift { from { transform: translateX(-3%); } to { transform: translateX(3%); } }

@media (max-width: 1100px) { .unit-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 850px) { .unit-grid, .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 700px) {
  .app-shell { display: block; }
  .rail { position: relative; height: auto; width: 100%; gap: .2rem; padding: .8rem 1.2rem; border-right: 0; border-bottom: 1px solid #294057; overflow: visible; }
  .rail-toggle { display: inline-block; }
  .rail-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: .8rem 0 .4rem; }
  .rail-nav.menu-ready:not(.is-open) { display: none; }
  .rail-nav.is-open { display: grid; }
  .rail-nav__group { align-content: start; }
  .rail-nav__group h2 { margin-left: .5rem; }
  .rail-nav a { padding: .45rem .5rem; }
  .welcome { margin: 4rem 0 2rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .catalog-head { margin-top: 2rem; }
  .preview-head { margin-top: 2rem; }
  .battle-scene { min-height: 350px; padding: 1rem; }
  .battle-actor__frame { height: 220px; }
  .battle-actor img { max-height: 198px; }
}
@media (max-width: 520px) {
  .rail-nav { grid-template-columns: 1fr; }
  .unit-grid, .item-grid { grid-template-columns: 1fr; }
  .unit-card { display: grid; grid-template-columns: 42% 58%; }
  .unit-card:has(form) { grid-template-columns: 1fr; }
  .unit-card:has(form) .unit-thumb { height: 160px; }
  .unit-thumb { height: 100%; min-height: 155px; }
  .unit-info h2 { min-height: 0; }
  .unit-info dl { gap: .3rem; }
  .search-row button { padding-inline: .85rem; }
  .battle-scene { gap: .25rem; min-height: 300px; }
  .battle-actor__frame { height: 170px; }
  .battle-actor img { max-height: 153px; }
  .battle-actor figcaption { min-height: 76px; padding: .5rem; font-size: .8rem; }
  .battle-actor figcaption .eyebrow { font-size: .68rem; letter-spacing: .04em; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { .battle-scene::before { animation: none; } }

/* Recorded battle presentation: fixed layers and one image per combatant. */
.result-head { max-width: 1150px; margin: 2rem 0 1.5rem; }
.result-summary { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; padding: 1.2rem 1.4rem; border: 1px solid #42617a; border-radius: 14px; background: linear-gradient(120deg, #183044, #101e31); }
.result-summary > div { min-width: 0; }
.result-summary strong { display: block; margin: .5rem 0; font-size: 1.3rem; color: #d8f1fc; }
.result-summary .result-verdict { font-size: clamp(1.8rem, 4vw, 2.5rem); }
.result-summary[data-outcome="draw"] .result-verdict { color: #b7ceff; }
.result-summary p { margin: .3rem 0; color: #acc4d5; line-height: 1.6; }
.result-rewards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin: 1rem 0; }
.result-rewards div { min-width: 0; padding: .8rem 1rem; border: 1px solid #34475e; border-radius: 10px; background: #101e31; }
.result-rewards dt { color: #acc4d5; font-size: .8rem; }
.result-rewards dd { margin: .35rem 0 0; font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.battle-scene { --battle-glow: #355877; --battle-line: #172d47; background: radial-gradient(ellipse at 50% 110%, var(--battle-glow), transparent 60%), linear-gradient(170deg, #101a2a, var(--battle-line) 60%, #091321); }
.battle-scene[data-terrain="1"] { --battle-glow: #5b4a3c; --battle-line: #273342; }
.battle-scene[data-terrain="2"] { --battle-glow: #146979; --battle-line: #102d41; }
.battle-scene[data-terrain="3"] { --battle-glow: #453f6c; --battle-line: #1b203c; }
.battle-scene[data-terrain="4"] { --battle-glow: #3b6486; --battle-line: #203c55; }
.battle-scene[data-phase="settled"]::before { animation-play-state: paused; }
.battle-actor__frame { position: relative; }
.battle-impact { position: absolute; top: 8%; bottom: 25%; width: 44%; border-radius: 50%; opacity: 0; pointer-events: none; z-index: 0; }
.battle-impact--left { left: 1%; }
.battle-impact--right { right: 1%; }
.battle-impact[data-kind="hit"] { background: radial-gradient(ellipse, #ffcda088, #ff684a44 35%, transparent 68%); }
.battle-impact[data-kind="recover"] { background: radial-gradient(ellipse, #78ffd744, transparent 47%, #6ef6c755 50%, transparent 57%); }
.battle-impact[data-kind="form"] { background: radial-gradient(ellipse, #b9d5ff66, transparent 40%, #8daaff66 45%, transparent 54%); }
.battle-cue { position: absolute; left: 0; right: 0; top: 12%; padding: .45rem .6rem; margin: 0 auto; width: fit-content; max-width: 100%; border-radius: 9px; background: #111f32ee; color: #d7e7ff; border: 1px solid #849cb4; font-weight: 800; font-size: 1.1rem; text-align: center; opacity: 0; pointer-events: none; z-index: 2; overflow-wrap: anywhere; }
.battle-cue[data-kind="hit"] { color: #ffd1bc; border-color: #dd9f80; }
.battle-cue[data-kind="recover"] { color: #a4f7d8; border-color: #70c4a2; }
.battle-cue:empty { display: none; }
.battle-scene.motion-reduced .battle-cue:not(:empty) { opacity: 1; }
.battle-resources dd { color: #d8edf9; }
.battle-resources dd[data-recorded-value^="-"] { color: #ffc4ad; }
@media (max-width: 700px) { .result-summary { grid-template-columns: 1fr; gap: .6rem; } .result-summary > div + div { padding-top: .8rem; border-top: 1px solid #395269; } .result-rewards { gap: .4rem; } .result-rewards div { padding: .65rem; } .result-rewards dd { font-size: 1rem; } .battle-cue { font-size: .8rem; padding: .35rem; } }

/* Search and progressive disclosure keep lengthy commands readable. */
.filter-form { display: flex; flex-wrap: wrap; align-items: end; gap: .85rem; margin: 1rem 0; }
.filter-form label { display: grid; gap: .4rem; flex: 1 1 180px; min-width: 0; }
.filter-form :is(input, select) { width: 100%; min-width: 0; }
.filter-form button { margin: 0; }
.workflow-panel > summary { font-size: 1.2rem; padding: .5rem 0; }
.workflow-panel[open] > summary { margin-bottom: 1rem; }
.selection-summary { display: block; grid-column: 1 / -1; padding: .75rem; border-left: 3px solid #8cd5ef; border-radius: 5px; background: #122b3e; color: #c8e8f5; line-height: 1.7; overflow-wrap: anywhere; }
.selection-summary[hidden] { display: none; }
.muted { color: #9eb8cb; font-size: .85rem; font-weight: 400; }
.member-card h3 { margin: .2rem 0 .8rem; }
.member-card .command-form + .command-form { border-top: 1px solid #395269; padding-top: 1rem; margin-top: 1rem; }
@media (max-width: 700px) { .filter-form { display: grid; grid-template-columns: 1fr; } .filter-form button { justify-self: start; } }

/* M9: readable commands, bounded images and accessible mobile battle playback. */
a { color: #9fdcf3; }
:focus-visible { outline: 2px solid #9ce6ff; outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 20; padding: .8rem; background: #112b43; border: 2px solid #9ce6ff; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.rail { flex-shrink: 0; }
.main-stage { max-width: 1680px; }
.panel, .topbar, .battle-actor figcaption, .command-form { min-width: 0; overflow-wrap: anywhere; }
.account-label { display: block; margin-top: .4rem; color: #d9edf8; font-size: .85rem; letter-spacing: 0; }
.command-form { display: grid; gap: .75rem; max-width: 760px; }
.command-form > label, .command-form p > label, .command-form fieldset label { display: grid; gap: .5rem; }
.command-form label:has(input[type="checkbox"]) { display: flex; align-items: flex-start; gap: .6rem; }
input[type="checkbox"] { flex-shrink: 0; width: 1.15rem; height: 1.15rem; accent-color: #8cd5ef; }
.command-form p { margin: .25rem 0; display: grid; gap: .85rem; }
.command-form button { justify-self: start; }
button { word-break: keep-all; }
.panel .profile-form { border: 0; padding: 0; background: transparent; }
.member-card { padding: 1.2rem 0; border-top: 1px solid #3a5269; }
.member-card > p { font-weight: 700; color: #cbeaf7; }
.member-card .command-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.member-card .command-form button { grid-column: 1 / -1; }
.member-card .command-form:has(input[value="remove"]) { margin-bottom: 1rem; }
.crafting-grid, .catalog-grid, .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.crafting-grid { max-width: 1100px; }
.crafting-grid .unit-card { display: block; }
.crafting-grid .unit-info h3 { margin-top: .3rem; }
.crafting-grid form + form { border-top: 1px solid #395269; padding-top: 1rem; margin-top: 1rem; }
.form-details { margin: 1rem 0; border: 1px solid #3b5770; border-radius: 10px; padding: 1rem; }
summary { cursor: pointer; padding: .35rem 0; color: #bce5f5; font-weight: 700; }
.form-details[open] summary { margin-bottom: 1rem; }
fieldset { min-width: 0; border: 1px solid #3b5770; border-radius: 10px; padding: 1rem; }
legend { padding: 0 .4rem; font-weight: 700; }
.shared-unit-image { display: block; width: auto; height: auto; max-width: 100%; max-height: 300px; object-fit: contain; margin: 1rem auto; }
.image-unavailable :is(.battle-actor__frame img, .shared-unit-image), .battle-actor__frame.image-unavailable img { display: none; }
.image-error { padding: .5rem; color: #b8cfe1; font-size: .8rem; text-align: center; }
.battle-scene.motion-reduced::before { animation: none; }
.battle-resources { display: flex; flex-wrap: wrap; gap: .7rem; margin: .5rem 0 0; }
.battle-resources div { flex: 1; min-width: 0; }
.battle-resources dt { font-size: .7rem; color: #9bbace; }
.battle-resources dd { margin: .2rem 0 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.battle-progress-label { display: block; margin-top: 1rem; font-size: .8rem; color: #a9cadd; }
#battle-progress { width: 100%; max-width: 1150px; height: .6rem; accent-color: #8cd5ef; }
.battle-log { max-width: 1150px; padding: .8rem 1rem; border: 1px solid #34475e; border-radius: 10px; }
.battle-log ol { padding-left: 1.5rem; line-height: 1.8; color: #b8cfdf; }
form[data-submitting] button[type="submit"] { opacity: .55; cursor: wait; pointer-events: none; }
.submission-status { color: #bce5f5; font-size: .85rem; line-height: 1.5; }
@media (max-width: 700px) {
  .crafting-grid, .catalog-grid, .form-grid { grid-template-columns: 1fr; }
  .command-form, .member-card .command-form { grid-template-columns: 1fr; }
  .panel { padding: 1rem; }
  .preview-controls { gap: .75rem; margin-bottom: 1rem; }
  .preview-controls button { flex: 1 1 calc(50% - .375rem); }
  .battle-actor__frame { width: 100%; }
  .battle-scene__versus { font-size: 1.1rem; letter-spacing: 0; }
  .battle-resources { gap: .3rem; }
  .battle-resources dd { font-size: .8rem; }
  .empty-state { padding: 1.5rem; }
}
/* Read-only operations projection: scoped layout, no game flow changes. */
.operations-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.operations-grid .panel { min-width: 0; margin: 0; }
.operations-grid code { overflow-wrap: anywhere; }
.operations-row { display: grid; gap: .35rem; padding: .8rem 0; border-bottom: 1px solid var(--line, #263b50); }
.operations-row small, .operations-grid .muted, .operations-guidance .muted { color: var(--muted, #9cabb9); line-height: 1.6; }
.operations-warning { color: #ffd59a; }
.operations-guidance { margin-top: 1rem; }
.operations-guidance details { padding: .8rem 0; }
.operations-guidance summary { cursor: pointer; font-weight: 600; }
@media (max-width: 700px) { .operations-grid { grid-template-columns: 1fr; } }

/* Keep large ranking values readable without widening the page. */
.ranking-table-scroll { max-width: 100%; overflow-x: auto; }
.ranking-table { width: 100%; min-width: 790px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ranking-table th, .ranking-table td { padding: .6rem .8rem; border-bottom: 1px solid #34475e; text-align: left; white-space: nowrap; }
.ranking-table tbody tr:last-child td { border-bottom: 0; }
