/* =========================================================
   Öğren / Geliştir › Satranç - Çocuklar İçin Görsel Rehber
   Sıcak, hikaye kitabı tadında aydınlık eğitim teması
   ========================================================= */

:root {
  --bg: #FDF8EE;
  --bg-soft: #F7EFE0;
  --card: #FFFFFF;
  --border: #EAE0CE;
  --border-strong: #D9CBB2;
  --text: #242938;
  --text-muted: #5A6275;

  --indigo: #364FC7;
  --indigo-soft: #EDF2FF;
  --green: #2F9E44;
  --green-dark: #237A34;
  --green-soft: #EBFBEE;
  --amber: #F08C00;
  --amber-soft: #FFF3BF;
  --red: #E03131;
  --red-soft: #FFE3E3;

  --sq-light: #F4E4C8;
  --sq-dark: #B58454;
  --board-frame: #6E4726;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 4px 12px rgba(60, 40, 15, 0.06);
  --shadow-md: 0 10px 28px rgba(60, 40, 15, 0.10);
  --shadow-board: 0 14px 34px rgba(72, 42, 18, 0.18);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 10%, rgba(255, 243, 191, 0.55) 0%, transparent 32%),
    radial-gradient(circle at 88% 18%, rgba(237, 242, 255, 0.65) 0%, transparent 34%);
  color: var(--text);
  font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand-title, .btn, .nav-pill {
  font-family: 'Fredoka', 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

h1, h2, h3, h4, p {
  margin-top: 0;
}

a {
  color: var(--indigo);
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ================= STICKY HEADER ================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 252, 245, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 2px 12px rgba(60, 40, 15, 0.05);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--indigo-soft);
  border: 2px solid #BAC8FF;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-icon svg {
  width: 28px;
  height: 28px;
}

.breadcrumb-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.breadcrumb-badge span {
  color: var(--indigo);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  background: transparent;
  border: 1.5px solid transparent;
  transition: all 0.18s ease;
}

.nav-pill:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.nav-pill.active {
  background: var(--indigo);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(54, 79, 199, 0.28);
}

.btn-play-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #2F9E44, #2B8A3E);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 0.98rem;
  box-shadow: 0 4px 14px rgba(47, 158, 68, 0.30);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-play-nav:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(47, 158, 68, 0.38);
}

/* ================= LAYOUT & CARDS ================= */
.page-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}

.hero-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #FFFDF7 60%, #F2F5FF 100%);
  border: 2px solid #DDE3F8;
  border-radius: 26px;
  padding: 32px;
  box-shadow: var(--shadow-md);
  margin-bottom: 28px;
}

.eyebrow {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #9C5700;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

.hero-title {
  font-size: clamp(1.85rem, 3.5vw, 2.55rem);
  line-height: 1.2;
  margin-bottom: 12px;
  color: #1C2340;
}

.hero-lead {
  font-size: 1.12rem;
  color: var(--text-muted);
  max-width: 760px;
  margin-bottom: 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-num {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--indigo);
  color: #FFF;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.55rem;
  color: #1E243B;
}

/* Chapter overview cards on index */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 10px;
}

.chapter-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  border: 2px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.chapter-card:hover {
  transform: translateY(-3px);
  border-color: var(--indigo);
  box-shadow: var(--shadow-sm);
}

.chapter-card.is-current {
  border-color: var(--indigo);
  background: #F6F8FF;
}

.chapter-step {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--indigo);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chapter-card strong {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.12rem;
}

.chapter-card span.chapter-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Two-column Board + Info lab layout */
.lab-grid {
  display: grid;
  grid-template-columns: minmax(290px, 460px) 1fr;
  gap: 28px;
  align-items: start;
}

.board-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.info-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ================= CHESSBOARD ================= */
.chess-board-host {
  display: block;
  width: 100%;
  max-width: 460px;
}

.chess-board-wrap {
  position: relative;
  width: 100%;
  max-width: 460px;
  aspect-ratio: 1 / 1;
  padding: 10px;
  background: var(--board-frame);
  border-radius: 16px;
  box-shadow: var(--shadow-board);
  user-select: none;
}

.chess-board-inner {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
}

.square {
  position: relative;
  border: none;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.12s ease;
  outline: none;
}

.square.light {
  background-color: var(--sq-light);
  color: #7D532B;
}

.square.dark {
  background-color: var(--sq-dark);
  color: #F9EBCE;
}

