:root {
  --ink: #182038;
  --muted: #69708a;
  --line: #e5e7ef;
  --surface: #ffffff;
  --surface-soft: #f4f5fa;
  --page: #f8f9fc;
  --primary: #5c55d9;
  --primary-dark: #4640b8;
  --primary-soft: #eeedff;
  --mint: #37b99b;
  --mint-soft: #e7faf4;
  --sky: #5aaeee;
  --sky-soft: #e9f6ff;
  --amber: #f4b844;
  --amber-soft: #fff6dc;
  --danger: #dd5a6f;
  --danger-soft: #fff0f3;
  --shadow: 0 18px 60px rgba(30, 39, 77, .10);
  --shadow-sm: 0 8px 28px rgba(30, 39, 77, .08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 0 0, rgba(92, 85, 217, .06), transparent 34rem),
    var(--page);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(92, 85, 217, .28);
  outline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 16px;
  color: white;
  background: var(--ink);
  border-radius: 10px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px clamp(20px, 5vw, 72px);
  background: rgba(248, 249, 252, .88);
  border-bottom: 1px solid rgba(229, 231, 239, .85);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: white;
  font-size: 23px;
  font-weight: 800;
  background: linear-gradient(145deg, #746dec, #5049c7);
  border-radius: 14px 14px 14px 5px;
  box-shadow: 0 8px 22px rgba(92, 85, 217, .26);
}

.brand-copy {
  display: grid;
  line-height: 1.05;
}

.brand-copy strong {
  font-size: 17px;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

main {
  width: min(1260px, calc(100% - 40px));
  margin: 0 auto;
}

.screen {
  animation: screen-in .35s ease-out both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.home-screen {
  padding: 38px 0 72px;
}

.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, .98fr);
  min-height: 440px;
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, .98) 0 53%, rgba(239, 238, 255, .84) 53% 100%);
  border: 1px solid var(--line);
  border-radius: 34px;
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  z-index: 2;
  align-self: center;
  padding: clamp(42px, 6vw, 82px);
  padding-right: 32px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  background: var(--mint);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(55, 185, 155, .12);
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(42px, 5vw, 70px);
  line-height: 1.02;
  letter-spacing: -.055em;
}

.hero-copy h1 span {
  color: var(--primary);
}

.hero-intro {
  max-width: 590px;
  margin: 24px 0 26px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: var(--surface-soft);
  border-radius: 999px;
}

.feature-row b {
  color: var(--primary);
}

.hero-visual {
  position: relative;
  min-height: 440px;
  overflow: hidden;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
}

.shape-one {
  width: 340px;
  height: 340px;
  top: 54px;
  left: 64px;
  background: rgba(92, 85, 217, .09);
}

.shape-two {
  width: 230px;
  height: 230px;
  right: -48px;
  bottom: -30px;
  background: rgba(55, 185, 155, .12);
}

.visual-card {
  position: absolute;
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  padding: 18px;
  background: rgba(255, 255, 255, .93);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 40px;
  box-shadow: 0 24px 55px rgba(45, 51, 102, .14);
}

.visual-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.visual-card-sky {
  top: 35px;
  right: 48px;
  transform: rotate(5deg);
}

.visual-card-water {
  right: 195px;
  bottom: 28px;
  transform: rotate(-5deg);
}

.visual-card-garage {
  right: 18px;
  bottom: 2px;
  width: 150px;
  height: 150px;
  border-radius: 32px;
  transform: rotate(7deg);
}

.listen-badge {
  position: absolute;
  top: 164px;
  left: 36px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 17px;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
  background: rgba(255, 255, 255, .94);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transform: rotate(-4deg);
}

.mode-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .55fr);
  gap: 28px;
  margin-top: 56px;
}

.section-heading,
.tray-heading,
.game-topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2,
.how-it-works h2,
.tray-heading h2,
.game-topbar h1,
.practice-panel h2 {
  margin: 0;
  letter-spacing: -.025em;
}

.section-heading h2,
.how-it-works h2,
.practice-panel h2 {
  font-size: 30px;
}

.mode-badge {
  padding: 8px 12px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  background: var(--primary-soft);
  border-radius: 999px;
}

.section-description {
  max-width: 720px;
  margin: 11px 0 20px;
  color: var(--muted);
  line-height: 1.55;
}

.level-list {
  display: grid;
  gap: 12px;
}

