:root {
  --sky: #9adcf6;
  --sky-deep: #5bb7e6;
  --leaf: #2f9e6d;
  --leaf-dark: #187353;
  --sun: #ffd45a;
  --coral: #ff7766;
  --berry: #d94b71;
  --ink: #263143;
  --cream: #fff6d6;
  --paper: #fffdf4;
  --shadow: rgba(38, 49, 67, 0.18);
  --focus: #174ea6;
  font-family:
    Nunito, "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.95), transparent 20rem),
    linear-gradient(180deg, #dff7ff 0%, #fff6d6 70%, #f6d47f 100%);
  color: var(--ink);
  overflow-x: hidden;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 4px;
}

.game-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(12px, 2vw, 24px);
  position: relative;
}

.playfield {
  width: min(1120px, 100%);
  min-height: min(760px, calc(100vh - 32px));
  position: relative;
  overflow: hidden;
  border: 8px solid #fff;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0) 0 64%, rgba(255, 248, 206, 0.9) 64% 100%),
    linear-gradient(180deg, var(--sky) 0%, #c9f1ff 63%, #77c672 64%, #48a85d 100%);
  box-shadow: 0 22px 70px var(--shadow);
}

.sky {
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.cloud {
  position: absolute;
  width: 150px;
  height: 54px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow:
    42px -18px 0 2px rgba(255, 255, 255, 0.84),
    82px 4px 0 -2px rgba(255, 255, 255, 0.8);
}

.cloud-a {
  left: 8%;
  top: 12%;
  animation: drift 16s ease-in-out infinite alternate;
}

.cloud-b {
  right: 16%;
  top: 20%;
  transform: scale(0.78);
  animation: drift 18s ease-in-out infinite alternate-reverse;
}

.kite {
  position: absolute;
  right: 12%;
  top: 10%;
  width: 42px;
  height: 42px;
  rotate: 45deg;
  background:
    linear-gradient(135deg, var(--coral) 0 50%, transparent 50%),
    linear-gradient(315deg, #62c5ff 0 50%, transparent 50%);
  border: 3px solid white;
  border-radius: 4px;
  box-shadow: 0 8px 18px rgba(38, 49, 67, 0.14);
  animation: bob 4s ease-in-out infinite;
}

.hud {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
}

.hud-pill,
.icon-button,
.voice-button,
.listen-button,
.primary-button,
.secondary-button {
  box-shadow: 0 8px 0 rgba(38, 49, 67, 0.16);
}

.hud-pill {
  min-width: 90px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(255, 253, 244, 0.92);
  font-size: 1.4rem;
  font-weight: 900;
}

.streak-pill {
  min-width: 92px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  background: rgba(255, 253, 244, 0.86);
  color: #526071;
  box-shadow: 0 8px 0 rgba(38, 49, 67, 0.12);
  font-size: 0.98rem;
  font-weight: 900;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.streak-icon {
  color: #ff9f43;
  font-size: 1.25rem;
  text-shadow: 0 2px 0 white;
}

.streak-pill.hot {
  border-color: #ffd45a;
  background: #fff6c9;
  color: #a56116;
  transform: translateY(-2px) scale(1.04);
}

.streak-pill.super-hot {
  border-color: #ff9579;
  background: #ffe3df;
  color: #a83c4b;
  animation: streakGlow 900ms ease-in-out infinite alternate;
}

.hud-icon {
  color: #f8b900;
  text-shadow: 0 2px 0 white;
}

.icon-button {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 253, 244, 0.92);
  font-size: 1.45rem;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.voice-button {
  height: 54px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 0 8px;
  border-radius: 999px;
  background: rgba(255, 253, 244, 0.92);
  font-size: 1rem;
  font-weight: 900;
}

.voice-badge {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #ff9579, var(--coral));
  color: white;
  text-shadow: 0 1px 0 rgba(38, 49, 67, 0.2);
}

.icon-button:last-child {
  margin-left: auto;
}

.icon-button:active,
.voice-button:active,
.listen-button:active,
.primary-button:active,
.secondary-button:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 rgba(38, 49, 67, 0.16);
}

.prompt-panel {
  width: min(860px, calc(100% - 36px));
  margin: 12px auto 22px;
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(12px, 2vw, 22px);
  padding: clamp(14px, 2.4vw, 24px);
  border: 5px solid #fff;
  border-radius: 26px;
  background: rgba(255, 253, 244, 0.88);
  box-shadow: 0 14px 30px rgba(38, 49, 67, 0.16);
  backdrop-filter: blur(8px);
}

.sunny {
  width: clamp(76px, 12vw, 122px);
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
}

.sun-rays {
  position: absolute;
  inset: 5%;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--sun) 0deg 12deg,
    transparent 12deg 28deg,
    var(--sun) 28deg 42deg,
    transparent 42deg 60deg
  );
  animation: slowSpin 18s linear infinite;
}

.sun-face {
  width: 72%;
  aspect-ratio: 1;
  position: relative;
  z-index: 1;
  border: 4px solid #fff;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff4a8 0 20%, var(--sun) 52%, #f7a93b 100%);
  box-shadow: inset 0 -8px 0 rgba(201, 112, 30, 0.16);
}

.eye {
  position: absolute;
  top: 35%;
  width: 10%;
  height: 13%;
  border-radius: 50%;
  background: var(--ink);
}

.left-eye {
  left: 30%;
}

.right-eye {
  right: 30%;
}

.smile {
  position: absolute;
  left: 32%;
  top: 55%;
  width: 36%;
  height: 18%;
  border-bottom: 5px solid var(--ink);
  border-radius: 0 0 999px 999px;
}

.speech {
  min-width: 0;
}

.micro-label {
  margin: 0 0 4px;
  color: var(--leaf-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(2rem, 6vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.speech p:last-child {
  margin: 0;
  color: #526071;
  font-size: clamp(0.95rem, 2vw, 1.12rem);
}

.listen-button {
  min-width: 130px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ff9579, var(--coral));
  color: white;
  font-size: 1.18rem;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(38, 49, 67, 0.2);
}

.cards {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2.2vw, 24px);
}

.word-card {
  min-height: clamp(210px, 31vw, 290px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0;
  padding: clamp(12px, 2vw, 22px);
  border: 5px solid white;
  border-radius: 24px;
  background: var(--card-color, var(--paper));
  box-shadow:
    0 10px 0 rgba(38, 49, 67, 0.16),
    0 18px 28px rgba(38, 49, 67, 0.1);
  transform-origin: 50% 100%;
  transition:
    transform 180ms ease,
    filter 180ms ease,
    box-shadow 180ms ease;
}

.word-card:hover {
  transform: translateY(-4px) rotate(var(--tilt, 0deg));
}

.word-card:active {
  transform: translateY(4px) scale(0.98);
  box-shadow:
    0 6px 0 rgba(38, 49, 67, 0.16),
    0 12px 18px rgba(38, 49, 67, 0.1);
}

.word-card.correct {
  animation: celebrate 760ms ease both;
}

.word-card.wrong {
  animation: shake 360ms ease both;
}

.picture {
  width: min(188px, 44vw);
  height: min(188px, 44vw);
  display: grid;
  place-items: center;
}

.picture svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 8px 4px rgba(38, 49, 67, 0.12));
}

.picture img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 8px 4px rgba(38, 49, 67, 0.12));
}

