.ai-main [hidden] {
  display: none !important;
}

.ai-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 80px;
  text-align: center;
}

.section-subtitle {
  color: #cfd8ff;
  font-size: 1.05rem;
  margin-bottom: 32px;
}

/* Selection screen */
.ai-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
  gap: 24px;
  justify-content: center;
}

.ai-game-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 28px 20px;
  backdrop-filter: blur(6px);
}

.ai-game-icon {
  font-size: 2.6rem;
  margin-bottom: 8px;
}

.ai-game-card h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.ai-game-card p {
  color: #cfd8ff;
  font-size: 0.95rem;
  min-height: 44px;
}

.ai-play-btn,
.restart-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd166, #ef476f);
  color: #1b1035;
  font-weight: bold;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.ai-play-btn:hover,
.restart-btn:hover {
  transform: scale(1.05);
}

.ai-back-btn {
  display: inline-block;
  margin: 0 0 20px;
  padding: 8px 20px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #cfd8ff;
  font-size: 0.85rem;
  cursor: pointer;
}

.ai-back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.ai-game-screen h2 {
  margin: 0 0 14px;
}

.ai-panel {
  margin-top: 20px;
}

/* Shared choice buttons */
.ai-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 16px;
}

.ai-choice-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  margin: 16px auto 0;
}

.ai-choice-btn {
  padding: 12px 20px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.ai-choice-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

/* Game 1: shapes */
.ai-shape-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
}

.ai-shape {
  width: 80px;
  height: 80px;
  transition: transform 0.2s ease;
}

.ai-shape.shape-circle {
  border-radius: 50%;
}

.ai-shape.shape-square {
  border-radius: 12px;
}

.ai-shape.shape-triangle {
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  background: var(--tri-color, #ffd166) !important;
}

.ai-guess-line {
  font-size: 1.1rem;
  margin: 4px 0;
}

.ai-progress {
  color: #cfd8ff;
  font-size: 0.9rem;
}

.ai-bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 24px;
  height: 140px;
  margin: 16px 0;
}

.ai-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 60px;
}

.ai-bar-fill {
  width: 100%;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #06d6a0, #118ab2);
  transition: height 0.5s ease;
}

.ai-bar-label {
  font-size: 0.8rem;
  color: #cfd8ff;
}

.ai-why {
  margin-top: 16px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  color: #ffe8b3;
  font-size: 0.95rem;
}

/* Game 2: box stage */
.ai-layer-indicator {
  color: #cfd8ff;
  font-size: 1rem;
}

.ai-box-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.ai-item-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 560px;
}

.ai-pool-item {
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease;
  position: relative;
}

.ai-pool-item:hover {
  transform: scale(1.08);
}

.ai-pool-item.shape-circle {
  border-radius: 50%;
}

.ai-pool-item.shape-triangle {
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  background: var(--tri-color, #ffd166) !important;
}

.ai-box {
  width: 120px;
  height: 90px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px dashed rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  position: relative;
  overflow: visible;
}

.ai-box-flash {
  position: absolute;
  top: -34px;
  font-size: 1.1rem;
  font-weight: bold;
  animation: aiFlashUp 0.7s ease forwards;
}

.ai-box-flash.pass {
  color: #06d6a0;
}

.ai-box-flash.block {
  color: #ef476f;
}

@keyframes aiFlashUp {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-24px); }
}

.ai-tally {
  color: #cfd8ff;
  font-size: 0.95rem;
}

.ai-feedback {
  margin-top: 12px;
  font-size: 0.95rem;
  color: #ffe8b3;
}

/* Game 3: sentence */
.ai-sentence {
  font-size: 1.3rem;
  min-height: 40px;
  margin: 16px 0;
}

.ai-word-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.ai-word-btn {
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 100px;
}

.ai-word-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.ai-word-prob {
  font-size: 0.8rem;
  color: #ffd166;
}

.ai-actions-row {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.ai-final-sentence {
  font-size: 1.4rem;
  font-weight: bold;
  margin: 10px 0;
}

/* Game 4: time machine stops */
.ai-g4-year {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffd166;
  font-weight: bold;
  font-size: 0.9rem;
  margin: 8px 0;
}

#g4StopTitle {
  margin: 4px 0 8px;
  font-size: 1.2rem;
}

#g4StopDesc {
  color: #cfd8ff;
}

.ai-g4-stage {
  font-size: 3.4rem;
  margin: 20px 0;
  min-height: 70px;
}

.ai-g4-stage.ai-g4-thinking {
  animation: aiG4Pulse 0.5s ease infinite alternate;
}

@keyframes aiG4Pulse {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(1.12); opacity: 0.7; }
}
