:root {
  color-scheme: dark;
  --bg: #101412;
  --surface: #17211d;
  --surface-2: #1d2924;
  --surface-3: #22332c;
  --line: #395247;
  --muted: #9eb2aa;
  --text: #f3f7f5;
  --amber: #f0b84b;
  --teal: #3cc3a0;
  --blue: #5aa6d6;
  --red: #e35d4f;
  --lime: #9ad56d;
  --shadow: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.no-break {
  white-space: nowrap;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #101714;
  font: inherit;
}

input,
select {
  min-height: 40px;
  padding: 0 10px;
}

textarea {
  min-height: 72px;
  resize: vertical;
  padding: 10px;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 18px;
}

.site-footer {
  width: min(980px, calc(100% - 36px));
  margin: -34px auto 22px;
  padding: 12px 0 0;
  border-top: 1px solid rgba(173, 207, 194, 0.18);
  color: rgba(158, 178, 170, 0.82);
  text-align: center;
  display: none;
}

.is-home .site-footer {
  display: block;
}

.site-footer p {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.45;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 2px;
}

.title-lockup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.title-lockup .eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  white-space: nowrap;
}

.title-lockup .eyebrow::before {
  content: "/";
  color: var(--muted);
  font-weight: 800;
}

.title-lockup h1 {
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.eyebrow,
.label {
  display: block;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.6rem, 2.35vw, 2.18rem);
  line-height: 1;
}

h2 {
  font-size: 1.6rem;
}

.mode-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 6px;
  padding: 0;
}

.game-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(104px, 1fr));
  gap: 6px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-mode-button,
.mode-button,
.home-nav-button,
.tool-button,
.ghost-button,
.primary-button,
.icon-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.game-mode-button:hover,
.mode-button:hover,
.home-nav-button:hover,
.tool-button:hover,
.ghost-button:hover,
.primary-button:hover,
.icon-button:hover,
.character-card:hover {
  transform: translateY(-1px);
}

.character-card.is-selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(60, 195, 160, 0.22);
}

.icon-button {
  width: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.home-nav-button {
  min-width: 74px;
  padding: 0 14px;
}

.game-mode-button.is-active,
.mode-button.is-active,
.home-nav-button.is-active {
  color: #102019;
  border-color: var(--teal);
  background: var(--teal);
  font-weight: 900;
}

.home-nav-button:disabled {
  opacity: 1;
}

.home-view {
  width: min(980px, 100%);
  min-height: calc(100vh - 86px);
  display: grid;
  align-content: center;
  gap: 26px;
  margin: 0 auto;
  padding: 36px 0 52px;
}

.home-hero {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.home-hero h2 {
  max-width: 820px;
  font-size: clamp(2.4rem, 6vw, 5rem);
  font-weight: 900;
  line-height: 0.98;
}

.home-copy {
  width: min(660px, 100%);
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

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

.home-actions .primary-button,
.home-actions .tool-button {
  min-width: 150px;
  min-height: 44px;
}

.home-rule-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.home-rule-card {
  min-width: 0;
  min-height: 142px;
  display: grid;
  align-content: start;
  gap: 8px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 33, 29, 0.72);
}

.home-rule-card span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--teal);
  border-radius: 50%;
  color: var(--teal);
  background: #101714;
  font-weight: 900;
}

.home-rule-card h3,
.home-roles h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.15;
}

.home-rule-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.4;
}

.home-roles {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding-top: 20px;
  border-top: 1px solid rgba(173, 207, 194, 0.22);
  text-align: center;
}

.draft-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  margin-top: 10px;
}

.draft-panel {
  padding: 0;
}

.squad-panel {
  align-self: start;
  position: sticky;
  top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 40px var(--shadow);
}

.round-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 18px;
  margin-top: 2px;
  margin-bottom: 8px;
}

.round-strip > div {
  min-width: max-content;
  padding: 0;
}

.spin-tile,
.empty-card {
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 14px;
}

.round-strip strong {
  display: block;
  min-height: 0;
  font-size: 1.05rem;
  line-height: 1.15;
}

.spin-tile strong {
  display: block;
  min-height: 21px;
  font-size: 1.05rem;
  line-height: 1.2;
  white-space: nowrap;
}

.spin-board {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 28px;
  margin-top: 0;
}