.square.interactive:hover {
  filter: brightness(1.06);
}

.square:focus-visible {
  box-shadow: inset 0 0 0 3px var(--indigo);
  z-index: 4;
}

.coord-rank {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  opacity: 0.85;
}

.coord-file {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  opacity: 0.85;
}

.piece-slot {
  width: 84%;
  height: 84%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.piece-slot svg {
  width: 100%;
  height: 100%;
  display: block;
}

.piece-slot.piece-white svg {
  filter: drop-shadow(0 2px 2px rgba(25, 20, 12, 0.35));
}

.piece-slot.piece-black svg {
  filter: drop-shadow(0 0 2px rgba(255, 252, 240, 0.55)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

/* Highlights */
.square.hl-selected {
  box-shadow: inset 0 0 0 4px #F08C00;
  background-color: #FFE082 !important;
}

.square.hl-focus {
  box-shadow: inset 0 0 0 3px rgba(54, 79, 199, 0.65);
}

.square.hl-focus.light {
  background-color: #DCE6FF;
}

.square.hl-focus.dark {
  background-color: #7D91D9;
}

.square.hl-move::after {
  content: "";
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(47, 158, 68, 0.78);
  border: 2px solid #FFFFFF;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 3;
  pointer-events: none;
}

.square.hl-capture {
  box-shadow: inset 0 0 0 4px var(--red);
}

.square.hl-capture::after {
  content: "";
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  border: 4px solid rgba(224, 49, 49, 0.88);
  pointer-events: none;
  z-index: 3;
  animation: pulseRing 1.4s ease-in-out infinite;
}

@keyframes pulseRing {
  0%, 100% { transform: scale(0.95); opacity: 0.9; }
  50% { transform: scale(1.03); opacity: 0.55; }
}

.square.hl-danger {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(224, 49, 49, 0.26),
    rgba(224, 49, 49, 0.26) 8px,
    rgba(255, 227, 227, 0.28) 8px,
    rgba(255, 227, 227, 0.28) 16px
  );
  box-shadow: inset 0 0 0 3px rgba(224, 49, 49, 0.85);
}

.square.hl-blocked {
  box-shadow: inset 0 0 0 3px rgba(90, 98, 117, 0.65);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(90, 98, 117, 0.18),
    rgba(90, 98, 117, 0.18) 6px,
    transparent 6px,
    transparent 12px
  );
}

.square.hl-phantom::after {
  content: "";
  position: absolute;
  width: 34%;
  height: 34%;
  border-radius: 50%;
  border: 3px dashed rgba(224, 49, 49, 0.72);
  background: rgba(255, 227, 227, 0.35);
  z-index: 3;
  pointer-events: none;
}

.square-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 5;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #C92A2A;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.square-badge.badge-star {
  background: #FFF3BF;
  color: #D97706;
}

.square-badge.badge-ok {
  background: #EBFBEE;
  color: #2B8A3E;
}

/* SVG arrow overlay */
.board-arrows {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
}

/* ================= BUTTONS & CONTROLS ================= */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  background: #FFFFFF;
  color: var(--text);
  font-weight: 600;
  font-size: 0.96rem;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  border-color: var(--indigo);
  background: var(--indigo-soft);
  color: var(--indigo);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.btn-primary {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #FFFFFF;
}

.btn.btn-primary:hover:not(:disabled) {
  background: #2B42B0;
  color: #FFFFFF;
}

.btn.btn-green {
  background: var(--green);
  border-color: var(--green);
  color: #FFFFFF;
}

.btn.btn-green:hover:not(:disabled) {
  background: var(--green-dark);
  color: #FFFFFF;
}

.btn.btn-amber {
  background: #FFF3BF;
  border-color: #F59F00;
  color: #8F4F00;
}

.btn.btn-red {
  background: var(--red-soft);
  border-color: #FFA8A8;
  color: #C92A2A;
}

.btn.is-active {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #FFFFFF;
  box-shadow: 0 3px 10px rgba(54, 79, 199, 0.25);
}

/* ================= INFO BOXES & CALLOUTS ================= */
.callout {
  padding: 15px 18px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--bg-soft);
}

.callout-indigo {
  background: var(--indigo-soft);
  border-color: #BAC8FF;
}

.callout-green {
  background: var(--green-soft);
  border-color: #8CE99A;
}

.callout-amber {
  background: var(--amber-soft);
  border-color: #FFD43B;
}

