/* ========================================================
   Совёнок v2 — Design Tokens & Base Styles
   ======================================================== */

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

*:focus {
  outline: none;
}

/* --- Design Tokens --- */
:root {
  --base-size: calc(1vmin * 1);

  --color-bg:       #FFF8E1;
  --color-surface:  #FFFFFF;
  --color-primary:  #FF9800;
  --color-primary-light: #FFE0B2;
  --color-secondary: #7C4DFF;
  --color-secondary-light: #D1C4E9;
  --color-success:  #4CAF50;
  --color-success-light: #C8E6C9;
  --color-error:    #F44336;
  --color-error-light: #FFCDD2;
  --color-warning:  #FFC107;
  --color-text:     #3E2723;
  --color-text-light: #8D6E63;
  --color-shadow:   rgba(62, 39, 35, 0.12);

  --color-age3: #FFE0B2;
  --color-age4: #C8E6C9;
  --color-age5: #BBDEFB;

  --radius:       1.5rem;
  --radius-small: 0.75rem;
  --radius-round: 50%;

  --gap:     1.25rem;
  --gap-lg:  2rem;
  --padding: 1.25rem;

  --font-family: "SF Pro Rounded", "Nunito", "Comfortaa", system-ui, -apple-system, sans-serif;
  --font-size-xs:    clamp(0.75rem,  2vmin, 0.875rem);
  --font-size-sm:    clamp(0.875rem, 2.5vmin, 1rem);
  --font-size-base:  clamp(1rem,     3vmin, 1.25rem);
  --font-size-lg:    clamp(1.25rem,  4vmin, 1.5rem);
  --font-size-xl:    clamp(1.5rem,   5vmin, 2rem);
  --font-size-2xl:   clamp(2rem,     7vmin, 3rem);
  --font-size-hero:  clamp(3rem,    10vmin, 5rem);

  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow:   400ms ease-out;
}

/* --- Body & App --- */
html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background: var(--color-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  -webkit-font-smoothing: antialiased;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

/* --- Screen --- */
.screen {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: var(--padding);
  gap: var(--gap);
  animation: fadeIn var(--transition-slow) both;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* --- Typography --- */
.subtitle {
  font-size: var(--font-size-lg);
  font-weight: 500;
  color: var(--color-text-light);
  text-align: center;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 60px;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: 700;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-normal);
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.95);
}

.btn-play {
  background: var(--color-success);
  color: #FFFFFF;
  min-width: 200px;
  padding: 1rem 2.5rem;
  font-size: var(--font-size-lg);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.35), 0 2px 4px var(--color-shadow);
}

.btn-play:active {
  background: #43A047;
}

.btn-back {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  border-radius: var(--radius-round);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-lg);
  box-shadow: 0 2px 8px var(--color-shadow);
}

.btn-back:active {
  background: #F5F5F5;
}

.btn-small {
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 1rem;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-small);
}

/* --- Stars --- */
.stars-count {
  font-size: var(--font-size-lg);
  font-weight: 700;
  white-space: nowrap;
}

/* ========================================================
   Animations
   ======================================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes bounce {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-10px); }
  50%  { transform: translateX(10px); }
  75%  { transform: translateX(-10px); }
  100% { transform: translateX(0); }
}

@keyframes flash-green {
  0%   { background-color: inherit; }
  50%  { background-color: var(--color-success-light); }
  100% { background-color: inherit; }
}

@keyframes pop-in {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes zoom-bounce {
  0%   { opacity: 0; transform: scale(0); }
  70%  { transform: scale(1.15); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes celebrate {
  0%   { transform: scale(1) rotate(0deg); }
  25%  { transform: scale(1.15) rotate(-5deg); }
  50%  { transform: scale(1.1) rotate(5deg); }
  75%  { transform: scale(1.15) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes star-pop {
  0%   { opacity: 0; transform: scale(0) rotate(-30deg); }
  60%  { transform: scale(1.3) rotate(10deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes progress-glow {
  0%, 100% { box-shadow: none; }
  50%      { box-shadow: 0 0 8px var(--color-primary), inset 0 0 4px var(--color-primary); }
}

@keyframes fade-slide-in {
  from { opacity: 0; transform: translateX(-15px); }
  to   { opacity: 1; transform: translateX(0); }
}

.bounce { animation: bounce 0.4s ease; }
.shake { animation: shake 0.4s ease; }
.pop-in { animation: pop-in 0.35s ease-out both; }

/* ========================================================
   Home Screen — Age Group Selection
   ======================================================== */

.home {
  gap: var(--gap-lg);
  justify-content: center;
}

.home-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.home-header h1 {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--color-primary);
}

