:root {
  color-scheme: dark;
  --bg: #161817;
  --panel: #242a2a;
  --panel-2: #303836;
  --line: #4b5652;
  --text: #f4f0e8;
  --muted: #b8beb8;
  --accent: #e5b94f;
  --accent-2: #68b7a3;
  --danger: #e36a70;
  --good: #80cf8b;
  --field: #527468;
  --card: #f1e7d2;
  --ink: #242321;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(229, 185, 79, 0.14), transparent 28rem),
    radial-gradient(circle at 92% 10%, rgba(104, 183, 163, 0.14), transparent 22rem),
    linear-gradient(135deg, #151716, #23302d 54%, #181b1b);
  color: var(--text);
  font-family: "Segoe UI", "Meiryo", sans-serif;
}

button {
  font: inherit;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: #333b39;
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.game-shell {
  width: min(1220px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 16px 0 28px;
}

.top-bar,
.status-row,
.zones,
.log-panel,
.field-row {
  background: rgba(36, 42, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.22);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 15px 18px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.main-nav,
.home-actions,
.builder-actions,
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.main-nav button.active {
  border-color: var(--accent);
  background: rgba(229, 185, 79, 0.18);
  color: var(--accent);
}

.home-screen {
  min-height: 520px;
  padding: clamp(24px, 7vw, 74px);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0.08)),
    radial-gradient(circle at 74% 24%, rgba(229, 185, 79, 0.22), transparent 24rem),
    linear-gradient(135deg, #24312d, #171a1a);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin-top: 12px;
}

.home-copy {
  max-width: 680px;
}

.home-copy h2 {
  color: var(--text);
  font-size: clamp(1.6rem, 4vw, 3.4rem);
  line-height: 1.08;
  margin: 0 0 14px;
}

.home-copy p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}

.home-actions {
  margin-top: 26px;
}

.home-actions button {
  min-height: 54px;
  padding: 10px 18px;
  background: #34413d;
}

.home-status {
  display: grid;
  gap: 8px;
  max-width: 520px;
  margin-top: 28px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.home-status p {
  margin: 0;
}

.compact-select,
.deck-class-row label,
.home-status label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.compact-select select,
.deck-class-row select,
.home-status select {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: #1f2625;
  color: var(--text);
  padding: 6px 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(1.35rem, 3vw, 2.1rem);
}

h2 {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
}

.turn-panel {
  display: flex;
  align-items: center;
  gap: 10px;
}

#turnLabel {
  min-width: 124px;
  color: var(--accent);
  font-weight: 900;
  text-align: right;
}

.turn-label {
  display: inline-grid;
  min-height: 54px;
  place-items: center;
  margin-left: auto;
}

.status-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin: 10px 0;
  padding: 10px;
}

.battle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 12px;
  align-items: start;
}

.hero,
.resource,
#awakenButton,
#endTurnButton,
#newGameButton {
  min-height: 54px;
  padding: 8px 12px;
}

.hero {
  display: grid;
  min-width: 132px;
  background: linear-gradient(145deg, #303836, #202523);
}

.hero strong {
  font-size: 1.45rem;
  color: var(--danger);
}

.hero-player strong {
  color: var(--good);
}

.hero.highlight {
  border-color: var(--accent);
  background: linear-gradient(145deg, rgba(229, 185, 79, 0.24), #202523);
  box-shadow: 0 0 0 3px rgba(229, 185, 79, 0.18);
}

.resource,
.field-slot {
  display: grid;
  min-width: 96px;
  align-content: center;
  background: rgba(255, 255, 255, 0.055);
  border-radius: 7px;
}

.resource {
  padding: 8px 12px;
}

.resource span,
.hero span,
.field-slot span {
  color: var(--muted);
  font-size: 0.76rem;
}

.resource strong,
.field-slot strong {
  font-size: 1.05rem;
}

#awakenButton {
  margin-left: auto;
  background: #5b442f;
}

#endTurnButton {
  background: #7b3436;
}

.board-wrap {
  padding: 12px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    #202826;
  background-size: 36px 36px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.side-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 2px 4px 6px;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 8px;
}

