/* ==========================================================
   Hành Trình Của Mầm — watercolor storybook UI
   ========================================================== */
:root {
  --paper: #FFF6E6;
  --paper-2: #FCEBD2;
  --ink: #3C3550;
  --ink-soft: #6E6585;
  --line: #E8D9BF;
  --sage: #7DBB86;
  --sage-d: #5A9965;
  --peach: #F5AE87;
  --peach-d: #DB8A62;
  --pink: #F2A2B8;
  --pink-d: #D57A95;
  --sky: #8FC9E6;
  --sky-d: #5FA7CB;
  --lav: #B6A6E2;
  --lav-d: #8E7CC6;
  --sun: #F8D46E;
  --sun-d: #DDB143;
  --ice: #9ED8D8;
  --ice-d: #6BB7B8;
  --coral: #F39C86;
  --coral-d: #D27460;
  --white: #FFFDF8;
  --shadow: 0 10px 30px rgba(80, 60, 40, .16);
  --radius: 22px;
  --font-title: "Baloo 2", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
input, textarea { user-select: text; -webkit-user-select: text; font-family: inherit; }
button { font-family: inherit; color: inherit; }
h1, h2, h3, .title-font { font-family: var(--font-title); line-height: 1.1; margin: 0; }

#app { position: fixed; inset: 0; overflow: hidden; }

/* paper grain overlay */
#app::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 50;
  opacity: .22; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .55  0 0 0 0 .45  0 0 0 0 .35  0 0 0 .35 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------------- screens ---------------- */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  animation: screenIn .45s ease both;
}
.screen.leaving { animation: screenOut .3s ease both; pointer-events: none; }
@keyframes screenIn { from { opacity: 0; transform: scale(1.02); } to { opacity: 1; transform: none; } }
@keyframes screenOut { to { opacity: 0; transform: scale(.98); } }

.bg {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
}
.bg::after { /* watercolor edge vignette */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(120, 90, 60, .14) 100%);
}
.screen > .content { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; min-height: 0; }

.scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.scroll::-webkit-scrollbar { width: 0; height: 0; }

