/* ============================================================
   Modals
   ============================================================ */

.modal {
  border: none;
  border-radius: 10px;
  background: var(--color-modal-bg);
  color: var(--color-text);
  padding: 0;
  max-width: min(480px, 90vw);
  width: 100%;
  margin: auto;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
  animation: modal-in 0.2s ease;
}

.modal[open] {
  display: flex;
  flex-direction: column;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Modal shell ──────────────────────────────── */
.modal-content {
  padding: 20px 24px 24px;
  overflow-y: auto;
  max-height: 90vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-hr);
}

.modal-header h2 {
  font-size: 0.875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.modal-close {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.modal-close:hover { opacity: 1; }

/* ── Modal body typography ────────────────────── */
.modal-body {
  font-size: 0.875rem;
  line-height: 1.55;
}

.modal-body p {
  margin-bottom: 10px;
}

.modal-body ul {
  margin: 0 0 12px 20px;
}

.modal-body ul li {
  margin-bottom: 6px;
}

.modal-body hr {
  border: none;
  border-top: 1px solid var(--color-hr);
  margin: 16px 0;
}

/* ── How to Play examples ─────────────────────── */
.examples {
  margin: 16px 0;
}

.examples p {
  margin: 6px 0;
}

.example-row {
  display: flex;
  gap: 4px;
  margin: 8px 0;
}

.example-tile {
  width: 46px;
  height: 46px;
  border: 2px solid var(--color-tile-border-filled);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-text);
}

.example-tile.correct {
  background: var(--color-correct);
  border-color: var(--color-correct);
  color: #fff;
}
.example-tile.present {
  background: var(--color-present);
  border-color: var(--color-present);
  color: #fff;
}
.example-tile.absent {
  background: var(--color-absent);
  border-color: var(--color-absent);
  color: #fff;
}

/* ── Stats ────────────────────────────────────── */
.stats-grid {
  display: flex;
  justify-content: space-around;
  margin-bottom: 28px;
  gap: 8px;
}

.stat-item {
  text-align: center;
  flex: 1;
}

.stat-value {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
  opacity: 0.75;
  line-height: 1.4;
}

.modal-body h3 {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
}

.distribution {
  margin-bottom: 20px;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 0.875rem;
  font-weight: 700;
}

.dist-label {
  min-width: 12px;
  text-align: right;
}

.dist-bar-wrapper {
  flex: 1;
}

.dist-bar {
  height: 24px;
  background: var(--color-absent);
  min-width: 24px;
  width: 7%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.dist-bar.current {
  background: var(--color-correct);
}

/* ── Share section ────────────────────────────── */
.share-section {
  padding-top: 16px;
  border-top: 1px solid var(--color-hr);
}

.share-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 16px;
}

.share-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
  margin-bottom: 4px;
}

.countdown {
  font-size: 1.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-correct);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 16px 24px;
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: filter 0.15s;
  white-space: nowrap;
}

.share-btn:hover {
  filter: brightness(1.1);
}

/* ── Settings ─────────────────────────────────── */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--color-hr);
}

.setting-label {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.setting-desc {
  font-size: 0.75rem;
  opacity: 0.6;
}

.settings-credit {
  margin-top: 16px;
  font-size: 0.8rem;
  line-height: 1.5;
  opacity: 0.6;
}

.settings-credit a {
  color: inherit;
  font-weight: 700;
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-absent);
  border-radius: 14px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: var(--color-correct);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}
