:root {
  color-scheme: light;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 16px;
  --accent-color: #3266ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f8f9fb 0%, #ffffff 60%);
  color: #222222;
}

main.game-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.game-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.game-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin: 0;
}

.game-subtitle {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  color: #555555;
}

.game-message {
  min-height: 2.5rem;
  padding: 0.75rem 1rem;
  background: #eef3ff;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.selector-area {
  background: #ffffff;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(32, 62, 136, 0.08);
}

.selector-area h2 {
  margin-top: 0;
  font-size: 1.4rem;
}

.selector-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 1rem;
}

.selector-grid button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  text-align: left;
}

.selector-grid button strong {
  font-size: 1.1rem;
}

.selector-grid button span {
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.85;
}

.game-card {
  background: #ffffff;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 8px 24px rgba(17, 27, 56, 0.08);
  margin-bottom: 1.5rem;
}

.game-card h2 {
  margin-top: 0;
  font-size: 1.4rem;
}

.button-primary,
.button-secondary,
.tap-button,
.ppt-options button {
  min-height: 52px;
  min-width: 52px;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.button-primary,
.tap-button,
.ppt-options button {
  background: var(--accent-color, #3266ff);
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(50, 102, 255, 0.25);
}

.button-secondary {
  background: #ffffff;
  color: var(--accent-color, #2440a4);
  border: 2px solid var(--accent-color, #2440a4);
}

.button-primary:disabled,
.tap-button:disabled,
.ppt-options button:disabled {
  background: #b0befa;
  box-shadow: none;
  cursor: not-allowed;
}

.button-secondary:disabled {
  color: #888888;
  border-color: #cccccc;
  cursor: not-allowed;
}

.button-primary:active,
.tap-button:active,
.ppt-options button:active {
  transform: translateY(1px) scale(0.98);
}

button:focus-visible {
  outline: 4px solid rgba(255, 160, 0, 0.8);
  outline-offset: 2px;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.back-button {
  margin-bottom: 1rem;
}

.game-result {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1b4d8c;
}

.ranking-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.ranking-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #e6e9f5;
}

.options-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.trivia-question {
  font-size: 1.2rem;
  font-weight: 600;
}

.timer {
  font-weight: 600;
  color: #d84315;
}

.memory-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(80px, 1fr));
  gap: 0.75rem;
  justify-items: center;
}

.memory-card {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: linear-gradient(135deg, #8ab4ff, #4f6ff5);
  border-radius: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.6rem, 8vw, 2.3rem);
  color: #ffffff;
  cursor: pointer;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.4s ease;
}

.memory-card.revealed,
.memory-card.matched {
  background: #ffffff;
  color: #2440a4;
  border: 2px solid #2440a4;
}

.memory-card.matched {
  box-shadow: 0 0 0 4px rgba(50, 102, 255, 0.15);
}

.memory-status {
  display: flex;
  gap: 1.5rem;
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: #e6ecff;
  border-radius: 999px;
  overflow: hidden;
  margin: 0.75rem 0 1rem;
}

.progress-indicator {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #46c5ff, var(--accent-color, #3266ff));
  transition: width 0.2s ease;
}

.tap-button {
  width: 100%;
}

.ppt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.ppt-open-section {
  margin-top: 1rem;
}

.ppt-open-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ppt-open-list li {
  background: #f2f5ff;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ppt-open-list li button {
  flex-shrink: 0;
}

.ppt-current {
  margin-top: 1.25rem;
}

@media (min-width: 720px) {
  main.game-shell {
    padding: 2rem 2.5rem 4rem;
  }

  .game-actions {
    justify-content: flex-start;
  }
}