.level-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  width: 100%;
  min-height: 118px;
  padding: 21px 24px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 22px rgba(30, 39, 77, .04);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

.level-card:hover {
  border-color: rgba(92, 85, 217, .45);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.level-number {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: var(--primary);
  font-size: 19px;
  font-weight: 850;
  background: var(--primary-soft);
  border-radius: 16px;
}

.level-copy {
  display: grid;
  gap: 5px;
}

.level-copy strong {
  font-size: 17px;
}

.level-copy small {
  color: var(--muted);
  font-size: 13px;
}

.instruction-example {
  width: fit-content;
  margin-top: 3px;
  padding: 4px 8px;
  color: #717790;
  font-size: 12px;
  background: var(--surface-soft);
  border-radius: 7px;
}

.level-arrow {
  color: var(--primary);
  font-size: 26px;
  transition: transform .2s;
}

.level-card:hover .level-arrow {
  transform: translateX(4px);
}

.secondary-stack {
  display: grid;
  align-self: start;
  gap: 18px;
}

.automatic-panel,
.practice-panel {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.automatic-panel {
  background:
    radial-gradient(circle at 100% 0, rgba(92, 85, 217, .12), transparent 190px),
    var(--surface);
  border: 1px solid rgba(92, 85, 217, .16);
}

.practice-panel {
  color: white;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 255, 255, .15), transparent 220px),
    linear-gradient(145deg, #272c4f, #191e38);
}

.practice-panel .eyebrow {
  color: #a7a2ff;
}

.automatic-panel > p,
.practice-panel > p {
  margin: 11px 0 18px;
  font-size: 14px;
  line-height: 1.55;
}

.automatic-panel > p {
  color: var(--muted);
}

.practice-panel > p {
  color: #bdc1d3;
}

.secondary-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.secondary-heading h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -.025em;
}

.secondary-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 13px;
}

.practice-panel .secondary-icon {
  color: #f5da75;
  background: rgba(255, 255, 255, .09);
}

.compact-levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.compact-levels button {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  width: 100%;
  padding: 11px 6px;
  color: var(--ink);
  text-align: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
}

.automatic-panel .compact-levels button:hover {
  color: var(--primary);
  border-color: rgba(92, 85, 217, .35);
  background: var(--primary-soft);
}

.practice-panel .compact-levels button {
  color: white;
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .09);
}

.practice-panel .compact-levels button:hover {
  background: rgba(255, 255, 255, .12);
}

.compact-levels b {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 9px;
}

.practice-panel .compact-levels b {
  color: #c7c4ff;
  background: rgba(167, 162, 255, .14);
}

