:root {
  --bg: #f3f6fb;
  --bg-2: #e9eef8;
  --surface: #ffffff;
  --surface-soft: #f7f9fd;
  --line: #d4dcec;
  --line-strong: #c2cde3;
  --text: #0f1b33;
  --text-muted: #56627a;
  --brand: #1f4ed8;
  --brand-strong: #123aa9;
  --brand-soft: rgba(31, 78, 216, 0.12);
  --warning: #9b6510;
  --good: #1f8f5f;
  --danger: #b94242;
  --board-dark: #8b5e38;
  --board-light: #e8cfaa;
  --btn-h-base: 52px;
  --btn-h-primary: 60px;
  --btn-w-wizard-nav: 180px;
  --shadow-soft: 0 12px 28px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 20px 46px rgba(15, 23, 42, 0.14);
  --landing-bg-image: url("assets/landing/maestro.png");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Neue Haas Grotesk Text Pro", "Helvetica Neue", "SF Pro Text", "Inter", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 340px at 8% 0%, #ffffff 0%, transparent 72%),
    radial-gradient(980px 420px at 95% 0%, #f0f4ff 0%, transparent 74%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  padding: 28px 16px 44px;
  overflow-y: auto;
}

.app {
  width: min(1240px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.hidden {
  display: none !important;
}

.landing-screen {
  position: relative;
  min-height: min(78vh, 820px);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(57, 28, 10, 0.4);
  box-shadow: 0 24px 54px rgba(16, 8, 3, 0.35);
  background:
    linear-gradient(180deg, rgba(16, 7, 2, 0.06) 0%, rgba(16, 7, 2, 0.34) 100%),
    radial-gradient(1200px 520px at 85% 96%, rgba(255, 176, 86, 0.42) 0%, rgba(255, 176, 86, 0) 54%),
    radial-gradient(900px 460px at 8% 14%, rgba(255, 223, 175, 0.22) 0%, rgba(255, 223, 175, 0) 58%),
    var(--landing-bg-image),
    linear-gradient(120deg, #3a1f10 0%, #5a3117 42%, #32180d 100%);
  background-size: auto, auto, auto, cover, auto;
  background-position: center, center, center, center, center;
}

.landing-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg,
      rgba(255, 210, 155, 0.04) 0 2px,
      rgba(255, 210, 155, 0) 2px 64px),
    linear-gradient(180deg, rgba(16, 7, 2, 0.08) 0%, rgba(16, 7, 2, 0.38) 100%);
  pointer-events: none;
}

.landing-sheen {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38%;
  background: linear-gradient(180deg, rgba(26, 11, 4, 0) 0%, rgba(26, 11, 4, 0.3) 68%, rgba(26, 11, 4, 0.5) 100%);
  pointer-events: none;
}

.landing-content {
  position: relative;
  z-index: 1;
  width: min(980px, 96%);
  margin: 0 auto;
  padding: 42px 18px 34px;
  display: grid;
  justify-items: center;
  gap: 16px;
}

.landing-title {
  margin: 0 0 12px;
  text-align: center;
  color: #f4d998;
  text-shadow:
    0 2px 0 #6f451d,
    0 8px 18px rgba(22, 8, 2, 0.7);
  font-family: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  font-size: clamp(44px, 7vw, 82px);
  letter-spacing: 0.02em;
  font-weight: 700;
}

.landing-description {
  margin: 0;
  max-width: 740px;
  text-align: center;
  color: #f8e7c2;
  font-family: "Neue Haas Grotesk Text Pro", "Helvetica Neue", "SF Pro Text", "Inter", Arial, sans-serif;
  font-size: clamp(20px, 2.5vw, 31px);
  line-height: 1.28;
  text-shadow: 0 2px 12px rgba(17, 7, 2, 0.6);
}

.landing-main-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 20px;
}

.landing-secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 18px;
}

.landing-btn {
  position: relative;
  border: 2px solid #5f3618;
  border-radius: 18px;
  background:
    linear-gradient(180deg, #edd9b1 0%, #dec599 62%, #d1b282 100%);
  color: #2b170d;
  box-shadow:
    inset 0 2px 0 rgba(255, 242, 216, 0.85),
    inset 0 -2px 0 rgba(95, 54, 24, 0.45),
    0 8px 16px rgba(20, 8, 3, 0.35);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.landing-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 2px 0 rgba(255, 242, 216, 0.88),
    inset 0 -2px 0 rgba(95, 54, 24, 0.45),
    0 12px 20px rgba(20, 8, 3, 0.44);
}

.landing-btn:active {
  transform: translateY(0);
  filter: brightness(0.96);
}

.landing-btn-main {
  min-height: 102px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.landing-btn-start {
  min-width: clamp(220px, 28vw, 360px);
  min-height: 74px;
  padding: 0 34px;
  font-family: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  font-size: clamp(34px, 4vw, 50px);
  line-height: 1;
}

.landing-btn-icon {
  font-size: 34px;
  width: 48px;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 237, 201, 0.92);
}

.landing-btn-text {
  display: grid;
  text-align: left;
  gap: 2px;
}

.landing-btn-text strong {
  font-family: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  font-size: clamp(30px, 2.4vw, 44px);
  line-height: 1;
  letter-spacing: 0.01em;
}

.landing-btn-text small {
  font-family: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  font-size: 28px;
  line-height: 1;
}

.landing-btn-secondary {
  min-height: 66px;
  min-width: 180px;
  padding: 0 26px;
  font-family: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  font-size: 38px;
  line-height: 1;
}

.landing-note {
  margin: 4px 0 0;
  min-height: 22px;
  color: #f8e8c2;
  text-align: center;
  font-size: 19px;
  text-shadow: 0 2px 10px rgba(15, 6, 2, 0.58);
}

body.landing-active .hero,
body.landing-active #setup-panel {
  display: none !important;
}