.spin-tile {
  min-height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.fighter-tile {
  border-left: 0;
}

.age-tile {
  border-left: 0;
}

.tile-label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.tile-icon {
  width: 15px;
  height: 15px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.primary-button,
.tool-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
}

.primary-button {
  min-width: 116px;
  min-height: 40px;
  color: #201606;
  border-color: var(--amber);
  background: var(--amber);
  font-weight: 900;
}

.tool-button {
  min-width: 108px;
}

.ghost-button {
  min-width: 100px;
  color: var(--muted);
  background: transparent;
}

.action-row .tool-button,
.action-row .ghost-button {
  min-width: auto;
  min-height: 34px;
  padding: 0 10px;
  border-color: transparent;
  color: #c7d6d0;
  background: transparent;
}

.action-row .tool-button:hover,
.action-row .ghost-button:hover,
.action-row .tool-button:focus-visible,
.action-row .ghost-button:focus-visible {
  border-color: rgba(60, 195, 160, 0.28);
  background: rgba(60, 195, 160, 0.1);
}

.action-row .tool-button:disabled,
.action-row .ghost-button:disabled {
  border-color: transparent;
  background: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}

.stroke-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stroke-icon path {
  fill: none;
}

.status-text {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.is-finished .round-strip,
.is-finished .spin-board,
.is-finished .action-row,
.is-finished .status-text {
  display: none;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.duel-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.duel-board {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 25, 22, 0.54);
}

.duel-board.is-active {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px rgba(60, 195, 160, 0.18);
}

.duel-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.duel-board-head h3 {
  margin: 0;
  font-size: 0.88rem;
  text-transform: uppercase;
}

.duel-board-head span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.duel-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.character-card {
  position: relative;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-shadow: none;
}

.duel-card {
  min-height: 166px;
  padding: 7px;
}

.duel-card:disabled {
  opacity: 0.72;
}

.character-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--accent, var(--teal));
}

.card-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.portrait {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid var(--accent, var(--teal));
  border-radius: 50%;
  color: var(--text);
  background: #0f1714;
  font-weight: 900;
  font-size: 0.86rem;
}

.card-main {
  min-width: 0;
}

.character-name {
  margin: 0;
  font-size: 0.97rem;
  line-height: 1.18;
}

.series-name {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pill {
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #111916;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.15;
}

.pill.is-role {
  color: #17211d;
  border-color: var(--lime);
  background: var(--lime);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-top: auto;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111916;
  padding: 4px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 1px;
  font-size: 0.84rem;
}

.empty-card {
  min-height: 252px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

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

.record-badge {
  min-width: 86px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  color: var(--amber);
  background: #101714;
  text-align: center;
  font-weight: 900;
}

.squad-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.duel-squad {
  display: grid;
  gap: 7px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(173, 207, 194, 0.18);
}

.duel-squad:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.duel-squad-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.squad-slot {
  position: relative;
  width: 100%;
  min-height: 60px;
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.squad-slot:hover {
  border-color: rgba(60, 195, 160, 0.28);
  background: rgba(60, 195, 160, 0.08);
}

.squad-slot:disabled {
  opacity: 1;
  cursor: default;
}

.squad-slot:disabled:hover {
  background: var(--surface-2);
}

.squad-slot.has-pick {
  border-color: color-mix(in srgb, var(--slot-accent) 35%, var(--line));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--slot-accent) 14%, transparent), transparent 36%),
    var(--surface-2);
  cursor: default;
}

.squad-slot.has-pick:disabled:hover {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--slot-accent) 14%, transparent), transparent 36%),
    var(--surface-2);
}

.squad-slot.is-open-role {
  border-color: rgba(60, 195, 160, 0.22);
}

.squad-slot.is-assignable {
  border-color: var(--slot-accent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--slot-accent) 18%, transparent), transparent 42%),
    var(--surface-2);
}

.squad-slot.is-assignable .slot-role {
  color: var(--slot-accent);
}

.squad-slot.is-out-of-role {
  border-color: color-mix(in srgb, var(--amber) 36%, var(--line));
}

.squad-slot.is-out-of-role .slot-role,
.slot-warning {
  color: var(--amber);
}

.squad-slot.has-pick::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--slot-accent);
  opacity: 0.88;
}

.slot-number {
  position: relative;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #101714;
  font-weight: 900;
}

