/* Shared game shell — used by deviation, approximation, cube, grid, series, memory */
.deviation-game {
  background: var(--hub-surface);
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-lg);
  overflow: hidden;
  box-shadow: var(--hub-shadow-md);
}

.dev-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px;
  border-bottom: 1px solid var(--hub-border);
  background: var(--hub-surface-muted);
}

.dev-header h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--hub-ink);
}

.dev-header p {
  margin: 0;
  color: var(--hub-muted);
  font-size: 14px;
  line-height: 1.5;
  max-width: 56ch;
}

.dev-header-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dev-header-stats span {
  padding: 8px 14px;
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-pill);
  background: var(--hub-surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--hub-muted);
  box-shadow: var(--hub-shadow-sm);
}

.dev-header-stats strong {
  color: var(--hub-ink);
}

.dev-game-view {
  padding: 24px 26px 28px;
}

.dev-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dev-top-row h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--hub-ink);
}

.dev-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-pill);
  background: var(--hub-surface-muted);
  font-size: 14px;
  font-weight: 600;
  color: var(--hub-muted);
}

.dev-timer strong {
  font-size: 22px;
  font-weight: 800;
  color: var(--hub-ink);
  font-variant-numeric: tabular-nums;
}

.dev-timer.is-low {
  border-color: var(--hub-timer-low-border);
  background: var(--hub-timer-low-bg);
}

.dev-timer.is-low strong {
  color: var(--hub-timer-low-text);
}

.dev-timer[hidden] {
  display: none;
}

.dev-start-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 20px;
  border: 1px solid var(--hub-banner-border);
  border-radius: var(--hub-radius-md);
  background: var(--hub-banner-bg);
}

.dev-start-banner[hidden] {
  display: none;
}

.dev-start-banner p {
  margin: 0;
  flex: 1;
  min-width: 200px;
  color: var(--hub-banner-text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}

.dev-strings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.dev-string-box {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-sm);
  background: var(--hub-input-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  word-break: break-all;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hub-ink);
}

.dev-choices {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.dev-btn {
  height: 42px;
  padding: 0 16px;
  border-radius: var(--hub-radius-sm);
  border: 1px solid var(--hub-border);
  background: var(--hub-input-bg);
  color: var(--hub-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.12s ease,
    box-shadow 0.15s ease;
}

.dev-btn:hover:not(:disabled) {
  background: var(--hub-surface-muted);
}

.dev-btn:focus-visible {
  outline: none;
  box-shadow: var(--hub-focus-ring);
}

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

.dev-btn-primary {
  background: var(--hub-accent);
  border-color: var(--hub-accent);
  color: #fff;
}

.dev-btn-primary:hover:not(:disabled) {
  background: var(--hub-accent-hover);
  border-color: var(--hub-accent-hover);
}

.dev-btn-secondary {
  background: var(--hub-input-bg);
  color: var(--hub-ink);
}

.dev-btn-lg {
  height: 48px;
  padding: 0 24px;
  font-size: 16px;
  border-radius: var(--hub-radius-md);
}

.dev-choice {
  height: 56px;
  border: 2px solid var(--hub-border-strong);
  border-radius: var(--hub-radius-md);
  background: var(--hub-input-bg);
  font-size: 17px;
  font-weight: 800;
}

.dev-choice:hover:not(:disabled) {
  background: var(--hub-surface-muted);
  transform: translateY(-1px);
}

.dev-choice.is-selected {
  border-color: var(--hub-accent);
  box-shadow: var(--hub-focus-ring);
}

.dev-choice.is-correct {
  background: var(--hub-good-soft);
  border-color: var(--hub-good);
}

.dev-choice.is-wrong {
  background: var(--hub-bad-soft);
  border-color: var(--hub-bad);
}

.dev-feedback {
  min-height: 24px;
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--hub-muted);
}

.dev-feedback.is-good {
  color: var(--hub-good);
}

.dev-feedback.is-bad {
  color: var(--hub-bad);
}

.dev-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
}

.dev-results {
  padding: 32px 26px 36px;
  text-align: center;
  border-top: 1px solid var(--hub-border);
  background: var(--hub-surface-muted);
}

.dev-results[hidden] {
  display: none;
}

.deviation-game.is-finished .dev-game-view {
  display: none;
}

.dev-results h2 {
  margin: 0 0 24px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--hub-ink);
}

.dev-results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 520px;
  margin: 0 auto 24px;
}

.dev-result-stat {
  padding: 16px;
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-md);
  background: var(--hub-surface);
  box-shadow: var(--hub-shadow-sm);
}

.dev-result-stat span {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--hub-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dev-result-stat strong {
  font-size: 28px;
  font-weight: 800;
  color: var(--hub-ink);
  font-variant-numeric: tabular-nums;
}

.dev-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.dev-modal[hidden] {
  display: none;
}

.dev-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--hub-modal-backdrop);
  backdrop-filter: blur(4px);
}

.dev-modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 400px);
  padding: 24px;
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-lg);
  background: var(--hub-surface);
  box-shadow: var(--hub-shadow-lg);
}

.dev-modal-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 800;
  color: var(--hub-ink);
}

.dev-modal-card p {
  margin: 0 0 20px;
  color: var(--hub-muted);
  line-height: 1.5;
}

.dev-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 768px) {
  .dev-header {
    padding: 18px 20px;
  }

  .dev-game-view {
    padding: 20px 18px 24px;
  }

  .dev-strings {
    grid-template-columns: 1fr;
  }

  .dev-choices {
    grid-template-columns: repeat(2, 1fr);
  }

  .dev-choices .dev-choice:last-child {
    grid-column: 1 / -1;
  }

  .dev-results-grid {
    grid-template-columns: 1fr;
  }

  .dev-start-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .dev-start-banner .dev-btn-lg {
    width: 100%;
  }
}
