/* ── Kosti — spielspezifische Styles ────────────────────────────────────────
   Baut auf style.css auf. Keine globalen Overrides — alles scoped.        */

/* ── Section padding overrides (neutralise global section { padding: 8rem 2rem }) ── */

#kosti {
  padding: 0;
}

/* ── Page layout ─────────────────────────────────────────────────────────── */

.kosti-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px 16px;
}

/* ── Intro ───────────────────────────────────────────────────────────────── */

.kosti-intro {
  text-align: center;
  padding: 64px 0 52px;
}

.kosti-label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 14px;
}

.kosti-narrative {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.85;
  max-width: 500px;
  margin: 0 auto;
  font-weight: 300;
}

/* ── Game section ────────────────────────────────────────────────────────── */

.kosti-game {
  margin-bottom: 12px;
}

/* ── Board ───────────────────────────────────────────────────────────────── */

.kosti-board {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--parchment-mid);
  border: 1px solid var(--parchment-border);
  border-radius: 8px;
  box-shadow: 0 4px 28px rgba(42, 34, 24, 0.13);
  padding: 22px 14px;
  gap: 14px;
  max-width: 720px;
  margin: 0 auto;
}

.kosti-board::before,
.kosti-board::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--teal-dim);
  opacity: 0.35;
  pointer-events: none;
}

.kosti-board::before { top: 9px; }
.kosti-board::after  { bottom: 9px; }

/* ── Pits wrapper ────────────────────────────────────────────────────────── */

.pits-wrap {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

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

/* ── Pit ─────────────────────────────────────────────────────────────────── */

.pit {
  border-radius: 50%;
  width: clamp(44px, 9.5vw, 64px);
  height: clamp(44px, 9.5vw, 64px);
  background: var(--parchment-deep);
  border: 1px solid var(--parchment-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px;
  box-sizing: border-box;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
  overflow: hidden;
}

.pit--player:not(.pit--disabled):hover {
  border-color: var(--teal);
  box-shadow: 0 0 11px rgba(74, 138, 133, 0.24);
  background: var(--parchment-mid);
}

.pit--ai {
  cursor: default;
}

.pit--disabled {
  opacity: 0.48;
  cursor: default;
}

.pit--disabled:hover {
  border-color: var(--parchment-border) !important;
  box-shadow: none !important;
  background: var(--parchment-deep) !important;
}

/* ── Stones ──────────────────────────────────────────────────────────────── */

.stone {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stone--player { background: var(--ember); }
.stone--ai     { background: var(--stone); }

.stone-count {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.8rem, 2vw, 1rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.02em;
}

.stone-count--player { color: var(--ember); }
.stone-count--ai     { color: var(--stone); }

/* ── Kalahs ──────────────────────────────────────────────────────────────── */

.kalah {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 40px;
  width: clamp(48px, 12vw, 72px);
  flex-shrink: 0;
  border: 2px solid;
  padding: 18px 8px;
  background: var(--parchment-mid);
  box-sizing: border-box;
}

.kalah--player { border-color: var(--teal-dim); }
.kalah--ai     { border-color: var(--stone); }

.kalah-count {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.3rem, 3.2vw, 1.9rem);
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1;
  letter-spacing: 0.04em;
}

.kalah-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 3px;
  width: 100%;
  padding: 0 4px;
  box-sizing: border-box;
}

/* ── Status line ─────────────────────────────────────────────────────────── */

.kosti-status {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 300;
  color: var(--text-dim);
  text-align: center;
  margin-top: 14px;
  transition: opacity 0.25s ease;
  letter-spacing: 0.02em;
}

.kosti-status.fading {
  opacity: 0;
}

/* ── Restart button ──────────────────────────────────────────────────────── */

.kosti-restart {
  display: block;
  margin: 18px auto 0;
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  background: transparent;
  border: 1px solid var(--teal-dim);
  border-radius: 2px;
  padding: 10px 30px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.kosti-restart:hover {
  background: var(--teal);
  color: var(--parchment);
  border-color: var(--teal);
}


/* ── Phase 2 — Name entry ────────────────────────────────────────────────── */

.kosti-name-entry {
  max-width: 480px;
  margin: 0 auto 48px;
  text-align: center;
  padding: 40px 0; /* bewusst beibehalten — überschreibt globales 8rem */
}

.kosti-name-label {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

#kosti-name-input {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  color: var(--ink);
  background: var(--parchment-mid);
  border: 1px solid var(--parchment-border);
  border-radius: 2px;
  padding: 9px 14px;
  margin-right: 8px;
  outline: none;
  transition: border-color 0.2s ease;
}

#kosti-name-input:focus {
  border-color: var(--teal);
}

#kosti-name-submit {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
  background: transparent;
  border: 1px solid var(--teal-dim);
  border-radius: 2px;
  padding: 9px 22px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

#kosti-name-submit:hover {
  background: var(--teal);
  color: var(--parchment);
}