body.landing-active {
  overflow-y: auto;
}

.hero {
  position: relative;
  padding: 26px 28px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(19, 58, 150, 0.2);
  background:
    radial-gradient(circle at 95% -10%, rgba(88, 137, 255, 0.34) 0%, transparent 36%),
    linear-gradient(130deg, #0f2044 0%, #15306c 48%, #1c4191 100%);
  box-shadow: var(--shadow-strong);
  color: #f8fbff;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -58% auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 160, 255, 0.18) 0%, transparent 68%);
  pointer-events: none;
}

.hero-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  padding: 7px;
  border-radius: 12px;
  background: rgba(208, 224, 255, 0.15);
  border: 1px solid rgba(208, 224, 255, 0.22);
  filter: drop-shadow(0 6px 10px rgba(4, 11, 31, 0.28));
}

.hero-art {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-piece {
  width: 48px;
  height: 48px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(214, 228, 255, 0.18);
  border: 1px solid rgba(214, 228, 255, 0.28);
  filter: drop-shadow(0 8px 12px rgba(4, 11, 31, 0.24));
}

.hero-piece-a {
  transform: translateY(3px) rotate(-6deg);
}

.hero-piece-b {
  transform: translateY(-4px) rotate(7deg);
}

.hero-piece-c {
  transform: translateY(2px) rotate(-4deg);
}

.hero h1 {
  position: relative;
  z-index: 2;
  margin: 12px 0 0;
  font-family: "Neue Haas Grotesk Display Pro", "Helvetica Neue", "SF Pro Display", "Inter", Arial, sans-serif;
  font-weight: 700;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  max-width: 1180px;
}

.hero-lead {
  position: relative;
  z-index: 2;
  margin: 12px 0 0;
  max-width: 980px;
  color: #f0f6ff;
  font-size: clamp(20px, 2.2vw, 33px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-family: "Neue Haas Grotesk Display Pro", "Helvetica Neue", "SF Pro Display", "Inter", Arial, sans-serif;
  font-weight: 600;
}

.hero-points {
  position: relative;
  z-index: 2;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  max-width: 980px;
}

.hero-points li {
  position: relative;
  margin: 0;
  padding-left: 24px;
  color: rgba(233, 241, 255, 0.95);
  font-size: 15px;
  line-height: 1.35;
}

.hero-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.52em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #9fc0ff 65%, #6e97ec 100%);
}

.hero .hint {
  position: relative;
  z-index: 2;
  margin-top: 6px;
  color: rgba(206, 222, 247, 0.95);
}

.panel {
  background: linear-gradient(180deg, #f3e4c4 0%, #e7d4ad 62%, #dcc297 100%);
  border-radius: 16px;
  border: 1px solid #6a3d1d;
  padding: 18px;
  display: grid;
  gap: 12px;
  box-shadow:
    inset 0 2px 0 rgba(255, 243, 218, 0.8),
    0 12px 28px rgba(23, 10, 3, 0.2);
}

.panel h2 {
  margin: 0;
  font-family: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  font-size: 40px;
  line-height: 1.02;
  letter-spacing: 0.01em;
  color: #2e1a0f;
}

#setup-panel {
  position: relative;
  overflow: hidden;
  min-height: min(72vh, 780px);
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 14px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(16, 7, 2, 0.14) 0%, rgba(16, 7, 2, 0.34) 100%),
    var(--landing-bg-image),
    linear-gradient(120deg, #3a1f10 0%, #5a3117 42%, #32180d 100%);
  background-size: cover;
  background-position: center top;
  border-color: rgba(57, 28, 10, 0.7);
  box-shadow: 0 24px 54px rgba(16, 8, 3, 0.35);
}

#setup-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(23, 11, 4, 0.06) 0%, rgba(23, 11, 4, 0.24) 100%);
  pointer-events: none;
}

#setup-panel>* {
  position: relative;
  z-index: 1;
}

#setup-panel h2 {
  margin: 0;
  font-size: clamp(34px, 2.8vw, 46px);
  line-height: 1.02;
}


body.mode-citizen .engineer-only {
  display: none !important;
}

body.mode-engineer .citizen-only {
  display: none !important;
}

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