.lane-rule {
  height: 2px;
  margin: 12px 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.slot {
  position: relative;
  min-height: 112px;
  padding: 7px;
  background: rgba(18, 22, 21, 0.78);
  border: 1px solid var(--line);
  overflow: hidden;
}

.slot.front {
  box-shadow: inset 0 0 0 1px rgba(229, 185, 79, 0.14);
}

.slot.back {
  box-shadow: inset 0 0 0 1px rgba(104, 183, 163, 0.14);
}

.slot.highlight {
  border-color: var(--accent);
  background: rgba(229, 185, 79, 0.13);
}

.slot.ready::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 14px var(--good);
}

.empty {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 900;
}

.card-frame {
  position: relative;
  border-width: 2px;
  border-style: solid;
  overflow: hidden;
}

.card-frame > *:not(.card-frame-image) {
  position: relative;
  z-index: 4;
}

.card-frame-image {
  position: absolute;
  inset: 0;
  z-index: 3;
  background-image: var(--frame-image);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  opacity: 0.96;
}

.card-frame > .card-art {
  z-index: 2;
}

.card-frame.bronze {
  border-color: #8c7456;
}

.card-frame.silver {
  border-color: #bec7cc;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.card-frame.gold {
  border-color: #e5bd50;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32), 0 0 18px rgba(229, 189, 80, 0.12);
}

.card-frame.legend {
  border-color: #f0d878;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    0 0 0 1px rgba(104, 183, 163, 0.32),
    0 0 24px rgba(229, 185, 79, 0.2);
}

.card-art {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 5px;
  background-size: cover;
  background-position: center;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.48);
}

.card-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 42%),
    radial-gradient(circle at 72% 24%, rgba(255, 255, 255, 0.16), transparent 34%);
}

.card-art.has-image {
  background-image: var(--card-image);
}

.card-art.has-image::before {
  background: linear-gradient(180deg, transparent 52%, rgba(0, 0, 0, 0.28));
}

.card-art span {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
}

.tribe-label {
  position: absolute;
  left: 5px;
  bottom: 5px;
  z-index: 2;
  max-width: calc(100% - 10px);
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 900;
}

.art-unit {
  background:
    linear-gradient(145deg, #4d665b, #293b45 52%, #725842);
}

.art-spell {
  background:
    radial-gradient(circle at 36% 30%, #efd37c, transparent 24%),
    linear-gradient(145deg, #554077, #23364c 58%, #713b4b);
}

.art-field {
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.25), transparent 28%),
    linear-gradient(145deg, #4d806e, #2d4f49 54%, #5f6d42);
}

.card-art-board {
  width: 100%;
  height: 42px;
}

.card-art-hand {
  width: 100%;
  aspect-ratio: 1.35 / 1;
}

.card-art-preview {
  width: 100%;
  aspect-ratio: 1.45 / 1;
}

.completed-card,
.card-image-card {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  display: block;
  border-radius: 6px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 42%),
    #29323a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.completed-card-img,
.card-full-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card-num {
  position: absolute;
  z-index: 5;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
  transform: translate(-50%, -50%);
  text-shadow:
    0 2px 2px rgba(0, 0, 0, 0.92),
    0 0 4px rgba(0, 0, 0, 0.76),
    1px 0 0 rgba(0, 0, 0, 0.72),
    -1px 0 0 rgba(0, 0, 0, 0.72);
}

.card-cost-num {
  left: var(--cost-x, 16.8%);
  top: var(--cost-y, 10.5%);
  width: 13%;
  height: 13%;
}

.card-atk-num {
  left: var(--atk-x, 17%);
  top: var(--atk-y, 91.2%);
  width: 14%;
  height: 14%;
}

.card-hp-num {
  left: var(--hp-x, 84.5%);
  top: var(--hp-y, 91.2%);
  width: 14%;
  height: 14%;
}

.card-size-hand {
  max-width: 124px;
  margin-inline: auto;
}

.card-size-list {
  max-width: 150px;
  margin-inline: auto;
}

.card-size-hover {
  max-width: 256px;
  margin-inline: auto;
}

.card-size-preview {
  max-width: 248px;
  margin-inline: auto;
}

.card-size-modal {
  max-width: 146px;
  margin-inline: auto;
}

.card-size-board {
  width: min(100%, 62px);
  margin-inline: auto;
}

.card-size-hand .card-num,
.card-size-list .card-num,
.card-size-modal .card-num {
  font-size: 1.02rem;
}

.card-size-hover .card-num,
.card-size-preview .card-num {
  font-size: 1.5rem;
}

.card-size-board .card-num {
  font-size: 0.7rem;
}

.dummy-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, transparent 42%, rgba(0, 0, 0, 0.68)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0 8px, transparent 8px 16px);
  pointer-events: none;
}