.word-label {
  display: none;
}

.garden-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: clamp(116px, 19vh, 176px);
  pointer-events: none;
  z-index: 2;
}

.soil {
  position: absolute;
  left: -3%;
  right: -3%;
  bottom: -34px;
  height: 104px;
  border-radius: 50% 50% 0 0;
  background:
    radial-gradient(circle at 18% 30%, rgba(255, 255, 255, 0.18) 0 8px, transparent 9px),
    radial-gradient(circle at 66% 40%, rgba(255, 255, 255, 0.14) 0 6px, transparent 7px),
    #8c5b33;
}

.flower-bed {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 48px;
  min-height: 88px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: clamp(10px, 2vw, 26px);
}

.flower {
  width: 48px;
  height: 76px;
  position: relative;
  transform-origin: 50% 100%;
  animation: grow 460ms cubic-bezier(0.19, 1, 0.22, 1) both;
}

.flower::before {
  content: "";
  position: absolute;
  left: 23px;
  top: 28px;
  width: 6px;
  height: 46px;
  border-radius: 999px;
  background: var(--leaf-dark);
}

.flower::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  width: 42px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 17%, transparent 18%),
    radial-gradient(circle at 50% 18%, var(--bloom, var(--coral)) 0 20%, transparent 21%),
    radial-gradient(circle at 78% 50%, var(--bloom, var(--coral)) 0 20%, transparent 21%),
    radial-gradient(circle at 50% 80%, var(--bloom, var(--coral)) 0 20%, transparent 21%),
    radial-gradient(circle at 22% 50%, var(--bloom, var(--coral)) 0 20%, transparent 21%);
}