label {
  font-size: 14px;
  font-weight: 700;
  color: #402615;
  letter-spacing: 0.01em;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #b08a58;
  border-radius: 11px;
  background: #fbf1dd;
  color: #2d1b10;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:hover,
select:hover {
  border-color: #8b5c32;
}

input:focus,
select:focus {
  outline: none;
  border-color: #8f5b2a;
  box-shadow: 0 0 0 3px rgba(143, 91, 42, 0.22);
}

input[type="file"] {
  padding: 7px 8px;
  background: #f4e5c7;
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 1px solid #8b5c32;
  border-radius: 9px;
  background: linear-gradient(180deg, #f6e6c5, #e1c89f);
  color: #3c2515;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}

.hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.42;
}

.status-line {
  margin: 0;
  border: 1px solid #b48a58;
  border-radius: 11px;
  background: linear-gradient(180deg, #f8ecd3 0%, #f0dfbc 100%);
  color: #3d2616;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}

#analysis-status:empty {
  display: none;
}

#config-files-status:empty {
  display: none;
}

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

.progress-track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #dbe4f6;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1a45c2, #2c74ff);
  transition: width 0.18s ease;
}

.progress-label {
  margin: 0;
  font-size: 12px;
  color: #536280;
  font-weight: 700;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wizard-primary {
  border-color: #6a3d1d;
  background: linear-gradient(180deg, #8f5b2a, #6f431f);
  color: #f9ebc7;
}

.wizard-primary:hover {
  border-color: #5b3519;
}

button {
  border: 1px solid #6a3d1d;
  border-radius: 11px;
  min-height: 44px;
  padding: 0 15px;
  background: linear-gradient(180deg, #f0dfbc 0%, #e3cca1 60%, #d8bb8c 100%);
  color: #2b170d;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 242, 216, 0.85),
    inset 0 -2px 0 rgba(95, 54, 24, 0.35),
    0 8px 18px rgba(20, 8, 3, 0.24);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: #7e4c22;
  box-shadow:
    inset 0 2px 0 rgba(255, 242, 216, 0.88),
    inset 0 -2px 0 rgba(95, 54, 24, 0.38),
    0 12px 24px rgba(20, 8, 3, 0.32);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#analyze-btn,
#next-btn {
  border-color: #6a3d1d;
  background: linear-gradient(180deg, #8f5b2a, #6f431f);
  color: #f9ebc7;
}

#analyze-btn:hover,
#next-btn:hover {
  border-color: #5b3519;
}

#skip-btn {
  border-color: #e2c187;
  background: linear-gradient(180deg, #fff5e0, #ffecd0);
  color: var(--warning);
}

.layout {
  display: grid;
  grid-template-columns: minmax(420px, 2fr) minmax(310px, 1fr);
  grid-template-areas:
    "info info"
    "board side";
  gap: 14px;
}

.game-info {
  grid-area: info;
  padding: 10px 14px;
  border-color: #8f6641;
  background: linear-gradient(180deg, #f7ecd4 0%, #edd9b1 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 219, 0.85),
    0 8px 16px rgba(28, 14, 5, 0.14);
}

.top-status-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 300px);
  gap: 14px;
  align-items: center;
}

.game-info .status-line {
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

.progress-stack {
  display: grid;
  gap: 4px;
}

.session-progress {
  font-size: 14px;
  font-weight: 600;
  color: #593e27;
  white-space: normal;
}

#round-status {
  color: #2f1d11;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 800;
}

.timer-line {
  display: grid;
  gap: 5px;
  border: 1px solid #b48a58;
  border-radius: 10px;
  padding: 8px 10px;
  background: linear-gradient(180deg, #fbf2de, #f2dfbc);
}

.timer-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: #674630;
}

#turn-timer-value {
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: #2e1b10;
}

.timer-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #ddc9a4;
}

.timer-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #7f522a, #bf8544);
  transition: width 90ms linear, background 140ms ease;
}

.timer-line.urgency-mid {
  border-color: #d6a46a;
  background: linear-gradient(180deg, #fff8eb, #fbe7c8);
}

.timer-line.urgency-mid .timer-bar {
  background: linear-gradient(90deg, #d0882c, #e26b25);
}

.timer-line.urgency-high {
  border-color: #cb8a83;
  background: linear-gradient(180deg, #fff7f5, #f9dfdc);
}

.timer-line.urgency-high .timer-bar {
  background: linear-gradient(90deg, #c14f3a, #ad2f2f);
}

#competitive-status {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #6b4a30;
  line-height: 1.35;
}

.board-panel {
  grid-area: board;
  display: grid;
  gap: 10px;
  align-content: start;
}

.side-panel {
  grid-area: side;
  display: grid;
  gap: 12px;
  align-content: start;
}

body.playing-mode {
  padding: 12px 10px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  background:
    radial-gradient(780px 320px at 12% 2%, rgba(255, 238, 204, 0.5) 0%, rgba(255, 238, 204, 0) 70%),
    linear-gradient(180deg, #f1e3c3 0%, #e6cfaa 62%, #dcc093 100%);
}

body.playing-mode .app {
  max-width: 1380px;
  height: auto;
  gap: 10px;
}

body.playing-mode .layout {
  height: auto;
  gap: 10px;
  grid-template-columns: minmax(560px, 2.15fr) minmax(320px, 1fr);
}

body.playing-mode .side-panel {
  position: static;
  max-height: none;
  overflow: visible;
  grid-template-rows: auto auto auto;
}

body.playing-mode .side-panel .panel:last-child {
  min-height: auto;
}

body.playing-mode .panel {
  box-shadow: 0 8px 20px rgba(36, 16, 4, 0.16);
}

.board {
  width: 100%;
  max-width: min(78vh, 820px);
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 1px solid rgba(80, 48, 25, 0.6);
  box-shadow: var(--shadow-strong);
}

body.playing-mode .board {
  max-width: min(76vh, 780px);
}

.square {
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.square.light {
  background: var(--board-light);
}

.square.dark {
  background: var(--board-dark);
}

.square.selected {
  background: linear-gradient(135deg, #e4ba7c, #cb8f4d);
}

.piece-img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28));
  z-index: 2;
}

.coord {
  position: absolute;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.84;
  pointer-events: none;
  z-index: 1;
}

.coord-rank {
  top: 4px;
  left: 4px;
}

.coord-file {
  bottom: 4px;
  right: 4px;
}

.square.light .coord {
  color: rgba(72, 42, 22, 0.78);
}

.square.dark .coord {
  color: rgba(251, 236, 205, 0.9);
}

.square.legal::after {
  content: "";
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.58);
}

.square.capture::after {
  content: "";
  position: absolute;
  width: 70%;
  height: 70%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
}

.square.best-from {
  box-shadow: inset 0 0 0 3px rgba(31, 143, 95, 0.95);
}

.square.best-to {
  box-shadow: inset 0 0 0 5px rgba(31, 143, 95, 0.95);
}

.square.game-from {
  outline: 2px dashed rgba(0, 188, 212, 0.92);
  outline-offset: -3px;
}

.square.game-to {
  outline: 3px solid rgba(0, 188, 212, 0.92);
  outline-offset: -4px;
}

.square.user-from {
  box-shadow: inset 0 0 0 3px rgba(25, 118, 210, 0.95);
}

.square.user-to {
  box-shadow: inset 0 0 0 5px rgba(25, 118, 210, 0.95);
}

.square.user-alt-from {
  box-shadow: inset 0 0 0 3px rgba(0, 188, 212, 0.95);
}

.square.user-alt-to {
  box-shadow: inset 0 0 0 5px rgba(0, 188, 212, 0.95);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 12px;
  color: #5c3f2a;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  display: inline-block;
}

.swatch.best {
  background: rgba(31, 143, 95, 0.95);
}

.swatch.game {
  background: rgba(0, 188, 212, 0.92);
}

.swatch.user {
  background: rgba(25, 118, 210, 0.95);
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

#score-label {
  font-size: 14px;
  font-weight: 700;
  color: #61442d;
}

#score {
  font-size: 24px;
  line-height: 1;
  color: #2f1c10;
}

.result {
  font-size: 15px;
  line-height: 1.45;
  min-height: 54px;
}

body.playing-mode .side-panel .panel {
  padding: 14px 14px 12px;
}

body.playing-mode .side-panel .panel h2 {
  font-size: 22px;
  line-height: 1.1;
}

.round-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.round-actions #next-btn {
  min-height: 46px;
  font-size: 16px;
}

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

