/* ---------- Go/No-Go game ---------- */

/* Level selector tabs */
.level-select{
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.level-tab{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 100px;
  border: 1.5px solid var(--panel-border);
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink-soft);
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
[data-theme="dark"] .level-tab{ background: rgba(255,255,255,0.05); }
.level-tab:hover{ border-color: var(--pine-deep); }
.level-tab.is-active{
  background: var(--pine-deep);
  border-color: var(--pine-deep);
  color: #fff;
}
.level-num{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  font-size: 0.78rem;
}
.level-tab.is-active .level-num{ background: rgba(255,255,255,0.25); }
.level-lock{ display: flex; opacity: 0.6; }
.level-lock svg{ width: 15px; height: 15px; }
.level-tab.is-locked{ cursor: not-allowed; opacity: 0.6; }
.level-tab.is-locked:hover{ border-color: var(--panel-border); }

.game-panel{
  padding: 40px;
  margin-bottom: 24px;
}

.game-stage{
  position: relative;
  height: 320px;
  border-radius: 18px;
  background: var(--placeholder-bg);
  border: 1.5px solid var(--placeholder-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Distractor shapes (levels 2 & 3) */
.distractor-layer{
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.distractor{
  position: absolute;
  opacity: 0.35;
  will-change: transform;
  animation: drift linear infinite;
}
.distractor.d-circle{
  border-radius: 50%;
  background: #2f9e6e;
}
.distractor.d-square{
  border-radius: 8px;
  background: #d94f4f;
}
.distractor.d-triangle{
  width: 0;
  height: 0;
  background: transparent !important;
  border-left: 28px solid transparent;
  border-right: 28px solid transparent;
  border-bottom: 48px solid #c9972f;
}
[data-theme="dark"] .distractor.d-circle{ background: #4ee3f0; }
[data-theme="dark"] .distractor.d-square{ background: #f05a6e; }
[data-theme="dark"] .distractor.d-triangle{ border-bottom-color: #e3b84a; }

@keyframes drift{
  0%   { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(14px, -10px) rotate(90deg); }
  50%  { transform: translate(-6px, 12px) rotate(180deg); }
  75%  { transform: translate(-16px, -6px) rotate(270deg); }
  100% { transform: translate(0, 0) rotate(360deg); }
}

/* Central target zone */
.target-zone{
  position: relative;
  z-index: 2;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.target-zone-inner{
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Level 3: slot-machine frame around the target zone */
.game-stage.slot-mode .target-zone{
  border-radius: 28px;
  background: linear-gradient(145deg, #f0c23a, #d9a419);
  box-shadow: 0 10px 24px rgba(160,110,10,0.35), inset 0 0 0 4px rgba(255,255,255,0.35);
  padding: 10px;
}
.game-stage.slot-mode .target-zone::before,
.game-stage.slot-mode .target-zone::after{
  content: '';
  position: absolute;
  top: -8px; bottom: -8px;
  width: 16px;
  border-radius: 8px;
  background: linear-gradient(180deg, #e4e4e4, #b8b8b8);
}
.game-stage.slot-mode .target-zone::before{ left: -22px; }
.game-stage.slot-mode .target-zone::after{ right: -22px; }
.game-stage.slot-mode .target-zone-inner{
  width: 100%;
  height: 100%;
  border-radius: 18px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
[data-theme="dark"] .game-stage.slot-mode .target-zone-inner{ background: #1f2127; }

.game-shape{
  width: 90px;
  height: 90px;
  display: none;
}
.game-shape.show{ display: block; }
.game-shape.circle{
  border-radius: 50%;
  background: #2f9e6e;
}
.game-shape.square{
  border-radius: 10px;
  background: #d94f4f;
}
[data-theme="dark"] .game-shape.circle{ background: #4ee3f0; }
[data-theme="dark"] .game-shape.square{ background: #f05a6e; }

/* Spin animation for level 3 */
.game-shape.spinning{
  animation: slotSpin 0.1s linear infinite;
}
@keyframes slotSpin{
  0%   { transform: translateY(-14px); opacity: 0.5; }
  50%  { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(14px); opacity: 0.5; }
}
.game-shape.landed{
  animation: slotLand .32s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes slotLand{
  0%   { transform: scale(0.8); }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.game-overlay{
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  background: var(--grad);
  transition: opacity .25s ease, visibility .25s ease;
}
.game-overlay.hidden{
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.game-overlay h3{ font-size: 1.4rem; margin-bottom: 12px; }
.game-overlay p{ color: var(--ink-soft); max-width: 42ch; margin-bottom: 22px; }

.game-controls{
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.game-stats{
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  order: 2;
}

.go-btn{
  order: 1;
  min-width: 200px;
  font-size: 1.15rem;
  padding: 20px 44px;
}
.go-btn:disabled{
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}
.go-btn.flash{
  transform: scale(0.96);
}

.stat-chip{
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
}
.stat-chip span{
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  color: var(--pine-deep);
  font-weight: 500;
}
.stat-chip label{
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.game-note{
  padding: 24px 32px;
}
.game-note p{ color: var(--ink-soft); font-size: 0.95rem; }

@media (max-width: 560px){
  .game-panel{ padding: 24px; }
  .game-stage{ height: 260px; }
  .target-zone{ width: 130px; height: 130px; }
  .go-btn{ width: 100%; min-width: 0; }
  .go-btn-text{ display: none; }
  .go-btn::after{
    content: '';
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: currentColor;
  }
  .game-stats{ justify-content: space-between; width: 100%; }
  .level-select{ justify-content: center; }
  .level-tab{ padding: 8px 14px; font-size: 0.84rem; }
}


/* ================= Game switch (top) ================= */
.game-select{
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.game-tab{
  padding: 11px 24px;
  border-radius: 100px;
  border: 1.5px solid var(--panel-border);
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink-soft);
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
[data-theme="dark"] .game-tab{ background: rgba(255,255,255,0.05); }
.game-tab:hover{ border-color: var(--pine-deep); }
.game-tab.is-active{ background: var(--pine-deep); border-color: var(--pine-deep); color: #fff; }
[data-theme="dark"] .game-tab.is-active{ color: var(--btn-ink, #0b1626); }
.game-tab:focus-visible{ outline: 2px solid var(--pine-deep); outline-offset: 3px; }

/* ================= Bottom row: levels (left) + main button (center) ================= */
.controls-row{
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  width: 100%;
}
.controls-row .level-select{ margin: 0; gap: 8px; }
.controls-row .level-tab{ padding: 8px 14px; font-size: 0.86rem; }
.restart-btn{ min-width: 200px; font-size: 1.05rem; padding: 18px 40px; }

/* ================= Schulte table ================= */
.st-stage{
  height: auto;
  min-height: 320px;
  padding: 22px;
}
.st-grid{
  display: grid;
  grid-template-columns: repeat(var(--st-cols, 5), minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 820px;
}
.st-grid[data-level="1"]{ max-width: 460px; }
.st-grid[data-level="2"]{ max-width: 580px; }
.st-cell{
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1.5px solid var(--panel-border);
  background: rgba(255,255,255,0.9);
  color: var(--ink);
  font-family: 'Fraunces', serif;
  font-size: clamp(1.1rem, 2.6vw, 1.7rem);
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, opacity .15s ease, transform .1s ease;
  -webkit-tap-highlight-color: transparent;
}
[data-theme="dark"] .st-cell{ background: rgba(255,255,255,0.08); }
.st-cell:active{ transform: scale(0.95); }
.st-cell.done{
  background: var(--pine-deep);
  color: #fff;
  border-color: var(--pine-deep);
  opacity: 0.35;
  pointer-events: none;
}
[data-theme="dark"] .st-cell.done{ color: var(--btn-ink, #0b1626); }
.st-cell.wrong{ animation: stShake .28s ease; background: #f6d4d4; border-color: #d94f4f; }
[data-theme="dark"] .st-cell.wrong{ background: rgba(240,90,110,0.25); border-color: #f05a6e; }
@keyframes stShake{
  0%,100%{ transform: translateX(0); }
  25%{ transform: translateX(-5px); }
  75%{ transform: translateX(5px); }
}

/* ================= Game picker pop-up ================= */
.game-picker{
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 12, 18, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.game-picker[hidden]{ display: none; }
body.picker-open{ overflow: hidden; }
.game-picker-card{
  width: 100%;
  max-width: 640px;
  max-height: 100%;
  overflow-y: auto;
  padding: 34px;
  border-radius: 24px;
  background: var(--grad);
  border: 1.5px solid var(--panel-border);
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
  text-align: center;
}
.game-picker-card h2{ font-size: 1.7rem; margin: 0 0 8px; }
.game-picker-card > p{ color: var(--ink-soft); margin: 0 0 24px; }
.picker-options{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.picker-option{
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 12px 16px;
  border-radius: 18px;
  border: 1.5px solid var(--panel-border);
  background: rgba(255,255,255,0.55);
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
[data-theme="dark"] .picker-option{ background: rgba(255,255,255,0.05); }
.picker-option:hover, .picker-option:focus-visible{
  border-color: var(--pine-deep);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.14);
  outline: none;
}
.picker-art svg{ display: block; width: 100%; height: auto; }
.picker-name{ font-family: 'Fraunces', serif; font-size: 1.2rem; font-weight: 500; }
.pa-bg{ fill: var(--placeholder-bg); stroke: var(--placeholder-border); stroke-width: 1.5; }
.pa-circle{ fill: #2f9e6e; }
.pa-square{ fill: #d94f4f; }
[data-theme="dark"] .pa-circle{ fill: #4ee3f0; }
[data-theme="dark"] .pa-square{ fill: #f05a6e; }
.pa-tiles rect{ fill: rgba(255,255,255,0.95); stroke: var(--panel-border); stroke-width: 1.2; }
[data-theme="dark"] .pa-tiles rect{ fill: rgba(255,255,255,0.1); }
.pa-nums text{ font-family: 'Fraunces', serif; font-size: 15px; fill: var(--ink); }

@media (max-width: 800px){
  .controls-row{ grid-template-columns: 1fr; justify-items: center; gap: 16px; }
  .controls-spacer{ display: none; }
  .controls-row .level-select{ justify-content: center; order: 2; }
  .controls-row .go-btn, .controls-row .restart-btn{ order: 1; }
}
@media (max-width: 560px){
  .st-stage{ padding: 14px; min-height: 260px; }
  .st-grid{ gap: 6px; }
  .restart-btn{ width: 100%; min-width: 0; }
  .game-picker-card{ padding: 24px 18px; }
  .game-picker-card h2{ font-size: 1.4rem; }
  .picker-options{ grid-template-columns: 1fr; gap: 12px; }
  .game-tab{ padding: 9px 18px; font-size: 0.88rem; }
}