.round-card {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 7;
  translate: -50% 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 10px 16px 12px;
  border-radius: 999px;
  background: rgba(255, 253, 244, 0.9);
  box-shadow: 0 10px 28px rgba(38, 49, 67, 0.14);
}

.round-card .micro-label {
  margin: 0;
  color: #526071;
  font-size: 0.68rem;
}

.round-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 16px;
  height: 16px;
  border: 3px solid #d3e4dd;
  border-radius: 50%;
  background: white;
}

.dot.done {
  border-color: #fff;
  background: var(--sun);
  box-shadow: 0 0 0 3px rgba(255, 212, 90, 0.24);
}

.modal {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 0;
  background: transparent;
}

.modal#parentModal {
  width: min(940px, calc(100% - 32px));
}

.modal::backdrop {
  background: rgba(38, 49, 67, 0.38);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  padding: 28px;
  border: 6px solid white;
  border-radius: 28px;
  background: var(--paper);
  text-align: center;
  box-shadow: 0 24px 80px rgba(38, 49, 67, 0.24);
}

.modal-card h2 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 8vw, 3.1rem);
  line-height: 1;
}

.modal-card p {
  color: #526071;
  font-size: 1.05rem;
}

.reward-summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  margin: 8px auto 18px;
  padding: 8px 18px;
  border: 3px solid #ffd45a;
  border-radius: 999px;
  background: #fff6c9;
  color: #85571d;
  box-shadow: 0 6px 0 rgba(255, 212, 90, 0.2);
}

.reward-summary-icon {
  color: #f8b900;
  font-size: 1.5rem;
  text-shadow: 0 2px 0 white;
}

.modal-sun {
  width: 88px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: -6px auto 8px;
  border-radius: 50%;
  background: #fff2a0;
  font-size: 3.2rem;
}

.primary-button,
.secondary-button {
  min-height: 54px;
  padding: 0 24px;
  border-radius: 16px;
  font-weight: 900;
}

.primary-button {
  background: linear-gradient(180deg, #67cc91, var(--leaf));
  color: white;
}

.secondary-button {
  background: #ffe3df;
  color: #973d4c;
}

.ghost-button {
  background: #edf6f8;
  color: #376275;
}

.parent-card {
  text-align: left;
  max-height: min(88vh, 920px);
  overflow: auto;
}

.parent-card h2 {
  font-size: 2rem;
}

.parent-card::-webkit-scrollbar {
  width: 10px;
}

.parent-card::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(38, 49, 67, 0.16);
}

.library-panel {
  margin: 18px 0 16px;
  padding-top: 16px;
  border-top: 2px dashed #dbe5dd;
}

.library-manager {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px dashed #dbe5dd;
}

.lesson-panel {
  margin: 18px 0 16px;
  padding: 16px 0 2px;
  border-top: 2px dashed #dbe5dd;
}

.lesson-status {
  margin: 0 0 12px;
  color: #526071;
  font-size: 0.96rem;
  font-weight: 700;
}

.lesson-preset-panel {
  margin: 0 0 14px;
  padding: 14px;
  border: 2px solid #d8e9dd;
  border-radius: 8px;
  background: #f6fbf6;
}

.lesson-preset-heading h4 {
  margin: 0 0 3px;
  color: #187353;
  font-size: 1rem;
}

.lesson-preset-heading p {
  margin: 0;
  color: #66768d;
  font-size: 0.88rem;
  line-height: 1.4;
}

.lesson-preset-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.lesson-preset-create input {
  min-height: 44px;
  padding-block: 10px;
}

.lesson-preset-create .secondary-button {
  min-height: 44px;
  padding: 0 16px;
}

.lesson-preset-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.lesson-preset-empty {
  margin: 0;
  color: #66768d;
  font-size: 0.86rem;
  line-height: 1.45;
}

.lesson-preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid #dce9df;
  border-radius: 8px;
  background: #fffdf4;
}

