:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #21404f;
  background: #e8f6ff;
  font-size: 18px;
  --page-top: #dff2ff;
  --page-mid: #f2fbff;
  --page-bottom: #fff5de;
  --panel: #fffdf9;
  --panel-border: #ddd8c8;
  --text-muted: #5d6d79;
  --purple: #6d42cf;
  --purple-dark: #5830b1;
  --green: #4c8f63;
  --green-soft: #b7dd9f;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, var(--page-top) 0%, var(--page-mid) 56%, var(--page-bottom) 100%);
}

button { font: inherit; }

.scene {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.sun-glow {
  position: absolute;
  top: -80px;
  right: -40px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 242, 170, 0.78) 0%, rgba(255, 242, 170, 0.45) 36%, rgba(255, 242, 170, 0.08) 67%, rgba(255, 242, 170, 0) 72%);
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  filter: blur(0.2px);
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: inherit;
}

.cloud-one {
  width: 120px;
  height: 34px;
  top: 92px;
  left: 11%;
}
.cloud-one::before {
  width: 40px;
  height: 40px;
  left: 14px;
  top: -17px;
}
.cloud-one::after {
  width: 58px;
  height: 48px;
  right: 14px;
  top: -22px;
}

.cloud-two {
  width: 145px;
  height: 38px;
  top: 150px;
  right: 18%;
}
.cloud-two::before {
  width: 52px;
  height: 48px;
  left: 16px;
  top: -20px;
}
.cloud-two::after {
  width: 64px;
  height: 54px;
  right: 18px;
  top: -25px;
}

.hill {
  position: absolute;
  left: -8%;
  right: -8%;
  border-radius: 50% 50% 0 0;
}