.board-actions-secondary button {
  min-height: 36px;
  padding: 0 10px;
  font-size: 14px;
}

#skip-btn {
  grid-column: 1 / -1;
}

#restart-btn {
  opacity: 0.92;
}

.mini-details {
  font-size: 13px;
  color: var(--text-muted);
  padding: 2px 4px 0;
}

.history {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  font-size: 13px;
}

body.playing-mode .history {
  max-height: 380px;
  height: auto;
}

.history-empty {
  color: #775236;
  font-size: 13px;
  padding: 4px 2px;
}

.history-item-btn {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #c79d6f;
  border-radius: 9px;
  background: linear-gradient(180deg, #fff8ea, #f2dfbf);
  color: #4a2f1b;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  box-shadow: none;
}

.history-item-btn:hover {
  transform: none;
  border-color: #ad7f4f;
  box-shadow: none;
}

.history-item-btn:active {
  transform: none;
}

.history-item-btn.active {
  border-color: #8b5b2f;
  background: linear-gradient(180deg, #f7e8cb, #e7cfaa);
  color: #2f1c10;
}

.history-preview {
  display: grid;
  gap: 5px;
}

.history-preview-title {
  margin: 0 0 2px;
  color: #2f1c10;
}

.history-preview p {
  margin: 0;
  font-size: 14px;
  color: #593a24;
}

body.thinking-mode .side-panel .panel:last-child,
body.thinking-mode .mini-details {
  display: none !important;
}

body.thinking-mode #session-progress {
  display: none !important;
}

body.thinking-mode #restart-btn,
body.thinking-mode #restart-btn {
  display: none;
}

body.duel-mode #next-btn {
  min-width: 176px;
}

@keyframes stepFade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  body {
    padding: 16px 12px 28px;
  }

  #setup-panel {
    padding: 12px;
    min-height: auto;
  }

  #setup-panel h2 {
    font-size: clamp(36px, 9vw, 50px);
  }

  .landing-screen {
    min-height: auto;
    border-radius: 15px;
  }

  .landing-content {
    width: min(760px, 100%);
    padding: 28px 12px 24px;
    gap: 14px;
  }

  .landing-title {
    font-size: clamp(36px, 11vw, 58px);
    margin-bottom: 8px;
  }

  .landing-description {
    font-size: clamp(18px, 5vw, 24px);
    max-width: 620px;
  }

  .landing-btn-start {
    min-width: min(300px, 92%);
    min-height: 64px;
    font-size: clamp(28px, 9vw, 40px);
  }

  .hero {
    padding: 18px 16px;
  }

  .hero h1 {
    font-size: clamp(28px, 8vw, 44px);
  }

  .hero-lead {
    font-size: clamp(18px, 6vw, 30px);
  }

  .hero-points li {
    font-size: 14px;
  }

  .hero-top {
    flex-direction: column;
    gap: 12px;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
    padding: 6px;
  }

  .hero-piece {
    width: 40px;
    height: 40px;
    padding: 6px;
  }

  .panel {
    border-radius: 13px;
    padding: 13px;
  }

  .panel h2 {
    font-size: 30px;
  }

  body.playing-mode {
    overflow-y: auto;
    padding: 14px 12px 24px;
  }

  body.playing-mode .app {
    height: auto;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "info"
      "board"
      "side";
  }

  .top-status-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body.playing-mode .side-panel {
    position: static;
    max-height: none;
    overflow: visible;
    grid-template-rows: unset;
  }

  .board {
    max-width: 100%;
  }

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

/* -------------------- Gameplay Redesign -------------------- */

:root {
  --game-bg: #ececeb;
  --game-surface: #f8f8f7;
  --game-surface-strong: #fefefd;
  --game-line: #d3d2ce;
  --game-line-strong: #bcbab4;
  --game-text: #1f2328;
  --game-text-muted: #5e646c;
  --game-good: #1f8f5f;
  --game-bad: #bf4949;
  --game-alert: #b03a3a;
}

body {
  font-family: "Inter", "Roboto", "Helvetica Neue", "SF Pro Text", Arial, sans-serif;
}

body.playing-mode {
  background:
    radial-gradient(1000px 420px at 50% -10%, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0) 74%),
    linear-gradient(180deg, #ececea 0%, #e3e1dc 100%);
  padding: 16px;
}

body.playing-mode .app {
  max-width: 1680px;
  gap: 0;
}

#game-layout.layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(220px, 18%) minmax(700px, 64%) minmax(220px, 18%);
  gap: clamp(16px, 2vw, 26px);
  align-items: stretch;
}

body.solo-mode #game-layout.layout {
  grid-template-columns: minmax(250px, 23%) minmax(0, 1fr);
}

body.solo-mode #right-player-panel {
  display: none;
}

body.solo-mode #player-a-avatar,
body.solo-mode #player-a-kicker,
body.solo-mode #player-a-timer {
  display: none;
}