.card-temp-label,
.card-temp-name,
.card-no-image {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.75);
}

.card-temp-label {
  right: 8%;
  top: 6%;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
}

.card-no-image {
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 900;
}

.dummy-card-body {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 19%;
  bottom: 16%;
  z-index: 4;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 4px;
  color: #fff;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.78);
}

.dummy-card-body strong {
  font-size: 0.82rem;
  line-height: 1.12;
  text-align: center;
}

.dummy-card-sub,
.dummy-card-body em {
  font-size: 0.62rem;
  line-height: 1.15;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.dummy-card-body small {
  align-self: end;
  max-height: 45%;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.62rem;
  line-height: 1.25;
}

.card-size-hover .dummy-card-body strong,
.card-size-preview .dummy-card-body strong {
  font-size: 1.05rem;
}

.card-size-hover .dummy-card-sub,
.card-size-hover .dummy-card-body em,
.card-size-hover .dummy-card-body small,
.card-size-preview .dummy-card-sub,
.card-size-preview .dummy-card-body em,
.card-size-preview .dummy-card-body small {
  font-size: 0.76rem;
}

.unit-card {
  display: grid;
  height: 100%;
  min-height: 96px;
  align-content: start;
  gap: 4px;
  color: var(--ink);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.58), transparent 48%),
    var(--card);
  border-radius: 6px;
  padding: 7px;
  text-align: left;
}

.unit-card.completed-mode {
  align-content: center;
  justify-items: center;
  padding: 4px;
  background: rgba(255, 255, 255, 0.08);
}

.state-badge {
  position: absolute;
  right: 5px;
  top: 5px;
  z-index: 8;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(34, 57, 77, 0.82);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 900;
  pointer-events: none;
}

.unit-card .card-name {
  font-size: clamp(0.82rem, 1.5vw, 1rem);
  line-height: 1.2;
}

.card-cost {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #26394c;
  color: #fff;
  font-weight: 900;
}

.stats {
  justify-self: end;
  min-width: 44px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #362d25;
  color: #fff;
  font-weight: 900;
  text-align: center;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 18px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(38, 57, 76, 0.12);
  color: #5d3a00;
  font-size: 0.68rem;
  font-weight: 900;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
  padding: 10px;
}

.field-slot {
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid rgba(104, 183, 163, 0.18);
}

.field-slot strong {
  color: #d9fff3;
}

.field-slot.has-card {
  cursor: pointer;
  border-color: rgba(229, 185, 79, 0.28);
}

.zones {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 14px;
  padding: 12px;
}

.extra-summary {
  display: grid;
  align-content: center;
  justify-items: start;
  min-height: 132px;
  padding: 14px;
  background:
    radial-gradient(circle at 84% 18%, rgba(229, 185, 79, 0.2), transparent 8rem),
    linear-gradient(145deg, #2c3735, #1d2222);
  border-color: rgba(229, 185, 79, 0.32);
  text-align: left;
}

.extra-summary span {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 900;
}

.extra-summary strong {
  font-size: 2rem;
}

.extra-summary small {
  color: var(--muted);
  font-weight: 800;
}

.preview-panel {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 8px;
  min-height: 360px;
  padding: 12px;
  background: rgba(36, 42, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.22);
}

.card-preview {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 310px;
  padding: 12px;
  color: var(--ink);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.62), transparent 48%),
    var(--card);
  border-radius: 8px;
}

.card-preview.completed-mode {
  justify-items: center;
  min-height: 0;
}

.empty-preview {
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.055);
}

.preview-head,
.preview-stats {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.preview-type,
.preview-stats span {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(38, 57, 76, 0.12);
  color: #3b342c;
  font-size: 0.78rem;
  font-weight: 900;
}

.preview-name {
  font-size: 1.18rem;
  line-height: 1.18;
}

.preview-keywords {
  color: #6c4b13;
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 900;
}

.preview-class {
  color: #4f4537;
  font-size: 0.78rem;
  font-weight: 900;
}

.card-preview p {
  min-height: 64px;
  margin: 0;
  color: #45413a;
  font-size: 0.88rem;
  line-height: 1.45;
}

.card-row {
  display: flex;
  gap: 8px;
  min-height: 164px;
  padding-top: 8px;
  overflow-x: auto;
}

.play-card {
  flex: 0 0 142px;
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 152px;
  padding: 9px;
  color: var(--ink);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.58), transparent 52%),
    var(--card);
  text-align: left;
}