.compact-levels span {
  max-width: 100%;
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-button,
.manage-button {
  width: 100%;
  margin-top: 14px;
  font-size: 13px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  font-weight: 780;
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
}

.button:active {
  transform: translateY(1px);
}

.button-primary {
  color: white;
  background: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: 0 8px 18px rgba(92, 85, 217, .2);
}

.button-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.button-secondary {
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
}

.button-secondary:hover,
.button-quiet:hover {
  border-color: #cdd0dd;
  background: var(--surface-soft);
}

.button-quiet {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.manage-button {
  color: white;
  background: transparent;
  border-color: rgba(255, 255, 255, .18);
}

.manage-button:hover {
  color: var(--ink);
  background: white;
}

.how-it-works {
  margin-top: 68px;
  text-align: center;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 24px;
  text-align: left;
}

.steps article {
  display: flex;
  gap: 16px;
  padding: 22px;
  background: rgba(255, 255, 255, .65);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.steps article > span {
  display: grid;
  flex: 0 0 38px;
  height: 38px;
  place-items: center;
  color: var(--primary);
  font-weight: 850;
  background: var(--primary-soft);
  border-radius: 12px;
}

.steps strong {
  font-size: 15px;
}

.steps p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

/* Game */

.game-screen {
  padding: 34px 0 70px;
}

.game-topbar {
  align-items: center;
}

.game-topbar h1 {
  font-size: clamp(28px, 4vw, 42px);
}

.game-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.meta-pill {
  display: grid;
  min-width: 86px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  text-align: center;
}

.meta-pill span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.meta-pill strong {
  margin-top: 2px;
  font-size: 17px;
}

.progress-track {
  height: 5px;
  margin: 24px 0;
  overflow: hidden;
  background: #e6e7ef;
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #8882ef);
  border-radius: inherit;
  transition: width .35s ease;
}

.instruction-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 22px 24px;
  background:
    linear-gradient(110deg, rgba(92, 85, 217, .035), rgba(92, 85, 217, .09)),
    var(--surface);
  border: 1px solid rgba(92, 85, 217, .18);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.instruction-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: white;
  font-size: 21px;
  background: var(--primary);
  border-radius: 15px;
  box-shadow: 0 8px 20px rgba(92, 85, 217, .22);
}

.instruction-copy small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.instruction-copy p {
  margin: 5px 0 0;
  font-size: clamp(19px, 3vw, 27px);
  font-weight: 780;
  line-height: 1.25;
}

.practice-hint {
  margin: 22px 0 0;
  padding: 16px 18px;
  color: #426c62;
  font-weight: 650;
  background: var(--mint-soft);
  border: 1px solid rgba(55, 185, 155, .2);
  border-radius: 14px;
}

.destinations-section,
.objects-section {
  margin-top: 35px;
}

.tray-heading {
  margin-bottom: 15px;
}

.tray-heading h2 {
  font-size: 24px;
}

.keyboard-hint,
.selection-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.destinations {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.destination {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  padding: 24px;
  color: white;
  text-align: left;
  background: #a7b2ca;
  border: 3px solid transparent;
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

.destination:hover,
.destination.drop-ready {
  border-color: rgba(255, 255, 255, .8);
  box-shadow: 0 0 0 3px var(--primary), var(--shadow);
  transform: translateY(-2px);
}

.destination img,
.destination-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.destination img {
  object-fit: cover;
}

.destination-overlay {
  background: linear-gradient(0deg, rgba(20, 26, 48, .72), rgba(20, 26, 48, .02) 70%);
}

.destination strong,
.destination > small {
  position: absolute;
  z-index: 2;
  left: 24px;
}

.destination strong {
  bottom: 35px;
  font-size: 21px;
}

.destination > small {
  bottom: 18px;
  color: rgba(255, 255, 255, .8);
  font-size: 12px;
}

.placed-items {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: row-reverse;
}

.placed-items img {
  position: static;
  width: 54px;
  height: 54px;
  margin-left: -12px;
  padding: 5px;
  object-fit: contain;
  background: rgba(255, 255, 255, .92);
  border: 2px solid white;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, .15);
}

.object-tray {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 13px;
  min-height: 162px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
}

.object-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 138px;
  place-items: center;
  padding: 9px;
  background: var(--surface-soft);
  border: 2px solid transparent;
  border-radius: 18px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: border-color .18s, background .18s, box-shadow .18s, transform .18s;
}

.object-card:hover {
  background: #f0f0f8;
  transform: translateY(-2px);
}

.object-card.selected {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(92, 85, 217, .1);
}

.object-card.dragging {
  opacity: .42;
}

.object-card.used {
  pointer-events: none;
  opacity: .22;
  filter: grayscale(.7);
}

.object-card img {
  width: 100%;
  height: 112px;
  object-fit: contain;
  pointer-events: none;
}

.object-card small {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  background: rgba(255, 255, 255, .82);
  border-radius: 6px;
  text-transform: uppercase;
}

.drag-ghost {
  position: fixed;
  z-index: 1000;
  width: 126px;
  height: 126px;
  padding: 10px;
  pointer-events: none;
  background: rgba(255, 255, 255, .96);
  border: 2px solid var(--primary);
  border-radius: 22px;
  box-shadow: 0 24px 50px rgba(30, 39, 77, .24);
  transform: translate(-50%, -50%) rotate(3deg) scale(1.05);
}

.drag-ghost img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body.is-dragging {
  cursor: grabbing;
}

.destination.correct {
  animation: correct-pulse .55s ease;
  box-shadow: 0 0 0 4px var(--mint), var(--shadow);
}

.destination.incorrect {
  animation: shake .45s ease;
  box-shadow: 0 0 0 4px var(--danger), var(--shadow);
}

@keyframes correct-pulse {
  50% { transform: scale(1.015); }
}

@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.feedback {
  position: fixed;
  z-index: 150;
  left: 50%;
  bottom: 28px;
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 10px;
  min-width: min(360px, calc(100% - 36px));
  padding: 15px 20px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(30, 39, 77, .2);
  transform: translateX(-50%);
  animation: feedback-in .25s ease both;
}

.feedback > span {
  grid-row: 1 / 3;
  align-self: center;
  font-size: 24px;
}

.feedback strong {
  font-size: 15px;
}

.feedback small {
  color: var(--muted);
}

.feedback.is-correct {
  border-color: rgba(55, 185, 155, .35);
}

.feedback.is-wrong {
  border-color: rgba(221, 90, 111, .35);
}

@keyframes feedback-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
}

/* Dialogs */

dialog {
  color: var(--ink);
  background: white;
  border: 0;
  box-shadow: 0 30px 100px rgba(20, 26, 48, .3);
}

dialog::backdrop {
  background: rgba(23, 28, 51, .55);
  backdrop-filter: blur(7px);
}

.result-dialog {
  width: min(520px, calc(100% - 32px));
  padding: 40px;
  overflow: hidden;
  border-radius: 28px;
  text-align: center;
}

.result-dialog h2 {
  margin: 0;
  font-size: 34px;
}

.result-dialog > p:not(.eyebrow) {
  margin: 16px auto;
  color: var(--muted);
}

.score-ring {
  display: grid;
  width: 150px;
  height: 150px;
  margin: 24px auto 12px;
  place-items: center;
  background: conic-gradient(var(--primary) var(--score-deg, 0deg), var(--primary-soft) 0);
  border-radius: 50%;
}

.score-ring::before {
  position: absolute;
  width: 118px;
  height: 118px;
  content: "";
  background: white;
  border-radius: 50%;
}

.score-ring div {
  position: relative;
  z-index: 2;
  display: grid;
}

.score-ring strong {
  font-size: 44px;
  line-height: .95;
}

.score-ring small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 20px 0 26px;
}

