/* Ripple Pond: a calm pond toy in the Favabeans look (see ../APP_DESIGN.md, 2026 refresh).
   Light by default, dark when the system asks or the shared prefs force it. Accent: clear pond blue.
   The water is clear light blue.
   No dark green or dark teal anywhere. */
:root {
  --canvas: #F4F8FB;
  --surface: #FFFFFF;
  --surface-2: #EAF0F5;
  --surface-3: #DEE6EE;
  --ink: #18181B;
  --ink-2: #46464E;
  --line: rgb(24 24 27 / .09);
  --line-2: rgb(24 24 27 / .18);
  --shadow-1: 0 1px 2px rgb(0 0 0 / .04), 0 16px 36px -26px rgb(0 0 0 / .25);
  --shadow-2: 0 1px 2px rgb(0 0 0 / .05), 0 26px 50px -28px rgb(0 0 0 / .32);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --r-card: 32px;
  --r-md: 20px;
  --r-sm: 14px;
  --gutter: clamp(16px, 4vw, 40px);
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "IBM Plex Sans Arabic", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, serif;

  /* Accent: clear pond blue */
  --accent: #1F66C9;
  --accent-ink: #FFFFFF;
  --accent-soft: #E1EEFF;
  --accent-text: #1756AD;
  --focus: #1F66C9;

  /* The pond rim (the water itself is painted by app.js) */
  --box-0: #CDEEFF;
  --box-1: #8FCDF8;
  --box-rim: rgb(30 80 150 / .14);
  --sheen: rgb(255 255 255 / .22);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --canvas: #111318; --surface: #1D1D21; --surface-2: #26262B; --surface-3: #303036;
    --ink: #F2F1EC; --ink-2: #C2C1BC; --line: rgb(255 255 255 / .10); --line-2: rgb(255 255 255 / .22);
    --shadow-1: 0 1px 0 rgb(255 255 255 / .04) inset, 0 8px 24px -12px rgb(0 0 0 / .6);
    --shadow-2: 0 1px 0 rgb(255 255 255 / .05) inset, 0 28px 56px -22px rgb(0 0 0 / .8);
    --accent: #8EC2FF; --accent-ink: #0B1A30; --accent-soft: #1B2638; --accent-text: #A9D0FF; --focus: #A9D0FF;
    --box-0: #CDEEFF; --box-1: #8FCDF8; --box-rim: rgb(255 255 255 / .10); --sheen: rgb(255 255 255 / .10);
    color-scheme: dark;
  }
}
:root:where([data-theme="dark"]) {
  --canvas: #111318; --surface: #1D1D21; --surface-2: #26262B; --surface-3: #303036;
  --ink: #F2F1EC; --ink-2: #C2C1BC; --line: rgb(255 255 255 / .10); --line-2: rgb(255 255 255 / .22);
  --shadow-1: 0 1px 0 rgb(255 255 255 / .04) inset, 0 8px 24px -12px rgb(0 0 0 / .6);
  --shadow-2: 0 1px 0 rgb(255 255 255 / .05) inset, 0 28px 56px -22px rgb(0 0 0 / .8);
  --accent: #8EC2FF; --accent-ink: #0B1A30; --accent-soft: #1B2638; --accent-text: #A9D0FF; --focus: #A9D0FF;
  --box-0: #CDEEFF; --box-1: #8FCDF8; --box-rim: rgb(255 255 255 / .10); --sheen: rgb(255 255 255 / .10);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0; color: var(--ink); font: 400 1.0625rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased; overflow-x: clip;
  background:
    radial-gradient(1100px 520px at 88% -12%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(900px 480px at -10% 110%, color-mix(in srgb, #FFB3CF 12%, transparent), transparent 70%),
    var(--canvas);
  background-attachment: fixed;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Drawn icons: 24×24, round strokes, a soft fill */
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; overflow: visible; flex: none; }
.ico .f { fill: color-mix(in srgb, var(--c, var(--accent)) 45%, transparent); }
.ico .k { fill: currentColor; stroke: none; }

/* ---------- Header (same pattern as the other apps) ---------- */
.top { position: relative; z-index: 20; }
.top-in { max-width: 1180px; margin: 0 auto; padding-inline: var(--gutter); min-height: 88px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; }
.brand { display: flex; align-items: center; gap: 14px; margin-inline-end: auto; min-width: 0; }
.brand img { width: 52px; height: 52px; border-radius: 15px; transform: rotate(-6deg); box-shadow: 0 12px 24px -12px rgb(0 0 0 / .45); flex: none; }
.brand h1 { margin: 0; display: flex; align-items: center; font: italic 400 clamp(1.9rem, 4vw, 2.75rem)/1 var(--serif); letter-spacing: -0.01em; white-space: nowrap; }
body .top .fbk-beta {
  margin-inline-start: 10px; padding: .32em .62em; border: 0; border-radius: 999px; box-shadow: none;
  font: 700 max(.66rem, 11px)/1.1 var(--font); font-style: normal; letter-spacing: .06em;
  color: var(--accent-text); background: var(--accent-soft);
}
.fb-lang { display: flex; align-items: center; color: var(--line-2); font-size: .875rem; }
.fb-lang button { min-height: 44px; display: inline-flex; align-items: center; padding-inline: 10px; border: 0; border-radius: 12px; background: none; color: var(--ink-2); font: 700 .875rem/1 var(--font); cursor: pointer; }
.fb-lang button:hover, .fb-lang button[aria-pressed="true"] { color: var(--ink); }
.fb-lang button[aria-pressed="false"] { font-weight: 500; }
.fb-lang button[lang="ar"] { font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; font-size: .95rem; }
.home-link, .fava-share-btn, .sound-btn { min-height: 44px; min-width: 44px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; text-decoration: none; }
.home-link { padding-inline: 18px; background: var(--ink); color: var(--canvas); white-space: nowrap; font-size: .9rem; }
.home-link:hover { filter: brightness(1.25); }
.fava-share-btn, .sound-btn { padding: 0; background: var(--surface); border: 1.5px solid var(--line-2); color: var(--ink); cursor: pointer; }
.fava-share-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.sound-btn .snd-off { display: none; }
.sound-btn[data-on="false"] { color: var(--ink-2); }
.sound-btn[data-on="false"] .snd-on { display: none; }
.sound-btn[data-on="false"] .snd-off { display: inline; }
.sound-btn[data-on="false"] .ico .f { fill: none; }

main { max-width: 1180px; margin: 0 auto; padding: 6px var(--gutter) 28px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }

/* ---------- The pond ---------- */
.play { display: grid; gap: 14px; }
.box {
  position: relative; height: clamp(360px, 64vh, 640px); border-radius: var(--r-card); overflow: hidden;
  background: linear-gradient(180deg, var(--box-0), var(--box-1));
  box-shadow: var(--shadow-2), inset 0 0 0 1.5px var(--box-rim);
  transform-origin: 50% 100%;
}
.box::after { /* soft glass sheen on top */
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(160deg, var(--sheen), transparent 34%);
  box-shadow: inset 0 0 0 6px rgb(255 255 255 / .18), inset 0 -10px 28px -18px rgb(20 60 120 / .35);
}
.box canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  touch-action: none; cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.box canvas:focus-visible { outline: none; }
.box:has(canvas:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.hint {
  position: absolute; inset-inline: 0; top: 30%; margin: 0; display: flex; justify-content: center; pointer-events: none;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.hint span {
  padding: 12px 22px; border-radius: 999px; background: var(--ink); color: var(--canvas);
  font-weight: 700; font-size: 1.0625rem; box-shadow: var(--shadow-2);
}
.hint.gone { opacity: 0; transform: translateY(-6px); }

/* ---------- Tools, light and actions ---------- */
.tools { display: flex; gap: 4px; padding: 4px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
.tool {
  flex: 1 1 0; min-width: 0; min-height: 52px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 12px; border: 0; border-radius: 18px; background: transparent; color: var(--ink-2);
  font: 700 .9375rem/1.1 var(--font); cursor: pointer;
  transition: background-color .2s var(--ease), color .2s, transform .2s var(--ease);
}
.tool:hover { color: var(--ink); background: var(--surface-2); }
.tool:active { transform: scale(.97); }
.tool[aria-checked="true"] { background: var(--ink); color: var(--canvas); }
.tool[aria-checked="true"] .ico .f { fill: color-mix(in srgb, var(--c) 70%, transparent); }
.tool[data-tool="swim"] { --c: #4CB8FF; }
.tool[data-tool="food"] { --c: #FFB547; }
.tool[data-tool="pad"] { --c: #8ADB6E; }

.dock { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.light { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
.lt {
  min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 18px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-2); font: 700 .9375rem/1.1 var(--font); cursor: pointer;
  transition: background-color .2s var(--ease), color .2s;
}
.lt:hover { color: var(--ink); background: var(--surface-2); }
.lt[aria-checked="true"] { background: var(--ink); color: var(--canvas); }
.lt[data-light="day"] { --c: #FFC94A; }
.lt[data-light="evening"] { --c: #B9A4FF; }
.lt[aria-checked="true"] .ico .f { fill: color-mix(in srgb, var(--c) 80%, transparent); }

.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-inline-start: auto; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border: 0; border-radius: 999px;
  background: var(--btn, var(--surface)); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-2);
  font: 700 .9375rem/1.2 var(--font); cursor: pointer; white-space: nowrap;
  transition: background-color .2s, transform .2s var(--ease), filter .2s;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 6%, var(--btn, var(--surface))); }
.btn:active { transform: scale(.98); }
.btn.primary { --c: #fff; background: var(--accent); color: var(--accent-ink); box-shadow: 0 12px 24px -14px var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.primary .ico .f { fill: color-mix(in srgb, var(--accent-ink) 25%, transparent); }
#clearBtn { --c: #4CB8FF; }

/* ---------- Settings card ---------- */
.card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); padding: clamp(18px, 2.6vw, 28px); }
.prefs { display: grid; gap: 12px; justify-items: start; }
.prefs-title { margin: 0; font: italic 400 clamp(1.7rem, 3vw, 2.2rem)/1.05 var(--serif); }
:root[dir="rtl"] .prefs-title { font: 700 1.5rem/1.3 var(--font); }
.prefs [data-fava-howto] { margin: 0; }
.pref-note { margin: 0; color: var(--ink-2); font-size: .9375rem; }
.theme-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.theme-l { font-weight: 700; }
.theme-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-2); }
.theme-opt { position: relative; }
.theme-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.theme-opt span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; color: var(--ink-2); font-weight: 700; font-size: .9375rem; }
.theme-opt input:checked + span { background: var(--ink); color: var(--canvas); }
.theme-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- About, FAQ, footer, feedback ---------- */
.fb-about { max-width: 46rem; margin: 12px auto 0; padding: 26px var(--gutter) 6px; color: var(--ink-2); }
.fb-about h2 { margin: 0 0 10px; color: var(--ink); font: italic 400 clamp(2rem, 3.6vw, 2.75rem)/1.05 var(--serif); letter-spacing: -0.01em; }
:root[dir="rtl"] .fb-about h2 { font: 700 clamp(1.5rem, 2.6vw, 2rem)/1.3 var(--font); }
.fb-about > p { margin: 0 0 14px; font-size: 1.0625rem; line-height: 1.7; }
.fb-faq h3 { margin: 18px 0 6px; font-size: .9375rem; color: var(--ink); }
.fb-faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; margin-block: 10px; }
.fb-faq summary { min-height: 56px; padding: 14px 20px; font-size: 1.0625rem; font-weight: 700; color: var(--ink); cursor: pointer; }
.fb-faq details[open] summary { border-bottom: 1px solid var(--line); }
.fb-faq summary:focus-visible { border-radius: 22px; }
.fb-faq details p { margin: 0; padding: 12px 20px 16px; line-height: 1.7; }
.foot { max-width: 1180px; margin: 0 auto; padding: 8px var(--gutter) 28px; color: var(--ink-2); font-size: .875rem; text-align: center; }
.foot p { margin: 0 auto 6px; max-width: 70ch; }
body .fbk {
  width: min(760px, calc(100% - 2 * var(--gutter))); margin: 24px auto 40px; padding: 24px 26px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 30px; box-shadow: var(--shadow-1);
}
body .fbk-q { font-family: var(--font); font-style: normal; font-weight: 700; font-size: 1.25rem; line-height: 1.3; }
body .fbk-q svg { stroke: var(--accent); }
body .fbk-hint { color: var(--accent-text); }
body .fbk-send { min-height: 44px; padding: 0 22px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
body .fbk textarea, body .fbk input[type=email] { background: var(--surface); border-color: var(--line-2); border-radius: var(--r-sm); }
body .fbk .fbk-beta { color: var(--accent-text); background: var(--accent-soft); border: 0; box-shadow: none; font-family: var(--font); font-weight: 700; letter-spacing: .06em; }
body .fbk .fbk-star { min-width: 44px; min-height: 44px; background: none; padding: 8px; border-radius: 12px; }
body .fbk .fbk-link { background: none; min-height: 44px; padding: 4px 0; border-radius: 0; }
body .fbk button:focus-visible, body .fbk textarea:focus-visible, body .fbk input:focus-visible { outline-color: var(--focus); }

/* ---------- Arabic ---------- */
:root[lang="ar"] { --font: "Atkinson Hyperlegible Next", "IBM Plex Sans Arabic", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
:root[lang="ar"] body { line-height: 1.7; }
:root[lang="ar"] body *:not(svg):not(svg *) { letter-spacing: normal !important; }
:root[dir="rtl"] .brand h1 { font: 700 1.75rem/1.1 var(--font); }
:root[dir="rtl"] .brand h1 > span { font: italic 400 clamp(1.9rem, 4vw, 2.6rem)/1 var(--serif); }
.fb-suggest { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
.fb-suggest p { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.fb-suggest-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-suggest button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; cursor: pointer; font-weight: 700; }
.fb-suggest .fb-ar { background: var(--accent); color: var(--accent-ink); font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; }
.fb-suggest .fb-en { background: var(--surface-2); color: var(--ink); }

/* ---------- Shared comfort settings (prefs.js) ---------- */
:root[data-text="large"] { font-size: 120%; }
:root[data-contrast="high"] { --ink-2: var(--ink); --line: rgb(24 24 27 / .45); --line-2: rgb(24 24 27 / .6); --box-rim: rgb(24 24 27 / .5); }
@media (prefers-color-scheme: dark) { :root[data-contrast="high"]:where(:not([data-theme="light"])) { --line: rgb(255 255 255 / .45); --line-2: rgb(255 255 255 / .6); --box-rim: rgb(255 255 255 / .5); } }
:root[data-contrast="high"]:where([data-theme="dark"]) { --line: rgb(255 255 255 / .45); --line-2: rgb(255 255 255 / .6); --box-rim: rgb(255 255 255 / .5); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }

/* ---------- Desktop: tools, light and actions share one row under the pond ---------- */
@media (min-width: 900px) {
  .play { grid-template-columns: auto 1fr auto; grid-template-areas: "box box box" "tools light acts"; align-items: center; gap: 12px 16px; }
  .box { grid-area: box; }
  .tools { grid-area: tools; }
  .tool { flex: none; }
  .play > .dock-wrap { display: contents; }
  .light { grid-area: light; justify-self: center; }
  .acts { grid-area: acts; }
}

/* ---------- Phones ---------- */
@media (max-width: 1023px) { .top-in { padding-top: 12px; } }
@media (max-width: 640px) {
  .top-in { min-height: 64px; row-gap: 0; gap: 0 8px; }
  .brand { gap: 10px; }
  .brand img { width: 38px; height: 38px; border-radius: 11px; }
  .brand h1 { font-size: 1.6rem; }
  .home-link { font-size: 0; width: 44px; padding: 0; }
  .home-link::before { content: '←'; font-size: 1.1rem; line-height: 1; }
  :root[dir="rtl"] .home-link::before { content: '→'; }
  .fb-lang button { padding-inline: 6px; font-size: .8125rem; }
  main { gap: 16px; }
  .play { gap: 10px; }
  .box { height: min(56vh, 520px); height: min(56svh, 520px); border-radius: 26px; }
  .tool { flex-direction: column; gap: 3px; min-height: 60px; padding: 6px 2px; border-radius: 16px; font-size: .78rem; }
  .dock { gap: 10px; }
  .light { width: 100%; }
  .lt { flex: 1 1 0; justify-content: center; }
  .acts { width: 100%; margin: 0; flex-wrap: nowrap; }
  .acts .btn { flex: 1 1 0; min-width: 0; padding: 0 8px; gap: 6px; font-size: .875rem; }
  .hint span { font-size: 1rem; padding: 11px 18px; }
}
@media (max-width: 440px) {
  .top-in { flex-wrap: wrap; }
  body .top .fbk-beta { margin-inline-start: 6px; padding: .3em .5em; }
  .sound-btn, .fava-share-btn { border: 0; background: none; }
}
@media (max-width: 370px) {
  .acts .btn .ico { display: none; }
}