.play-card.completed-mode {
  align-content: center;
  min-height: 214px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.play-card.field {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.55), transparent 52%),
    #cfe5d4;
}

.play-card.gold,
.play-card.legend {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.62), transparent 52%),
    #ead08a;
}

.play-card.selected,
.play-card.usable:hover:not(:disabled) {
  outline: 3px solid var(--accent);
}

.play-card.locked {
  filter: grayscale(0.72);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-top b {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #26394c;
  color: #fff;
}

.play-card strong {
  line-height: 1.2;
}

.play-card em {
  color: #6c4b13;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
}

.play-card small {
  color: #45413a;
  font-size: 0.74rem;
  line-height: 1.35;
}

.log-panel {
  margin-top: 12px;
  padding: 12px;
}

.log-panel ol {
  display: grid;
  gap: 5px;
  margin: 8px 0 0;
  padding-left: 22px;
  color: var(--muted);
  font-size: 0.88rem;
}

.library-header,
.builder-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-top: 12px;
  padding: 14px;
  background: rgba(36, 42, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.library-header p,
.builder-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.filter-bar input,
.filter-bar select {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: #1f2625;
  color: var(--text);
  padding: 8px 10px;
}

.filter-bar input {
  min-width: min(320px, 100%);
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.collection-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 250px;
  padding: 9px;
  color: var(--ink);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.58), transparent 52%),
    var(--card);
  text-align: left;
}

.collection-card.completed-mode {
  min-height: 0;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.collection-card.field {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.55), transparent 52%),
    #cfe5d4;
}

.collection-card strong {
  line-height: 1.18;
}

.collection-card em {
  color: #6c4b13;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
}

.collection-card small {
  color: #45413a;
  font-size: 0.75rem;
  line-height: 1.35;
}

.collection-meta,
.collection-sub {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #45413a;
  font-size: 0.76rem;
  font-weight: 800;
}

.collection-meta b {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #26394c;
  color: #fff;
}

.owned-count {
  position: absolute;
  left: 50%;
  bottom: 8px;
  min-width: 42px;
  height: 24px;
  padding: 0 10px;
  display: grid;
  place-items: center;
  transform: translateX(-50%);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 48%),
    linear-gradient(180deg, #273035, #111718);
  border: 1px solid rgba(232, 202, 124, 0.72);
  color: #ffe5a5;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.34),
    0 6px 18px rgba(0, 0, 0, 0.28);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
  align-items: start;
  margin-top: 12px;
}

.deck-class-row {
  margin-top: 10px;
  padding: 12px;
  background: rgba(36, 42, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.builder-tabs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.builder-tabs button.active {
  border-color: var(--accent);
  background: rgba(229, 185, 79, 0.18);
  color: var(--accent);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.58);
}

.extra-modal {
  width: min(1040px, 96vw);
  max-height: 88vh;
  overflow: auto;
  padding: 14px;
  background: #202826;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.extra-modal-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(174px, 1fr));
  gap: 10px;
}

.extra-modal-card {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 264px;
  padding: 9px;
  color: var(--ink);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.58), transparent 52%),
    var(--card);
  text-align: left;
}

.extra-modal-card.completed-mode {
  min-height: 0;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.state-line {
  justify-self: center;
}

.extra-modal-card.locked {
  filter: grayscale(0.72);
  opacity: 0.58;
}

.extra-modal-card.usable {
  box-shadow: 0 0 0 2px rgba(128, 207, 139, 0.25);
}

.extra-modal-card em {
  color: #6c4b13;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
}

.hover-preview {
  position: fixed;
  z-index: 60;
  width: 280px;
  pointer-events: none;
}

.hover-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 400px;
  padding: 12px;
  color: var(--ink);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.62), transparent 48%),
    var(--card);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
}

.hover-card.completed-mode {
  min-height: 0;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
}