/* ── Phase 2 — Leaderboard ───────────────────────────────────────────────── */

.kosti-leaderboard {
  max-width: 580px;
  margin: 16px auto 80px;
  text-align: center;
  padding: 0;
}

.kosti-leaderboard .kosti-label {
  margin-bottom: 22px;
}

.kosti-lb-table {
  width: 100%;
  border-collapse: collapse;
}

.kosti-lb-table th {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stone);
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--parchment-border);
}

.kosti-lb-table td {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  color: var(--ink-soft);
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--parchment-border);
  transition: background 0.15s ease;
}

.kosti-lb-table tbody tr:hover td {
  background: var(--parchment-deep);
}

.kosti-lb-table tbody tr:first-child td {
  color: var(--ember);
  font-weight: 400;
}

/* ── Spielanleitung (ausklappbar) ────────────────────────────────────────── */

.kosti-rules {
  max-width: 720px;
  margin: 0 auto 0;
  padding: 0;
}

.kosti-rules-details {
  border-left: 2px solid var(--teal-dim);
  border-radius: 0 2px 2px 0;
  background: var(--parchment-deep);
  box-shadow: 0 2px 12px rgba(42, 34, 24, 0.07);
}

/* Marker entfernen */
.kosti-rules-details summary::-webkit-details-marker { display: none; }
.kosti-rules-details summary::marker              { display: none; }

.kosti-rules-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  user-select: none;
  transition: color 0.2s ease, background 0.2s ease;
  border-radius: 0 2px 2px 0;
}

.kosti-rules-summary:hover {
  color: var(--teal-dim);
  background: var(--parchment-border);
}

.kosti-rules-arrow {
  font-size: 0.85rem;
  line-height: 1;
  transition: transform 0.25s ease;
  display: inline-block;
}

.kosti-rules-details[open] .kosti-rules-arrow {
  transform: rotate(180deg);
}

/* Smooth expand via max-height */
.kosti-rules-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.32s ease;
}

.kosti-rules-details[open] .kosti-rules-body {
  max-height: 900px;
}

/* Einzelne Regel */
.kosti-rule {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0 16px;
  align-items: baseline;
  padding: 10px 18px;
  border-top: 1px solid var(--parchment-border);
}

.kosti-rule:first-child {
  border-top: 1px solid var(--parchment-border);
}

.kosti-rule-label {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  padding-top: 3px;
}

.kosti-rule p {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.65;
  margin: 0;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .kosti-main {
    padding: 0 12px 80px;
  }

  .kosti-intro {
    padding: 48px 0 40px;
  }

  .kosti-board {
    padding: 16px 8px;
    gap: 8px;
  }

  .pits-wrap {
    gap: 10px;
  }

  .kalah {
    width: clamp(42px, 10vw, 60px);
    padding: 14px 6px;
    gap: 8px;
  }

  .kalah-count {
    font-size: clamp(1.1rem, 2.8vw, 1.5rem);
  }
}

@media (max-width: 480px) {
  .pit {
    padding: 5px;
    gap: 1px;
  }

  .stone {
    width: 6px;
    height: 6px;
  }
}
