/* ==========================================================================
   Word Locker (docs/word-locker-plan.md §6). A calm dark notebook in the
   style of the reference app, with Readflexes' own name and shapes. The
   outrun touch (§6.6) is deliberately faint: a reviewer who sees it at a
   glance should turn it down, not up. No glow, no neon, no motion on any
   decoration, and nothing decorative behind text a person reads.
   ========================================================================== */

.wl-body {
  --wl-bg: #111114;
  --wl-panel: #1d1d22;
  --wl-card: #2c2c33;
  --wl-text: #ffffff;
  --wl-muted: #9a9aa6;
  --wl-violet: #8f83ff;
  --wl-indigo: #4f43d8;
  --wl-green: #3fbf87;
  --wl-green-ink: #08241a;
  --wl-danger: #ff8a8a;
  --wl-learning: #f08a5d;
  --wl-reviewing: #4f43d8;
  --wl-mastered: #3fbf87;
  --wl-sunset: linear-gradient(135deg, #4f43d8 0%, #4f43d8 55%, #7a48d6 100%);
  --wl-sun-ink: #ffffff;
  --wl-sun-alpha: 0.035;
  --wl-shape-alpha: 0.055;
  --wl-line: rgba(255, 255, 255, 0.08);
  --wl-r-panel: 28px;
  --wl-r-card: 22px;
  --wl-r-key: 14px;
  --wl-rail: 232px;
  --wl-bar: 74px;
  margin: 0;
  min-height: 100dvh;
  background: var(--wl-bg);
  color: var(--wl-text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
:root.light-mode .wl-body {
  --wl-bg: #f5f5f8;
  --wl-panel: #ffffff;
  --wl-card: #e9e9ef;
  --wl-text: #17171c;
  --wl-muted: #5d5d6a;
  --wl-violet: #5546e0;
  --wl-indigo: #4f43d8;
  --wl-green: #23a06c;
  --wl-green-ink: #ffffff;
  --wl-danger: #b3261e;
  --wl-sun-ink: #9a8676;
  --wl-sun-alpha: 0.06;
  --wl-shape-alpha: 0.07;
  --wl-line: rgba(0, 0, 0, 0.08);
}
.wl-body * { box-sizing: border-box; }
.wl-body h1, .wl-body h2, .wl-body h3 { font-family: inherit; letter-spacing: -0.01em; }
.wl-body h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 800; margin: 0; }
.wl-body h2 { font-size: 1.15rem; font-weight: 800; margin: 0 0 10px; }
.wl-body a { color: inherit; }
.wl-body [hidden] { display: none !important; }
.wl-muted { color: var(--wl-muted); }
.wl-small { font-size: 0.85rem; }
.wl-label { font-size: 0.8rem; font-weight: 600; color: var(--wl-muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 18px 0 4px; }
.wl-error { color: var(--wl-danger); min-height: 1.2em; }
/* Headings take focus on a route change (for screen readers), not a ring. */
.wl-body [tabindex="-1"]:focus { outline: none; }
.wl-skip:focus { position: fixed; left: 12px; top: 12px; width: auto; height: auto; clip: auto; z-index: 9999; background: var(--wl-panel); padding: 8px 12px; border-radius: 10px; }

/* ── frame: bottom tab bar on a phone, a left rail on a laptop ──────────── */
.wl-app { min-height: 100dvh; }
.wl-stage {
  /* The top padding clears the site's floating pills (language, Flex Funds). */
  padding: 64px clamp(16px, 3vw, 36px) calc(var(--wl-bar) + 28px + env(safe-area-inset-bottom));
  max-width: 100%;
  outline: none;
}
.wl-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around; align-items: flex-end;
  height: calc(var(--wl-bar) + env(safe-area-inset-bottom));
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: var(--wl-panel);
  border-top: 1px solid var(--wl-line);
}
.wl-brand { display: none; text-decoration: none; }
.wl-nav-btn {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-decoration: none; color: var(--wl-muted); font-size: 0.72rem; font-weight: 600;
  min-width: 0; min-height: 52px; justify-content: center;
}
.wl-nav-ic {
  display: grid; place-items: center; width: 40px; height: 30px; border-radius: 12px;
  font-size: 1.15rem; line-height: 1;
}
.wl-nav-btn.is-active { color: var(--wl-text); }
.wl-nav-btn.is-active .wl-nav-ic { background: var(--wl-indigo); color: #fff; }
.wl-nav-add { position: relative; }
.wl-nav-add .wl-nav-ic {
  width: 58px; height: 58px; border-radius: 50%; background: var(--wl-green); color: var(--wl-green-ink);
  font-size: 1.9rem; font-weight: 800; transform: translateY(-14px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}
.wl-nav-add-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (min-width: 900px) {
  .wl-app { display: grid; grid-template-columns: var(--wl-rail) minmax(0, 1fr); }
  .wl-nav {
    position: sticky; top: 0; bottom: auto; height: 100dvh; flex-direction: column; justify-content: flex-start;
    align-items: stretch; gap: 6px; padding: 18px 14px; border-top: 0; border-right: 1px solid var(--wl-line);
  }
  /* The brand leads home, so it leads the rail (order -2, above Add's -1);
     on a phone it is hidden and js/rf-home-logo.js puts the logo in the corner. */
  .wl-brand { order: -2; display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.1rem; margin: 0 6px 18px; }
  .wl-brand img { width: 34px; height: 34px; object-fit: contain; }
  .wl-nav-btn { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 1rem; padding: 6px 8px; border-radius: 16px; min-height: 48px; }
  .wl-nav-btn.is-active { background: rgba(79, 67, 216, 0.16); }
  .wl-nav-add { order: -1; margin-bottom: 12px; background: var(--wl-green); color: var(--wl-green-ink); justify-content: center; }
  .wl-nav-add .wl-nav-ic { width: auto; height: auto; background: none; transform: none; box-shadow: none; font-size: 1.4rem; color: inherit; }
  .wl-nav-add-label { position: static; width: auto; height: auto; clip: auto; font-weight: 800; }
  .wl-nav-add:hover { filter: brightness(1.05); }
  .wl-stage { padding: 56px clamp(20px, 3vw, 44px) 48px; }
}

/* ── buttons, chips, forms ──────────────────────────────────────────────── */
.wl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 0;
  background: var(--wl-card); color: var(--wl-text); font: inherit; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.wl-btn:hover { filter: brightness(1.08); }
.wl-btn:disabled { opacity: 0.55; cursor: default; }
.wl-btn--primary { background: var(--wl-indigo); color: #fff; }
.wl-btn--green { background: var(--wl-green); color: var(--wl-green-ink); }
.wl-btn--quiet { background: transparent; color: var(--wl-muted); }
.wl-btn--danger { background: transparent; color: var(--wl-danger); box-shadow: inset 0 0 0 1px currentColor; }
.wl-link { background: none; border: 0; color: var(--wl-violet); font: inherit; font-weight: 600; cursor: pointer; padding: 6px 0; text-decoration: underline; }
.wl-icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--wl-card); color: var(--wl-text); font-size: 1.2rem; cursor: pointer; flex: 0 0 auto;
}
.wl-icon-btn--indigo { background: var(--wl-indigo); color: #fff; font-weight: 800; }
.wl-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.wl-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.wl-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; border-radius: 999px; background: var(--wl-card); font-size: 0.85rem; font-weight: 600; text-decoration: none; }
.wl-chip--lang { background: transparent; box-shadow: inset 0 0 0 1px var(--wl-line); color: var(--wl-muted); }
.wl-chip--pick { cursor: pointer; padding: 0; background: none; }
.wl-chip--pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wl-chip--pick span { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 999px; background: var(--wl-card); }
.wl-chip--pick input:checked + span { background: var(--wl-indigo); color: #fff; }
.wl-chip--pick input:focus-visible + span { outline: 2px solid var(--wl-violet); outline-offset: 2px; }
/* The shelf's meanings switch (views/meaning-switch.js): one pill per language, the shown one filled. */
.wl-meaning-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0; }
.wl-meaning-switch .wl-chips { margin: 0; }
.wl-mean-chip { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--wl-card); color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.wl-mean-chip.is-on { background: var(--wl-indigo); color: #fff; }
.wl-mean-chip:focus-visible { outline: 2px solid var(--wl-violet); outline-offset: 2px; }
.wl-mean-chip:disabled { opacity: .6; cursor: default; }
.wl-form { display: grid; gap: 14px; }
.wl-form label, .wl-inline { display: grid; gap: 6px; font-weight: 600; font-size: 0.9rem; color: var(--wl-muted); }
.wl-form fieldset { border: 0; padding: 0; margin: 0; }
.wl-form legend { font-weight: 700; margin-bottom: 6px; }
.wl-body input[type=text], .wl-body input:not([type]), .wl-body input[type=search], .wl-body input[type=url],
.wl-body textarea, .wl-body select {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--wl-r-key); border: 1px solid var(--wl-line);
  background: var(--wl-card); color: var(--wl-text); font: inherit; font-weight: 400;
}
.wl-body textarea { resize: vertical; }
.wl-body input:focus, .wl-body textarea:focus, .wl-body select:focus { outline: 2px solid var(--wl-violet); outline-offset: 1px; }
.wl-switch, .wl-check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; min-height: 44px; }
.wl-switch input, .wl-check input { width: 20px; height: 20px; accent-color: var(--wl-indigo); }

/* ── panels and views ───────────────────────────────────────────────────── */
.wl-panel { background: var(--wl-panel); border-radius: var(--wl-r-panel); padding: 20px; margin: 14px 0; }
.wl-view-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.wl-view-head h1 { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.wl-title-violet { color: var(--wl-violet); }
.wl-back { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--wl-card); text-decoration: none; font-size: 1.6rem; line-height: 1; }
.wl-loading { color: var(--wl-muted); padding: 40px 0; }
.wl-hero { position: relative; overflow: hidden; max-width: 720px; padding: 40px 0; }
.wl-hero p { font-size: 1.1rem; color: var(--wl-muted); }

/* The banded setting sun (§6.6): 4–6% opacity, clipped, behind no running text. */
.wl-sun {
  position: absolute; right: -40px; top: -70px; width: 260px; height: 130px; pointer-events: none;
  border-radius: 260px 260px 0 0; background: var(--wl-sun-ink); opacity: var(--wl-sun-alpha);
  -webkit-mask: linear-gradient(to bottom, #000 0 58%, transparent 58% 64%, #000 64% 76%, transparent 76% 81%, #000 81% 90%, transparent 90% 94%, #000 94%);
  mask: linear-gradient(to bottom, #000 0 58%, transparent 58% 64%, #000 64% 76%, transparent 76% 81%, #000 81% 90%, transparent 90% 94%, #000 94%);
}
.wl-home-head, .wl-setup-head { position: relative; overflow: hidden; padding: 8px 0 14px; }
.wl-home-head h1, .wl-home-head p, .wl-setup-head h1 { position: relative; }

.wl-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.wl-tile { display: grid; gap: 2px; padding: 18px 20px; border-radius: var(--wl-r-card); background: var(--wl-panel); text-decoration: none; }
.wl-tile--sunset { background: var(--wl-sunset); color: #fff; }
.wl-tile--green { background: var(--wl-green); color: var(--wl-green-ink); }
.wl-tile-n { font-size: 2rem; font-weight: 900; line-height: 1.1; }
.wl-tile-label { font-weight: 600; opacity: 0.9; }
.wl-inbox-note { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: space-between; }
.wl-inbox-note p { margin: 0; font-weight: 600; }

/* ── shelves ────────────────────────────────────────────────────────────── */
.wl-shelf-list { display: grid; gap: 10px; margin-top: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.wl-shelf {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--wl-r-card);
  background: var(--wl-panel); text-decoration: none; min-height: 76px;
}
.wl-shelf-link { position: absolute; inset: 0; border-radius: inherit; }
.wl-shelf-link:focus-visible { outline: 2px solid var(--wl-violet); }
.wl-shelf-dot { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: var(--dot); color: #fff; flex: 0 0 auto; font-size: 1.1rem; }
.wl-shelf-main { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
.wl-shelf-name { font-weight: 800; overflow-wrap: anywhere; }
.wl-shelf-langs { display: flex; gap: 6px; flex-wrap: wrap; position: relative; z-index: 1; justify-content: flex-end; }
.wl-shelf-menu summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.wl-shelf-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.wl-colors { display: flex; gap: 10px; flex-wrap: wrap; border: 0; padding: 0; margin: 10px 0 0; }
.wl-colors legend { width: 100%; font-weight: 700; margin-bottom: 6px; }
.wl-color input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wl-color span { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--dot); cursor: pointer; }
.wl-color input:checked + span { box-shadow: 0 0 0 3px var(--wl-bg), 0 0 0 5px var(--wl-text); }
.wl-color input:focus-visible + span { outline: 2px solid var(--wl-violet); outline-offset: 4px; }
.wl-filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 14px 0; }
.wl-search { flex: 1 1 260px; }

/* ── word cards ─────────────────────────────────────────────────────────── */
.wl-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.wl-card {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; border-radius: var(--wl-r-card); background: var(--wl-card); text-decoration: none; min-height: 96px;
}
.wl-card:focus-visible { outline: 2px solid var(--wl-violet); outline-offset: 2px; }
.wl-card-shape { position: absolute; right: 0; bottom: 0; width: 110px; height: 110px; pointer-events: none; }
.wl-card-shape svg { width: 100%; height: 100%; fill: #fff; opacity: var(--wl-shape-alpha); }
:root.light-mode .wl-card-shape svg { fill: #6b5a4c; }
.wl-card-shape .wl-gap { fill: var(--wl-card); opacity: 1; }
.wl-card-body { position: relative; display: grid; gap: 3px; min-width: 0; flex: 1 1 auto; }
.wl-card-term { font-weight: 900; font-size: 1.25rem; overflow-wrap: anywhere; }
.wl-card-reading { color: var(--wl-muted); font-size: 0.9rem; }
.wl-card-meaning { font-weight: 400; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.wl-card-shelf { color: var(--wl-muted); font-size: 0.8rem; font-weight: 600; }
.wl-card-pic { position: relative; width: 64px; height: 64px; border-radius: 16px; object-fit: cover; flex: 0 0 auto; background: var(--wl-panel); }
.wl-cards--compact { grid-template-columns: 1fr; gap: 6px; }
.wl-cards--compact .wl-card { min-height: 0; padding: 10px 16px; }
.wl-cards--compact .wl-card-term { font-size: 1.05rem; }
.wl-cards--compact .wl-card-shape, .wl-cards--compact .wl-card-pic { display: none; }

/* ── one word ───────────────────────────────────────────────────────────── */
.wl-word { max-width: 860px; }
.wl-word-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-top: 10px; }
.wl-word-term { font-size: clamp(2rem, 7vw, 3.2rem) !important; font-weight: 900 !important; overflow-wrap: anywhere; }
.wl-word-reading { color: var(--wl-muted); margin: 4px 0 0; font-size: 1.1rem; }
.wl-word-meaning { font-size: 1.2rem; margin: 0; overflow-wrap: anywhere; }
.wl-word-pic { display: block; max-width: min(320px, 100%); border-radius: var(--wl-r-card); margin: 14px 0; }
.wl-examples { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.wl-note-form { margin-top: 22px; background: var(--wl-panel); border-radius: var(--wl-r-panel); padding: 18px; }
.wl-word-actions { margin-top: 16px; }
.wl-speak { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--wl-card); font-size: 1.1rem; cursor: pointer; flex: 0 0 auto; }
.wl-speak--big { width: 60px; height: 60px; font-size: 1.5rem; background: var(--wl-indigo); }

/* ── the add sheet ──────────────────────────────────────────────────────── */
.wl-sheet { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: flex-end; justify-content: center; }
.wl-sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
.wl-sheet-card {
  position: relative; width: 100%; max-width: 720px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--wl-panel); border-radius: var(--wl-r-panel) var(--wl-r-panel) 0 0;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
}
.wl-sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--wl-line); margin: 4px auto 10px; }
@media (min-width: 900px) {
  .wl-sheet { align-items: center; }
  .wl-sheet-card { border-radius: var(--wl-r-panel); padding: 20px 28px 28px; }
  .wl-sheet-grip { display: none; }
}
body.wl-sheet-open { overflow: hidden; }
.wl-add-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wl-add-head h2 { margin: 0; font-size: 1.4rem; }
.wl-seg { display: inline-flex; background: var(--wl-card); border-radius: 999px; padding: 4px; margin: 12px 0; }
.wl-seg-btn { border: 0; background: none; color: var(--wl-muted); font: inherit; font-weight: 700; padding: 8px 16px; border-radius: 999px; min-height: 40px; cursor: pointer; }
.wl-seg-btn.is-on { background: var(--wl-indigo); color: #fff; }
.wl-add-word input { font-size: 1.4rem !important; font-weight: 800 !important; min-height: 56px !important; }
.wl-add-where { align-items: end; }
.wl-add-where .wl-inline { flex: 1 1 180px; }
.wl-senses { display: grid; gap: 8px; border: 0; padding: 0; margin: 0; }
.wl-sense { display: flex !important; gap: 10px; align-items: flex-start; grid-template-columns: none; color: var(--wl-text) !important; font-weight: 400 !important; background: var(--wl-card); border-radius: var(--wl-r-key); padding: 10px 12px; cursor: pointer; }
.wl-sense input { margin-top: 4px; accent-color: var(--wl-indigo); }
.wl-add-picrow { display: flex !important; align-items: center; gap: 12px; color: var(--wl-text) !important; }
.wl-add-pic { width: 64px; height: 64px; border-radius: 16px; object-fit: cover; }
.wl-more summary { cursor: pointer; font-weight: 700; min-height: 36px; color: var(--wl-muted); }
.wl-more[open] { display: grid; gap: 12px; }
.wl-add-actions { position: sticky; bottom: -1px; background: var(--wl-panel); padding: 10px 0 4px; }
.wl-add-actions .wl-btn--green { min-width: 140px; font-size: 1.05rem; }
.wl-add-page { max-width: 720px; margin: 0 auto; background: var(--wl-panel); border-radius: var(--wl-r-panel); padding: 20px; }
.wl-add-page .wl-add-actions { position: static; }
.wl-done { font-size: 1.2rem; font-weight: 800; color: var(--wl-green); }

/* ── settings, trash, setup, practice ───────────────────────────────────── */
.wl-links { display: flex; flex-wrap: wrap; gap: 10px; }
.wl-trash { list-style: none; padding: 0; margin: 0; }
.wl-trash-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px; }
.wl-trash-main { flex: 1 1 220px; display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.wl-setup-nav { margin-top: 18px; }
.wl-note { background: var(--wl-card); border-radius: var(--wl-r-key); padding: 10px 14px; }
.wl-practice-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.wl-practice-row { display: flex; align-items: center; gap: 12px; margin: 0; flex-wrap: wrap; }

/* ── toast ──────────────────────────────────────────────────────────────── */
.wl-toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--wl-bar) + 18px + env(safe-area-inset-bottom));
  z-index: 9500; display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  background: var(--wl-text); color: var(--wl-bg); padding: 12px 18px; border-radius: 16px; font-weight: 600;
}
.wl-toast-action { background: none; border: 0; color: #4f43d8; font: inherit; font-weight: 800; cursor: pointer; min-height: 32px; }
:root.light-mode .wl-toast-action { color: #b8b0ff; }
@media (min-width: 900px) { .wl-toast { bottom: 24px; } }

/* ── the add door and the share help ────────────────────────────────────── */
.wl-door { min-height: 100dvh; }
.wl-door-head { padding: 16px clamp(16px, 3vw, 36px); }
.wl-door-head .wl-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.1rem; }
.wl-door-head .wl-brand img { width: 32px; height: 32px; object-fit: contain; }
.wl-body--door .wl-stage { padding-bottom: 48px; }
.wl-share { max-width: 900px; }
.wl-share ol { display: grid; gap: 8px; padding-left: 1.3em; }

@media (prefers-reduced-motion: reduce) { .wl-body * { transition: none !important; animation: none !important; } }

/* ── phase 2: the ring, Home's panels, Practice, the quiz ───────────────── */
.wl-ring {
  --p: 0; display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; flex: 0 0 auto;
  background: radial-gradient(closest-side, var(--wl-panel) 78%, transparent 79% 100%),
    conic-gradient(var(--wl-violet) calc(var(--p) * 1%), var(--wl-card) 0);
  font-size: 0.8rem; font-weight: 800;
}
.wl-ring--big { width: 96px; height: 96px; font-size: 1rem; background: radial-gradient(closest-side, var(--wl-bg) 80%, transparent 81% 100%), conic-gradient(var(--wl-violet) calc(var(--p) * 1%), var(--wl-card) 0); }
.wl-ring--big b { font-size: 1.6rem; line-height: 1; }
.wl-ring--big small { color: var(--wl-muted); }
.wl-ring--big { display: inline-flex; align-items: center; justify-content: center; gap: 1px; }
.wl-home-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wl-home-greet { position: relative; min-width: 0; }
.wl-home-head .wl-ring { position: relative; }
.wl-tile small { font-size: 1rem; font-weight: 700; opacity: 0.85; }
.wl-tile-sub { font-size: 0.85rem; opacity: 0.9; }
.wl-home-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.wl-home-grid .wl-panel { margin: 0; }
.wl-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.wl-seg--small { margin: 0 0 8px; }
.wl-seg--small .wl-seg-btn { min-height: 34px; padding: 4px 12px; font-size: 0.85rem; }
.wl-overview { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wl-overview li { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.wl-overview b { margin-left: auto; font-size: 1.2rem; font-weight: 900; }
.wl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--wl-card); flex: 0 0 auto; }
.wl-dot--learning { background: var(--wl-learning); }
.wl-dot--reviewing { background: var(--wl-reviewing); }
.wl-dot--mastered { background: var(--wl-mastered); }
.wl-bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 120px; }
.wl-bars--month { gap: 2px; }
.wl-bar { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 4px; text-align: center; }
.wl-bar i { align-self: end; display: block; height: max(var(--h), 3px); border-radius: 6px; background: var(--wl-indigo); }
.wl-bar small { font-size: 0.7rem; color: var(--wl-muted); min-height: 1em; }

.wl-today { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.wl-today-n { font-size: 1.3rem; font-weight: 800; margin: 0; }
.wl-btn--big { min-height: 54px; padding: 12px 30px; font-size: 1.1rem; }
.wl-mode-tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 18px; }
.wl-mode-tile {
  display: grid; gap: 4px; text-align: left; padding: 16px; border-radius: var(--wl-r-card); border: 0;
  background: var(--wl-panel); color: var(--wl-text); font: inherit; cursor: pointer; min-height: 96px;
}
.wl-mode-tile:hover { filter: brightness(1.08); }
.wl-mode-tile:disabled { opacity: 0.5; cursor: default; }
.wl-mode-tile small { color: var(--wl-muted); }
.wl-mode-ic { font-size: 1.4rem; }

/* The quiz: a full-bleed indigo header, the dark sheet rising over it. */
body.wl-in-quiz .wl-stage { padding: 0 0 calc(var(--wl-bar) + 20px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { body.wl-in-quiz .wl-stage { padding: 0 0 40px; } }
.wl-quiz-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--wl-sunset); color: #fff; padding: 64px clamp(16px, 3vw, 36px) 56px;
}
@media (min-width: 900px) { .wl-quiz-head { padding-top: 56px; } }
.wl-quiz-close { background: rgba(255, 255, 255, 0.18); color: #fff; }
.wl-quiz-mode { font-weight: 800; font-size: 1.1rem; flex: 1 1 auto; text-align: center; }
.wl-quiz-head .wl-ring { background: radial-gradient(closest-side, #4f43d8 78%, transparent 79% 100%), conic-gradient(#fff calc(var(--p) * 1%), rgba(255, 255, 255, 0.25) 0); color: #fff; }
.wl-quiz-sheet {
  position: relative; margin: -32px auto 0; max-width: 720px; background: var(--wl-bg);
  border-radius: var(--wl-r-panel) var(--wl-r-panel) 0 0; padding: 22px clamp(16px, 3vw, 28px) 20px; display: grid; gap: 14px;
}
.wl-q-card { background: var(--wl-panel); border-radius: var(--wl-r-panel); padding: 22px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.wl-q-label { margin: 0; color: var(--wl-muted); font-weight: 600; }
.wl-q-prompt { font-size: 1.25rem; overflow-wrap: anywhere; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.wl-q-term { font-size: clamp(1.8rem, 7vw, 2.6rem); font-weight: 900; }
.wl-q-sentence { font-size: 1.25rem; line-height: 1.5; }
.wl-q-pic { width: 120px; height: 120px; object-fit: cover; border-radius: 18px; }
.wl-choices { display: grid; gap: 10px; }
.wl-choice {
  min-height: 56px; padding: 12px 18px; border-radius: var(--wl-r-card); border: 2px solid transparent;
  background: var(--wl-card); color: var(--wl-text); font: inherit; font-size: 1.05rem; text-align: left; cursor: pointer;
}
.wl-choice:hover:not(:disabled) { filter: brightness(1.1); }
.wl-choice.is-right { border-color: var(--wl-green); background: rgba(63, 191, 135, 0.18); }
.wl-choice.is-wrong { border-color: var(--wl-danger); opacity: 0.55; text-decoration: line-through; }
.wl-choice.is-answer { border-color: var(--wl-green); }
.wl-feedback { min-height: 1.4em; margin: 0; text-align: center; font-weight: 700; }
.wl-feedback.is-right { color: var(--wl-green); }
.wl-feedback.is-wrong { color: var(--wl-danger); }
.wl-q-continue { justify-self: center; min-width: 160px; }
.wl-slots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.wl-slot { display: grid; place-items: center; min-width: 44px; height: 52px; padding: 0 6px; border-radius: var(--wl-r-key); background: var(--wl-panel); border-bottom: 3px solid var(--wl-line); font-size: 1.5rem; font-weight: 800; }
.wl-slot.is-filled { border-bottom-color: var(--wl-violet); }
.wl-slot--space { min-width: 16px; background: none; border: 0; }
.wl-tiles-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.wl-tile-key { min-width: 52px; height: 52px; padding: 0 10px; border-radius: var(--wl-r-key); border: 0; background: var(--wl-indigo); color: #fff; font: inherit; font-size: 1.4rem; font-weight: 800; cursor: pointer; }
.wl-tile-key:disabled { opacity: 0.25; cursor: default; }
.wl-tile-tools { justify-content: center; margin-top: 10px; }
.wl-type { display: flex; gap: 10px; }
.wl-type input { font-size: 1.3rem !important; font-weight: 700; }
.wl-q-done h1 { color: var(--wl-violet); }
.wl-big { font-size: 1.3rem; font-weight: 800; margin: 0; }
.wl-miss-list { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }

/* The AI meaning and photo buttons under the meaning, and the photo picker. */
.wl-add-helpers { gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.wl-photo-picker { margin: 8px 0; }
.wl-photo-search { gap: 8px; flex-wrap: wrap; }
.wl-photo-search input { flex: 1 1 160px; min-width: 0; }
.wl-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-top: 8px; }
.wl-photo { display: flex; flex-direction: column; gap: 4px; padding: 4px; border: 2px solid transparent; border-radius: 14px; background: none; color: inherit; cursor: pointer; text-align: left; }
.wl-photo:hover, .wl-photo:focus-visible { border-color: var(--wl-indigo); }
.wl-photo img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 10px; display: block; }
.wl-photo-credit { font-size: 0.75rem; opacity: 0.75; overflow-wrap: anywhere; }
.wl-photo-credit a { color: inherit; }

/* ✨ Fill in with AI (views/ai-fill.js, 2026-11-28) */
.wl-fill-host { margin: 10px 0; }
.wl-fill .wl-check { display: flex; color: var(--wl-text); font-size: 1rem; }
.wl-fill-title { font-size: 1.1rem; margin: 0 0 8px; }
.wl-fill-pics { border: 0; padding: 0; margin: 6px 0; }
.wl-fill-pics legend, .wl-fill-label { font-weight: 600; margin: 8px 0 2px; padding: 0; }