.owl-big {
  font-size: clamp(4rem, 12vmin, 6rem);
  line-height: 1;
  animation: bounce 0.6s ease both;
}

.age-groups {
  display: flex;
  flex-direction: row;
  gap: var(--gap);
  justify-content: center;
  flex-wrap: wrap;
  max-width: 500px;
  padding: 0 var(--padding);
}

.age-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 130px;
  min-height: 140px;
  padding: var(--padding);
  gap: 0.4rem;
  background: linear-gradient(to bottom, var(--card-color, #fff), var(--color-surface));
  border: 3px solid var(--card-color, #ddd);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px var(--color-shadow);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  animation: pop-in 0.35s ease-out both;
}

.age-card:nth-child(1) { animation-delay: 0s; }
.age-card:nth-child(2) { animation-delay: 0.1s; }
.age-card:nth-child(3) { animation-delay: 0.2s; }

.age-card:active {
  transform: scale(0.95);
}

.age-icon {
  font-size: var(--font-size-2xl);
  line-height: 1;
}

.age-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--color-text);
}

.age-subtitle {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  text-align: center;
}

.age-stars {
  font-size: var(--font-size-xs);
  color: var(--color-warning);
  font-weight: 600;
}

/* ========================================================
   Subjects Screen — Subject Grid
   ======================================================== */

.subjects {
  justify-content: flex-start;
  padding-top: var(--padding);
}

.screen-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0;
  gap: var(--gap);
  flex-shrink: 0;
}

.screen-header h2 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  flex: 1;
  text-align: center;
}

.screen-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  text-align: center;
  flex-shrink: 0;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
  width: 100%;
  max-width: 500px;
  padding: var(--gap) 0;
}

.subject-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 1.25rem 0.75rem;
  gap: 0.4rem;
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--card-color, #ddd) 20%, var(--color-surface)),
    var(--color-surface));
  border-top: 4px solid var(--card-color, #ddd);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px var(--color-shadow);
  cursor: pointer;
  transition: transform var(--transition-fast);
  animation: pop-in 0.35s ease-out both;
}

.subject-card:nth-child(1) { animation-delay: 0s; }
.subject-card:nth-child(2) { animation-delay: 0.06s; }
.subject-card:nth-child(3) { animation-delay: 0.12s; }
.subject-card:nth-child(4) { animation-delay: 0.18s; }
.subject-card:nth-child(5) { animation-delay: 0.24s; }
.subject-card:nth-child(6) { animation-delay: 0.30s; }

.subject-card:active {
  transform: scale(0.95);
}

.subject-icon {
  font-size: var(--font-size-2xl);
  line-height: 1;
}

.subject-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
}

.subject-progress {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
}

.subject-stars {
  font-size: var(--font-size-xs);
  color: var(--color-warning);
  font-weight: 600;
}

/* ========================================================
   Topics Screen — Topic List
   ======================================================== */

.topics {
  justify-content: flex-start;
  padding-top: var(--padding);
}

.topics-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 500px;
  padding: var(--gap) 0;
}

.topic-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 60px;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 2px solid transparent;
  border-radius: var(--radius-small);
  box-shadow: 0 2px 8px var(--color-shadow);
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-normal);
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
  animation: fade-slide-in 0.35s ease-out both;
}

.topic-item:nth-child(1)  { animation-delay: 0s; }
.topic-item:nth-child(2)  { animation-delay: 0.04s; }
.topic-item:nth-child(3)  { animation-delay: 0.08s; }
.topic-item:nth-child(4)  { animation-delay: 0.12s; }
.topic-item:nth-child(5)  { animation-delay: 0.16s; }
.topic-item:nth-child(6)  { animation-delay: 0.20s; }
.topic-item:nth-child(7)  { animation-delay: 0.24s; }
.topic-item:nth-child(8)  { animation-delay: 0.28s; }
.topic-item:nth-child(9)  { animation-delay: 0.32s; }
.topic-item:nth-child(10) { animation-delay: 0.36s; }

.topic-item:active {
  transform: scale(0.98);
}

.topic-item.done {
  background: var(--color-success-light);
  border-color: var(--color-success);
}

.topic-item.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.topic-item.locked:active {
  transform: none;
}

.topic-num {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-round);
  background: var(--color-primary-light);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 700;
  flex-shrink: 0;
}

.topic-item.done .topic-num {
  background: var(--color-success);
  color: white;
}

.topic-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;
}

.topic-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
}

.topic-progress {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
}

.topic-status {
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

/* ========================================================
   Play Screen & Game Engine
   ======================================================== */

.play {
  position: relative;
  justify-content: flex-start;
  padding-top: var(--padding);
  overflow: hidden;
}

.play-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 0.75rem;
  flex-shrink: 0;
}