body.solo-mode #left-player-panel .player-identity {
  display: block;
}

body.solo-mode #player-a-name {
  margin: 0;
  font-size: clamp(22px, 2vw, 30px);
}

.player-panel {
  min-height: min(76vh, 860px);
  border-radius: 18px;
  border: 1px solid var(--game-line);
  background: linear-gradient(180deg, var(--game-surface-strong) 0%, var(--game-surface) 100%);
  box-shadow: 0 12px 26px rgba(29, 22, 12, 0.08);
  padding: clamp(14px, 1.5vw, 22px);
  display: grid;
  align-content: start;
  gap: 18px;
  transition: opacity 160ms ease, filter 160ms ease, transform 180ms ease;
}

.player-panel.is-active {
  opacity: 1;
  filter: none;
}

.player-panel.is-inactive {
  opacity: 0.46;
  filter: grayscale(0.2);
}

.player-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-avatar {
  width: clamp(52px, 4.8vw, 68px);
  height: clamp(52px, 4.8vw, 68px);
  border-radius: 999px;
  border: 1px solid #c9c8c4;
  background: #f1f1ef;
  color: #3b4046;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: clamp(15px, 1.2vw, 18px);
  letter-spacing: 0.03em;
}

.player-identity-copy {
  min-width: 0;
}

.player-kicker {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--game-text-muted);
}

.player-panel h2 {
  margin: 2px 0 0;
  font-family: "Inter", "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(18px, 1.6vw, 24px);
  line-height: 1.08;
  color: var(--game-text);
  font-weight: 700;
}

.player-score {
  display: grid;
  gap: 4px;
  padding: 14px 12px;
  border-radius: 12px;
  border: 1px solid var(--game-line);
  background: #f4f4f2;
}

.player-score-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--game-text-muted);
}

.player-score-value {
  font-size: clamp(32px, 4.1vw, 52px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: #1b1f24;
  font-weight: 800;
}

body.solo-mode .player-score-value {
  font-size: clamp(25px, 2.4vw, 36px);
  line-height: 1.02;
}

.solo-progress-line {
  margin: -10px 0 0;
  font-size: 13px;
  color: var(--game-text-muted);
  font-weight: 600;
}

.player-timer {
  display: grid;
  gap: 7px;
  border-radius: 12px;
  border: 1px solid var(--game-line);
  background: #f6f6f4;
  padding: 10px 11px;
}

.player-timer-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  color: #4f5560;
  font-size: 13px;
  font-weight: 600;
}

.player-timer-head strong {
  color: #20242b;
  font-size: clamp(19px, 1.7vw, 28px);
}

.player-timer-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #deddd8;
}

.player-timer-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #84714f, #9b835b);
  transition: width 100ms linear, background 140ms ease;
}

.player-timer.urgency-mid {
  border-color: #d4af80;
  background: #f9f2e8;
}

.player-timer.urgency-mid .player-timer-bar {
  background: linear-gradient(90deg, #c89a4f, #d98235);
}

.player-timer.urgency-high {
  border-color: #cf908a;
  background: #fdf0ee;
}

.player-timer.urgency-high .player-timer-bar {
  background: linear-gradient(90deg, #cb4f4f, var(--game-alert));
}

.player-timer.is-passive {
  opacity: 0.7;
}

.player-actions-slot {
  margin-top: auto;
}

#shared-actions {
  display: none;
}

.player-actions-slot #shared-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

.player-actions-slot #shared-actions button {
  height: var(--btn-h-base);
  min-height: var(--btn-h-base);
  font-size: 15px;
}

.board-stage {
  min-height: min(76vh, 860px);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 14px;
}

.board-stage-status {
  display: grid;
  gap: 5px;
}

.round-status {
  margin: 0;
  font-size: clamp(20px, 2vw, 32px);
  line-height: 1.05;
  font-weight: 700;
  color: #1d2229;
}

.session-progress {
  margin: 0;
  font-size: clamp(12px, 1vw, 14px);
  color: #5d6470;
}

body.solo-mode #session-progress {
  display: none;
}

.board-stage-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-items: start;
  gap: 16px;
  padding: clamp(10px, 2.2vh, 26px) 0;
}

body.result-visible .board-stage-main {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
  justify-items: stretch;
}

body.solo-mode:not(.result-visible) .board-stage-main {
  grid-template-columns: minmax(0, 1fr) auto;
  justify-items: stretch;
  align-items: center;
  gap: 14px;
}

.board-wrap {
  position: relative;
  width: min(100%, min(72vh, 980px));
  display: grid;
  place-items: center;
  isolation: isolate;
}

body.solo-mode .board-wrap {
  width: min(100%, min(80vh, 1120px));
}

body.solo-mode:not(.result-visible) .board-wrap {
  justify-self: end;
}

body.result-visible .board-wrap {
  justify-self: end;
}

#game-layout .board {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(72vh, 980px);
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  border: 1px solid rgba(78, 58, 37, 0.54);
  box-shadow: 0 18px 46px rgba(31, 24, 14, 0.22);
}

body.solo-mode #game-layout .board {
  max-width: min(80vh, 1120px);
}

.board-arrows {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  pointer-events: none;
  overflow: visible;
}

.board-arrow-line {
  stroke: rgba(31, 143, 95, 0.55);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  filter: drop-shadow(0 1px 1px rgba(8, 24, 16, 0.24));
}

.handoff-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  border: 0;
  border-radius: 18px;
  background: rgba(18, 22, 28, 0.9);
  color: #f7f7f6;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  cursor: pointer;
}

.handoff-overlay-title {
  font-size: clamp(22px, 2vw, 33px);
  font-weight: 700;
}

.handoff-overlay-subtitle {
  font-size: clamp(14px, 1.2vw, 18px);
  color: rgba(245, 245, 243, 0.84);
}

