/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  background: #1a1a2e;
  color: #e8e0d0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

/* ── Layout ──────────────────────────────────────────────────── */
.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px 32px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  padding: 24px 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 28px;
}

.header-inner { max-width: 100%; }

.opening-name {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: #f5e6c8;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.opening-subtitle {
  margin-top: 4px;
  font-size: 0.95rem;
  color: #a09070;
  letter-spacing: 0.3px;
}

.app-main {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  flex: 1;
}

/* ── Board column ─────────────────────────────────────────────── */
.board-column {
  flex: 1 1 auto;
  max-width: 620px;
  min-width: 300px;
}

#board-container {
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    0 0 0 3px #8b6914,
    0 0 0 6px #2d1f0a,
    0 8px 32px rgba(0,0,0,0.6);
}

/* ── Info column ─────────────────────────────────────────────── */
.info-column {
  flex: 0 0 300px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Move info card ──────────────────────────────────────────── */
.move-info-card {
  background: #16213e;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 20px 22px;
}

.move-info-card h2 {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f0c060;
  margin-bottom: 10px;
  line-height: 1.3;
}

.move-info-card p {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 1rem;
  line-height: 1.7;
  color: #d0c8b8;
}

.move-info-card p strong { color: #f0c060; font-style: normal; }

/* ── Move list card ──────────────────────────────────────────── */
.move-list-card {
  background: #16213e;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 16px 22px;
}

.moves-heading {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #706050;
  margin-bottom: 10px;
}

#move-list {
  font-family: "SF Mono", "Fira Code", "Courier New", monospace;
  font-size: 0.88rem;
  line-height: 2;
  color: #a09070;
}

.move-num {
  color: #605040;
  margin-right: 2px;
}

.move {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  cursor: default;
  transition: background 150ms, color 150ms;
  margin-right: 2px;
}

.white-move { color: #c8b890; }
.black-move { color: #a09070; }

.move.active {
  background: #f0c060;
  color: #1a1208;
  font-weight: 700;
}

.move-pair { white-space: nowrap; }

/* ── Controls ────────────────────────────────────────────────── */
.controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  padding: 10px 22px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms, opacity 150ms, transform 80ms;
  letter-spacing: 0.3px;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-primary {
  background: #f0c060;
  color: #1a1208;
}
.btn-primary:not(:disabled):hover { background: #f5cc70; }

.btn-secondary {
  background: #2d3a5a;
  color: #c8b890;
}
.btn-secondary:not(:disabled):hover { background: #354468; }

.step-counter {
  flex: 1;
  text-align: center;
  font-size: 0.82rem;
  color: #605040;
  font-variant-numeric: tabular-nums;
}

.keyboard-hint {
  font-size: 0.75rem;
  color: #504030;
  text-align: center;
}

/* ── Piece animation ─────────────────────────────────────────── */
.piece {
  transition: transform 300ms ease;
  cursor: default;
  pointer-events: none;
}

.piece text {
  font-size: 50px;
  user-select: none;
}

/* ── Board labels ────────────────────────────────────────────── */
.board-label {
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
  pointer-events: none;
}

/* ── Footer ──────────────────────────────────────────────────── */
.app-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  text-align: center;
  font-size: 0.8rem;
}

.app-footer a {
  color: #605040;
  text-decoration: none;
}
.app-footer a:hover { color: #a09070; }

/* ── Landing page ────────────────────────────────────────────── */
.landing {
  max-width: 900px;
  justify-content: center;
}

.landing-hero {
  text-align: center;
  padding: 64px 0 40px;
}

.hero-title {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: #f5e6c8;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.hero-sub {
  margin-top: 10px;
  font-size: 1rem;
  color: #a09070;
  letter-spacing: 0.3px;
}

.openings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.opening-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #16213e;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 26px 24px 22px;
  text-decoration: none;
  color: inherit;
  transition: transform 150ms, border-color 150ms, box-shadow 150ms;
}

.opening-card:hover {
  transform: translateY(-3px);
  border-color: rgba(240,192,96,0.45);
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}

.side-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.badge-white { background: #f0d9b5; color: #2d1f0a; }
.badge-black { background: #2d3a5a; color: #c8b890; }

.card-title {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: #f5e6c8;
}

.card-subtitle {
  font-size: 0.85rem;
  color: #a09070;
  margin-top: -4px;
}

.card-line {
  font-family: "SF Mono", "Fira Code", "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.7;
  color: #f0c060;
  background: rgba(240,192,96,0.07);
  border-left: 3px solid rgba(240,192,96,0.5);
  border-radius: 4px;
  padding: 10px 12px;
  word-spacing: 2px;
}

.card-blurb {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #d0c8b8;
}

.card-cta {
  margin-top: auto;
  padding-top: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #f0c060;
}

/* ── Viewer header extras ────────────────────────────────────── */
.back-link {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.78rem;
  letter-spacing: 0.4px;
  color: #806850;
  text-decoration: none;
}

.back-link:hover { color: #f0c060; }

.header-inner .side-badge { margin-top: 12px; }

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .app-main {
    flex-direction: column;
  }

  .board-column {
    width: 100%;
  }

  .opening-name { font-size: 1.6rem; }

  .controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .step-counter { order: -1; width: 100%; }

  .openings-grid { grid-template-columns: 1fr; }
  .landing-hero { padding: 40px 0 28px; }
  .hero-title { font-size: 2rem; }
}