.squad-slot.has-pick .slot-number {
  border-color: color-mix(in srgb, var(--slot-accent) 65%, var(--line));
  color: var(--slot-accent);
  background: color-mix(in srgb, var(--slot-accent) 10%, #101714);
}

.slot-role {
  position: relative;
  min-height: 28px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.squad-slot.has-pick .slot-role {
  color: var(--slot-accent);
}

.slot-picks {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.slot-pick + .slot-pick {
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.slot-name {
  margin: 0;
  font-weight: 900;
  line-height: 1.2;
}

.slot-meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.slot-fighter,
.slot-coverage {
  overflow-wrap: anywhere;
}

.slot-coverage {
  margin-top: 2px;
  color: #c7d6d0;
}

.result-panel {
  width: min(980px, 100%);
  display: grid;
  gap: 26px;
  margin: 22px auto 0;
  padding: 24px;
  border: 0;
  background: transparent;
}

.is-finished .result-panel {
  margin-top: 52px;
}

.result-panel.is-empty {
  display: none;
}

.final-hero {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 6px 0 0;
  text-align: center;
}

.final-kicker,
.final-mode,
.final-label {
  max-width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1.15;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.final-kicker {
  color: var(--text);
  font-size: 0.95rem;
}

.final-mode {
  display: inline-grid;
  min-height: 28px;
  place-items: center;
  padding: 0 14px;
  border-radius: 999px;
  color: #102019;
  background: var(--teal);
  letter-spacing: 0;
}

.final-record {
  display: block;
  max-width: 100%;
  margin-top: 8px;
  color: var(--text);
  font-size: clamp(4rem, 9vw, 6.8rem);
  font-weight: 900;
  line-height: 0.92;
  overflow-wrap: anywhere;
}

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

.result-title h3 {
  margin: 0;
  font-size: 1.2rem;
}

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

.score-item {
  min-width: 0;
  min-height: 86px;
  display: grid;
  align-content: center;
  justify-items: center;
  border: 1px solid var(--line);
  background: #111916;
  padding: 12px 10px;
  text-align: center;
}

.score-item span {
  max-width: 100%;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.18;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.score-item strong {
  display: block;
  margin-top: 3px;
  max-width: 100%;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.role-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.role-pill {
  max-width: min(180px, 100%);
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.role-pill.is-covered {
  color: #102019;
  border-color: var(--teal);
  background: var(--teal);
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(560px, 100%);
  margin: 0 auto;
}

.result-actions .primary-button,
.result-actions .tool-button {
  min-width: 0;
  min-height: 46px;
}

.result-actions span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.team-average-panel {
  width: min(var(--tune-final-squad-width, 980px), 100%);
  display: grid;
  margin: 0 auto;
  padding-top: 12px;
  border-top: 1px solid rgba(173, 207, 194, 0.22);
}

.team-average-panel h3 {
  display: none;
}

.team-average-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
}

.team-average-stat {
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 0;
  border: 0;
  background: transparent;
}

.team-average-stat strong {
  color: var(--text);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.team-average-stat span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.result-status {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.duel-winner {
  margin: -4px 0 0;
  color: var(--amber);
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
}

.duel-score-grid {
  grid-template-columns: repeat(4, minmax(0, 118px));
  justify-content: center;
}

.duel-phase-panel {
  width: min(980px, 100%);
  display: grid;
  gap: 10px;
  margin: 0 auto;
}

.duel-phase-panel h3,
.duel-final-teams h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.duel-phase-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.duel-phase {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 25, 22, 0.66);
}

.duel-phase strong {
  font-size: 0.74rem;
  line-height: 1.15;
}

.duel-phase span {
  color: var(--amber);
  font-size: 0.74rem;
  font-weight: 900;
}

.duel-phase p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.duel-final-teams {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 0 auto;
}

.duel-final-teams > div {
  display: grid;
  gap: 8px;
}

.duel-final-grid {
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.duel-roster-panel {
  min-width: 0;
}

.duel-roster-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
  table-layout: fixed;
}

.duel-role-col {
  width: 112px;
}

.duel-name-col {
  width: auto;
}

.duel-stat-col {
  width: 44px;
}

.duel-roster-table th,
.duel-roster-table td {
  min-width: 0;
  padding: 7px 8px;
  color: var(--text);
  background: rgba(17, 25, 22, 0.72);
  border-top: 1px solid rgba(124, 162, 148, 0.32);
  border-bottom: 1px solid rgba(124, 162, 148, 0.32);
}

.duel-roster-table thead th {
  padding: 0 7px 2px;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.duel-roster-table thead th:first-child,
.duel-roster-table thead th:nth-child(2) {
  text-align: left;
}

.duel-roster-table tbody th {
  color: var(--accent, var(--teal));
  border-left: 4px solid var(--accent, var(--teal));
  border-radius: 8px 0 0 8px;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.08;
  text-align: left;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.duel-roster-table tbody td:last-child {
  border-right: 1px solid rgba(124, 162, 148, 0.32);
  border-radius: 0 8px 8px 0;
}

.duel-roster-name strong {
  display: block;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.duel-roster-name span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.duel-roster-table tbody td:not(.duel-roster-name) {
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.is-duel #rerollBothButton,
.is-duel #rerollFighterButton,
.is-duel #rerollAgeButton {
  display: none;
}

.save-run-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.save-run-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.save-run-actions .primary-button,
.save-run-actions .tool-button {
  min-height: 40px;
}

.save-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

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

.modal-backdrop[hidden] {
  display: none;
}

.help-modal {
  width: min(760px, 100%);
  max-height: min(820px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
}

.log-modal {
  width: min(1180px, 100%);
  max-height: min(820px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
}

.share-modal {
  width: min(540px, 100%);
  max-height: min(860px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.share-modal .modal-head {
  padding: 16px 18px;
}

.help-content {
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.log-content {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 18px;
}

.share-content {
  min-height: 0;
  display: grid;
  gap: 14px;
  overflow: auto;
  padding: 16px 18px 18px;
}

.share-preview-wrap {
  display: grid;
  place-items: center;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 8px;
  background: linear-gradient(180deg, #101714 0%, var(--surface-2) 100%);
}

.share-preview-image {
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--bg);
}

.share-caption {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
}

.share-link-input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border-color: var(--amber);
  color: var(--text);
  background: #101714;
  font-size: 0.82rem;
}

.share-button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.share-button-grid .primary-button,
.share-button-grid .tool-button {
  min-width: 0;
  min-height: 48px;
}

.share-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.log-toolbar strong {
  font-size: 1.4rem;
}

.log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.log-table-wrap {
  min-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  background: #111916;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1040px;
}

.log-table th,
.log-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.84rem;
}

.log-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #102019;
  background: var(--teal);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.log-table td {
  color: var(--muted);
}

.log-table strong {
  color: var(--text);
}

.empty-log {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.help-section + .help-section {
  margin-top: 20px;
}

.help-section h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.help-section p,
.help-section li,
.help-table span {
  color: var(--muted);
  line-height: 1.45;
}

.help-section p,
.help-section ol,
.help-section ul {
  margin: 0;
}

.help-section ol,
.help-section ul {
  display: grid;
  gap: 7px;
  padding-left: 22px;
}

.help-table {
  display: grid;
  gap: 8px;
}

.help-table > div {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  background: #111916;
}

.help-table strong {
  color: var(--text);
}

@media (max-width: 1050px) {
  .home-rule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .draft-grid {
    grid-template-columns: 1fr;
  }

  .duel-option-grid,
  .duel-final-teams {
    grid-template-columns: 1fr;
  }

  .duel-phase-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .squad-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .round-strip,
  .spin-board {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .game-control {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-view {
    min-height: auto;
    align-content: start;
    padding: 34px 0;
  }

  .home-rule-grid {
    grid-template-columns: 1fr;
  }

  .home-rule-card {
    min-height: auto;
  }

  .home-actions {
    width: 100%;
  }

  .home-actions .primary-button,
  .home-actions .tool-button {
    flex: 1 1 180px;
  }

  .topbar-actions .icon-button {
    flex: 0 0 44px;
  }

  .option-grid,
  .duel-card-grid,
  .duel-final-grid {
    grid-template-columns: 1fr;
  }

  .score-grid,
  .duel-score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .duel-phase-list {
    grid-template-columns: 1fr;
  }

  .duel-roster-panel {
    overflow-x: auto;
  }

  .duel-roster-table {
    min-width: 560px;
  }

  .result-panel {
    padding: 18px;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  .team-average-panel {
    justify-items: center;
  }

  .team-average-grid {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .share-button-grid {
    grid-template-columns: 1fr;
  }

  .share-preview-image {
    max-height: 300px;
  }

  .mode-control {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .action-row > button {
    flex: 1 1 140px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .help-modal,
  .log-modal {
    max-height: calc(100vh - 20px);
  }

  .log-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .log-actions > button {
    flex: 1 1 150px;
  }

  .help-table > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