.solo-clock-rail {
  display: none;
  position: static;
  align-self: center;
  justify-self: start;
  width: 58px;
  padding: 8px 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(169, 157, 134, 0.6);
  background: rgba(251, 250, 247, 0.82);
  backdrop-filter: blur(3px);
  justify-items: center;
  gap: 8px;
}

body.solo-mode .solo-clock-rail {
  display: grid;
}

body.result-visible .solo-clock-rail {
  display: none;
}

.solo-clock-value {
  font-size: 14px;
  line-height: 1;
  color: #2f3540;
  font-weight: 700;
}

.solo-clock-track {
  position: relative;
  width: 12px;
  height: 170px;
  border-radius: 999px;
  border: 1px solid rgba(176, 166, 145, 0.65);
  background: rgba(224, 220, 209, 0.78);
  overflow: hidden;
}

.solo-clock-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  background: linear-gradient(180deg, #9d8a63, #857251);
  transition: height 100ms linear, background 150ms ease;
}

.solo-clock-rail.urgency-mid .solo-clock-bar {
  background: linear-gradient(180deg, #d79a4d, #cb7730);
}

.solo-clock-rail.urgency-high .solo-clock-bar {
  background: linear-gradient(180deg, #d1645a, #b8463f);
}

.position-search-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  border-radius: 18px;
  display: grid;
  place-content: center;
  gap: 6px;
  justify-items: center;
  text-align: center;
  padding: 24px;
  pointer-events: none;
  background: rgba(17, 21, 28, 0.58);
  color: #f7f7f6;
}

.position-search-title {
  font-size: clamp(21px, 1.9vw, 32px);
  line-height: 1.06;
  font-weight: 700;
}

.position-search-meta {
  font-size: clamp(13px, 1vw, 16px);
  color: rgba(243, 244, 246, 0.92);
  font-weight: 600;
  max-width: 95%;
}

.position-search-progress {
  width: min(360px, 90%);
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.position-search-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.position-search-progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #7fc08f, #57a772);
  transition: width 120ms linear;
}

.position-search-progress-label {
  font-size: clamp(12px, 0.96vw, 14px);
  font-weight: 700;
  color: rgba(246, 247, 249, 0.96);
  letter-spacing: 0.02em;
}

.result-overlay {
  position: relative;
  z-index: 8;
  width: min(390px, 100%);
  align-self: stretch;
}

body.result-visible .result-overlay {
  justify-self: start;
}

.result-overlay-panel {
  width: 100%;
  height: 100%;
  max-height: min(72vh, 860px);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(218, 218, 213, 0.56);
  background: rgba(252, 252, 250, 0.96);
  box-shadow: 0 16px 30px rgba(5, 7, 10, 0.22);
  padding: clamp(12px, 1.6vw, 20px);
  display: grid;
  gap: 12px;
}

.result-overlay-header {
  display: grid;
  gap: 4px;
}

.result-overlay-title {
  margin: 0;
  font-size: clamp(24px, 2.1vw, 34px);
  line-height: 1.04;
  font-weight: 800;
  color: #1e2329;
}

.result-overlay-points {
  margin: 0;
  font-size: clamp(14px, 1.1vw, 17px);
  color: #4f5660;
  font-weight: 600;
}

.result-overlay-grid {
  display: grid;
  gap: 12px;
}

.result-summary-line {
  margin: 0;
  font-size: 14px;
  color: #515761;
}

.result-cards {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.session-summary-result {
  display: grid;
  gap: 8px;
  text-align: center;
  padding: 24px 10px;
  background: linear-gradient(180deg, rgba(235, 222, 196, 0.45) 0%, rgba(224, 206, 172, 0.5) 100%);
  border: 1px solid rgba(133, 90, 52, 0.3);
  border-radius: 12px;
  margin-top: 6px;
  margin-bottom: 6px;
}

.summary-score-display {
  font-size: clamp(38px, 4vw, 54px);
  line-height: 1;
  font-weight: 800;
  color: #1a222d;
  font-family: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
}

.summary-details-text {
  margin: 0;
  font-size: 15px;
  color: #4f5a6b;
  line-height: 1.4;
}

.result-overlay-actions #summary-menu-btn {
  border-color: #2e624b;
  background: linear-gradient(180deg, #3aa175, #267954);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
}

.result-card {
  border: 1px solid #d7d5cf;
  border-radius: 11px;
  background: #f8f8f6;
  padding: 10px 10px 9px;
  display: grid;
  gap: 3px;
}

.result-card .card-label {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #666c76;
}

.result-card .card-move {
  margin: 0;
  font-size: 24px;
  line-height: 1;
  color: #1c2128;
  font-weight: 800;
}

.result-card .card-meta {
  margin: 0;
  font-size: 12px;
  color: #545b65;
}

.result-card.state-good {
  border-color: rgba(31, 143, 95, 0.45);
  background: rgba(31, 143, 95, 0.1);
}

.result-card.state-bad {
  border-color: rgba(191, 73, 73, 0.45);
  background: rgba(191, 73, 73, 0.1);
}

.result-card.state-neutral {
  border-color: rgba(126, 130, 136, 0.44);
  background: rgba(133, 136, 141, 0.11);
}

.result-overlay-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.result-overlay-actions button {
  height: var(--btn-h-base);
  min-height: var(--btn-h-base);
  width: 100%;
}

.result-overlay-actions #result-analysis-btn,
.result-overlay-actions #result-analysis-reset-btn {
  border-color: #9ca3ad;
  background: #f0f2f5;
  color: #293240;
}

.result-overlay.analysis-mode #result-analysis-btn {
  border-color: #2b7f59;
  background: rgba(31, 143, 95, 0.18);
  color: #1e5f42;
}

.result-overlay-actions #next-btn {
  width: 100%;
  height: var(--btn-h-primary);
  min-height: var(--btn-h-primary);
  border-color: #59626f;
  background: linear-gradient(180deg, #6c7785, #59626f);
  color: #f8f8f7;
}