.lesson-preset-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.lesson-preset-copy strong {
  color: var(--ink);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.lesson-preset-copy span {
  color: #66768d;
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.lesson-preset-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lesson-preset-start {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  background: #e8f7ed;
  color: #187353;
  font-size: 0.82rem;
  font-weight: 900;
}

.lesson-preset-delete {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #ffe3df;
  color: #973d4c;
  font-size: 1.25rem;
  font-weight: 900;
}

.lesson-actions {
  margin-bottom: 12px;
}

.lesson-category-hint {
  margin: 0 0 10px;
  color: #66768d;
  font-size: 0.9rem;
  line-height: 1.45;
}

.lesson-search-row {
  margin: 0 0 12px;
}

.lesson-search-row .field-label {
  margin: 0 0 7px;
}

.lesson-search-control {
  position: relative;
  display: flex;
  align-items: center;
}

.lesson-search-control input {
  width: 100%;
  min-height: 46px;
  padding: 10px 44px 10px 42px;
  border: 2px solid #d8e9dd;
  border-radius: 8px;
  background: #fbfffb;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.lesson-search-control input:focus {
  outline: 3px solid rgba(103, 204, 145, 0.25);
  border-color: #67cc91;
}

.lesson-search-icon {
  position: absolute;
  left: 14px;
  z-index: 1;
  color: #187353;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.lesson-search-clear {
  position: absolute;
  right: 6px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #e8f7ed;
  color: #187353;
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1;
}

.lesson-search-meta,
.audio-status {
  margin: 7px 0 0;
  color: #66768d;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
}

.audio-status {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-left: 3px solid #67cc91;
  background: #f4fbf6;
  color: #296546;
}

.audio-status.warning {
  border-left-color: #f4c56a;
  background: #fff8e1;
  color: #8b6a16;
}

.lesson-category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.lesson-category-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  max-width: 100%;
  padding: 9px 14px;
  border: 2px solid #dfe8de;
  border-radius: 999px;
  background: #fffdf4;
  color: #526071;
  box-shadow: 0 4px 0 rgba(38, 49, 67, 0.06);
  text-align: left;
}

.lesson-category-chip.active {
  border-color: #67cc91;
  background: #effaf3;
  color: #187353;
}

.lesson-category-chip.partial {
  border-color: #f4c56a;
  background: #fff8e1;
  color: #8b6a16;
}

.lesson-category-chip.empty {
  border-color: #d9e1da;
  background: #f5f8f4;
  color: #91a09b;
}

.lesson-category-name {
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.lesson-category-count {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(38, 49, 67, 0.08);
  font-size: 0.72rem;
  font-weight: 900;
}

.lesson-category-chip.active .lesson-category-count {
  background: rgba(23, 115, 83, 0.12);
}

.lesson-category-chip.partial .lesson-category-count {
  background: rgba(139, 106, 22, 0.12);
}

.lesson-category-chip.empty .lesson-category-count {
  background: rgba(145, 160, 155, 0.16);
}

.lesson-category-empty {
  padding: 10px 0 4px;
  color: #66768d;
  font-size: 0.9rem;
  font-weight: 700;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  max-height: 280px;
  padding-right: 4px;
  overflow: auto;
}

.lesson-search-empty {
  grid-column: 1 / -1;
  padding: 18px 6px;
  color: #66768d;
  font-size: 0.94rem;
  font-weight: 700;
  text-align: center;
}

.lesson-chip {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px 12px;
  border: 3px solid #dfe8de;
  border-radius: 16px;
  background: #fffdf4;
  text-align: left;
  box-shadow: 0 6px 0 rgba(38, 49, 67, 0.08);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.lesson-chip:hover {
  transform: translateY(-2px);
}

.lesson-chip.selected {
  border-color: #67cc91;
  background: #effaf3;
}

.lesson-chip.active {
  border-color: var(--coral);
  background: #fff0ec;
}

.lesson-chip.selected.active {
  border-color: #2f9e6d;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(239, 250, 243, 0.98));
}

.lesson-chip-word {
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.1;
}

.lesson-chip-meta {
  color: #526071;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.section-head h3 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.section-head p {
  margin: 0 0 10px;
  color: #526071;
  font-size: 0.96rem;
}

.field-label {
  display: block;
  margin: 12px 0 8px;
  color: #526071;
  font-size: 0.92rem;
  font-weight: 800;
}

.field-hint {
  margin: 8px 0 2px;
  color: #66768d;
  font-size: 0.88rem;
  line-height: 1.45;
}

.field-hint code {
  padding: 2px 6px;
  border-radius: 999px;
  background: #edf6f8;
  color: #2a3c4f;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 12px;
}

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

.category-create-row input {
  flex: 1 1 220px;
  min-width: 0;
}

.category-create-row button {
  flex: 0 0 auto;
}

.category-tab {
  min-height: 38px;
  max-width: 100%;
  padding: 9px 12px;
  border: 2px solid #dfe8de;
  border-radius: 999px;
  background: #fffdf4;
  color: #526071;
  font-size: 0.88rem;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(38, 49, 67, 0.06);
  overflow-wrap: anywhere;
}

.category-tab.active {
  border-color: #67cc91;
  background: #effaf3;
  color: #187353;
}

#importCustomCategoryInput,
#newCustomCategoryInput {
  margin-top: 8px;
}

.library-summary {
  margin: 0 0 12px;
  color: #526071;
  font-size: 0.92rem;
  font-weight: 700;
}

.library-search-row {
  margin: 8px 0 12px;
}

.library-search-row .field-label {
  margin-top: 0;
}

.library-search-row .lesson-search-control {
  max-width: 460px;
}

.library-search-row .lesson-search-meta {
  margin-bottom: 0;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.library-word {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 3px solid #dfe8de;
  border-radius: 18px;
  background: #fffdf4;
  box-shadow: 0 6px 0 rgba(38, 49, 67, 0.08);
}

.library-word-editor {
  display: grid;
  gap: 6px;
}

.library-word-editor-label {
  color: #66768d;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.library-word-category-select {
  min-width: 0;
  min-height: 42px;
  padding-block: 10px;
}

.library-word-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.library-word-picture {
  flex: none;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 16px;
  background: #edf8ff;
}

.library-word-picture img,
.library-word-picture svg {
  width: 100%;
  height: 100%;
}

.library-word-picture img {
  object-fit: cover;
}

.library-word-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.library-word-name {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.1;
  word-break: break-word;
}

.library-word-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.library-tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf6f8;
  color: #526071;
  font-size: 0.72rem;
  font-weight: 900;
}

.library-tag.custom {
  background: #eaf8ef;
  color: #187353;
}

.library-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}

.replace-image-button,
.restore-image-button {
  min-height: 34px;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 0 rgba(45, 84, 79, 0.12);
}

.replace-image-button {
  border: 2px solid #9fd8be;
  background: #effbf3;
  color: #176842;
}

.replace-image-button:hover,
.replace-image-button:focus-visible {
  border-color: #4da979;
  background: #ddf6e6;
}

.restore-image-button {
  border: 2px solid #d8e2ed;
  background: #f6f9fc;
  color: #53657a;
}

.restore-image-button:hover,
.restore-image-button:focus-visible {
  border-color: #9db1c8;
  background: #ebf1f7;
}

.replace-image-input {
  display: none;
}

.delete-word-button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #ffe3df;
  color: #973d4c;
  font-size: 1.35rem;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(151, 61, 76, 0.12);
}