/* Ver.0.8 Grid Tactics refresh */
body {
  background:
    radial-gradient(circle at 50% 0%, rgba(231, 196, 99, 0.16), transparent 34%),
    linear-gradient(180deg, #101613, #060908);
}

.game-shell {
  max-width: 1480px;
}

.game-shell {
  width: min(1760px, calc(100vw - 12px));
  padding: 6px 0 16px;
}

.top-bar {
  background: rgba(8, 12, 11, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.top-bar h1 {
  letter-spacing: 0;
  text-transform: none;
}

.screen {
  position: relative;
  overflow: hidden;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.screen > * {
  position: relative;
  z-index: 1;
}

.home-screen {
  min-height: calc(100vh - 88px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 28px;
  align-items: center;
  padding: clamp(24px, 5vw, 64px);
  background:
    linear-gradient(90deg, rgba(4, 9, 10, 0.88), rgba(4, 9, 10, 0.38)),
    linear-gradient(135deg, #13211f, #0b1113);
}

.home-screen::before {
  background-image:
    linear-gradient(90deg, rgba(5, 8, 8, 0.82), rgba(5, 8, 8, 0.34)),
    url("assets/背景/ホーム画面背景.png");
  background-size: cover;
  background-position: center;
  opacity: 0.92;
}

.home-hero h2 {
  max-width: 780px;
  margin: 0;
  color: #fff;
  font-size: clamp(3.5rem, 9vw, 8rem);
  line-height: 0.92;
  letter-spacing: 0;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
}

.home-tagline {
  max-width: 620px;
  margin: 20px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  font-weight: 800;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.home-actions button,
.builder-actions button,
.result-actions button,
.battle-controls button,
.combatant-panel button,
.main-nav button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.primary-action,
.home-actions .primary-action,
.end-turn-button {
  background: linear-gradient(180deg, #f1d27a, #ad7d27) !important;
  color: #16110a !important;
  border-color: rgba(255, 231, 160, 0.78) !important;
  font-weight: 900;
  box-shadow: 0 10px 30px rgba(189, 134, 38, 0.32);
}

.home-actions .primary-action {
  min-width: 210px;
  min-height: 58px;
  font-size: 1.1rem;
}

.home-status,
.combatant-panel,
.preview-panel,
.field-slot,
.log-panel,
.deck-list-panel,
.builder-header,
.library-header,
.deck-class-row {
  background: rgba(12, 18, 18, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  backdrop-filter: blur(10px);
}

.home-status {
  display: grid;
  gap: 18px;
  padding: 20px;
  border-radius: 10px;
}

.home-status-head,
.combatant-panel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.deck-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.deck-info-grid span {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
}

.deck-info-grid strong {
  color: #fff;
  font-size: 1rem;
}

.deck-info-grid .valid {
  color: #86e29b;
}

.deck-info-grid .invalid {
  color: #ffb0a5;
}

.class-icon {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.32), transparent 42%),
    linear-gradient(145deg, #2e3f4a, #131817);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18), 0 8px 18px rgba(0, 0, 0, 0.28);
}

.class-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.class-icon span {
  color: #fff;
  font-weight: 900;
}

.battle-screen {
  min-height: calc(100vh - 88px);
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(5, 9, 9, 0.72), rgba(5, 9, 9, 0.88)),
    linear-gradient(135deg, #18201e, #0b1010);
}

.battle-screen::before {
  background-image:
    linear-gradient(180deg, rgba(5, 8, 9, 0.74), rgba(5, 8, 9, 0.9)),
    url("assets/背景/対戦画面背景.png");
  background-size: cover;
  background-position: center;
  opacity: 0.96;
}

.battle-top-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.combatant-panel {
  min-height: 74px;
  padding: 10px;
  border-radius: 10px;
}

.hero {
  min-width: 118px;
  border-radius: 8px;
}

.hero strong {
  font-size: 2rem;
  color: #fff;
}

.resource {
  min-width: 82px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.resource strong {
  color: #fff;
  font-size: 1.2rem;
}

.primary-resource strong {
  color: #ffe197;
}

.battle-controls {
  display: grid;
  gap: 8px;
  min-width: 148px;
}

.battle-menu {
  position: relative;
  justify-self: end;
}

.battle-menu summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 900;
}

.battle-menu summary::-webkit-details-marker {
  display: none;
}

.battle-menu[open] {
  z-index: 20;
}

.battle-menu[open]::after {
  content: "";
  position: absolute;
  right: 0;
  top: 38px;
  width: 190px;
  height: 144px;
  border-radius: 10px;
  background: rgba(12, 18, 18, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
}

.battle-menu > button,
.battle-menu > label {
  position: absolute;
  right: 10px;
  z-index: 1;
  width: 170px;
}

.battle-menu > button {
  min-height: 34px;
}

.battle-menu > #newGameButton {
  top: 50px;
}

.battle-menu > #battleHomeButton {
  top: 90px;
}

.battle-menu > label {
  top: 130px;
  color: #fff;
}

.battle-layout {
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 10px;
}

.board-wrap {
  padding: 12px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035)),
    rgba(6, 9, 9, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.22);
}

.zones {
  margin-top: 8px;
  padding: 8px;
}

.card-row {
  min-height: 178px;
}

.board {
  gap: 10px;
}

.slot {
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04)),
    rgba(9, 15, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.slot.front {
  box-shadow: inset 0 0 0 1px rgba(239, 198, 111, 0.28);
}

.slot.back {
  box-shadow: inset 0 0 0 1px rgba(126, 185, 226, 0.22);
}

.slot.highlight {
  outline: 3px solid rgba(236, 207, 117, 0.95);
  box-shadow: 0 0 28px rgba(236, 207, 117, 0.32);
}

.slot.ready {
  animation: readyPulse 1.4s ease-in-out infinite;
}

.slot.guard-slot {
  border-color: rgba(106, 181, 255, 0.72);
}

.play-card.usable {
  box-shadow: 0 0 0 2px rgba(236, 207, 117, 0.26), 0 0 22px rgba(236, 207, 117, 0.16);
}

.play-card.cost-locked {
  filter: grayscale(0.65) brightness(0.62);
}

.play-card.selected {
  outline: 3px solid #ffe197;
  transform: translateY(-6px) scale(1.03);
}

.pulse-ready {
  animation: readyPulse 1.25s ease-in-out infinite;
}

.extra-summary {
  min-width: 150px;
  border: 1px solid rgba(231, 197, 101, 0.48);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 229, 146, 0.32), transparent 55%),
    linear-gradient(180deg, rgba(80, 45, 117, 0.78), rgba(24, 19, 42, 0.9));
  color: #fff;
  box-shadow: 0 10px 30px rgba(78, 48, 128, 0.28);
}

.log-panel {
  max-height: 170px;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 10px;
}

.modal-backdrop {
  backdrop-filter: blur(5px);
}

.result-modal {
  width: min(520px, 92vw);
  padding: 28px;
  text-align: center;
  border-radius: 12px;
  background: rgba(12, 18, 18, 0.94);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.56);
}

.howto-modal {
  width: min(620px, 94vw);
  max-height: 86vh;
  overflow: auto;
  padding: 20px;
  border-radius: 12px;
  background: rgba(12, 18, 18, 0.96);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.56);
}

.howto-modal ul {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding-left: 22px;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.7;
}

.result-modal h2 {
  margin: 0;
  font-size: clamp(3rem, 11vw, 6rem);
  letter-spacing: 0;
}

.result-modal.victory h2 {
  color: #ffe197;
}

.result-modal.defeat h2 {
  color: #ff9b90;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.effect-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}

.float-text {
  position: fixed;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  font-weight: 900;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.72);
  animation: floatText 0.85s ease-out forwards;
}

.float-text.damage {
  color: #ff5d4d;
}

.float-text.heal {
  color: #77f09a;
}

.float-text.awaken {
  color: #bde8ff;
}

.float-text.cast {
  color: #ffe197;
}

.float-text.extra {
  color: #d6a5ff;
}

.hit-shake {
  animation: hitShake 0.42s ease-in-out;
}

.collection-grid {
  align-items: start;
}

.deck-message:not(:empty) {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(119, 240, 154, 0.12);
  color: #d9ffe4;
}

.deck-message.error {
  background: rgba(255, 93, 77, 0.14);
  color: #ffd6d2;
}

@keyframes readyPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(236, 207, 117, 0.18);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(236, 207, 117, 0.35), 0 0 28px rgba(236, 207, 117, 0.2);
  }
}