.mini-details {
  font-size: 13px;
  color: #58606a;
  padding: 2px;
  text-align: center;
}

#competitive-status {
  margin: 0;
  font-size: 12px;
  color: #5c626c;
  text-align: center;
}

body.solo-mode #competitive-status {
  display: none !important;
}

body.duel-mode .player-panel .solo-only {
  display: none;
}

body.playing-mode #setup-panel,
body.playing-mode #landing-screen {
  display: none !important;
}

@media (max-width: 1260px) {
  #game-layout.layout {
    grid-template-columns: minmax(190px, 21%) minmax(560px, 58%) minmax(190px, 21%);
    gap: 14px;
  }

  .player-panel {
    padding: 13px;
  }

  .board-wrap {
    width: min(100%, min(70vh, 860px));
  }
}

@media (max-width: 1080px) {
  #game-layout.layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body.solo-mode #game-layout.layout {
    grid-template-columns: 1fr;
  }

  .board-stage {
    order: 1;
    min-height: auto;
  }

  #left-player-panel {
    order: 2;
    min-height: auto;
  }

  #right-player-panel {
    order: 3;
    min-height: auto;
  }

  .player-panel.is-inactive {
    opacity: 0.8;
    filter: none;
  }

  .board-wrap {
    width: min(100%, 760px);
  }

  body.solo-mode:not(.result-visible) .board-stage-main {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
  }

  .solo-clock-rail {
    width: 48px;
    padding: 6px 6px 8px;
    gap: 6px;
  }

  .solo-clock-value {
    font-size: 12px;
  }

  .solo-clock-track {
    width: 10px;
    height: 126px;
  }

  .position-search-title {
    font-size: clamp(18px, 4.8vw, 25px);
  }

  .position-search-meta {
    font-size: clamp(12px, 3.4vw, 14px);
  }

  body.result-visible .board-stage-main {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  body.result-visible .board-wrap {
    justify-self: center;
  }

  .result-overlay {
    width: min(100%, 760px);
  }

  #shared-actions button,
  .result-overlay-actions button {
    width: 100%;
  }
}

/* -------------------- Setup Wizard -------------------- */

.setup-wizard {
  width: min(920px, 100%);
  margin: 0 auto;
  border: 1px solid rgba(106, 61, 29, 0.75);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(248, 236, 207, 0.95) 0%, rgba(238, 220, 184, 0.95) 58%, rgba(226, 203, 164, 0.96) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 243, 218, 0.8),
    0 14px 24px rgba(23, 10, 3, 0.22);
  padding: 20px;
  display: grid;
  gap: 16px;
}

.wizard-header {
  display: grid;
  gap: 8px;
}

.wizard-title {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #744521;
  font-weight: 800;
}

.wizard-inline-form input,
#wizard-step-2 input,
#wizard-step-3 input {
  max-width: 320px;
  text-align: center;
}

.wizard-header h2 {
  margin: 0;
  font-size: clamp(32px, 4.6vw, 48px);
  line-height: 1.02;
  color: #2f1b11;
}

.wizard-step-indicator {
  margin: 0;
  font-size: 16px;
  color: #56321c;
  font-weight: 700;
}

.wizard-progress-track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(111, 67, 31, 0.2);
}

.wizard-progress-bar {
  width: 25%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8e5928, #ba7a3b);
  transition: width 180ms ease;
}

.wizard-steps {
  min-height: 360px;
  display: grid;
}

.wizard-step {
  display: grid;
  align-content: start;
  gap: 14px;
  animation: stepFade 180ms ease;
}

.wizard-question {
  margin: 0;
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.03;
  color: #2e190f;
}

.wizard-help {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
  color: #5d3a23;
}

.wizard-details-help {
  font-size: 16px;
  color: #6e462b;
  background: rgba(244, 229, 198, 0.4);
  border: 1px solid rgba(145, 96, 54, 0.25);
  border-radius: 12px;
  padding: 10px 14px;
}

.wizard-details-help summary {
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.wizard-details-help p {
  margin: 10px 0 0 0;
  line-height: 1.4;
  font-size: 15px;
}

.wizard-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.wizard-choice-card {
  min-height: 92px;
  border: 2px solid #a06a38;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8ebcd 0%, #edd7ac 100%);
  font-family: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  font-size: clamp(30px, 3.2vw, 40px);
  line-height: 0.98;
  color: #2e1a10;
  box-shadow:
    inset 0 2px 0 rgba(255, 242, 217, 0.9),
    inset 0 -2px 0 rgba(98, 60, 31, 0.34),
    0 8px 16px rgba(25, 10, 3, 0.2);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.wizard-choice-card:hover {
  transform: translateY(-1px);
}

.wizard-choice-card.is-selected {
  border-color: #6e3f20;
  box-shadow:
    inset 0 2px 0 rgba(255, 242, 217, 0.95),
    inset 0 -2px 0 rgba(98, 60, 31, 0.35),
    0 0 0 3px rgba(123, 75, 38, 0.28),
    0 8px 16px rgba(25, 10, 3, 0.24);
}

.wizard-inline-form {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(145, 96, 54, 0.35);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(252, 244, 226, 0.62) 0%, rgba(244, 229, 198, 0.6) 100%);
  padding: 12px;
}

.wizard-inline-form label {
  font-size: 17px;
  color: #4d301d;
  font-weight: 700;
}

.wizard-inline-form input,
#wizard-step-2 input,
#wizard-step-3 input {
  min-height: 56px;
  font-size: 30px;
  border-radius: 12px;
  border: 1px solid #a67546;
  background: linear-gradient(180deg, #fffdf8 0%, #f3e8ce 100%);
  color: #2b180f;
  padding: 8px 12px;
  max-width: 320px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

.wizard-status {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  color: #5d3b24;
}

.wizard-error {
  margin: 0;
  border: 1px solid rgba(167, 55, 55, 0.45);
  border-radius: 10px;
  background: rgba(191, 73, 73, 0.1);
  color: #7d2c2c;
  font-size: 16px;
  font-weight: 700;
  padding: 10px 12px;
}

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

.wizard-secondary-btn {
  min-height: 44px;
  font-size: 15px;
  padding: 0 14px;
}

.wizard-secondary-btn.revealed-state {
  background: var(--surface-default);
  border-color: #5d3b24;
  color: #2b180f;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  font-weight: 700;
}

.wizard-size-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}

.wizard-size-chip {
  min-height: 70px;
  border: 2px solid #a06a38;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8ebcd 0%, #edd7ac 100%);
  color: #2e1a10;
  font-family: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  font-size: clamp(24px, 2.5vw, 32px);
}

.wizard-size-chip.is-selected {
  border-color: #6e3f20;
  box-shadow: 0 0 0 3px rgba(123, 75, 38, 0.28);
}

.wizard-summary {
  border: 1px solid rgba(145, 96, 54, 0.35);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(252, 244, 226, 0.62) 0%, rgba(244, 229, 198, 0.6) 100%);
  padding: 12px;
  display: grid;
  gap: 7px;
}