.result-stats span {
  display: grid;
  gap: 3px;
  padding: 13px;
  color: var(--muted);
  font-size: 12px;
  background: var(--surface-soft);
  border-radius: 13px;
}

.result-stats b {
  color: var(--ink);
  font-size: 22px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.result-dialog .dialog-actions {
  justify-content: center;
}

.result-confetti i {
  position: absolute;
  width: 8px;
  height: 20px;
  top: 20px;
  background: var(--primary);
  border-radius: 4px;
  transform: rotate(20deg);
}

.result-confetti i:nth-child(1) { left: 12%; background: var(--amber); transform: rotate(-28deg); }
.result-confetti i:nth-child(2) { left: 28%; top: 45px; background: var(--mint); transform: rotate(37deg); }
.result-confetti i:nth-child(3) { right: 27%; top: 34px; background: var(--sky); transform: rotate(-43deg); }
.result-confetti i:nth-child(4) { right: 12%; background: var(--danger); transform: rotate(26deg); }
.result-confetti i:nth-child(5) { left: 50%; top: 13px; height: 12px; background: #9f83e5; transform: rotate(80deg); }

.manager-dialog {
  width: min(680px, calc(100% - 32px));
  max-height: min(850px, calc(100vh - 32px));
  padding: 0;
  overflow: auto;
  border-radius: 26px;
}

.manager-dialog form {
  padding: 30px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 28px;
}

.close-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  background: var(--surface-soft);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.form-intro {
  margin: 12px 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.field {
  display: grid;
  gap: 7px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field > span {
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  height: 47px;
  padding: 0 13px;
  color: var(--ink);
  background: white;
  border: 1px solid #dfe1e9;
  border-radius: 11px;
}

.upload-field {
  position: relative;
  display: grid;
  min-height: 130px;
  place-items: center;
  align-content: center;
  gap: 3px;
  overflow: hidden;
  padding: 18px;
  text-align: center;
  background: var(--surface-soft);
  border: 1px dashed #c9ccda;
  border-radius: 15px;
  cursor: pointer;
}

.upload-field input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.upload-field small {
  color: var(--muted);
  font-size: 11px;
}

.upload-icon {
  color: var(--primary);
  font-size: 24px;
  font-weight: 800;
}

.upload-field img {
  width: 90px;
  height: 90px;
  object-fit: contain;
}

.form-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  color: #a6374a;
  font-size: 13px;
  background: var(--danger-soft);
  border-radius: 10px;
}

.custom-items-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

/* Audio set manager */

.audio-dialog-content {
  padding: 30px;
}

.voice-settings {
  display: grid;
  grid-template-columns: .65fr 1.35fr;
  gap: 14px;
  padding: 16px;
  background: var(--surface-soft);
  border-radius: 16px;
}

.audio-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.audio-summary strong {
  color: var(--primary);
  font-size: 17px;
}

.audio-task-list {
  display: grid;
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.audio-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 67px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
}

.audio-row:last-child {
  border-bottom: 0;
}

.audio-row-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.audio-row-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-row-copy small {
  color: var(--muted);
  font-size: 10px;
}

.audio-row.has-audio .audio-row-copy small {
  color: #27846e;
}

.audio-row-actions {
  display: flex;
  gap: 6px;
}

.audio-action {
  position: relative;
  display: grid;
  min-width: 36px;
  height: 36px;
  place-items: center;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.audio-action:hover {
  color: var(--primary);
  border-color: rgba(92, 85, 217, .35);
}

.audio-action input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.audio-action.delete-audio {
  color: var(--danger);
}

.custom-item-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  background: var(--surface-soft);
  border-radius: 12px;
}

.custom-item-row img {
  width: 42px;
  height: 42px;
  padding: 3px;
  object-fit: contain;
  background: white;
  border-radius: 9px;
}

.custom-item-row span {
  display: grid;
  font-size: 12px;
}

.custom-item-row span small {
  color: var(--muted);
}

.delete-item {
  padding: 7px 9px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
  background: white;
  border: 1px solid #ead9dd;
  border-radius: 8px;
  cursor: pointer;
}

@media (max-width: 1080px) {
  .home-hero {
    grid-template-columns: 1fr .75fr;
  }

  .visual-card {
    width: 165px;
    height: 165px;
  }

  .visual-card-sky {
    right: 22px;
  }

  .visual-card-water {
    right: 110px;
  }

  .visual-card-garage {
    display: none;
  }

  .mode-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(290px, .8fr);
  }

  .object-tray {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 820px) {
  main {
    width: min(100% - 28px, 700px);
  }

  .home-hero {
    grid-template-columns: 1fr;
    background: white;
  }

  .hero-copy {
    padding: 48px 36px 30px;
  }

  .hero-visual {
    min-height: 300px;
    background: var(--primary-soft);
  }

  .visual-card-sky { top: 24px; right: 13%; }
  .visual-card-water { right: auto; bottom: 20px; left: 14%; }
  .visual-card-garage { display: grid; right: 8%; bottom: 7px; }
  .listen-badge { top: 25px; left: 10%; }

  .mode-layout {
    grid-template-columns: 1fr;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .destinations {
    gap: 10px;
  }

  .destination {
    min-height: 180px;
  }

  .object-tray {
    grid-template-columns: repeat(3, 1fr);
  }

  .game-topbar {
    align-items: flex-start;
  }

  .keyboard-hint {
    display: none;
  }
}

@media (max-width: 600px) {
  .site-header {
    min-height: 66px;
    padding: 10px 16px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .sound-label {
    display: none;
  }

  .icon-button {
    min-width: 42px;
    justify-content: center;
  }

  .header-home {
    padding-inline: 11px;
    font-size: 12px;
  }

  main {
    width: min(100% - 20px, 520px);
  }

  .home-screen {
    padding-top: 16px;
  }

  .home-hero {
    min-height: 0;
    border-radius: 24px;
  }

  .hero-copy {
    padding: 34px 22px 26px;
  }

  .hero-copy h1 {
    font-size: clamp(37px, 12vw, 50px);
  }

  .hero-intro {
    font-size: 15px;
  }

  .hero-visual {
    min-height: 245px;
  }

  .visual-card {
    width: 135px;
    height: 135px;
    border-radius: 28px;
  }

  .visual-card-sky { right: 7%; }
  .visual-card-water { left: 8%; }
  .visual-card-garage { width: 105px; height: 105px; right: 5%; }
  .listen-badge { left: 6%; }

  .mode-layout {
    margin-top: 44px;
  }

  .section-heading h2,
  .how-it-works h2,
  .practice-panel h2 {
    font-size: 26px;
  }

  .level-card {
    grid-template-columns: auto 1fr;
    gap: 13px;
    min-height: 0;
    padding: 17px;
  }

  .level-number {
    width: 44px;
    height: 44px;
  }

  .level-arrow {
    display: none;
  }

  .instruction-example {
    display: none;
  }

  .practice-panel {
    padding: 27px 22px;
  }

  .game-screen {
    padding-top: 22px;
  }

  .game-topbar {
    display: grid;
  }

  .game-meta {
    width: 100%;
  }

  .meta-pill {
    flex: 1;
  }

  .game-meta .button {
    flex: 1.4;
  }

  .instruction-panel {
    grid-template-columns: auto 1fr;
    padding: 17px;
  }

  .replay-button {
    grid-column: 1 / -1;
  }

  .destinations {
    grid-template-columns: 1fr;
  }

  .destination {
    min-height: 136px;
  }

  .destination img {
    object-position: center 48%;
  }

  .object-tray {
    grid-template-columns: repeat(2, 1fr);
    padding: 11px;
    gap: 9px;
  }

  .object-card {
    min-height: 128px;
  }

  .object-card img {
    height: 103px;
  }

  .tray-heading {
    align-items: flex-start;
  }

  .selection-hint {
    max-width: 120px;
    text-align: right;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .voice-settings {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }

  .manager-dialog form,
  .result-dialog {
    padding: 24px;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .audio-dialog-content {
    padding: 22px;
  }

  .audio-row {
    grid-template-columns: 1fr;
  }

  .audio-row-actions {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Full-screen, game-like test surface */

body.game-active {
  background:
    radial-gradient(circle at 8% 8%, rgba(92, 85, 217, .11), transparent 24rem),
    radial-gradient(circle at 92% 95%, rgba(55, 185, 155, .11), transparent 24rem),
    #f7f8fd;
}

body.game-active .site-header {
  position: fixed;
  top: 10px;
  right: 12px;
  left: auto;
  z-index: 90;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  backdrop-filter: none;
}

body.game-active .brand {
  display: none;
}

body.game-active .header-actions {
  gap: 7px;
}

body.game-active .header-actions .icon-button,
body.game-active .header-actions .button {
  min-height: 42px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 6px 20px rgba(30, 39, 77, .09);
  backdrop-filter: blur(12px);
}

body.game-active main {
  width: 100%;
  max-width: none;
}

body.game-active .game-screen {
  display: grid;
  grid-template-areas:
    "topbar"
    "progress"
    "instruction"
    "destinations"
    "objects";
  grid-template-rows: 48px 5px 72px minmax(190px, 1.1fr) minmax(220px, .9fr);
  gap: 10px;
  width: 100%;
  height: 100dvh;
  min-height: 620px;
  padding: 12px clamp(12px, 2vw, 24px) 14px;
}

body.game-active.practice-active .game-screen {
  grid-template-areas:
    "topbar"
    "hint"
    "destinations"
    "objects";
  grid-template-rows: 48px auto minmax(190px, .8fr) minmax(220px, 1.2fr);
}

/*
 * Attribute-driven fallback for free practice. This deliberately does not
 * depend on the body.practice-active helper class, so cached/older script
 * state can never squeeze the hint into the progress row and the destinations
 * into the instruction row.
 */
body.game-active .game-screen:has(#practiceHint:not([hidden])) {
  grid-template-areas:
    "topbar"
    "hint"
    "destinations"
    "objects";
  grid-template-rows: 48px auto minmax(190px, .8fr) minmax(220px, 1.2fr);
}

body.game-active .game-topbar {
  grid-area: topbar;
  min-width: 0;
  min-height: 48px;
  padding-right: 224px;
}

.game-round {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.game-round-icon {
  display: grid;
  flex: 0 0 38px;
  height: 38px;
  place-items: center;
  color: white;
  font-size: 17px;
  background: linear-gradient(145deg, var(--primary), #817bec);
  border-radius: 13px;
  box-shadow: 0 7px 18px rgba(92, 85, 217, .22);
}

body.game-active .game-topbar h1 {
  overflow: hidden;
  font-size: clamp(16px, 2vw, 21px);
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.game-active .game-meta {
  gap: 7px;
}

body.game-active .meta-pill {
  display: flex;
  min-width: 64px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 11px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 6px 18px rgba(30, 39, 77, .06);
}

body.game-active .meta-pill span {
  font-size: 9px;
}

body.game-active .meta-pill strong {
  margin: 0;
}

body.game-active .progress-track {
  grid-area: progress;
  height: 5px;
  margin: 0;
}

body.game-active .instruction-panel {
  grid-area: instruction;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  height: 72px;
  padding: 10px 12px;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(30, 39, 77, .07);
}

body.game-active .instruction-icon {
  width: 42px;
  height: 42px;
  font-size: 14px;
  border-radius: 14px;
}

body.game-active .instruction-copy small {
  display: none;
}

body.game-active .instruction-copy p {
  overflow: hidden;
  margin: 0;
  font-size: clamp(18px, 2.5vw, 27px);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.game-active .replay-button {
  min-height: 42px;
  padding: 8px 13px;
  border-radius: 13px;
}

body.game-active .practice-hint {
  grid-area: hint;
  margin: 0;
  padding: 12px 15px;
}

body.game-active .destinations-section,
body.game-active .objects-section {
  display: grid;
  min-height: 0;
  margin: 0;
}

body.game-active .destinations-section {
  grid-area: destinations;
}

body.game-active .objects-section {
  grid-area: objects;
}

body.game-active .tray-heading {
  display: none;
}

body.game-active .destinations {
  min-height: 0;
  gap: clamp(8px, 1.5vw, 16px);
}

body.game-active .destination {
  min-height: 0;
  height: 100%;
  padding: 0;
  border-width: 3px;
  border-radius: clamp(18px, 2.5vw, 28px);
  box-shadow: 0 10px 28px rgba(30, 39, 77, .12);
}

body.game-active .destination > img {
  object-position: center;
  transform: scale(1.015);
  transition: transform .55s ease;
}

body.game-active .destination:hover > img,
body.game-active .destination.drop-ready > img {
  transform: scale(1.055);
}

body.game-active .destination-overlay {
  background: linear-gradient(0deg, rgba(20, 26, 48, .18), transparent 48%);
}

body.game-active .destination > strong,
body.game-active .destination > small {
  display: none;
}

body.game-active .placed-items {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-content: flex-end;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  padding: 10px;
  pointer-events: none;
}

body.game-active .destination-water .placed-items {
  align-content: center;
  padding-top: 24%;
}

body.game-active .destination-sky .placed-items {
  align-content: flex-start;
  padding-top: 5%;
}

body.game-active .placed-items img {
  position: relative;
  inset: auto;
  width: clamp(50px, 20%, 88px);
  height: clamp(50px, 36%, 86px);
  margin: -3px;
  padding: 0;
  object-fit: contain;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 7px 5px rgba(15, 20, 42, .22));
}

body.game-active .placed-items img.just-placed {
  animation: item-arrive .72s cubic-bezier(.2, .9, .26, 1.25) both;
}

body.game-active .object-tray {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  gap: clamp(6px, 1vw, 10px);
  padding: clamp(8px, 1.2vw, 12px);
  border-radius: 22px;
}

body.game-active .object-card {
  min-height: 0;
  height: 100%;
  padding: 5px;
  border-radius: 16px;
}

body.game-active .object-card img {
  width: 100%;
  height: 100%;
  min-height: 54px;
  object-fit: contain;
}

body.game-active .object-card small {
  display: none;
}

body.game-active .destination.correct {
  animation: game-win-pulse .7s cubic-bezier(.2, .8, .2, 1);
  border-color: #6ed7b8;
  box-shadow:
    0 0 0 5px rgba(55, 185, 155, .18),
    0 18px 38px rgba(31, 128, 104, .2);
}

body.game-active .destination.correct::before,
body.game-active .destination.correct::after {
  position: absolute;
  z-index: 6;
  top: 18%;
  color: #fff4a8;
  font-size: clamp(22px, 4vw, 42px);
  line-height: 1;
  text-shadow: 0 3px 12px rgba(66, 58, 20, .28);
  content: "✦";
  pointer-events: none;
  animation: sparkle-pop .75s ease-out both;
}

body.game-active .destination.correct::before {
  left: 13%;
}

body.game-active .destination.correct::after {
  right: 12%;
  top: 33%;
  animation-delay: .08s;
}

body.game-active .destination.try-again {
  border-color: rgba(92, 85, 217, .34);
  box-shadow: 0 0 0 5px rgba(92, 85, 217, .08), var(--shadow-sm);
  animation: gentle-return .42s ease;
}

body.game-active .feedback {
  bottom: 20px;
  min-width: min(330px, calc(100% - 30px));
  border-radius: 18px;
}

body.game-active .feedback > span {
  color: var(--primary);
}

body.game-active .feedback.is-correct {
  border-color: rgba(55, 185, 155, .38);
  background: rgba(244, 255, 251, .97);
}

body.game-active .feedback.is-neutral {
  border-color: rgba(92, 85, 217, .18);
  background: rgba(249, 248, 255, .97);
}

@keyframes item-arrive {
  0% { opacity: 0; transform: translateY(-30px) scale(.55) rotate(-7deg); }
  65% { opacity: 1; transform: translateY(3px) scale(1.12) rotate(2deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

@keyframes game-win-pulse {
  35% { transform: scale(1.025); }
  70% { transform: scale(.995); }
}

@keyframes sparkle-pop {
  0% { opacity: 0; transform: scale(.2) rotate(-25deg); }
  45% { opacity: 1; transform: scale(1.25) rotate(12deg); }
  100% { opacity: 0; transform: translateY(-24px) scale(.8) rotate(35deg); }
}

@keyframes gentle-return {
  45% { transform: scale(.985); }
}

@media (min-height: 620px) {
  body.game-active {
    overflow: hidden;
  }
}

@media (max-width: 820px) {
  body.game-active .game-screen {
    grid-template-rows: 48px 5px 70px minmax(205px, .9fr) minmax(300px, 1.1fr);
    min-height: 720px;
  }

  body.game-active.practice-active .game-screen {
    grid-template-areas:
      "topbar"
      "hint"
      "destinations"
      "objects";
    grid-template-rows: 48px auto minmax(205px, .75fr) minmax(300px, 1.25fr);
  }

  body.game-active .game-screen:has(#practiceHint:not([hidden])) {
    grid-template-areas:
      "topbar"
      "hint"
      "destinations"
      "objects";
    grid-template-rows: 48px auto minmax(205px, .75fr) minmax(300px, 1.25fr);
  }

  body.game-active .game-topbar {
    display: flex;
    align-items: center;
    padding-right: 190px;
  }

  body.game-active .game-meta {
    width: auto;
  }

  body.game-active .meta-pill {
    flex: none;
  }

  body.game-active .object-tray {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  body.game-active {
    overflow: auto;
  }

  body.game-active .site-header {
    top: 8px;
    right: 8px;
  }

  body.game-active .header-actions .icon-button,
  body.game-active .header-actions .button {
    min-height: 40px;
  }

  body.game-active .game-screen {
    grid-template-rows: 44px 5px 64px 155px minmax(360px, 1fr);
    gap: 8px;
    height: auto;
    min-height: 100dvh;
    padding: 8px;
  }

  body.game-active.practice-active .game-screen {
    grid-template-areas:
      "topbar"
      "hint"
      "destinations"
      "objects";
    grid-template-rows: 44px auto 155px minmax(360px, 1fr);
  }

  body.game-active .game-screen:has(#practiceHint:not([hidden])) {
    grid-template-areas:
      "topbar"
      "hint"
      "destinations"
      "objects";
    grid-template-rows: 44px auto 155px minmax(360px, 1fr);
  }

  body.game-active .game-topbar {
    display: flex;
    min-height: 44px;
    padding-right: 170px;
  }

  body.game-active .game-round-icon,
  body.game-active .game-meta {
    display: none;
  }

  body.game-active .game-topbar h1 {
    font-size: 14px;
  }

  body.game-active .instruction-panel {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 8px;
    height: 64px;
    padding: 8px;
  }

  body.game-active .instruction-icon {
    width: 38px;
    height: 38px;
  }

  body.game-active .instruction-copy p {
    font-size: 15px;
    white-space: normal;
  }

  body.game-active .replay-button {
    grid-column: auto;
    min-width: 40px;
    padding: 7px 9px;
    font-size: 0;
  }

  body.game-active .replay-button span {
    font-size: 16px;
  }

  body.game-active .destinations {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  body.game-active .destination {
    min-height: 0;
    border-radius: 16px;
  }

  body.game-active .object-tray {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 7px;
    gap: 6px;
  }

  body.game-active .object-card {
    min-height: 78px;
    border-radius: 13px;
  }

  body.game-active .placed-items {
    padding: 5px;
  }

  body.game-active .placed-items img {
    width: 29%;
    height: 46%;
  }
}

/* Keep the complete practice board usable on very wide but short screens. */
@media (min-width: 821px) and (max-height: 650px) {
  body.game-active .game-screen {
    height: 100dvh;
    min-height: 0;
  }

  body.game-active.practice-active .game-screen,
  body.game-active .game-screen:has(#practiceHint:not([hidden])) {
    grid-template-areas:
      "topbar"
      "hint"
      "destinations"
      "objects";
    grid-template-rows: 48px auto minmax(150px, .85fr) minmax(170px, 1.15fr);
  }
}
