:root {
  --game-stage-gap: 1.5rem;
}

/* Unified game detail layout */
.game-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.game-layout__header {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2vw, 1.75rem);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.game-layout__eyebrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.game-layout__title {
  margin: 0;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  color: var(--color-primary-dark);
}

.game-layout__description {
  margin: 0.15rem 0 0;
  color: var(--color-muted);
}

.game-layout__chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0;
  margin: 0.35rem 0 0;
  list-style: none;
}

.game-layout__chip-row .chip {
  margin: 0;
}

.game-layout__meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 0.4rem;
}

.game-layout__meta-item {
  padding: 0.7rem 0.9rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.game-layout__meta-item dt {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.game-layout__meta-item dd {
  margin: 0.15rem 0 0;
  font-weight: 700;
  color: var(--color-text);
}

.game-layout__stage {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--game-stage-gap);
  align-items: flex-start;
}

.game-layout__stage-play,
.game-layout__stage-control {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2vw, 1.75rem);
  box-shadow: var(--shadow-soft);

  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.game-layout__stage-play {
  min-height: 400px;
}

.game-layout__stage-control {
  position: sticky;
  top: 96px;

  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.game-layout__stage-control .control-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.game-layout__stage-control .control-wrapper[hidden] {
    display: none;
  }


.game-layout__stage-control button {
  border: none;
  border-radius: 16px;
  padding: 0.65rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--color-primary);
  color: #fff;
  transition: transform 0.2s ease, background 0.2s ease;
}
.game-layout__stage-control button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }
.game-layout__stage-control button:hover,
.game-layout__stage-control button:focus-visible {
  transform: translateY(-2px);
  background: var(--color-primary-dark);
  outline: none;
}

.game-layout__stage-control button.button-secondary {
	color: var(--color-primary);
    background: transparent;
    border: 1px solid rgba(15, 23, 42, 0.15);
}



.game-layout__stage-control .slider {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.game-layout__stage-control .slider label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-layout__stage-control .slider input[type="range"] {
  width: 100%;
  accent-color: var(--color-primary);
}

.game-layout__stage-control .slider-value {
    font-size: 0.9rem;
    color: var(--fraction-chart-accent-strong);
  }



.game-layout__stage-control .check-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.game-layout__stage-control .check-option input[type="checkbox"],
.game-layout__stage-control .check-option input[type="radio"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--color-primary);
  cursor: pointer;
}


.game-layout__stage-control .toggle {
    display: inline-flex;
    gap: 0.35rem;
    background: #eef0fc;
    padding: 0.35rem;
    border-radius: 999px;
    width: fit-content;
  }
.game-layout__stage-control .toggle button {
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    color: var(--fraction-chart-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
  }
.game-layout__stage-control .toggle button.is-active {
    background: #fff;
    color: var(--fraction-chart-accent-strong);
    box-shadow: 0 4px 12px rgba(66, 84, 180, 0.2);
  }


.game-layout__text {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.game-layout__text .game-layout__text-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-soft);
  scroll-margin-top: 6rem;
}

.game-layout__text .game-layout__text-card h3 {
  margin-top: 0;
  margin-bottom: 0.6rem;
}

.game-layout__text .game-layout__text-card p:last-child {
  margin-bottom: 0;
}

.game-layout__text .game-layout__text-card--full {
  grid-column: 1 / -1;
}

.game-layout__text .game-layout__text-card .card-grid {
  margin-top: 0.5rem;
}

/* Reusable dice face styles */
.dice-face {
  --dice-face-size: clamp(42px, 8vw, 56px);
  --dice-face-bg: #fff;
  --dice-face-border-color: rgba(12, 24, 32, 0.1);
  --dice-face-shadow: 0 8px 16px rgba(15, 23, 42, 0.15);
  --dice-face-padding: 6px;
  --dice-face-pip-color: #3645c5;

  width: var(--dice-face-size);
  height: var(--dice-face-size);
  border-radius: 14px;
  background: var(--dice-face-bg);
  border: 2px solid var(--dice-face-border-color);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: var(--dice-face-padding);
  box-shadow: var(--dice-face-shadow);
  position: relative;
}

.dice-face[data-size="compact"] {
  --dice-face-size: clamp(34px, 6vw, 40px);
  --dice-face-padding: 4px;
  border-radius: 12px;
}

.dice-face .pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dice-face-pip-color);
  opacity: 0;
  transition: opacity 0.1s ease;
  justify-self: center;
  align-self: center;
}

.dice-face .pip.pip--tl { grid-area: 1 / 1; }
.dice-face .pip.pip--tr { grid-area: 1 / 3; }
.dice-face .pip.pip--ml { grid-area: 2 / 1; }
.dice-face .pip.pip--center { grid-area: 2 / 2; }
.dice-face .pip.pip--mr { grid-area: 2 / 3; }
.dice-face .pip.pip--bl { grid-area: 3 / 1; }
.dice-face .pip.pip--br { grid-area: 3 / 3; }

.dice-face[data-value="1"] .pip.pip--center,
.dice-face[data-value="3"] .pip.pip--center,
.dice-face[data-value="5"] .pip.pip--center {
  opacity: 1;
}

.dice-face[data-value="2"] .pip.pip--tl,
.dice-face[data-value="3"] .pip.pip--tl,
.dice-face[data-value="4"] .pip.pip--tl,
.dice-face[data-value="5"] .pip.pip--tl,
.dice-face[data-value="6"] .pip.pip--tl,
.dice-face[data-value="4"] .pip.pip--br,
.dice-face[data-value="5"] .pip.pip--br,
.dice-face[data-value="6"] .pip.pip--br {
  opacity: 1;
}

.dice-face[data-value="2"] .pip.pip--br,
.dice-face[data-value="3"] .pip.pip--br,
.dice-face[data-value="4"] .pip.pip--tr,
.dice-face[data-value="5"] .pip.pip--tr,
.dice-face[data-value="6"] .pip.pip--tr,
.dice-face[data-value="4"] .pip.pip--bl,
.dice-face[data-value="5"] .pip.pip--bl,
.dice-face[data-value="6"] .pip.pip--bl {
  opacity: 1;
}

.dice-face[data-value="6"] .pip.pip--ml,
.dice-face[data-value="6"] .pip.pip--mr {
  opacity: 1;
}

@media (max-width: 1024px) {
  .game-layout__stage {
    grid-template-columns: 1fr;
  }

  .game-layout__stage-control {
    position: static;
  }
}

@media (max-width: 640px) {
  .game-layout__header {
    padding: 1rem;
    border-radius: var(--radius-md);
  }

  .game-layout__meta-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

}