@keyframes floatText {
  from {
    opacity: 0;
    transform: translate(-50%, -20%) scale(0.88);
  }
  16% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translate(-50%, -110%) scale(1.08);
  }
}

@keyframes hitShake {
  0%, 100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px);
  }
  45% {
    transform: translateX(5px);
  }
  70% {
    transform: translateX(-2px);
  }
}

@media (max-width: 980px) {
  .home-screen,
  .battle-layout,
  .battle-top-row {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    order: -1;
  }
}

.deck-list-panel {
  position: sticky;
  top: 12px;
  padding: 12px;
  background: rgba(36, 42, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.deck-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.deck-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 30px;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 7px 9px;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
}

.deck-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-row em {
  color: var(--accent);
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.deck-message {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--good);
  font-weight: 800;
}

.deck-message.error,
#deckCount.invalid {
  color: var(--danger);
}

.empty-state {
  color: var(--muted);
}

@media (max-width: 760px) {
  .top-bar,
  .status-row,
  .zones,
  .field-row {
    display: grid;
  }

  .turn-panel,
  .status-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #turnLabel {
    text-align: left;
  }

  #awakenButton {
    margin-left: 0;
  }

  .battle-layout {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
    min-height: 0;
  }

  .library-header,
  .builder-header,
  .builder-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .deck-list-panel {
    position: static;
  }

  .board {
    grid-template-columns: repeat(3, minmax(74px, 1fr));
  }

  .slot {
    min-height: 96px;
    padding: 5px;
  }

  .zones,
  .field-row {
    grid-template-columns: 1fr;
  }
}