.progress-bar {
  flex: 1;
  height: 12px;
  background: var(--color-primary-light);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 6px;
  transition: width 400ms ease;
}

.progress-fill.updated {
  animation: progress-glow 0.6s ease-out;
}

.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--color-text);
}

#game-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  flex: 1;
}

/* --- Game Container --- */
.game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-lg);
  padding: var(--padding);
  width: 100%;
}

.game-question {
  font-size: var(--font-size-xl);
  font-weight: 700;
  text-align: center;
  color: var(--color-text);
  animation: slide-down 0.3s ease-out both;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.game-question-text {
  flex: 1;
}

.btn-repeat {
  flex-shrink: 0;
  background: var(--color-card);
  border: 2px solid var(--color-border, #E0E0E0);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.15s, background 0.15s;
}

.btn-repeat:active {
  transform: scale(0.88);
  background: var(--color-primary-light, #FFF3E0);
}

.game-image {
  font-size: clamp(3rem, 10vmin, 5rem);
  line-height: 1;
  text-align: center;
  animation: zoom-bounce 0.4s ease-out 0.1s both;
}

.game-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
  width: 100%;
  max-width: 400px;
}

/* --- Option Buttons --- */
.btn-option {
  min-height: 70px;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 2px solid var(--color-primary-light);
  font-family: var(--font-family);
  font-size: clamp(2.2rem, 7vmin, 3rem);
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    background-color var(--transition-normal),
    border-color var(--transition-normal);
  box-shadow: 0 2px 8px var(--color-shadow);
}

.btn-option:active { transform: scale(0.95); }
.btn-option.correct {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #FFFFFF;
  animation: flash-green 0.6s ease;
}
.btn-option.wrong {
  background: var(--color-error);
  border-color: var(--color-error);
  color: #FFFFFF;
  animation: shake 0.4s ease;
}
.btn-option:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-option:disabled:active { transform: none; }
.btn-option.correct, .btn-option.wrong { opacity: 1; }

/* Adaptive emoji sizing (by grapheme count per element) */
.emoji-lg { font-size: clamp(1.8rem, 5.5vmin, 2.6rem) !important; line-height: 1.2 !important; }
.emoji-md { font-size: clamp(1.4rem, 4.5vmin, 2rem) !important; line-height: 1.2 !important; }
.emoji-sm { font-size: clamp(1rem, 3.5vmin, 1.5rem) !important; line-height: 1.2 !important; }
.seq-item.emoji-lg, .drag-item.emoji-lg, .drop-slot.emoji-lg, .classify-item.emoji-lg { width: auto; min-width: 56px; max-width: 120px; height: auto; min-height: 56px; padding: 0.3rem 0.5rem; }
.seq-item.emoji-md, .drag-item.emoji-md, .drop-slot.emoji-md, .classify-item.emoji-md { width: auto; min-width: 56px; max-width: 140px; height: auto; min-height: 56px; padding: 0.3rem 0.5rem; }
.seq-item.emoji-sm, .drag-item.emoji-sm, .drop-slot.emoji-sm, .classify-item.emoji-sm { width: auto; min-width: 56px; max-width: 180px; height: auto; min-height: 56px; padding: 0.3rem 0.5rem; }

.game-options.compact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}
.game-options.compact .btn-option {
  aspect-ratio: 1;
  width: 70px;
  min-height: unset;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Sequence Game --- */
.sequence-selected {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
}

.seq-item {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-small);
  border: 2px solid;
  font-size: 2.2rem;
  font-weight: bold;
}

.seq-item.done {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.seq-item.empty {
  background: #F5F5F5;
  border-color: #E0E0E0;
  border-style: dashed;
  color: #BDBDBD;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
  position: relative;
}
.seq-item.empty::after {
  content: '';
  position: absolute;
  inset: -12px;
}

/* --- Match Game --- */
.match-area {
  position: relative;
  width: 100%;
  max-width: 500px;
}

.match-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.match-line { stroke-width: 3; stroke-linecap: round; }
.matched-line { stroke: var(--color-success); opacity: 0.7; }
.drag-line { stroke: var(--color-primary); stroke-dasharray: 8 4; opacity: 0.8; }

.match-columns {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: row;
  gap: 2rem;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}

.match-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.match-item {
  min-width: 80px;
  min-height: 60px;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-small);
  border: 2px solid var(--color-primary-light);
  background: var(--color-surface);
  font-size: clamp(2.2rem, 7vmin, 3rem);
  font-weight: 600;
  text-align: center;
  color: var(--color-text);
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-normal), background-color var(--transition-normal);
  box-shadow: 0 2px 8px var(--color-shadow);
}