.hill-back {
  height: 240px;
  bottom: -120px;
  background: linear-gradient(180deg, #9fd18a 0%, #79b66e 100%);
}

.hill-front {
  height: 190px;
  bottom: -102px;
  background: linear-gradient(180deg, #8bc36a 0%, #64a953 100%);
}

.flower {
  position: absolute;
  bottom: 46px;
}

.flower .stem {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 8px;
  height: 112px;
  border-radius: 999px;
  background: linear-gradient(180deg, #5caa59 0%, #3b8f49 100%);
  transform: translateX(-50%);
}

.flower .leaf {
  position: absolute;
  bottom: 32px;
  width: 34px;
  height: 18px;
  background: #69b85d;
  border-radius: 100% 0 100% 0;
}

.flower .leaf-left {
  left: 50%;
  transform: translateX(-100%) rotate(-28deg);
}

.flower .leaf-right {
  left: 50%;
  transform: translateX(0%) rotate(152deg);
}

.flower-daisy {
  width: 110px;
  height: 176px;
}

.flower-daisy .petal {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 24px;
  height: 42px;
  margin-left: -12px;
  border-radius: 20px;
  background: #ffd7f0;
  transform-origin: center 52px;
}

.flower-daisy .p1 { transform: rotate(0deg) translateY(-10px); }
.flower-daisy .p2 { transform: rotate(72deg) translateY(-10px); }
.flower-daisy .p3 { transform: rotate(144deg) translateY(-10px); }
.flower-daisy .p4 { transform: rotate(216deg) translateY(-10px); }
.flower-daisy .p5 { transform: rotate(288deg) translateY(-10px); }

.flower-daisy .center {
  position: absolute;
  left: 50%;
  top: 22px;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  border-radius: 50%;
  background: #f5c84f;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.08);
}

.flower-tulip {
  width: 100px;
  height: 182px;
}

.flower-tulip .bloom {
  position: absolute;
  top: 8px;
  width: 30px;
  height: 44px;
  background: #ff94ab;
}

.flower-tulip .bloom-left {
  left: 22px;
  border-radius: 50% 50% 16px 18px;
  transform: rotate(-18deg);
}

.flower-tulip .bloom-center {
  left: 35px;
  width: 32px;
  border-radius: 50% 50% 12px 12px;
}

.flower-tulip .bloom-right {
  left: 48px;
  border-radius: 50% 50% 18px 16px;
  transform: rotate(18deg);
}

.flower-left {
  left: 32px;
}

.flower-right {
  right: 42px;
}

.flower-right-two {
  right: 128px;
  bottom: 42px;
}

.flower.small {
  transform: scale(0.82);
  transform-origin: bottom center;
}

.game {
  position: relative;
  z-index: 2;
  width: min(100% - 24px, 900px);
  margin: 24px auto 104px;
  padding: 24px;
  background: rgba(255, 252, 245, 0.80);
  border: 2px solid rgba(231, 223, 205, 0.95);
  border-radius: 30px;
  box-shadow: 0 18px 40px rgba(76, 96, 110, 0.12);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  font-weight: 800;
  letter-spacing: .16em;
  color: #668296;
  font-size: .8rem;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 2rem; }

.quiet-button {
  min-height: 48px;
  padding: 10px 16px;
  border: 2px solid #d6d0c2;
  border-radius: 12px;
  background: #fffcf5;
  color: #4b5a68;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(173, 165, 150, 0.45);
}

.words-panel,
.play-panel,
.help-panel {
  background: var(--panel);
  border: 2px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: 0 8px 16px rgba(97, 112, 122, 0.06);
}

.words-panel {
  padding: 20px;
  margin-bottom: 18px;
}

.words-panel h2 {
  margin-bottom: 14px;
  font-size: 1.3rem;
}

.word-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px 18px;
}

.word-slot {
  display: flex;
  justify-content: center;
  gap: 5px;
  min-height: 42px;
}

.word-slot .cell {
  width: 26px;
  height: 38px;
  border-bottom: 4px solid #9a9489;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.2rem;
  text-transform: uppercase;
}

.word-slot.solved .cell {
  color: #166534;
  border-bottom-color: #65a30d;
}

.word-slot.hinted .cell.revealed {
  color: #9a3412;
}

.play-panel {
  padding: 22px;
  text-align: center;
}

.current-word {
  min-height: 50px;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: .12em;
  color: var(--purple);
}

.wheel {
  position: relative;
  width: min(76vw, 360px);
  aspect-ratio: 1;
  margin: 8px auto 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #fff9f2 0%, #efe8da 80%);
  border: 4px solid #d9d1c4;
  touch-action: none;
  user-select: none;
  box-shadow: inset 0 0 0 8px rgba(255,255,255,0.35), 0 6px 14px rgba(122, 116, 106, 0.18);
}

.trace {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.trace polyline {
  fill: none;
  stroke: #8b5cf6;
  stroke-width: 18;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .42;
}

.letter {
  position: absolute;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 3px solid #ada496;
  background: white;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 900;
  cursor: pointer;
  transform: translate(-50%, -50%);
  box-shadow: 0 3px 0 #c7c0b4, 0 8px 12px rgba(121, 117, 106, 0.14);
}

.letter.selected {
  background: #f1ecff;
  border-color: #7c3aed;
  color: #5b21b6;
}

.message {
  min-height: 30px;
  margin: 8px 0 14px;
  font-weight: 650;
  color: #4b5563;
}

.actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.action-button,
.next-button {
  min-width: 150px;
  min-height: 58px;
  padding: 12px 20px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(180deg, var(--purple) 0%, var(--purple-dark) 100%);
  color: white;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(71, 43, 136, 0.28);
}

.action-button:focus-visible,
.next-button:focus-visible,
.quiet-button:focus-visible,
.letter:focus-visible {
  outline: 4px solid #2563eb;
  outline-offset: 3px;
}

.help-panel {
  margin-top: 18px;
  padding: 16px 18px;
  line-height: 1.5;
  color: var(--text-muted);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .55);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 50;
}

.overlay[hidden] { display: none; }

.dialog {
  width: min(100%, 440px);
  background: #fffdf8;
  border-radius: 22px;
  padding: 30px;
  text-align: center;
  border: 3px solid #ded7ca;
  box-shadow: 0 18px 34px rgba(37, 54, 65, 0.18);
}

.dialog h2 { font-size: 2rem; margin-bottom: 8px; }
.dialog p { font-size: 1.15rem; margin-bottom: 22px; }

@media (max-width: 700px) {
  .sun-glow { width: 260px; height: 260px; }
  .flower-left { left: 10px; }
  .flower-right { right: 12px; }
  .flower-right-two { right: 86px; }
}

@media (max-width: 520px) {
  :root { font-size: 16px; }
  .game {
    width: min(100% - 12px, 900px);
    padding: 12px;
    margin: 12px auto 96px;
  }
  .topbar { align-items: flex-start; }
  .letter { width: 68px; height: 68px; font-size: 1.7rem; }
  .wheel { width: min(92vw, 340px); }
  .word-list { grid-template-columns: repeat(2, 1fr); }
  .word-slot .cell { width: 22px; }
  .cloud-one,
  .cloud-two,
  .flower-right-two { display: none; }
  .hill-back { height: 180px; bottom: -100px; }
  .hill-front { height: 145px; bottom: -82px; }
  .flower { bottom: 24px; }
  .flower-daisy,
  .flower-tulip { transform: scale(0.82); transform-origin: bottom center; }
  .flower.small { display: none; }
}