.library-empty {
  padding: 20px 14px;
  border: 2px dashed #dbe5dd;
  border-radius: 18px;
  background: #f7fbf5;
  color: #66768d;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
}

textarea,
input,
select {
  width: 100%;
  border: 3px solid #dfe8de;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font: inherit;
  padding: 12px 14px;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.button-row > * {
  flex: 1 1 150px;
}

.draft-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  margin-top: 16px;
}

.draft-fields {
  min-width: 0;
}

.preview-card {
  display: grid;
  align-content: start;
  gap: 8px;
}

.preview-frame {
  position: relative;
  min-height: 220px;
  border: 4px solid #fff;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(242, 248, 237, 0.95)),
    #edf8ff;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.preview-frame img,
.preview-empty {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.preview-frame img {
  object-fit: cover;
}

.preview-empty {
  display: grid;
  place-items: center;
  color: #89a0aa;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.preview-frame img[hidden] + .preview-empty {
  display: grid;
}

.preview-frame img:not([hidden]) + .preview-empty {
  display: none;
}

.import-status {
  margin: 12px 0 0;
  color: #526071;
  font-size: 0.95rem;
}

.close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #edf6f8;
  font-size: 1.6rem;
  font-weight: 900;
}

dl {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 2px dashed #e4ebdd;
}

.transfer-panel {
  margin: 18px 0 16px;
  padding: 16px 0 2px;
  border-top: 2px dashed #dbe5dd;
}

.transfer-panel .section-head {
  margin-bottom: 12px;
}

.transfer-panel .section-head p {
  margin-bottom: 0;
}

.transfer-actions {
  margin: 0;
}

.transfer-actions > * {
  flex: 1 1 180px;
}

dt {
  color: #526071;
  font-weight: 800;
}

dd {
  margin: 0;
  font-weight: 900;
}

.star-pop {
  position: absolute;
  z-index: 8;
  color: var(--sun);
  font-size: clamp(1.7rem, 5vw, 3.2rem);
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 4px 0 white;
  animation: starPop 820ms ease forwards;
}

.toast {
  position: absolute;
  left: 50%;
  top: 47%;
  z-index: 9;
  translate: -50% -50%;
  padding: 12px 20px;
  border: 4px solid white;
  border-radius: 999px;
  background: rgba(255, 253, 244, 0.96);
  color: var(--leaf-dark);
  font-size: clamp(1.2rem, 4vw, 2rem);
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(38, 49, 67, 0.18);
  animation: toastRise 900ms ease forwards;
}

@keyframes drift {
  from {
    translate: -10px 0;
  }
  to {
    translate: 18px 4px;
  }
}

@keyframes bob {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 16px;
  }
}