/* Ver.1.0 final screen treatment */
body.home-mode,
body.battle-mode,
body.management-mode {
  overflow-x: hidden;
}

body.home-mode .game-shell,
body.battle-mode .game-shell {
  width: 100vw;
  max-width: none;
  min-height: 100vh;
  padding: 0;
}

body.management-mode .game-shell {
  width: 100vw;
  max-width: none;
  min-height: 100vh;
  padding: 0;
  background:
    linear-gradient(90deg, rgba(5, 7, 8, 0.86), rgba(5, 7, 8, 0.66)),
    url("assets/背景/ホーム画面背景.png"),
    linear-gradient(135deg, #0c1112, #172522);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

body.home-mode .top-bar,
body.battle-mode .top-bar {
  display: none;
}

body.management-mode .top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  width: min(1480px, calc(100vw - 24px));
  margin: 0 auto 12px;
  border-radius: 0 0 10px 10px;
}

.home-screen.screen.active,
.battle-screen.screen.active {
  display: grid;
}

.home-screen {
  width: 100vw;
  min-height: 100vh;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  padding: clamp(24px, 6vw, 72px);
  margin: 0;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(4, 6, 7, 0.74), rgba(4, 6, 7, 0.28) 48%, rgba(4, 6, 7, 0.78)),
    linear-gradient(135deg, #0c1112, #172522);
}

body:not(.home-mode) .home-screen {
  display: none !important;
}

.home-screen::before {
  background-image:
    linear-gradient(90deg, rgba(5, 7, 8, 0.72), rgba(5, 7, 8, 0.22), rgba(5, 7, 8, 0.74)),
    url("assets/背景/ホーム画面背景.png");
  background-size: cover;
  background-position: center;
  opacity: 1;
}

.home-hero {
  display: grid;
  justify-items: center;
  text-align: center;
  transform: translateY(-2vh);
}

.home-hero .eyebrow {
  color: rgba(255, 231, 166, 0.88);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.72);
}

.home-hero h2 {
  max-width: none;
  font-size: clamp(4.2rem, 12vw, 11rem);
  line-height: 0.86;
  color: #fff4cf;
  text-shadow:
    0 2px 0 rgba(91, 56, 17, 0.92),
    0 10px 34px rgba(0, 0, 0, 0.82),
    0 0 38px rgba(234, 195, 94, 0.42);
}

.home-tagline {
  margin-top: 24px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.8);
}

.home-actions {
  justify-content: center;
  margin-top: 34px;
  gap: 14px;
}

.home-actions button {
  min-width: 176px;
  min-height: 58px;
  padding: 12px 22px;
  border-color: rgba(232, 202, 124, 0.54);
  background:
    linear-gradient(rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, rgba(37, 43, 42, 0.92), rgba(15, 18, 18, 0.94));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  font-weight: 900;
}

.home-actions .primary-action {
  min-width: 230px;
  min-height: 64px;
  font-size: 1.16rem;
}

.home-help-button {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border-color: rgba(232, 202, 124, 0.58);
  background: rgba(12, 18, 18, 0.72);
  color: #ffe6a6;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
}

.home-status {
  display: none;
}

.deck-builder-screen,
.card-library-screen {
  width: min(1480px, calc(100vw - 24px));
  min-height: calc(100vh - 96px);
  margin: 0 auto 28px;
  padding: clamp(12px, 2vw, 24px);
  overflow: visible;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(8, 12, 13, 0.58), rgba(8, 12, 13, 0.76));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