.wizard-summary p {
  margin: 0;
  font-size: 16px;
  color: #392215;
}

.wizard-summary-floating {
  margin-top: 32px;
  border-top: 1px dashed var(--border-soft);
  padding-top: 24px;
}

.wizard-summary-title {
  margin: 0 0 12px 0;
  font-size: 1.1rem;
  color: #2e1a10;
  font-weight: 700;
}

.wizard-footer {
  display: flex;
  gap: 10px;
  align-items: center;
}

.wizard-footer #source-back-btn,
.wizard-footer #wizard-prev-btn,
.wizard-footer #wizard-next-btn,
.wizard-footer #analyze-btn {
  min-height: var(--btn-h-base);
  min-width: var(--btn-w-wizard-nav);
  justify-content: center;
}

.wizard-footer #wizard-next-btn,
.wizard-footer #analyze-btn {
  margin-left: auto;
}

@media (max-width: 920px) {
  .setup-wizard {
    padding: 14px;
  }

  .wizard-header h2 {
    font-size: clamp(30px, 8.6vw, 42px);
  }

  .wizard-question {
    font-size: clamp(29px, 9vw, 38px);
  }

  .wizard-card-grid {
    grid-template-columns: 1fr;
  }

  .wizard-size-grid {
    grid-template-columns: 1fr;
  }

  .wizard-inline-form input,
  #wizard-step-2 input,
  #wizard-step-3 input {
    font-size: 26px;
    min-height: 52px;
  }

  .wizard-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .wizard-footer #wizard-next-btn,
  .wizard-footer #analyze-btn {
    margin-left: 0;
  }

  .wizard-footer #source-back-btn {
    grid-column: 1 / -1;
  }

  .wizard-footer #source-back-btn,
  .wizard-footer #wizard-prev-btn,
  .wizard-footer #wizard-next-btn,
  .wizard-footer #analyze-btn {
    min-width: 0;
    width: 100%;
  }
}

/* --- Vertical Infographic Bar --- */
.vertical-infographic {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.5rem 0;
  padding: 1rem 0;
  min-height: 250px;
}

.vertical-infographic.hidden {
  display: none;
}

.infographic-track {
  position: absolute;
  top: 1rem;
  bottom: 1rem;
  left: 1.5rem;
  width: 14px;
  background: linear-gradient(to bottom, #1f8f5f 0%, #ebac2d 50%, #bd2929 100%);
  border-radius: 7px;
  z-index: 1;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(255, 255, 255, 0.7);
}

.infographic-nodes {
  position: absolute;
  top: 1rem;
  bottom: 1rem;
  width: 100%;
  z-index: 2;
}

.infographic-node {
  position: absolute;
  left: calc(1.5rem + 30px);
  transform: translateY(-50%);
  background: var(--surface-floating);
  border: 2px solid var(--border-soft);
  border-radius: 12px;
  padding: 8px 14px;
  min-width: min-content;
  text-align: left;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  transition: top 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Connector Line (Horizontal) */
.infographic-node::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  width: 16px;
  height: 2px;
  background: inherit;
  background-color: var(--border-soft);
  transform: translateY(-50%);
  z-index: -1;
}

/* Author Colors */
.infographic-node.node-engine {
  border-color: #1f8f5f;
  background: #e8f5e9;
}

.infographic-node.node-engine::before {
  background-color: #1f8f5f;
}

.infographic-node.node-p1 {
  border-color: #1976d2;
  background: #e3f2fd;
}

.infographic-node.node-p1::before {
  background-color: #1976d2;
}

.infographic-node.node-p2 {
  border-color: #00bcd4;
  background: #e0f7fa;
}

.infographic-node.node-p2::before {
  background-color: #00bcd4;
}

.node-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.node-engine.node-author-block .node-label,
.node-engine .node-label {
  color: #1f8f5f;
}

.node-p1.node-author-block .node-label,
.node-p1 .node-label {
  color: #1976d2;
}

.node-p2.node-author-block .node-label,
.node-p2 .node-label {
  color: #00bcd4;
}

.node-authors-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

.node-author-block {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  background-color: var(--surface-default);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
}

.node-engine.node-author-block {
  border-color: #1f8f5f;
  background-color: #e8f5e9;
}

.node-p1.node-author-block {
  border-color: #1976d2;
  background-color: #e3f2fd;
}

.node-p2.node-author-block {
  border-color: #00bcd4;
  background-color: #e0f7fa;
}

.node-move {
  font-size: 1.1rem;
  font-weight: 800;
  color: #1a222d;
  padding-right: 4px;
}

.node-eval {
  font-size: 0.8rem;
  color: #4f5660;
  font-weight: 600;
}