.match-item:active { transform: scale(0.95); }
.match-item.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(255, 152, 0, 0.3);
}
.match-item.matched {
  border-color: var(--color-success);
  background: rgba(76, 175, 80, 0.15);
  color: var(--color-success);
  cursor: default;
  opacity: 0.85;
}
.match-item.matched:active { transform: none; }
.match-item.wrong {
  border-color: var(--color-error);
  background: var(--color-error-light);
  animation: shake 0.4s ease;
}

/* --- Drag & Drop Game --- */
.drop-slots {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.drop-slot {
  width: 60px;
  height: 60px;
  border: 2px dashed var(--color-primary);
  border-radius: var(--radius-small);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: bold;
  background: var(--color-surface);
  cursor: pointer;
  transition: background-color var(--transition-normal), border-color var(--transition-normal), transform var(--transition-fast);
}

.drop-slot.filled {
  border-style: solid;
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  animation: pop-in 0.25s ease-out both;
}

.drag-items {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.drag-item {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-small);
  border: 2px solid var(--color-primary-light);
  font-size: 2.2rem;
  font-weight: bold;
  background: var(--color-surface);
  cursor: pointer;
  transition: transform var(--transition-fast), opacity var(--transition-normal);
}

.drag-item.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: scale(1.1);
}

.drag-item.used,
.drag-item:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

/* Drag hover & clone */
.drop-hover,
.seq-item.empty.drop-hover,
.drop-slot.drop-hover,
.work-cell.drop-hover {
  border-color: var(--color-primary) !important;
  background: var(--color-primary-light) !important;
  transform: scale(1.1);
}

.drag-clone {
  border-radius: var(--radius-small);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 0 12px rgba(255,152,0,0.2);
  will-change: transform;
}

.dragging {
  opacity: 0.4 !important;
}

.drag-source.used {
  opacity: 0.3;
}

/* --- Feedback Overlay --- */
.feedback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius);
  animation: pop-in 0.35s ease-out both;
  z-index: 20;
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.feedback.correct {
  background: rgba(200, 230, 201, 0.9);
  color: var(--color-success);
}

.feedback.correct .owl-big {
  animation: celebrate 0.8s ease-out;
}

.feedback.wrong {
  background: rgba(255, 205, 210, 0.9);
  color: var(--color-error);
}

.feedback.wrong .owl-big {
  animation: shake 0.5s ease;
}

/* --- Completion Screen --- */
.complete {
  gap: var(--gap-lg);
  text-align: center;
  justify-content: center;
}

.complete .owl-big {
  animation: celebrate 0.8s ease-out both;
}

.complete h1 {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--color-primary);
  animation: slide-up 0.4s ease-out 0.2s both;
}

.complete p {
  font-size: var(--font-size-lg);
  color: var(--color-text-light);
  animation: slide-up 0.4s ease-out 0.35s both;
}

.complete .stars-count {
  font-size: var(--font-size-xl);
  color: var(--color-warning);
  animation: star-pop 0.5s ease-out 0.5s both;
}

.complete .btn-play {
  animation: slide-up 0.4s ease-out 0.6s both;
}

/* --- Count Game --- */
.count-scene {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  max-width: 400px;
}

.count-item {
  font-size: clamp(2rem, 8vmin, 3.5rem);
  line-height: 1;
}

.count-tappable {
  font-size: clamp(2rem, 8vmin, 3.5rem);
  line-height: 1;
  padding: 0.5rem;
  border: 3px solid transparent;
  border-radius: var(--radius-small);
  background: var(--color-surface);
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-normal), background-color var(--transition-normal);
  box-shadow: 0 2px 8px var(--color-shadow);
}

.count-tappable:active { transform: scale(0.9); }

.count-tappable.count-tapped {
  border-color: var(--color-success);
  background: var(--color-success-light);
  cursor: default;
}

.count-tappable:disabled:not(.count-tapped) {
  opacity: 0.5;
  cursor: default;
}

.count-counter {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-primary);
}

/* --- Classify Game --- */
.classify-baskets {
  display: flex;
  flex-direction: row;
  gap: var(--gap);
  justify-content: center;
  width: 100%;
  max-width: 400px;
}

.classify-basket {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-height: 100px;
  padding: 0.75rem;
  border: 2px dashed var(--color-primary);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.basket-label {
  font-size: clamp(1.5rem, 6vmin, 2.5rem);
  line-height: 1;
}

.basket-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
}

.basket-item {
  font-size: 2.2rem;
  animation: pop-in 0.25s ease-out both;
}