@keyframes slowSpin {
  to {
    rotate: 360deg;
  }
}

@keyframes celebrate {
  0% {
    transform: translateY(0) scale(1);
  }
  40% {
    transform: translateY(-18px) scale(1.08) rotate(-2deg);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px) rotate(-1deg);
  }
  50% {
    transform: translateX(8px) rotate(1deg);
  }
  75% {
    transform: translateX(-5px);
  }
}

@keyframes grow {
  from {
    transform: scaleY(0.1);
    opacity: 0;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

@keyframes starPop {
  0% {
    opacity: 0;
    transform: translate(-50%, 20px) scale(0.4) rotate(-20deg);
  }
  55% {
    opacity: 1;
    transform: translate(-50%, -70px) scale(1.15) rotate(16deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -112px) scale(0.8) rotate(24deg);
  }
}

@keyframes streakGlow {
  from {
    box-shadow: 0 8px 0 rgba(38, 49, 67, 0.12), 0 0 0 rgba(255, 119, 102, 0);
  }
  to {
    box-shadow: 0 8px 0 rgba(38, 49, 67, 0.12), 0 0 22px rgba(255, 119, 102, 0.42);
  }
}

@keyframes toastRise {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.94);
  }
  18%,
  70% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-18px) scale(0.96);
  }
}

@media (max-width: 760px) {
  .game-shell {
    padding: 8px;
  }

  .playfield {
    min-height: calc(100vh - 16px);
    border-width: 5px;
    border-radius: 22px;
  }

  .hud {
    padding: 12px;
  }

  .voice-button {
    max-width: 76px;
    padding-right: 10px;
  }

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

  .lesson-grid {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    max-height: 240px;
  }

  .lesson-preset-create {
    grid-template-columns: 1fr;
  }

  .lesson-preset-item {
    align-items: flex-start;
  }

  .library-grid {
    grid-template-columns: 1fr;
    max-height: 260px;
  }

  .preview-frame {
    min-height: 180px;
  }

  #voiceLabel {
    display: none;
  }

  .prompt-panel {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "sun speech"
      "button button";
    width: calc(100% - 22px);
    margin-top: 2px;
    gap: 10px;
    padding: 14px;
  }

  .sunny {
    grid-area: sun;
  }

  .speech {
    grid-area: speech;
  }

  .listen-button {
    grid-area: button;
    width: 100%;
    height: 56px;
  }

  .cards {
    grid-template-columns: 1fr;
    width: calc(100% - 22px);
    gap: 10px;
  }

  .word-card {
    min-height: 154px;
    grid-template-columns: 1fr;
    justify-items: center;
    align-content: center;
  }

  .picture {
    width: 124px;
    height: 124px;
  }

  .garden-strip {
    height: 88px;
  }

  .flower-bed {
    bottom: 34px;
  }

  .flower {
    scale: 0.78;
  }
}

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