.memory-shell,
.recall-shell {
  display: grid;
  gap: var(--space-3);
  min-height: 380px;
}
.memory-hero,
.recall-hero {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}
.memory-hero .brand-ribbon,
.recall-hero .brand-ribbon { grid-column: 1 / -1; margin-bottom: 0; }
.memory-hero .hero-copy,
.recall-hero .hero-copy { min-width: 0; }
.memory-hero h1,
.recall-hero h1 {
  font-size: clamp(1.45rem, 4.6vw, 2.55rem);
  word-break: keep-all;
  overflow-wrap: normal;
}
.memory-hero p,
.recall-hero p {
  max-width: none;
  margin-bottom: 0;
  font-size: clamp(0.98rem, 2.8vw, 1.12rem);
  word-break: keep-all;
  overflow-wrap: normal;
}
.memory-stage {
  display: grid;
  gap: var(--space-3);
  min-height: 380px;
}
.sequence-box,
.input-box,
.recall-board-wrap {
  display: grid;
  gap: var(--space-2);
  align-content: center;
  min-height: 150px;
  padding: clamp(18px, 4vw, 28px);
  border-radius: var(--radius-xl);
  border: 2px solid rgba(40, 111, 143, 0.16);
  background: linear-gradient(180deg, #ffffff 0%, #f3fbfb 100%);
}
.sequence-box,
.input-box { width: 100%; }
.recall-board {
  --grid-size: 4;
  display: grid;
  grid-template-columns: repeat(var(--grid-size), minmax(0, 1fr));
  gap: clamp(6px, 1.6vw, 12px);
  width: min(100%, 520px);
  margin: 0 auto;
}
.recall-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid rgba(40, 111, 143, 0.18);
  border-radius: 14px;
  background: #fff;
  color: #17384a;
  font-size: clamp(1.45rem, 8vw, 3rem);
  font-weight: 900;
  cursor: pointer;
  user-select: none;
}
.recall-cell.is-hidden {
  background: rgba(40, 111, 143, 0.08);
  border-style: dashed;
  color: transparent;
}
.recall-cell.is-selected {
  outline: 4px solid rgba(40, 111, 143, 0.24);
}
.recall-cell.is-correct {
  background: #eefbf3;
  border-color: rgba(29, 107, 67, 0.34);
}
.recall-cell.is-wrong {
  background: #fff4ef;
  border-color: rgba(154, 61, 37, 0.28);
}
.progress-strip,
.recall-meta {
  display: grid;
  gap: 10px;
}
.progress-strip .box-label { margin: 0; }
.recall-timer {
  color: var(--accent-strong);
  font-weight: 900;
}
.progress-meter,
.recall-meter {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(40, 111, 143, 0.12);
}
.progress-meter span,
.recall-meter span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f876b 0%, #286f8f 100%);
  transition: width 0.2s ease;
}
.stimulus-palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.palette-button {
  min-width: 54px;
  min-height: 54px;
  border-radius: 14px;
  border: 2px solid rgba(40, 111, 143, 0.18);
  background: #fff;
  font-size: 1.7rem;
  cursor: pointer;
}
.palette-button.is-selected {
  border-color: rgba(40, 111, 143, 0.6);
  box-shadow: 0 0 0 4px rgba(40, 111, 143, 0.14);
}
.memory-actions,
.recall-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.feedback-line {
  min-height: 54px;
  display: grid;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 2px solid rgba(40, 111, 143, 0.12);
  background: #f7fbfd;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
}
.feedback-line.is-correct {
  background: #eefbf3;
  color: #1d6b43;
  border-color: rgba(29, 107, 67, 0.22);
}
.feedback-line.is-wrong {
  background: #fff4ef;
  color: #9a3d25;
  border-color: rgba(154, 61, 37, 0.20);
}
.sequence-box .color-board,
.input-box .color-board,
.recall-board-wrap .color-board {
  width: min(100%, 520px);
}
.print-sheet { display: none; }
.print-grid {
  --grid-size: 4;
  display: grid;
  grid-template-columns: repeat(var(--grid-size), 1fr);
  gap: 2mm;
  width: 120mm;
  margin-top: 6mm;
}
.print-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid #111;
  font-size: 18px;
  font-weight: 800;
}
.print-answer-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6mm;
  font-size: 12px;
}
.print-answer-table th,
.print-answer-table td {
  border: 1px solid #111;
  padding: 3mm;
  text-align: center;
}
@media (min-width: 640px) {
  .memory-hero,
  .recall-hero { grid-template-columns: auto auto minmax(0, 1fr); }
  .memory-hero .brand-ribbon,
  .recall-hero .brand-ribbon { grid-column: auto; }
  .memory-actions,
  .recall-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 860px) {
  .memory-stage { grid-template-columns: 1fr 1fr; }
}
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  body { background: #fff; }
  .page { display: none !important; }
  .print-sheet {
    display: block;
    min-height: 270mm;
    padding: 2mm;
    page-break-after: always;
    color: #111;
  }
  .print-sheet:last-child { page-break-after: auto; }
  .print-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8mm;
  }
  .print-title { font-size: 22px; font-weight: 800; }
  .print-subtitle,
  .print-note {
    margin-top: 4mm;
    font-size: 12px;
    line-height: 1.7;
  }
  .print-meta {
    font-size: 12px;
    line-height: 1.8;
    text-align: right;
    white-space: nowrap;
  }
  .print-brand { display: flex; align-items: center; gap: 10px; }
  .print-logo {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.08);
  }
}
