:root { color-scheme: light; font-family: system-ui, sans-serif; color: #242046; background: #f7f4ff; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.shell { width: min(100% - 24px, 660px); margin-inline: auto; }
header.shell { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 60px; }
header p { color: #625779; font-size: .85rem; margin-block: 4px; }
h1 { margin: 8px 0 14px; font-size: clamp(1.7rem, 6vw, 2.85rem); line-height: 1.05; }
h2 { margin: 3px 0 10px; font-size: clamp(1.25rem, 4vw, 1.75rem); }
h3 { margin: 16px 0 6px; font-size: 1.15rem; }
button, .back { border: 2px solid #d6c9f1; background: #fff; color: #302748; border-radius: 14px; min-height: 48px; padding: 6px 12px; font: inherit; font-weight: 750; }
button { cursor: pointer; }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
button:focus-visible, .back:focus-visible { outline: 3px solid #6b3abd; outline-offset: 3px; }
.ages { display: flex; gap: 8px; }
.ages button { font-size: 1.3rem; min-width: 57px; }
.ages button[aria-pressed="true"] { background: #5934a2; color: #fff; border-color: #5934a2; }
.panel { background: #fff; border: 1px solid #e1d7f0; border-radius: 22px; margin: 12px 0 26px; padding: 12px; }
.example, .solution, .home-visual { padding: 8px; border-radius: 14px; background: #f6f0ff; }
.example { display: flex; align-items: center; justify-content: center; gap: 8px; color: #492c85; }
.solution { background: #e6f4eb; }
.progress { color: #563796; font-weight: 850; margin: 6px 0 3px; letter-spacing: .12em; }
.starting-items { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; padding-bottom: 8px; font-size: 1.25rem; }
.apple-icon { display: block; width: clamp(18px, 5vw, 24px); aspect-ratio: 1; object-fit: contain; }
.starting-items .apple-icon { width: clamp(24px, 6vw, 32px); }
.choices { display: grid; gap: 8px; }
.option { padding: 7px; background: #fbf8ff; }
.option:hover { border-color: #7754ad; }
.groups { display: flex; justify-content: center; align-items: stretch; gap: 5px; }
.group, .rest { display: grid; place-items: center; align-content: center; min-width: 49px; max-width: 89px; width: 100%; min-height: 62px; border: 2px solid #ba8f57; background: #fff4d8; border-radius: 8px 8px 12px 12px; padding: 3px; gap: 1px; }
.group-icon { font-size: 1.18rem; line-height: 1; }
.group-items { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; min-height: 18px; font-size: .95rem; line-height: 1; }
.rest { min-width: 63px; max-width: 78px; border-style: dashed; border-color: #9c87c1; background: #f0e9fa; }
.rest-label { font-size: .8rem; font-weight: 760; text-align: center; }
.rest-empty { grid-column: 1 / -1; align-self: center; color: #665485; font-size: 1.25rem; }
#feedback { margin: 7px 0 0; min-height: 22px; color: #5d398f; font-weight: 750; }
#feedback-symbol { font-size: 1.25rem; }
.home-visual { display: grid; gap: 4px; text-align: center; margin: 10px 0; font-size: 1.25rem; }
.home-visual span { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.home-visual .napkin-icon { display: inline-block; width: 23px; height: 23px; border: 1px solid #62578a; border-radius: 3px; background: linear-gradient(135deg, #fcf8ff 0 49%, #cfc2eb 50% 100%); }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
body[data-level="5"] .language-link, body[data-level="6"] .language-link { display: none; }
body[data-level="5"] .picture-text { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body[data-level="5"] .group { min-height: 57px; }

body[data-level="7"] .prompt-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem .85rem;
  margin: 3px 0 .65rem;
}
body[data-level="7"] .prompt-row h2 { flex: 1 1 16rem; margin: 0; }
#instruction-toggle {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  min-height: 48px;
  border-color: #5934a2;
  color: #fff;
  background: #5934a2;
  touch-action: manipulation;
}
.audio-time { font-size: .85em; font-variant-numeric: tabular-nums; }
.audio-status { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

body[data-level="7"] .starting-items .apple-icon { width: clamp(25px, 5vw, 37px); }
body[data-level="7"] .groups {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 6.5rem));
  gap: clamp(4px, 1.4vw, 10px);
}
body[data-level="7"] :is(.group, .rest) {
  min-width: 0;
  max-width: none;
  min-height: clamp(5.2rem, 17vw, 8.15rem);
  grid-template-rows: 1.75rem 1fr;
  padding: clamp(2px, 1vw, 5px);
  align-content: start;
}
body[data-level="7"] .group-icon { font-size: clamp(1.25rem, 3.2vw, 1.75rem); }
body[data-level="7"] .group-items {
  align-self: start;
  align-content: start;
  width: min(100%, 5.4rem);
  min-height: 2.65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
body[data-level="7"] .group-items .apple-icon { justify-self: center; width: min(100%, 42px); }
body[data-level="7"] .rest-label { font-size: clamp(.72rem, 2.65vw, .89rem); line-height: 1; }
body[data-level="7"] .rest .group-items:has(.rest-empty) { align-content: center; }

@media (max-width: 350px) {
  .panel { padding: 8px; }
  .groups { gap: 3px; }
  body[data-level="7"] .option { padding: 5px; }
  body[data-level="7"] .groups { gap: 3px; }
  body[data-level="7"] :is(.group, .rest) { padding: 2px; }
  html[data-visual-fit="narrow"] body[data-level="7"] .panel { padding-inline: 6px; }
  html[data-visual-fit="narrow"] body[data-level="7"] .option { padding-inline: 3px; }
  html[data-visual-fit="narrow"] body[data-level="7"] .groups { gap: 2px; }
  html[data-visual-fit="narrow"] body[data-level="7"] :is(.group, .rest) { padding-inline: 1px; }
}