.deck-builder-screen::before,
.card-library-screen::before {
  background:
    radial-gradient(circle at 50% 0%, rgba(232, 202, 124, 0.1), transparent 42%);
  pointer-events: none;
}

.deck-builder-screen > *,
.card-library-screen > * {
  position: relative;
  z-index: 2;
}

.battle-screen {
  width: 100vw;
  min-height: 100vh;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  padding: 10px clamp(10px, 1.2vw, 20px);
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(5, 8, 9, 0.48), rgba(5, 8, 9, 0.78)),
    linear-gradient(135deg, #10191a, #0a0d12);
}

.battle-screen::before {
  background-image:
    linear-gradient(180deg, rgba(5, 8, 9, 0.42), rgba(5, 8, 9, 0.74)),
    url("assets/背景/対戦画面背景.png");
  background-size: cover;
  background-position: center;
  opacity: 1;
}

.battle-menu-button {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 55;
  width: 48px;
  height: 48px;
  display: grid;
  place-content: center;
  gap: 5px;
  border-radius: 10px;
  border-color: rgba(232, 202, 124, 0.48);
  background: rgba(9, 13, 14, 0.76);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
}

.battle-menu-button span {
  display: block;
  width: 24px;
  height: 2px;
  background: #ffe7a6;
  border-radius: 999px;
}

.battle-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 88;
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(2px);
}

.battle-side-menu {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 89;
  width: min(360px, 86vw);
  height: 100vh;
  padding: 22px;
  transform: translateX(105%);
  transition: transform 180ms ease;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 22%),
    rgba(10, 15, 16, 0.96);
  border-left: 1px solid rgba(232, 202, 124, 0.32);
  color: #fff;
  box-shadow: -24px 0 80px rgba(0, 0, 0, 0.5);
}

.battle-side-menu.open {
  transform: translateX(0);
}

.battle-side-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.battle-side-head h2 {
  margin: 0;
  color: #ffe7a6;
}

.battle-side-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.battle-side-actions button {
  width: 100%;
  min-height: 46px;
  border-color: rgba(232, 202, 124, 0.28);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.danger-action {
  border-color: rgba(227, 106, 112, 0.55) !important;
  color: #ffd5d7 !important;
}

.battle-top-row {
  grid-template-columns: minmax(0, 1fr) auto;
  padding-right: 58px;
  margin-bottom: 0;
}

.battle-controls {
  min-width: 126px;
  padding-right: 8px;
}

.turn-label {
  min-height: 46px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(8, 13, 14, 0.72);
  border: 1px solid rgba(232, 202, 124, 0.26);
  color: #ffe7a6;
  font-weight: 900;
}

.battle-layout {
  grid-template-columns: minmax(0, 1fr) minmax(230px, 300px);
  align-items: stretch;
}

.battle-main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  min-height: 0;
}

.board-wrap {
  display: grid;
  align-content: center;
  min-height: clamp(360px, 48vh, 560px);
  background:
    radial-gradient(circle at 50% 50%, rgba(232, 202, 124, 0.12), transparent 54%),
    rgba(6, 9, 9, 0.34);
}

.board {
  grid-template-columns: repeat(3, minmax(118px, 1fr));
}

.slot {
  min-height: clamp(112px, 14vh, 156px);
}

.zones {
  grid-template-columns: minmax(0, 1fr) 180px;
  margin-top: 0;
  background: rgba(10, 15, 16, 0.56);
}

.card-row {
  min-height: clamp(148px, 19vh, 206px);
}

.preview-panel {
  max-height: calc(100vh - 132px);
  overflow: auto;
}

.log-panel {
  max-height: 126px;
  background: rgba(10, 15, 16, 0.56);
}

.result-modal.victory {
  border-color: rgba(232, 202, 124, 0.55);
  background:
    radial-gradient(circle at 50% 0%, rgba(85, 155, 255, 0.16), transparent 42%),
    rgba(12, 18, 18, 0.96);
}

.result-modal.defeat {
  border-color: rgba(181, 78, 156, 0.55);
  background:
    radial-gradient(circle at 50% 0%, rgba(170, 38, 64, 0.2), transparent 42%),
    rgba(12, 11, 18, 0.96);
}

@media (max-width: 980px) {
  .home-status {
    position: relative;
    inset: auto;
    margin-top: 22px;
  }

  .battle-screen {
    min-height: 100vh;
    overflow: auto;
  }

  .battle-layout {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    max-height: none;
  }
}