.callout-red {
  background: var(--red-soft);
  border-color: #FFA8A8;
}

.status-banner {
  padding: 12px 16px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 2px solid var(--border);
  font-weight: 700;
  color: var(--text);
  width: 100%;
  max-width: 460px;
  text-align: center;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legend-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
  justify-content: center;
}

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

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.dot-move { background: rgba(47, 158, 68, 0.85); border: 2px solid #FFF; box-shadow: 0 0 0 1px #2F9E44; }
.dot-capture { border: 3px solid var(--red); background: transparent; }
.dot-phantom { border: 2px dashed var(--red); background: var(--red-soft); }
.dot-danger { background: var(--red-soft); border: 2px solid var(--red); border-radius: 4px; }

/* ================= PIECE SELECTOR BAR (taslar.html) ================= */
.piece-selector {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.piece-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 2px solid var(--border);
  transition: all 0.16s ease;
  text-align: center;
}

.piece-tab:hover {
  border-color: var(--indigo);
  transform: translateY(-2px);
}

.piece-tab.is-active {
  background: var(--indigo-soft);
  border-color: var(--indigo);
  box-shadow: 0 6px 16px rgba(54, 79, 199, 0.16);
}

.piece-tab-icon {
  width: 48px;
  height: 48px;
}

.piece-tab-icon svg {
  width: 100%;
  height: 100%;
}

.piece-tab-name {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.piece-tab-pts {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #8F4F00;
}

/* Detail fact grid inside piece panel */
.fact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.fact-box {
  padding: 13px 15px;
  border-radius: 14px;
  background: #FAF6EE;
  border: 1.5px solid var(--border);
}

.fact-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.fact-value {
  font-weight: 700;
  color: var(--text);
  font-size: 0.98rem;
}

/* Summary table on taslar.html */
.summary-table-wrap {
  overflow-x: auto;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.summary-table th,
.summary-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1.5px solid var(--border);
  vertical-align: middle;
}

.summary-table th {
  font-family: 'Fredoka', sans-serif;
  color: var(--indigo);
  background: #F8F9FE;
  font-size: 0.96rem;
}

.table-piece-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.table-piece-cell svg {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

/* ================= GOLDEN RULES & PROMO CARDS ================= */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.tip-card {
  padding: 18px;
  border-radius: 16px;
  background: #FFFDF8;
  border: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tip-badge {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--amber-soft);
  color: #9C5700;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* ================= PLAY SITES CARDS & MODAL ================= */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.site-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 18px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 2px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.site-card:hover {
  transform: translateY(-3px);
  border-color: var(--green);
  box-shadow: var(--shadow-sm);
}

.site-card-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
}

.site-card h4 {
  margin: 0;
  font-size: 1.18rem;
  color: #1B233D;
}

.site-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.site-card-cta {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  color: var(--green-dark);
  font-size: 0.95rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(24, 28, 44, 0.56);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal-dialog {
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  background: #FFFFFF;
  border-radius: 24px;
  border: 2px solid var(--border);
  padding: 26px;
  box-shadow: 0 24px 60px rgba(15, 20, 40, 0.28);
  position: relative;
}

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

.modal-close {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--red-soft);
  border-color: #FFA8A8;
  color: var(--red);
}

/* ================= BOTTOM LESSON NAV & FOOTER ================= */
.lesson-footer-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 2px dashed var(--border-strong);
}

.play-cta-banner {
  background: linear-gradient(135deg, #EBFBEE 0%, #FFF9DB 100%);
  border: 2px solid #8CE99A;
  border-radius: 22px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.site-footer {
  text-align: center;
  padding: 24px 20px 36px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 960px) {
  .chapter-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .piece-selector {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 860px) {
  .lab-grid {
    grid-template-columns: 1fr;
  }
  .chess-board-host,
  .chess-board-wrap {
    max-width: 420px;
  }
}

@media (max-width: 600px) {
  .header-inner {
    padding: 10px 14px;
  }
  .page-container {
    padding: 18px 14px 48px;
  }
  .card, .hero-card {
    padding: 18px;
  }
  .chapter-grid {
    grid-template-columns: 1fr;
  }
  .piece-selector {
    grid-template-columns: repeat(2, 1fr);
  }
  .fact-grid {
    grid-template-columns: 1fr;
  }
  .coord-rank, .coord-file {
    font-size: 9px;
  }
}