.classify-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  max-width: 400px;
}

.classify-item {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-small);
  border: 2px solid var(--color-primary-light);
  font-size: 2.2rem;
  background: var(--color-surface);
  cursor: pointer;
  transition: transform var(--transition-fast), opacity var(--transition-normal);
  box-shadow: 0 2px 8px var(--color-shadow);
}

.classify-item.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: scale(1.1);
}

.classify-item.used,
.classify-item:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

/* --- Maze Game --- */
.maze-grid {
  display: grid;
  width: fit-content;
  margin: 0 auto;
}

.maze-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  position: relative;
}

.maze-cell.maze-visited {
  background: var(--color-primary-light);
}

.maze-cell.maze-current {
  background: var(--color-primary-light);
}

.maze-cell.maze-end {
  background: var(--color-success-light);
}

.maze-player, .maze-target {
  font-size: 1.5rem;
  line-height: 1;
  animation: pop-in 0.25s ease-out both;
}

/* --- Trace Game --- */
.trace-container {
  position: relative;
  width: 300px;
  height: 300px;
  border: 2px solid #E0E0E0;
  border-radius: var(--radius-small);
  background: #fff;
  touch-action: none;
}

.trace-template, .trace-user {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.trace-template {
  z-index: 1;
  pointer-events: none;
}

.trace-user {
  z-index: 2;
}

.trace-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.trace-clear, .trace-check {
  font-size: 1.5rem;
  background: var(--color-surface);
  border: 2px solid var(--color-primary-light);
  box-shadow: 0 2px 8px var(--color-shadow);
}

/* --- Missing Game --- */
.missing-scene {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  max-width: 400px;
}

.missing-item {
  font-size: clamp(2.5rem, 9vmin, 4rem);
  line-height: 1;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.missing-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(3rem, 10vmin, 4.5rem);
  height: clamp(3rem, 10vmin, 4.5rem);
  border: 3px dashed var(--color-primary);
  border-radius: var(--radius-small);
  background: var(--color-primary-light);
  font-size: clamp(2rem, 7vmin, 3rem);
  animation: pulse 1.5s ease infinite;
}

.missing-revealed {
  animation: pop-in 0.35s ease-out both;
}

/* --- Mirror Game --- */
.mirror-original {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.mirror-pattern {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--color-surface);
  border: 2px solid var(--color-secondary-light);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--color-shadow);
}

.mirror-item {
  font-size: clamp(2.2rem, 8vmin, 3.5rem);
  line-height: 1;
}

.mirror-divider {
  font-size: var(--font-size-2xl);
  line-height: 1;
}

.mirror-option {
  letter-spacing: 0.15em;
}

/* --- Tangram Game --- */
.tangram-layout {
  display: flex;
  flex-direction: row;
  gap: var(--gap-lg);
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  max-width: 500px;
}

.tangram-target-wrap,
.tangram-work-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.tangram-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-light);
}

.tangram-grid {
  display: grid;
  gap: 4px;
  width: fit-content;
}

