/* Alvee English — lagoon resort world: pale lagoon mist, deep-sea ink, teal sea,
   mango for energy, hibiscus for love. Layout: one phone column, big tap targets. */
:root {
  --bg: #EAF3F1;
  --surface: #FFFFFF;
  --surface-2: #F4F9F8;
  --ink: #12313A;
  --muted: #5B7378;
  --line: #D5E3E0;
  --sea: #0E8A8A;
  --sea-deep: #0A5F66;
  --sea-tint: #D9F0EE;
  --mango: #FFB21E;
  --mango-deep: #D98A00;
  --mango-tint: #FFF1D3;
  --hibiscus: #E5476C;
  --hibiscus-tint: #FDE6EC;
  --good: #17955A;
  --good-deep: #0E7043;
  --good-bg: #E1F5E9;
  --bad: #D5473F;
  --bad-deep: #A9332C;
  --bad-bg: #FDEAE8;
  --font-display: "Mitr", "Lexend", "IBM Plex Sans Thai Looped", system-ui, sans-serif;
  --font-body: "Lexend", "IBM Plex Sans Thai Looped", "Noto Sans Thai", "Thonburi", system-ui, sans-serif;
  --font-th: "IBM Plex Sans Thai Looped", "Noto Sans Thai Looped", "Noto Sans Thai", "Thonburi", sans-serif;
  --r: 18px;
  --r-sm: 12px;
  --shadow: 0 1px 0 rgba(18, 49, 58, .04), 0 6px 18px rgba(18, 49, 58, .07);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-bg: rgba(255, 255, 255, .96);
  color-scheme: light;
  font-size: 17px;
}
:root.big { font-size: 19.5px; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--mango); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; margin: 0; text-wrap: balance; line-height: 1.2; }
p { margin: 0; }
.th { font-family: var(--font-th); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.tiny { font-size: .72rem; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

#app { min-height: 100%; max-width: 560px; margin: 0 auto; position: relative; }
.screen { padding: calc(14px + var(--safe-t)) 16px calc(96px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.screen.full { padding-bottom: calc(24px + var(--safe-b)); }

/* ---------- buttons */
.btn {
  border: 0; border-radius: 16px; padding: 14px 18px; font-weight: 600; font-size: 1rem;
  background: var(--sea); color: #fff; box-shadow: 0 4px 0 var(--sea-deep);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .06s, box-shadow .06s, filter .15s; min-height: 52px;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--sea-deep); }
.btn.mango { background: var(--mango); color: #3B2600; box-shadow: 0 4px 0 var(--mango-deep); }
.btn.mango:active { box-shadow: 0 1px 0 var(--mango-deep); }
.btn.good { background: var(--good); box-shadow: 0 4px 0 var(--good-deep); }
.btn.bad { background: var(--bad); box-shadow: 0 4px 0 var(--bad-deep); }
.btn.ghost { background: var(--surface); color: var(--sea-deep); box-shadow: 0 3px 0 var(--line); border: 2px solid var(--line); }
.btn.ghost:active { box-shadow: 0 0 0 var(--line); }
.btn.block { width: 100%; }
.btn:disabled { filter: grayscale(1) opacity(.45); transform: none; box-shadow: 0 4px 0 #9aa; cursor: default; }
.btn .sub { font-weight: 400; opacity: .85; font-size: .85em; }
.icon-btn {
  border: 0; background: transparent; width: 44px; height: 44px; border-radius: 12px;
  display: inline-grid; place-items: center; font-size: 1.25rem; color: var(--muted);
}
.icon-btn:active { background: var(--sea-tint); }
.say {
  border: 0; width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: var(--sea); color: #fff; display: inline-grid; place-items: center; font-size: 1.05rem;
  box-shadow: 0 3px 0 var(--sea-deep);
}
.say.slow { background: var(--surface); color: var(--sea-deep); box-shadow: 0 3px 0 var(--line); border: 2px solid var(--line); font-size: 1rem; }
.say.sm { width: 34px; height: 34px; font-size: .9rem; }
.say:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sea-deep); }
.no-speech .say { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--line); font-weight: 600; font-size: .9rem;
}
.chip.on { background: var(--sea); color: #fff; border-color: var(--sea); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.pill.good { background: var(--good-bg); color: var(--good-deep); }
.pill.bad { background: var(--bad-bg); color: var(--bad-deep); }
.pill.sea { background: var(--sea-tint); color: var(--sea-deep); }
.pill.mango { background: var(--mango-tint); color: #7A4D00; }
.pill.grey { background: #ECF0EF; color: var(--muted); }
.pill.love { background: var(--hibiscus-tint); color: #A02246; }

/* ---------- cards */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.card.flat { box-shadow: none; border: 1.5px solid var(--line); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sec-title { font-family: var(--font-display); font-weight: 500; font-size: 1.05rem; color: var(--sea-deep); }

/* ---------- top bar & stats */
.topbar { display: flex; align-items: center; gap: 10px; }
.topbar .hello { flex: 1; min-width: 0; }
.topbar .hello h1 { font-size: 1.45rem; }
.topbar .hello p { font-size: .85rem; color: var(--muted); }
.stat {
  display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--surface); padding: 6px 10px; border-radius: 12px; box-shadow: var(--shadow); font-size: .95rem;
}
.stat .e { font-size: 1.05rem; }

/* ---------- resort */
.resort { padding: 0; overflow: hidden; position: relative; }
.resort svg { display: block; width: 100%; height: auto; }
.resort .cap {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px 12px;
}
.resort .cap b { font-family: var(--font-display); font-weight: 500; }
.stars { color: var(--mango); letter-spacing: 1px; font-size: 1.05rem; }
.stars .off { color: #C9D6D3; }

/* ---------- today */
.today { display: flex; flex-direction: column; gap: 12px; }
.today .next { display: flex; gap: 12px; align-items: center; }
.ring { width: 58px; height: 58px; flex: none; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .78rem; font-weight: 700; }
.next .t { flex: 1; min-width: 0; }
.next .t .k { font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.next .t h2 { font-size: 1.2rem; }
.goal-bar { height: 10px; background: var(--sea-tint); border-radius: 99px; overflow: hidden; }
.goal-bar > i { display: block; height: 100%; background: var(--mango); border-radius: 99px; transition: width .5s; }

.msg-card { background: var(--hibiscus-tint); border: 2px solid #F7BFCD; display: flex; gap: 12px; align-items: center; }
.msg-card .env { font-size: 2rem; animation: wiggle 1.6s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-10deg); } 30% { transform: rotate(8deg); } 45% { transform: rotate(0); } }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile {
  background: var(--surface); border: 0; border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 600; font-size: .88rem; text-align: center;
}
.tile .e { font-size: 1.6rem; }
.tile .th { font-weight: 400; font-size: .75rem; color: var(--muted); }

/* ---------- bottom nav */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--nav-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--safe-b));
}
.nav .in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.nav button {
  border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 0; font-size: .7rem; font-weight: 600; color: var(--muted); border-radius: 12px;
}
.nav button .e { font-size: 1.35rem; filter: grayscale(.6); opacity: .8; }
.nav button.on { color: var(--sea-deep); background: var(--sea-tint); }
.nav button.on .e { filter: none; opacity: 1; }

/* ---------- journey */
.month { display: flex; flex-direction: column; gap: 10px; }
.month-head { display: flex; align-items: center; gap: 12px; padding: 4px 2px; }
.month-head .mn {
  width: 46px; height: 46px; border-radius: 14px; background: var(--sea); color: #fff; flex: none;
  display: grid; place-items: center; font-family: var(--font-display); font-size: 1.2rem;
}
.month-head.locked .mn { background: #C5D3D0; }
.month-head h2 { font-size: 1.1rem; }
.unit { display: flex; flex-direction: column; gap: 12px; }
.unit-head { display: flex; gap: 10px; align-items: flex-start; }
.unit-head .deco { font-size: 1.7rem; line-height: 1; }
.unit-head h3 { font-size: 1.02rem; }
.nodes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.nodes .soon-note { grid-column: 1 / -1; }
.node {
  width: 100%; max-width: 56px; aspect-ratio: 1; justify-self: center; border-radius: 50%; border: 0; position: relative;
  background: var(--surface-2); color: var(--muted); display: grid; place-items: center; font-size: 1.35rem;
  box-shadow: 0 4px 0 #CBD9D6; border: 2px solid var(--line);
}
.node.open { background: var(--mango); border-color: var(--mango); box-shadow: 0 4px 0 var(--mango-deep); color: #3B2600; animation: pulse 1.8s infinite; }
.node.done { background: var(--sea); border-color: var(--sea); box-shadow: 0 4px 0 var(--sea-deep); color: #fff; }
.node.locked { opacity: .55; }
.node.soon { opacity: .4; border-style: dashed; }
.node .st { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); font-size: .62rem; color: var(--mango); letter-spacing: -1px; white-space: nowrap; text-shadow: 0 1px 0 #fff; }
@keyframes pulse { 0%, 100% { box-shadow: 0 4px 0 var(--mango-deep), 0 0 0 0 rgba(255, 178, 30, .55); } 60% { box-shadow: 0 4px 0 var(--mango-deep), 0 0 0 12px rgba(255, 178, 30, 0); } }
.progress { height: 8px; background: var(--sea-tint); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--sea); border-radius: 99px; }

/* ---------- lesson player */
.player { min-height: 100%; display: flex; flex-direction: column; padding: calc(8px + var(--safe-t)) 16px calc(16px + var(--safe-b)); gap: 10px; }
.player-top { display: flex; align-items: center; gap: 8px; }
.player-top .progress { flex: 1; height: 14px; }
.player-top .progress > i { background: var(--good); transition: width .35s; }
.player-body { flex: 1; display: flex; flex-direction: column; gap: 16px; padding-top: 6px; }
.q-kind { font-size: .8rem; font-weight: 700; color: var(--sea-deep); letter-spacing: .03em; display: flex; gap: 6px; align-items: center; }
.q-title { font-family: var(--font-display); font-weight: 500; font-size: 1.25rem; }
.q-title .th { display: block; font-size: .95rem; color: var(--muted); font-weight: 400; }
.prompt { display: flex; gap: 12px; align-items: center; }
.prompt .bubble {
  background: var(--surface); border: 2px solid var(--line); border-radius: 18px 18px 18px 6px; padding: 12px 14px; flex: 1;
  font-size: 1.35rem; font-weight: 500; line-height: 1.45;
}
.prompt .bubble.th { font-size: 1.25rem; font-weight: 500; }
.hint-th { font-size: .95rem; color: var(--muted); margin-top: 6px; display: block; font-weight: 400; }
.thai-toggle { align-self: flex-start; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opts.grid { display: grid; grid-template-columns: 1fr 1fr; }
.opt {
  border: 2px solid var(--line); border-radius: 16px; background: var(--surface); padding: 14px 14px;
  text-align: left; font-size: 1.08rem; font-weight: 500; box-shadow: 0 4px 0 var(--line); min-height: 58px;
  display: flex; align-items: center; gap: 10px; transition: transform .06s;
}
.opt:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.opt .k { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; font-size: .75rem; color: var(--muted); flex: none; }
.opt.th { font-family: var(--font-th); font-size: 1.12rem; }
.opt.center { justify-content: center; text-align: center; }
.opt.big { font-size: 1.5rem; justify-content: center; }
.opt.right { border-color: var(--good); background: var(--good-bg); box-shadow: 0 4px 0 var(--good); color: var(--good-deep); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); box-shadow: 0 4px 0 var(--bad); color: var(--bad-deep); animation: shake .35s; }
.opt.dim { opacity: .45; }
.opt.sel { border-color: var(--sea); background: var(--sea-tint); box-shadow: 0 4px 0 var(--sea); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.tok { cursor: pointer; border-bottom: 2px dotted rgba(14, 138, 138, .55); border-radius: 3px; }
.tok:active, .tok.hit { background: var(--mango-tint); }
.gap-slot { display: inline-block; min-width: 64px; border-bottom: 3px solid var(--sea); margin: 0 3px; text-align: center; color: var(--sea-deep); font-weight: 700; }
.gap-slot.filled-ok { color: var(--good-deep); border-color: var(--good); }
.gap-slot.filled-bad { color: var(--bad-deep); border-color: var(--bad); }

.build-line {
  min-height: 112px; border-bottom: 2px solid var(--line); background:
  repeating-linear-gradient(to bottom, transparent 0 54px, var(--line) 54px 56px);
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; padding: 6px 0;
}
.bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding-top: 4px; }
.wtile {
  border: 2px solid var(--line); background: var(--surface); border-radius: 12px; padding: 9px 13px; font-size: 1.1rem;
  font-weight: 500; box-shadow: 0 3px 0 var(--line); min-height: 46px;
}
.wtile:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.wtile.used { visibility: hidden; }
.wtile.ghost { color: transparent; background: var(--surface-2); box-shadow: none; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match .col { display: flex; flex-direction: column; gap: 10px; }
.match .opt { justify-content: center; text-align: center; font-size: 1rem; min-height: 54px; padding: 10px; }
.match .opt.gone { visibility: hidden; }

.intro { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.intro .hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0; }
.intro .hero .pic { font-size: 3.6rem; line-height: 1.1; }
.intro .hero .w { font-size: 2.3rem; font-weight: 600; letter-spacing: -.01em; }
.intro .hero .tr { font-family: var(--font-th); font-size: 1.6rem; color: var(--sea-deep); font-weight: 600; }
.intro .hero .pr { font-family: var(--font-th); color: var(--muted); }
.note { background: var(--mango-tint); border-radius: 14px; padding: 12px 14px; font-family: var(--font-th); font-size: .98rem; }
.note b { font-family: var(--font-body); }
.ex { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.ex:first-child { border-top: 0; }
.ex .en { font-weight: 500; }
.ex .thx { font-family: var(--font-th); color: var(--muted); font-size: .95rem; }
.chips-wbw { display: flex; flex-wrap: wrap; gap: 8px; }
.wbw { background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 12px; padding: 6px 10px; text-align: center; }
.wbw b { display: block; font-size: 1.02rem; }
.wbw span { font-family: var(--font-th); font-size: .8rem; color: var(--muted); }

.tip-card { display: flex; flex-direction: column; gap: 12px; }
.tip-card h2 { font-size: 1.3rem; color: var(--sea-deep); }
.tip-card p { font-family: var(--font-th); font-size: 1.02rem; }
.tip-ok, .tip-no { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; }
.tip-ok { background: var(--good-bg); }
.tip-no { background: var(--bad-bg); }
.tip-ok .m, .tip-no .m { font-size: 1.2rem; }
.tip-ok .en, .tip-no .en { font-weight: 600; font-size: 1.08rem; }
.tip-no .en { text-decoration: line-through; text-decoration-color: rgba(213, 71, 63, .6); }
.tip-ok .thx, .tip-no .thx { font-family: var(--font-th); font-size: .9rem; color: var(--muted); }
.tip-table { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; }
.tip-table td { padding: 9px 12px; border-top: 1px solid var(--line); font-weight: 600; }
.tip-table tr:first-child td { border-top: 0; }
.tip-table td:nth-child(2) { color: var(--sea-deep); }
.tip-trick { background: var(--sea-tint); border-radius: 14px; padding: 12px 14px; font-family: var(--font-th); }
.tip-h { font-family: var(--font-display); font-weight: 500; color: var(--sea-deep); }

/* chat */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; animation: pop .25s ease-out; }
.msg .av { width: 36px; height: 36px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 1.2rem; flex: none; box-shadow: var(--shadow); }
.msg .b { background: var(--surface); border-radius: 18px 18px 18px 6px; padding: 10px 13px; box-shadow: var(--shadow); }
.msg .b .en { font-size: 1.08rem; font-weight: 500; }
.msg .b .thx { font-family: var(--font-th); font-size: .9rem; color: var(--muted); margin-top: 3px; }
.msg .who { font-size: .72rem; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.me .b { background: var(--sea); color: #fff; border-radius: 18px 18px 6px 18px; }
.msg.me .b .thx { color: rgba(255, 255, 255, .85); }
.msg.me .tok { border-bottom-color: rgba(255, 255, 255, .6); }
.msg.me .tok:active, .msg.me .tok.hit { background: rgba(255, 255, 255, .25); }
.msg.typing .b { color: var(--muted); font-style: italic; }
@keyframes pop { from { transform: translateY(8px) scale(.97); opacity: 0; } }

/* feedback sheet */
.fb {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 16px 16px calc(16px + var(--safe-b));
  animation: up .22s ease-out; border-radius: 22px 22px 0 0;
}
.fb .in { max-width: 528px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.fb.ok { background: var(--good-bg); }
.fb.no { background: var(--bad-bg); }
.fb h3 { font-size: 1.25rem; display: flex; align-items: center; gap: 8px; }
.fb.ok h3 { color: var(--good-deep); }
.fb.no h3 { color: var(--bad-deep); }
.fb .ans { font-weight: 600; font-size: 1.08rem; }
.fb .why { font-family: var(--font-th); font-size: .95rem; background: rgba(255, 255, 255, .7); border-radius: 12px; padding: 8px 10px; }
@keyframes up { from { transform: translateY(100%); } }

/* bottom sheet (word popup) */
.veil { position: fixed; inset: 0; background: rgba(10, 35, 40, .42); z-index: 60; animation: fade .18s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 88%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface); border-radius: 24px 24px 0 0; padding: 10px 18px calc(22px + var(--safe-b)); animation: up .22s ease-out;
}
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 10px; }
.sheet .in { max-width: 524px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.wp-head { display: flex; gap: 12px; align-items: center; }
.wp-head .pic { font-size: 2.4rem; }
.wp-head .w { font-size: 1.9rem; font-weight: 600; line-height: 1.1; }
.wp-head .pos { font-family: var(--font-th); font-size: .82rem; color: var(--muted); }
.wp-th { font-family: var(--font-th); font-size: 1.45rem; font-weight: 600; color: var(--sea-deep); }
.wp-sub { font-family: var(--font-th); color: var(--muted); }
.wp-phrase { background: var(--sea-tint); border-radius: 14px; padding: 10px 12px; }
.wp-phrase b { font-size: 1.05rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-family: var(--font-th); font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* toast & confetti */
.toast {
  position: fixed; left: 50%; top: calc(14px + var(--safe-t)); transform: translateX(-50%); z-index: 80;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 14px; font-size: .92rem; max-width: 92%;
  animation: drop .25s ease-out; box-shadow: var(--shadow);
}
@keyframes drop { from { transform: translate(-50%, -30px); opacity: 0; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

/* result */
.result { align-items: center; text-align: center; justify-content: center; min-height: 100%; }
.result .big-e { font-size: 4.2rem; line-height: 1; }
.result h1 { font-size: 1.8rem; }
.result .boxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.result .box { background: var(--surface); border-radius: 16px; padding: 12px 6px; box-shadow: var(--shadow); }
.result .box b { display: block; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.result .box span { font-size: .75rem; color: var(--muted); font-weight: 600; }
.can-say { width: 100%; text-align: left; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.input {
  border: 2px solid var(--line); border-radius: 14px; padding: 13px 14px; background: var(--surface); font-size: 1rem; width: 100%;
}
.input:focus { border-color: var(--sea); outline: none; }
.login { min-height: 100%; justify-content: center; padding-top: calc(30px + var(--safe-t)); }
.login .logo { font-size: 3rem; text-align: center; }
.login h1 { text-align: center; font-size: 1.9rem; }
.demo-box { background: var(--mango-tint); border-radius: 14px; padding: 12px 14px; font-size: .88rem; }
.err { color: var(--bad-deep); font-size: .9rem; min-height: 1.2em; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.switch:first-child { border-top: 0; }
.toggle { width: 52px; height: 30px; border-radius: 99px; border: 0; background: #C9D6D3; position: relative; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle.on { background: var(--sea); }
.toggle.on::after { left: 25px; }

/* words */
.search { position: sticky; top: 0; z-index: 5; }
.wlist { display: flex; flex-direction: column; }
.witem { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; }
.witem .pic { width: 34px; font-size: 1.4rem; text-align: center; flex: none; }
.witem .w { font-weight: 600; }
.witem .t { font-family: var(--font-th); color: var(--muted); font-size: .92rem; }
.witem .grow { flex: 1; min-width: 0; }
.str { display: inline-flex; gap: 2px; }
.str i { width: 6px; height: 14px; border-radius: 3px; background: #D4E0DD; }
.str i.on { background: var(--sea); }
.str.weak i.on { background: var(--bad); }

.badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.badge { text-align: center; background: var(--surface-2); border-radius: 14px; padding: 10px 4px; font-size: .68rem; font-weight: 600; color: var(--muted); }
.badge .e { font-size: 1.7rem; display: block; }
.badge.off .e { filter: grayscale(1); opacity: .35; }
.badge.on { background: var(--mango-tint); color: #7A4D00; }

.talk-item { display: flex; gap: 12px; align-items: center; width: 100%; border: 0; text-align: left; }
.talk-item .av { width: 48px; height: 48px; border-radius: 14px; background: var(--sea-tint); display: grid; place-items: center; font-size: 1.5rem; flex: none; }
.talk-item.locked { opacity: .5; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats .chip { flex: none; }

/* ---------- admin */
.adm .status { display: flex; gap: 14px; align-items: center; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #B9C7C4; flex: none; }
.dot.on { background: #22C55E; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: live 1.6s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 12px; }
.kpi b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; font-family: var(--font-display); font-weight: 500; }
.kpi span { font-size: .72rem; color: var(--muted); font-weight: 600; }
.feed { display: flex; flex-direction: column; }
.ev { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; padding: 9px 2px; border-bottom: 1px solid var(--line); align-items: start; font-size: .9rem; }
.ev .i { font-size: 1rem; text-align: center; }
.ev .tm { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev .d { color: var(--muted); font-size: .82rem; }
.ev.bad { background: linear-gradient(90deg, var(--bad-bg), transparent 70%); }
.ev .yours { color: var(--bad-deep); font-weight: 600; text-decoration: line-through; }
.ev .right { color: var(--good-deep); font-weight: 600; }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; position: sticky; top: 0; z-index: 6; background: var(--bg); padding: 6px 0; }
.tabs::-webkit-scrollbar { display: none; }
.tabs .chip { flex: none; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 6px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars .b i { width: 100%; background: var(--sea); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bars .b.today i { background: var(--mango); }
.bars .b span { font-size: .6rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.barrow { display: grid; grid-template-columns: minmax(96px, 1.3fr) 2fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.barrow .track { height: 10px; background: var(--sea-tint); border-radius: 9px; overflow: hidden; }
.barrow .track i { display: block; height: 100%; background: var(--bad); border-radius: 9px; }
.barrow .track.sea i { background: var(--sea); }
textarea.input { min-height: 96px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; }

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

/* ---------- night mode: the lagoon after sunset. Same layout, deep-sea colours, softer glare */
:root.dark {
  --bg: #0A1A1F;
  --surface: #11262D;
  --surface-2: #163038;
  --ink: #E2EFED;
  --muted: #8FAAAE;
  --line: #24414A;
  --sea: #1FA7A3;
  --sea-deep: #0F6E6D;
  --sea-tint: #123B3E;
  --mango: #FFB21E;
  --mango-deep: #B87700;
  --mango-tint: #3A2C0F;
  --hibiscus: #FF6E8E;
  --hibiscus-tint: #3A1823;
  --good: #33C27B;
  --good-deep: #5FD99A;
  --good-bg: #0F2E1F;
  --bad: #F06A61;
  --bad-deep: #FF8F87;
  --bad-bg: #3A1715;
  --nav-bg: rgba(14, 33, 39, .94);
  --shadow: 0 1px 0 rgba(0, 0, 0, .25), 0 6px 18px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
:root.dark .pill.grey { background: #1C3740; }
:root.dark .pill.mango, :root.dark .badge.on { color: #FFCF6E; }
:root.dark .pill.love { color: #FF9DB4; }
:root.dark .stars .off { color: #36545C; }
:root.dark .msg-card { border-color: #6B2A3D; }
:root.dark .month-head.locked .mn { background: #2A454D; }
:root.dark .node { box-shadow: 0 4px 0 #07141A; }
:root.dark .node.open { box-shadow: 0 4px 0 var(--mango-deep); }
:root.dark .node.done { box-shadow: 0 4px 0 var(--sea-deep); }
:root.dark .node .st { text-shadow: 0 1px 0 #000; }
:root.dark .fb .why { background: rgba(0, 0, 0, .25); }
:root.dark .toast { background: #E2EFED; color: #0A1A1F; }
:root.dark .toggle, :root.dark .str i, :root.dark .dot { background: #2E4A52; }
:root.dark .toggle.on { background: var(--sea); }
:root.dark .dot.on { background: #22C55E; }
:root.dark .veil { background: rgba(0, 0, 0, .6); }
:root.dark .btn:disabled { box-shadow: 0 4px 0 #2E4A52; }
:root.dark .btn.mango { color: #2A1B00; }
:root.dark .resort svg { filter: brightness(.9); }

/* night mode picker */
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; flex: none; }
.seg3 button { border: 0; background: none; border-radius: 9px; padding: 6px 10px; font-size: .85rem; color: var(--muted); }
.seg3 button.on { background: var(--sea); color: #fff; }