/* ---------------- buttons ---------------- */
.btn {
  --c: #4F9A5C; --cd: #3B7A47;
  appearance: none; border: 0; cursor: pointer;
  font-family: var(--font-title); font-weight: 700; font-size: 20px; letter-spacing: .2px;
  color: #fff; background: var(--c);
  padding: 12px 26px 10px; border-radius: 18px;
  box-shadow: 0 5px 0 var(--cd), 0 8px 18px rgba(60, 40, 20, .15);
  transform: translateY(0); transition: transform .08s, box-shadow .08s, filter .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.btn:hover { filter: brightness(1.05); }
.btn:active, .btn.pressed { transform: translateY(4px); box-shadow: 0 1px 0 var(--cd), 0 3px 8px rgba(60, 40, 20, .15); }
.btn:focus-visible, .chip:focus-visible, .icon-btn:focus-visible, .node:focus-visible { outline: 3px solid var(--sky-d); outline-offset: 3px; }
.btn[disabled] { filter: grayscale(.7) opacity(.6); cursor: default; }
.btn.big { font-size: 24px; padding: 16px 36px 14px; min-height: 64px; border-radius: 22px; }
.btn.small { font-size: 16px; padding: 8px 16px 6px; min-height: 40px; border-radius: 14px; box-shadow: 0 4px 0 var(--cd); }
.btn.ghost { --c: var(--white); --cd: var(--line); color: var(--ink); text-shadow: none; }
.btn.peach { --c: #D27A4F; --cd: #A95C36; }
.btn.pink { --c: #CC5F80; --cd: #A3445F; }
.btn.sky { --c: #3E8DB8; --cd: #2C6C8E; }
.btn.lav { --c: #7B66BF; --cd: #5B4897; }
.btn.sun { --c: var(--sun); --cd: var(--sun-d); color: var(--ink); text-shadow: none; }
.btn.coral { --c: #C9583F; --cd: #A0412C; }
.btn.ice { --c: #33918F; --cd: #246F6D; }

.icon-btn {
  appearance: none; border: 0; cursor: pointer;
  width: 48px; height: 48px; border-radius: 16px;
  background: var(--white); box-shadow: 0 4px 0 var(--line), 0 6px 14px rgba(60,40,20,.12);
  font-size: 24px; display: inline-grid; place-items: center;
  transition: transform .08s, box-shadow .08s;
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }

.chip {
  appearance: none; border: 2px solid var(--line); cursor: pointer;
  background: var(--white); color: var(--ink);
  border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: transform .1s, background .2s, border-color .2s;
}
.chip:active { transform: scale(.96); }
.chip.on { background: var(--sage); border-color: var(--sage-d); color: #fff; }
.chip.tag { cursor: default; padding: 4px 12px; font-size: 14px; border-width: 0; background: rgba(255,255,255,.75); }

/* ---------------- cards & panels ---------------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  position: relative;
}
.card.paper {
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(circle at 90% 90%, rgba(245, 206, 160, .25), transparent 55%),
    var(--white);
}
.topbar {
  position: relative; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-top)) 14px 10px;
}
.topbar .grow { flex: 1; min-width: 0; }
.topbar h2 { font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,253,248,.92); border-radius: 999px; padding: 6px 12px;
  font-weight: 800; font-size: 16px; box-shadow: 0 3px 0 var(--line);
}

/* ---------------- mascot ---------------- */
.mascot { display: block; width: 140px; height: auto; filter: drop-shadow(0 8px 10px rgba(60,40,20,.18)); }
.mascot.bob { animation: bob 3.2s ease-in-out infinite; }
.mascot.fill { width: 100%; }
.mascot.mini { width: 74px; }
svg .spin { animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-1.5deg); } }
.speech {
  position: relative; background: var(--white); border-radius: 20px; padding: 14px 18px;
  box-shadow: var(--shadow); font-weight: 700; font-size: 18px; max-width: 420px;
}
.speech::after {
  content: ""; position: absolute; left: -10px; bottom: 18px;
  border: 10px solid transparent; border-right-color: var(--white); border-left: 0;
}
.speech.up::after { left: 30px; bottom: auto; top: -10px; border: 10px solid transparent; border-bottom-color: var(--white); border-top: 0; }
.guide { display: flex; align-items: flex-end; gap: 12px; }

/* ---------------- title screen ---------------- */
.title-screen .bg {
  background-image: url(../assets/img/title.jpg),
    radial-gradient(circle at 30% 20%, #FFE9C2 0, transparent 50%),
    radial-gradient(circle at 80% 70%, #CDE8F2 0, transparent 55%),
    linear-gradient(180deg, #FDE6CF 0%, #F6D9E4 50%, #D5ECF2 100%);
}
/* Sized against the viewport HEIGHT too, so the start button always fits on
   short landscape screens (tablets, phones sideways). Scrolls as a last resort. */
.title-wrap {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  gap: clamp(8px, 2.2vh, 18px); padding: 8px 20px calc(16px + var(--safe-bottom)); text-align: center;
}
.title-wrap > * { flex-shrink: 0; }
.logo {
  font-family: var(--font-title); font-weight: 800; color: var(--ink);
  font-size: clamp(32px, min(9vw, 8.5vh), 78px); line-height: .95;
  text-shadow: 0 3px 0 #fff, 0 6px 18px rgba(255,255,255,.8);
}
.logo small { display: block; font-size: max(.38em, 15px); font-weight: 700; color: var(--ink-soft); margin-top: .25em; letter-spacing: .5px; }
.title-mascot { width: auto; height: clamp(90px, 26vh, 260px); max-width: 50vw; }
.title-wrap .speech { font-size: clamp(15px, 2.3vh, 18px); padding: 10px 16px; }
@media (max-height: 520px) {
  .title-wrap .credit { display: none; }
  .title-wrap .btn.big { min-height: 52px; padding: 10px 28px 8px; font-size: 20px; }
}
@media (max-height: 440px) {
  .title-wrap .title-mascot { display: none; }
  .title-wrap .speech.up::after { display: none; }
}
.credit { font-size: 13px; color: var(--ink-soft); max-width: 480px; background: rgba(255,253,248,.7); padding: 6px 12px; border-radius: 12px; }

/* ---------------- profiles ---------------- */
.profiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.profile-card {
  appearance: none; border: 3px solid transparent; cursor: pointer;
  background: var(--white); border-radius: 20px; padding: 14px 8px 12px;
  box-shadow: 0 5px 0 var(--line); text-align: center; position: relative;
  transition: transform .12s, border-color .2s;
}
.profile-card:active { transform: scale(.97); }
.profile-card.on { border-color: var(--sage); background: #F0F8EE; }
.profile-card.on::after { content: "✓"; position: absolute; top: 6px; right: 10px; color: var(--sage-d); font-weight: 900; font-size: 20px; }
.profile-card .ava { font-size: 52px; line-height: 1.1; }
.profile-card .nm { font-weight: 800; font-size: 17px; margin-top: 4px; word-break: break-word; }
.profile-card.add { border: 3px dashed var(--line); background: transparent; box-shadow: none; color: var(--ink-soft); }
.avatar {
  display: inline-grid; place-items: center; border-radius: 50%;
  width: 40px; height: 40px; font-size: 24px; background: var(--white);
  border: 3px solid var(--c, var(--sage)); flex: 0 0 auto;
}
.avatar.sm { width: 32px; height: 32px; font-size: 18px; border-width: 2px; }
.avatar.lg { width: 64px; height: 64px; font-size: 38px; }
.avatar-row { display: flex; }
.avatar-row .avatar + .avatar { margin-left: -10px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.emoji-grid button { font-size: 30px; padding: 6px; border-radius: 14px; border: 2px solid transparent; background: var(--paper); cursor: pointer; }
.emoji-grid button.on { border-color: var(--sage); background: #EAF6E8; }
.color-row { display: flex; gap: 10px; flex-wrap: wrap; }
.color-row button { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); cursor: pointer; }
.color-row button.on { box-shadow: 0 0 0 3px var(--ink); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 800; font-size: 15px; color: var(--ink-soft); }
.input {
  border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 18px;
  background: var(--white); color: var(--ink); outline: none; width: 100%;
}
.input:focus { border-color: var(--sky-d); }

/* ---------------- map ---------------- */
.map-screen .bg {
  background-image: url(../assets/img/map_ocean.jpg),
    radial-gradient(ellipse at 20% 10%, rgba(255,255,255,.6), transparent 40%),
    radial-gradient(ellipse at 80% 60%, rgba(255,255,255,.45), transparent 45%),
    linear-gradient(180deg, #CDEAF3 0%, #B5DDEA 30%, #A9D6E2 60%, #F6D6C8 100%);
  background-size: cover; background-attachment: local;
}
.map-scroll { flex: 1; position: relative; }
.map-inner { position: relative; max-width: 560px; margin: 0 auto; padding: 10px 16px 140px; }
.island-sec { position: relative; padding: 20px 0 10px; }
.island-head { display: flex; align-items: center; gap: 12px; position: relative; z-index: 2; }
.island-art { width: 46%; max-width: 240px; aspect-ratio: 1 / .82; position: relative; flex: 0 0 auto; }
.island-art img, .island-art svg { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 10px 12px rgba(40,70,90,.25)); }
.island-art.locked { filter: grayscale(.8) brightness(1.05); opacity: .7; }
.island-info { flex: 1; min-width: 0; }
.island-info .num { font-family: var(--font-title); font-weight: 700; font-size: 14px; color: var(--ink-soft); letter-spacing: 1px; text-transform: uppercase; }
.island-info h3 { font-size: 26px; }
.island-info .skill { display: inline-block; margin: 6px 0 8px; font-weight: 800; font-size: 14px; color: #fff; padding: 2px 12px; border-radius: 999px; background: var(--c); }
.island-sec.right .island-head { flex-direction: row-reverse; text-align: right; }

.path { position: relative; height: 230px; }
.path svg.trail { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.node {
  position: absolute; transform: translate(-50%, -50%);
  width: 92px; height: 92px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--c, var(--sage)); color: #fff; outline: 5px solid rgba(255,253,248,.95); outline-offset: -1px;
  box-shadow: 0 8px 0 var(--cd, var(--sage-d)), 0 12px 20px rgba(40, 60, 80, .25);
  display: grid; place-items: center; font-size: 40px;
  transition: transform .1s;
}
.node::before { /* glossy watercolor highlight */
  content: ""; position: absolute; inset: 8px 14px auto; height: 30%; border-radius: 50%;
  background: rgba(255,255,255,.35);
}
.node:active { transform: translate(-50%, -46%); box-shadow: 0 3px 0 var(--cd, var(--sage-d)); }
.node.locked { background: #D9D2C6; box-shadow: 0 8px 0 #B9B0A2, 0 12px 20px rgba(40, 60, 80, .2); cursor: default; font-size: 30px; }
.node.next { animation: nodePulse 1.8s ease-in-out infinite; }
@keyframes nodePulse { 50% { transform: translate(-50%, -50%) scale(1.08); } }
.node .stars { position: absolute; bottom: -30px; color: var(--ink); left: 50%; transform: translateX(-50%); font-size: 16px; white-space: nowrap; }
.node-label {
  position: absolute; transform: translate(-50%, 0); left: 50%; top: calc(100% + 12px); white-space: nowrap;
  font-weight: 800; font-size: 15px; background: rgba(255,253,248,.95); padding: 3px 10px; border-radius: 10px; color: var(--ink);
  font-family: var(--font-body); line-height: 1.3;
  box-shadow: 0 3px 0 var(--line); pointer-events: none;
}
.start-bubble {
  position: absolute; transform: translate(-50%, -100%); top: -14px; left: 50%;
  background: var(--white); color: var(--ink); font-weight: 900; font-size: 15px; letter-spacing: .5px;
  padding: 6px 12px; border-radius: 12px; box-shadow: 0 3px 0 var(--line);
  animation: bob 1.6s ease-in-out infinite; white-space: nowrap; pointer-events: none;
}
.start-bubble::after { content: ""; position: absolute; bottom: -8px; left: 50%; margin-left: -8px; border: 8px solid transparent; border-top-color: var(--white); border-bottom: 0; }

.map-bottom {
  position: absolute; z-index: 6; left: 0; right: 0; bottom: 0;
  padding: 10px 16px calc(14px + var(--safe-bottom));
  display: flex; justify-content: center; gap: 12px;
  background: linear-gradient(0deg, rgba(255,246,230,.95) 40%, transparent);
}

/* ---------------- garden ---------------- */
.garden-screen .bg {
  background-image: url(../assets/img/garden.jpg),
    radial-gradient(ellipse at 50% 0%, #FFF3D6 0, transparent 60%),
    linear-gradient(180deg, #DDF0F5 0%, #EAF4DA 45%, #CFE5B4 70%, #B9D79A 100%);
}
.garden-body { flex: 1; position: relative; padding: 0 14px calc(18px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 12px; }
.garden-top { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; }
.jar-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex: 1; min-width: 240px; }
.jar { width: 64px; height: 84px; flex: 0 0 auto; }
.lantern-line { position: relative; height: 96px; margin: 0 -14px; overflow: hidden; }
.lantern-line svg.rope { position: absolute; left: 0; top: 0; width: 100%; height: 60px; }
.lantern {
  position: absolute; top: 18px; transform-origin: top center; cursor: pointer;
  animation: sway 4s ease-in-out infinite; border: 0; background: none; padding: 0;
}
.lantern .lt {
  width: 34px; height: 44px; border-radius: 12px 12px 14px 14px;
  background: radial-gradient(circle at 50% 40%, #FFF5C7, var(--lc, var(--sun)) 70%);
  box-shadow: 0 0 18px rgba(255, 210, 120, .7); position: relative; margin-top: 8px;
}
.lantern .lt::before { content: ""; position: absolute; top: -8px; left: 50%; width: 2px; height: 8px; background: #8B7355; }
@keyframes sway { 50% { transform: rotate(4deg); } }
.plots { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 28vw), 1fr)); gap: 6px 14px; align-content: end; min-height: 0; overflow-y: auto; padding-top: 8px; width: 100%; max-width: 960px; margin: 0 auto; }
.plot {
  appearance: none; border: 0; background: none; cursor: pointer; position: relative;
  aspect-ratio: 1 / 1.15; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
}
.plot .soil { width: 86%; height: 22%; border-radius: 50%; background: radial-gradient(ellipse at 50% 35%, #9C7457, #7A563E); box-shadow: inset 0 -4px 0 rgba(0,0,0,.12); }
.plot.empty .soil { background: radial-gradient(ellipse at 50% 35%, #C9A88A, #A88566); opacity: .65; }
.plot .plant { position: absolute; bottom: 10%; width: 100%; height: 100%; }
.plot .plant svg { width: 100%; height: 100%; overflow: visible; }
.plot.grow-anim .plant { animation: sprout .9s cubic-bezier(.3,1.6,.5,1) both; transform-origin: bottom center; }
@keyframes sprout { from { transform: scale(0); } to { transform: scale(1); } }
.seed-bag { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------- game shell ---------------- */
.shell { background: var(--paper); }
.shell .bg { opacity: 1; }
.shell .bg::before { content: ""; position: absolute; inset: 0; background: rgba(255, 250, 240, .28); }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; z-index: 1; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.stage .layer { position: absolute; inset: 0; }
.center-col { display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 16px; text-align: center; padding: 20px; overflow-y: auto; }
.center-col > * { flex-shrink: 0; }

.intro-card { width: min(560px, calc(100% - 32px)); margin: auto; text-align: left; animation: popIn .5s cubic-bezier(.3,1.5,.5,1) both; }
@keyframes popIn { from { opacity: 0; transform: scale(.85) translateY(20px); } to { opacity: 1; transform: none; } }
.intro-card .icon-big { font-size: 64px; line-height: 1; position: absolute; top: -34px; right: 20px; filter: drop-shadow(0 6px 6px rgba(0,0,0,.15)); }
.intro-card h2 { font-size: 34px; margin-bottom: 6px; padding-right: 64px; }
.intro-card .tagline { font-size: 18px; font-weight: 700; color: var(--ink-soft); margin: 6px 0 12px; font-style: italic; }
.intro-card .how { list-style: none; padding: 0; margin: 12px 0 16px; display: flex; flex-direction: column; gap: 8px; }
.intro-card .how li { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; }
.intro-card .how li .ic { font-size: 22px; width: 30px; text-align: center; flex: 0 0 auto; }
.sticky-actions {
  position: sticky; bottom: -22px; z-index: 3;
  margin: 8px -22px -22px; padding: 18px 16px 16px;
  border-radius: 0 0 var(--radius) var(--radius);
  background: linear-gradient(rgba(255,253,248,0), var(--white) 32%);
}
@media (max-height: 760px) and (min-aspect-ratio: 1/1) {
  .intro-guide { display: none !important; }
  .intro-card { margin-top: 34px; }
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

.hint-bar {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 10;
  background: rgba(255,253,248,.94); border-radius: 16px; padding: 8px 16px; font-weight: 800; font-size: 17px;
  box-shadow: 0 4px 0 var(--line); text-align: center; max-width: calc(100% - 24px); pointer-events: none;
  transition: opacity .3s;
}
.hint-bar:empty { opacity: 0; }

/* breath circle */
.breath {
  position: relative; width: 200px; height: 200px; display: grid; place-items: center;
}
.breath .ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.9) 0, rgba(143, 201, 230, .55) 55%, rgba(143, 201, 230, .15) 72%, transparent 73%);
  transform: scale(.55); transition: transform linear;
}
.breath .ring.halo { background: radial-gradient(circle, transparent 60%, rgba(182,166,226,.35) 70%, transparent 73%); }
.breath .lbl { position: relative; font-family: var(--font-title); font-weight: 700; font-size: 24px; }

.reflect-card { width: min(600px, calc(100% - 32px)); margin: auto; animation: popIn .45s cubic-bezier(.3,1.5,.5,1) both; }
.reflect-card .q { font-family: var(--font-title); font-size: 26px; font-weight: 700; margin-bottom: 14px; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.opt {
  appearance: none; border: 3px solid var(--line); background: var(--white); border-radius: 18px; cursor: pointer;
  padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; font-size: 15px;
  transition: transform .1s, border-color .2s, background .2s; position: relative;
}
.opt .e { font-size: 38px; line-height: 1.1; }
.opt:active { transform: scale(.96); }
.opt.on { border-color: var(--sage); background: #EFF8EC; }
.opt .who { position: absolute; top: -10px; right: -6px; display: flex; }
.whose-turn { display: flex; align-items: center; gap: 8px; font-weight: 800; margin-bottom: 10px; color: var(--ink-soft); }
.reminder { margin-top: 16px; padding: 12px 16px; border-radius: 16px; background: #FFF3DA; font-weight: 700; font-size: 16px; border-left: 6px solid var(--sun); }
.reminder b { font-family: var(--font-title); }

.reward { text-align: center; }
.reward .seed-big { font-size: 96px; animation: seedDrop 1s cubic-bezier(.3,1.6,.5,1) both; display: inline-block; }
@keyframes seedDrop { from { transform: translateY(-120px) scale(.3) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- modal / toast ---------------- */
#modal-root { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.modal-back {
  position: absolute; inset: 0; background: rgba(60, 50, 70, .38); pointer-events: auto;
  display: grid; place-items: center; padding: 16px; animation: fadeIn .2s ease both;
  backdrop-filter: blur(2px);
}
.modal { width: min(560px, 100%); max-height: calc(100% - 20px); overflow-y: auto; animation: popIn .35s cubic-bezier(.3,1.5,.5,1) both; }
.modal h3 { font-size: 26px; margin-bottom: 10px; padding-right: 40px; }
.modal .close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; font-size: 20px; }
.modal p { margin: 8px 0; }
.modal ul { padding-left: 20px; }
.modal li { margin: 6px 0; }
@keyframes fadeIn { from { opacity: 0; } }
#toast-root { position: fixed; left: 0; right: 0; top: calc(16px + var(--safe-top)); z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 14px; font-weight: 800; box-shadow: var(--shadow); animation: toastIn .35s cubic-bezier(.3,1.5,.5,1) both; max-width: calc(100% - 32px); text-align: center; }
.toast.out { animation: fadeOut .3s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px) scale(.9); } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-weight: 700; }
.switch { appearance: none; width: 56px; height: 32px; border-radius: 999px; background: #DDD3C2; position: relative; cursor: pointer; transition: background .2s; flex: 0 0 auto; border: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.switch.on { background: var(--sage); }
.switch.on::after { left: 27px; }

/* ---------------- fx ---------------- */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.particle { position: absolute; will-change: transform, opacity; font-size: 22px; }
.pop-word {
  position: absolute; font-family: var(--font-title); font-weight: 800; font-size: 28px; color: var(--sage-d);
  text-shadow: 0 2px 0 #fff, 0 0 12px #fff; pointer-events: none; white-space: nowrap;
  animation: popWord 1.2s ease-out both; transform: translate(-50%, -50%);
}
@keyframes popWord { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -140%) scale(1); } }

/* generic game bits */
.big-q { font-family: var(--font-title); font-weight: 700; font-size: clamp(22px, 4.5vw, 32px); text-align: center; text-shadow: 0 2px 0 rgba(255,255,255,.8); }
.sub { color: var(--ink-soft); font-weight: 700; text-align: center; }
.meter { height: 16px; border-radius: 999px; background: rgba(0,0,0,.08); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--c, var(--sage)); border-radius: inherit; transition: width .5s cubic-bezier(.3,1.3,.5,1); }
.bottom-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 8; padding: 12px 16px calc(14px + var(--safe-bottom)); display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.kbd { display: inline-block; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 8px; padding: 0 8px; font-weight: 800; font-size: 14px; background: #fff; }

.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .btn.big { font-size: 21px; padding: 14px 26px 12px; }
  .intro-card h2 { font-size: 28px; }
  .island-info h3 { font-size: 22px; }
  .node { width: 80px; height: 80px; font-size: 34px; }
  .reflect-card .q { font-size: 22px; }
  .mascot { width: 110px; }
}