.tangram-cell {
  width: clamp(40px, 12vmin, 56px);
  height: clamp(40px, 12vmin, 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.8rem, 7vmin, 2.5rem);
  border-radius: var(--radius-small);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.target-cell {
  background: var(--color-surface);
  border: 2px solid #E0E0E0;
}

.work-cell.active {
  background: var(--color-surface);
  border: 2px dashed var(--color-primary);
  cursor: pointer;
}

.work-cell.active.filled {
  border-style: solid;
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  animation: pop-in 0.25s ease-out both;
}

.work-cell.empty-target {
  background: transparent;
  border: 2px solid transparent;
}

.tangram-pieces {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  max-width: 400px;
}

.tangram-piece {
  width: 56px;
  height: 56px;
  font-size: 2rem;
}

/* ========================================================
   Puzzles & Gallery
   ======================================================== */

/* Puzzle preview in play header */
.puzzle-preview {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: var(--radius-small);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: 0 2px 8px var(--color-shadow);
  cursor: pointer;
}

.puzzle-svg-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.puzzle-svg-wrapper svg {
  display: block;
}

/* Puzzle piece states */
.puzzle-piece-hidden {
  opacity: 0.08;
  filter: grayscale(1);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.puzzle-piece-revealed {
  opacity: 1;
  filter: none;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

@keyframes puzzle-pop {
  0%   { opacity: 0; transform: scale(0.5) rotate(-10deg); }
  70%  { transform: scale(1.1) rotate(3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Completion puzzle */
.puzzle-complete {
  animation: zoom-bounce 0.6s ease-out both;
}

/* Gallery screen */
.gallery {
  justify-content: flex-start;
  padding-top: var(--padding);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: 100%;
  max-width: 500px;
  padding: var(--gap) 0;
}

.gallery-item {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 2px solid transparent;
  box-shadow: 0 2px 8px var(--color-shadow);
  min-width: auto;
  min-height: auto;
}

.gallery-item.complete {
  border-color: var(--color-success);
  background: var(--color-success-light);
}

.gallery-item.partial {
  border-color: var(--color-primary-light);
}

.gallery-item.locked {
  opacity: 0.4;
}

.gallery-preview {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gallery-preview svg {
  width: 100% !important;
  height: 100% !important;
}

.gallery-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-light);
}

/* Puzzle modal */
.puzzle-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease both;
}

.puzzle-modal-content {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--padding);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  animation: pop-in 0.35s ease-out both;
  max-width: 90vw;
}

.puzzle-modal-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
}

.puzzle-modal-progress {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

/* Home gallery buttons */
.home-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.btn-gallery {
  background: var(--color-secondary-light);
  color: var(--color-text);
  padding: 0.5rem 1.5rem;
  font-size: var(--font-size-sm);
  border-radius: var(--radius);
  min-width: auto;
  min-height: 44px;
}

/* ========================================================
   Responsive
   ======================================================== */

@media (min-width: 600px) {
  :root {
    --gap:     1.75rem;
    --gap-lg:  2.5rem;
    --padding: 2rem;
  }

  .subject-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 600px;
  }

  .game-options {
    max-width: 500px;
  }

  .btn-option {
    min-height: 80px;
    font-size: 3rem;
  }

  .game-options.compact .btn-option {
    width: 80px;
    min-height: unset;
  }

  .age-card {
    width: 150px;
    min-height: 160px;
  }

  .classify-baskets {
    max-width: 500px;
  }

  .classify-pool {
    max-width: 500px;
  }

  .count-scene {
    max-width: 500px;
  }
}

/* ── Auth / Purchase modals ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  padding-top: calc(1.5rem + env(safe-area-inset-top));
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  backdrop-filter: blur(2px);
  overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }

.modal-box {
  background: var(--surface, #fff);
  border-radius: 1.5rem;
  padding: 2rem 1.75rem;
  max-width: 380px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.modal-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.modal-box h2 { margin: 0 0 0.4rem; font-size: 1.3rem; }
.modal-box p  { color: var(--text-secondary, #666); margin: 0 0 1rem; font-size: 0.95rem; line-height: 1.4; }

.modal-box input[type="email"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border, #e0e0e0);
  border-radius: 0.75rem;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}
.modal-box input[type="email"]:focus { border-color: var(--accent, #FF9800); }

.btn-primary {
  width: 100%;
  padding: 0.85rem;
  background: var(--accent, #FF9800);
  color: #fff;
  border: none;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-status {
  min-height: 1.4em;
  font-size: 0.875rem;
  color: var(--text-secondary, #666);
  margin: 0.5rem 0;
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--text-secondary, #999);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0.75rem 0.5rem;
  margin-top: 0.25rem;
  min-height: 44px;
  text-decoration: underline;
}

/* Settings gear button */
.btn-settings {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity var(--transition-normal);
  z-index: 10;
}
.btn-settings:active { opacity: 1; }

/* Settings modal list */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 1rem 0;
}
.settings-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg, #f5f0e8);
  border: none;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-family: var(--font-family);
  color: var(--color-text);
  cursor: pointer;
  text-decoration: none;
  text-align: left;
  min-height: 44px;
  transition: background 0.15s;
}
.settings-item:active {
  background: var(--border, #e0e0e0);
}
.settings-icon {
  font-size: 1.2rem;
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}
.settings-box .btn-ghost {
  margin-top: 0.5rem;
}
.doc-content {
  text-align: left;
  font-size: 0.85rem;
  line-height: 1.5;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.5rem 0;
}
.doc-content h1 { font-size: 1.1rem; color: var(--accent, #FF9800); margin: 0 0 0.5rem; }
.doc-content h2 { font-size: 0.95rem; margin: 1rem 0 0.25rem; }
.doc-content p, .doc-content li { margin: 0.25rem 0; }
.doc-content ul { padding-left: 1.25rem; }
.doc-content a { color: var(--accent, #FF9800); }

/* ── Purchase modal ─────────────────────────────────────────── */
.purchase-box { max-width: 380px; position: relative; }

.modal-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary, #999);
  cursor: pointer;
  padding: 0.5rem;
  min-width: 44px;
  min-height: 44px;
  line-height: 1;
}

.purchase-plans {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.purchase-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--bg-card, #fff);
  border: 2px solid var(--border, #e0e0e0);
  font-size: 1rem;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s;
}
.purchase-plan:hover,
.purchase-plan:focus { border-color: var(--accent, #FF9800); }

.purchase-plan.bundle {
  border-color: var(--accent, #FF9800);
  background: linear-gradient(135deg, #FFF8E1, #FFF3E0);
}

.plan-title { font-weight: 600; }
.plan-price { font-weight: 700; color: var(--accent, #FF9800); }

.plan-badge {
  position: absolute;
  top: -0.5rem;
  right: 0.75rem;
  background: var(--accent, #FF9800);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 8px;
}

.purchase-plan.selected {
  border-color: var(--accent, #FF9800);
  box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.3);
}

.purchase-plan.purchased {
  opacity: 0.5;
  pointer-events: none;
}

.payment-details {
  background: var(--bg-card, #f5f5f5);
  border-radius: 12px;
  padding: 1rem;
  margin: 0.75rem 0;
  text-align: center;
}
.payment-bank { font-weight: 600; margin: 0 0 0.25rem; color: var(--text, #333); }
.payment-card { font-size: 1.3rem; font-weight: 700; margin: 0.25rem 0; letter-spacing: 0.05em; cursor: pointer; user-select: none; padding: 0.4rem 0.8rem; border-radius: 8px; transition: background 0.15s; text-decoration: underline; text-decoration-style: dashed; text-underline-offset: 4px; color: var(--primary, #6c63ff); }
.payment-card::after { content: ' 📋'; font-size: 0.85rem; }
.payment-card:hover { background: var(--border, #ddd); }
.payment-recipient { color: var(--text-secondary, #666); margin: 0.25rem 0; font-size: 0.9rem; }
.payment-amount { margin: 0.5rem 0 0; font-size: 1rem; }
.payment-hint { font-size: 0.85rem; color: var(--text-secondary, #666); margin: 0.5rem 0 1rem; }

.promo-row {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0 0.25rem;
}
.promo-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border, #e0e0e0);
  border-radius: 10px;
  font-size: 0.95rem;
  text-transform: uppercase;
}
.promo-input:focus { border-color: var(--accent, #FF9800); outline: none; }
.promo-apply-btn {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  white-space: nowrap;
}
.promo-status { font-size: 0.85rem; margin: 0; min-height: 1.2em; }
.promo-status.success { color: #4caf50; }
.promo-status.error { color: #f44336; }

.plan-price .original-price {
  text-decoration: line-through;
  opacity: 0.5;
  font-size: 0.85em;
  margin-right: 0.25rem;
}

/* Lock style for paywalled topics */
.topic-item.locked {
  opacity: 0.65;
}
.topic-locked-hint {
  color: var(--accent, #FF9800);
  font-size: 0.8rem;
}

/* PWA Install banner */
.install-banner[hidden] { display: none; }
.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  background: #fff;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  z-index: 1000;
  font-size: 0.9rem;
}

/* Profile screen */
.profile-section {
  padding: 1rem 0;
  border-bottom: 1px solid #eee;
}
.profile-section:last-child { border-bottom: none; }
.profile-section h3 {
  font-size: 0.9rem;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.profile-email {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.profile-stats {
  display: flex;
  gap: 1.5rem;
}
.stat-item { text-align: center; }
.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary, #FF9800);
}
.stat-label {
  font-size: 0.8rem;
  color: #888;
}
.profile-purchase, .profile-payment {
  padding: 0.4rem 0;
  font-size: 0.9rem;
}
.install-banner span { flex: 1; }

/* Loading spinner */
.screen-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  font-size: 2.5rem;
  animation: pulse 1s infinite;
}

/* Error state */
.screen-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
  text-align: center;
  color: var(--text-secondary, #666);
}
.screen-error .error-icon { font-size: 2.5rem; }

/* ========================================================
   Admin / Moderation Screen
   ======================================================== */

.admin-screen {
  align-items: stretch;
  gap: 0.75rem;
  padding-bottom: 2rem;
}

.admin-access-denied {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 1rem;
  text-align: center;
}

/* Global stats in header */
.admin-global-stats {
  display: flex;
  gap: 0.4rem;
  font-size: var(--font-size-sm);
  font-weight: 700;
  white-space: nowrap;
}
.adm-ok   { color: var(--color-success); }
.adm-fix  { color: var(--color-warning); }
.adm-crit { color: var(--color-error); }

.admin-export-btn {
  min-width: 0;
  min-height: 0;
  padding: 0.2rem 0.4rem;
  font-size: 1rem;
  background: none;
  border-radius: var(--radius-small);
}

/* Age group tabs */
.admin-age-tabs {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
  padding-bottom: 2px;
}

.admin-age-tab {
  flex-shrink: 0;
  padding: 0.4rem 0.9rem;
  border: 2px solid var(--color-primary-light);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  min-height: 0;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.admin-age-tab.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* Subject accordion list */
.admin-subject-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.admin-subject-group {
  border-radius: var(--radius-small);
  overflow: hidden;
  box-shadow: 0 1px 4px var(--color-shadow);
}

.admin-subject-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  background: var(--color-surface);
  cursor: pointer;
  transition: background var(--transition-fast);
  user-select: none;
}

.admin-subject-group.open .admin-subject-row {
  background: #FFF3E0;
}

.admin-subj-icon { font-size: 1.2rem; flex-shrink: 0; }
.admin-subj-title { font-weight: 700; font-size: var(--font-size-sm); flex: 1; }
.admin-subj-count { font-size: var(--font-size-xs); color: var(--color-text-light); white-space: nowrap; }
.admin-chevron { font-size: 0.65rem; color: var(--color-text-light); flex-shrink: 0; }

/* Topic rows inside accordion */
.admin-topic-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--color-primary-light);
}

.admin-topic-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem 0.55rem 1.5rem;
  background: #FFFDE7;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-top: 1px solid rgba(255, 152, 0, 0.1);
}

.admin-topic-row:hover { background: #FFF9C4; }

.admin-topic-num { font-size: var(--font-size-xs); color: var(--color-text-light); width: 1.4rem; flex-shrink: 0; }
.admin-topic-title { flex: 1; font-size: var(--font-size-sm); }
.admin-topic-count { font-size: var(--font-size-xs); color: var(--color-text-light); white-space: nowrap; }

/* Status badge dot */
.admin-status-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-ok       { background: var(--color-success); }
.status-needs-fix { background: var(--color-warning); }
.status-critical  { background: var(--color-error); }
.status-partial   { background: #FFB74D; }
.status-pending   { background: #BDBDBD; }

/* ── Task Review View ── */

.admin-breadcrumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  flex: 1;
  text-align: center;
  min-width: 0;
}

.admin-bread-topic {
  font-size: var(--font-size-sm);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.admin-bread-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
}

.admin-task-type-badge {
  padding: 0.25rem 0.6rem;
  background: var(--color-secondary-light);
  border-radius: var(--radius-small);
  font-size: var(--font-size-xs);
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-secondary);
}

.admin-task-id {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  font-family: monospace;
}

/* Game area in admin mode */
.admin-game-area {
  width: 100%;
  flex-shrink: 0;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

/* Review panel */
.admin-review-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  padding: 0.9rem;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--color-shadow);
}

.admin-status-row {
  display: flex;
  gap: 0.4rem;
  width: 100%;
}

.admin-status-btn {
  flex: 1;
  min-height: 44px;
  padding: 0.4rem 0.5rem;
  font-size: var(--font-size-xs);
  font-weight: 700;
  background: #F5F5F5;
  border-radius: var(--radius-small);
  border: 2px solid transparent;
  color: var(--color-text);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.admin-status-btn[data-status="ok"].sel      { background: var(--color-success-light); border-color: var(--color-success); }
.admin-status-btn[data-status="needs-fix"].sel { background: #FFF9C4; border-color: var(--color-warning); }
.admin-status-btn[data-status="critical"].sel  { background: var(--color-error-light); border-color: var(--color-error); }

.admin-comment-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--color-primary-light);
  border-radius: var(--radius-small);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  background: var(--color-bg);
  resize: none;
  -webkit-user-select: text;
  user-select: text;
}

.admin-comment-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.admin-save-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-save-btn {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0.5rem 1.25rem;
  font-size: var(--font-size-sm);
}

.admin-save-msg {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  flex: 1;
}

.admin-save-msg.ok    { color: var(--color-success); font-weight: 700; }
.admin-save-msg.error { color: var(--color-error); }

/* Navigation row */
.admin-nav-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.25rem 0;
}

.admin-nav-btn {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0.35rem 0.9rem;
  font-size: var(--font-size-sm);
}

.admin-dots-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
  justify-content: center;
  align-items: center;
}

.admin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  min-width: 0;
  min-height: 0;
  padding: 0;
  transition: transform var(--transition-fast);
}

.admin-dot:active { transform: scale(0.85); }

.dot-pending  { background: #BDBDBD; }
.dot-ok       { background: var(--color-success); }
.dot-fix      { background: var(--color-warning); }
.dot-critical { background: var(--color-error); }
.dot-current  { border-color: var(--color-text); transform: scale(1.3); }
.screen-error p { margin: 0; font-size: 0.95rem; }
