/* ═══════════════════════════════════════════════
   Word Finder — styles.css
   Mobile-first, theme-switchable via CSS variables
   ═══════════════════════════════════════════════ */

/* ── Theme: Midnight (default) ── */
[data-theme="midnight"] {
  --bg-primary: #0e0e18;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #16213e;
  --surface: rgba(255,255,255,0.04);
  --surface-border: rgba(255,255,255,0.06);
  --surface-hover: rgba(255,255,255,0.08);
  --input-bg: rgba(0,0,0,0.3);
  --input-border: rgba(255,255,255,0.1);
  --text-primary: #e0e0e8;
  --text-secondary: #9a9ab0;
  --text-muted: #6a6a7e;
  --text-faint: #4a4a5e;
  --accent: #6C63FF;
  --accent-glow: #e040fb;
  --accent-soft: rgba(108,99,255,0.15);
  --accent-border: rgba(108,99,255,0.3);
  --accent-text: #b0a8ff;
  --error: #ff6b6b;
  --word-bg: rgba(255,255,255,0.04);
  --word-text: #c8c8d8;
  --word-active-bg: rgba(108,99,255,0.15);
  --word-active-border: rgba(108,99,255,0.4);
  --word-active-text: #e0d8ff;
  --chip-bg: rgba(255,255,255,0.05);
  --chip-border: rgba(255,255,255,0.08);
  --chip-active-bg: rgba(108,99,255,0.2);
  --chip-active-border: rgba(108,99,255,0.5);
  --switch-off: #3a3a4a;
  --popover-bg: linear-gradient(160deg, #1e1e32, #161628);
  --popover-border: rgba(108,99,255,0.3);
  --popover-shadow: 0 12px 48px rgba(0,0,0,0.6);
  --title-gradient: linear-gradient(90deg, #e0e0e8, #a0a0c0);
  --logo-gradient: linear-gradient(135deg, #6C63FF, #e040fb);
  --btn-gradient: linear-gradient(135deg, #6C63FF, #5a52e0);
  --example-border: rgba(108,99,255,0.2);
  --source-text: #444;
  --group-header-border: rgba(255,255,255,0.05);
  --menu-bg: rgba(20,20,36,0.97);
}

/* ── Theme: Ocean Breeze ── */
[data-theme="ocean"] {
  --bg-primary: #0a1628;
  --bg-secondary: #0f2035;
  --bg-tertiary: #132a3e;
  --surface: rgba(255,255,255,0.05);
  --surface-border: rgba(100,180,220,0.1);
  --surface-hover: rgba(100,180,220,0.12);
  --input-bg: rgba(0,10,20,0.4);
  --input-border: rgba(100,180,220,0.15);
  --text-primary: #d8eaf5;
  --text-secondary: #8ab4cc;
  --text-muted: #5a8aa0;
  --text-faint: #3a6a80;
  --accent: #22b8cf;
  --accent-glow: #15aabf;
  --accent-soft: rgba(34,184,207,0.12);
  --accent-border: rgba(34,184,207,0.3);
  --accent-text: #63e6e2;
  --error: #ff7b7b;
  --word-bg: rgba(34,184,207,0.06);
  --word-text: #b0d8e8;
  --word-active-bg: rgba(34,184,207,0.15);
  --word-active-border: rgba(34,184,207,0.4);
  --word-active-text: #c0f0f0;
  --chip-bg: rgba(34,184,207,0.08);
  --chip-border: rgba(34,184,207,0.12);
  --chip-active-bg: rgba(34,184,207,0.2);
  --chip-active-border: rgba(34,184,207,0.45);
  --switch-off: #1a3a4a;
  --popover-bg: linear-gradient(160deg, #0f2035, #0a1628);
  --popover-border: rgba(34,184,207,0.3);
  --popover-shadow: 0 12px 48px rgba(0,0,0,0.5);
  --title-gradient: linear-gradient(90deg, #d8eaf5, #8ab4cc);
  --logo-gradient: linear-gradient(135deg, #22b8cf, #15aabf);
  --btn-gradient: linear-gradient(135deg, #22b8cf, #1a9aaa);
  --example-border: rgba(34,184,207,0.2);
  --source-text: #3a5a6a;
  --group-header-border: rgba(100,180,220,0.08);
  --menu-bg: rgba(10,22,40,0.97);
}

/* ── Theme: Ember ── */
[data-theme="ember"] {
  --bg-primary: #1a0e0a;
  --bg-secondary: #241410;
  --bg-tertiary: #2e1a14;
  --surface: rgba(255,180,120,0.05);
  --surface-border: rgba(255,140,80,0.1);
  --surface-hover: rgba(255,140,80,0.12);
  --input-bg: rgba(10,5,0,0.4);
  --input-border: rgba(255,140,80,0.15);
  --text-primary: #f0dcd0;
  --text-secondary: #c09878;
  --text-muted: #8a6a50;
  --text-faint: #6a5040;
  --accent: #f76707;
  --accent-glow: #fd7e14;
  --accent-soft: rgba(247,103,7,0.12);
  --accent-border: rgba(247,103,7,0.3);
  --accent-text: #ffaa60;
  --error: #ff6b6b;
  --word-bg: rgba(247,103,7,0.06);
  --word-text: #d8b8a0;
  --word-active-bg: rgba(247,103,7,0.15);
  --word-active-border: rgba(247,103,7,0.4);
  --word-active-text: #ffd0a0;
  --chip-bg: rgba(247,103,7,0.08);
  --chip-border: rgba(247,103,7,0.12);
  --chip-active-bg: rgba(247,103,7,0.2);
  --chip-active-border: rgba(247,103,7,0.45);
  --switch-off: #3a2a1a;
  --popover-bg: linear-gradient(160deg, #241410, #1a0e0a);
  --popover-border: rgba(247,103,7,0.3);
  --popover-shadow: 0 12px 48px rgba(0,0,0,0.6);
  --title-gradient: linear-gradient(90deg, #f0dcd0, #c09878);
  --logo-gradient: linear-gradient(135deg, #f76707, #fd7e14);
  --btn-gradient: linear-gradient(135deg, #f76707, #d95a06);
  --example-border: rgba(247,103,7,0.2);
  --source-text: #5a4030;
  --group-header-border: rgba(255,140,80,0.08);
  --menu-bg: rgba(26,14,10,0.97);
}

/* ── Theme: Sage (light) ── */
[data-theme="sage"] {
  --bg-primary: #f4f1ec;
  --bg-secondary: #eae6df;
  --bg-tertiary: #e0dbd3;
  --surface: rgba(0,0,0,0.03);
  --surface-border: rgba(0,0,0,0.07);
  --surface-hover: rgba(0,0,0,0.06);
  --input-bg: #fff;
  --input-border: rgba(0,0,0,0.12);
  --text-primary: #2c2c2c;
  --text-secondary: #5a5a5a;
  --text-muted: #888;
  --text-faint: #aaa;
  --accent: #5a7a5a;
  --accent-glow: #6b8f6b;
  --accent-soft: rgba(90,122,90,0.1);
  --accent-border: rgba(90,122,90,0.3);
  --accent-text: #4a6a4a;
  --error: #c0392b;
  --word-bg: rgba(90,122,90,0.06);
  --word-text: #3c3c3c;
  --word-active-bg: rgba(90,122,90,0.12);
  --word-active-border: rgba(90,122,90,0.35);
  --word-active-text: #2a4a2a;
  --chip-bg: rgba(0,0,0,0.04);
  --chip-border: rgba(0,0,0,0.08);
  --chip-active-bg: rgba(90,122,90,0.12);
  --chip-active-border: rgba(90,122,90,0.4);
  --switch-off: #c0bbb3;
  --popover-bg: linear-gradient(160deg, #fff, #f8f6f2);
  --popover-border: rgba(90,122,90,0.25);
  --popover-shadow: 0 8px 32px rgba(0,0,0,0.12);
  --title-gradient: linear-gradient(90deg, #2c2c2c, #5a5a5a);
  --logo-gradient: linear-gradient(135deg, #5a7a5a, #6b8f6b);
  --btn-gradient: linear-gradient(135deg, #5a7a5a, #4e6e4e);
  --example-border: rgba(90,122,90,0.2);
  --source-text: #aaa;
  --group-header-border: rgba(0,0,0,0.06);
  --menu-bg: rgba(244,241,236,0.97);
}

/* ── Theme: Slate (default — softer dark) ── */
[data-theme="slate"] {
  --bg-primary: #1c2130;
  --bg-secondary: #242a3d;
  --bg-tertiary: #2a3248;
  --surface: rgba(255,255,255,0.05);
  --surface-border: rgba(255,255,255,0.08);
  --surface-hover: rgba(255,255,255,0.10);
  --input-bg: rgba(0,0,0,0.25);
  --input-border: rgba(255,255,255,0.12);
  --text-primary: #dce0ea;
  --text-secondary: #9aa0b8;
  --text-muted: #6c7290;
  --text-faint: #4e5470;
  --accent: #7c8db0;
  --accent-glow: #a0b0cc;
  --accent-soft: rgba(124,141,176,0.14);
  --accent-border: rgba(124,141,176,0.3);
  --accent-text: #adb8d4;
  --error: #f07070;
  --word-bg: rgba(124,141,176,0.06);
  --word-text: #c0c6d8;
  --word-active-bg: rgba(124,141,176,0.15);
  --word-active-border: rgba(124,141,176,0.4);
  --word-active-text: #d8ddef;
  --chip-bg: rgba(255,255,255,0.05);
  --chip-border: rgba(255,255,255,0.09);
  --chip-active-bg: rgba(124,141,176,0.18);
  --chip-active-border: rgba(124,141,176,0.45);
  --switch-off: #3a3f52;
  --popover-bg: linear-gradient(160deg, #252b3e, #1c2130);
  --popover-border: rgba(124,141,176,0.3);
  --popover-shadow: 0 12px 48px rgba(0,0,0,0.5);
  --title-gradient: linear-gradient(90deg, #dce0ea, #9aa0b8);
  --logo-gradient: linear-gradient(135deg, #7c8db0, #a0b0cc);
  --btn-gradient: linear-gradient(135deg, #7c8db0, #6a7a9e);
  --example-border: rgba(124,141,176,0.2);
  --source-text: #4a5068;
  --group-header-border: rgba(255,255,255,0.06);
  --menu-bg: rgba(28,33,48,0.97);
}

/* ── Theme: Rosé ── */
[data-theme="rose"] {
  --bg-primary: #1e1018;
  --bg-secondary: #2a1620;
  --bg-tertiary: #341c28;
  --surface: rgba(255,200,210,0.05);
  --surface-border: rgba(232,120,138,0.1);
  --surface-hover: rgba(232,120,138,0.12);
  --input-bg: rgba(10,0,5,0.35);
  --input-border: rgba(232,120,138,0.15);
  --text-primary: #f0dce0;
  --text-secondary: #c0909a;
  --text-muted: #8a6070;
  --text-faint: #6a4858;
  --accent: #e8788a;
  --accent-glow: #f08898;
  --accent-soft: rgba(232,120,138,0.12);
  --accent-border: rgba(232,120,138,0.3);
  --accent-text: #f0a0b0;
  --error: #ff6b6b;
  --word-bg: rgba(232,120,138,0.06);
  --word-text: #d8b8c0;
  --word-active-bg: rgba(232,120,138,0.15);
  --word-active-border: rgba(232,120,138,0.4);
  --word-active-text: #ffd0d8;
  --chip-bg: rgba(232,120,138,0.08);
  --chip-border: rgba(232,120,138,0.12);
  --chip-active-bg: rgba(232,120,138,0.2);
  --chip-active-border: rgba(232,120,138,0.45);
  --switch-off: #3a2028;
  --popover-bg: linear-gradient(160deg, #2a1620, #1e1018);
  --popover-border: rgba(232,120,138,0.3);
  --popover-shadow: 0 12px 48px rgba(0,0,0,0.6);
  --title-gradient: linear-gradient(90deg, #f0dce0, #c0909a);
  --logo-gradient: linear-gradient(135deg, #e8788a, #c06080);
  --btn-gradient: linear-gradient(135deg, #e8788a, #c06878);
  --example-border: rgba(232,120,138,0.2);
  --source-text: #5a3848;
  --group-header-border: rgba(232,120,138,0.08);
  --menu-bg: rgba(30,16,24,0.97);
}

/* ── Theme: Aurora ── */
[data-theme="aurora"] {
  --bg-primary: #0e1a10;
  --bg-secondary: #14241a;
  --bg-tertiary: #1a2e20;
  --surface: rgba(168,224,99,0.05);
  --surface-border: rgba(86,171,47,0.1);
  --surface-hover: rgba(86,171,47,0.12);
  --input-bg: rgba(0,10,0,0.35);
  --input-border: rgba(86,171,47,0.15);
  --text-primary: #d8f0d0;
  --text-secondary: #90c080;
  --text-muted: #608050;
  --text-faint: #486040;
  --accent: #56ab2f;
  --accent-glow: #a8e063;
  --accent-soft: rgba(86,171,47,0.12);
  --accent-border: rgba(86,171,47,0.3);
  --accent-text: #90d860;
  --error: #ff7b7b;
  --word-bg: rgba(86,171,47,0.06);
  --word-text: #b8d8a8;
  --word-active-bg: rgba(86,171,47,0.15);
  --word-active-border: rgba(86,171,47,0.4);
  --word-active-text: #c8f0a0;
  --chip-bg: rgba(86,171,47,0.08);
  --chip-border: rgba(86,171,47,0.12);
  --chip-active-bg: rgba(86,171,47,0.2);
  --chip-active-border: rgba(86,171,47,0.45);
  --switch-off: #1a2a18;
  --popover-bg: linear-gradient(160deg, #14241a, #0e1a10);
  --popover-border: rgba(86,171,47,0.3);
  --popover-shadow: 0 12px 48px rgba(0,0,0,0.5);
  --title-gradient: linear-gradient(90deg, #d8f0d0, #90c080);
  --logo-gradient: linear-gradient(135deg, #56ab2f, #a8e063);
  --btn-gradient: linear-gradient(135deg, #56ab2f, #48952a);
  --example-border: rgba(86,171,47,0.2);
  --source-text: #3a5830;
  --group-header-border: rgba(86,171,47,0.08);
  --menu-bg: rgba(14,26,16,0.97);
}


/* ═══════════════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════════════ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg-primary);
  font-family: 'Outfit', sans-serif;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.35s ease, color 0.35s ease;
}


/* ═══════════════════════════════════════════════
   Animations
   ═══════════════════════════════════════════════ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ═══════════════════════════════════════════════
   Layout
   ═══════════════════════════════════════════════ */
.wf-page {
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(145deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
  display: flex;
  justify-content: center;
  padding: 20px 12px 40px;
  transition: background 0.35s ease;
}

.wf-container {
  width: 100%;
  max-width: 640px;
}


/* ═══════════════════════════════════════════════
   Header
   ═══════════════════════════════════════════════ */
.wf-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.wf-logo {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--logo-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  flex-shrink: 0;
}

.wf-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.wf-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 300;
}

/* Theme toggle button in header */
.wf-header-right {
  margin-left: auto;
  position: relative;
}

.wf-theme-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.wf-theme-btn:hover,
.wf-theme-btn:active {
  background: var(--surface-hover);
}


/* ═══════════════════════════════════════════════
   Theme Menu
   ═══════════════════════════════════════════════ */
.wf-theme-menu {
  position: absolute;
  top: 46px;
  right: 0;
  background: var(--menu-bg);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--popover-shadow);
  z-index: 100;
  animation: popIn 0.15s ease-out;
  min-width: 170px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.wf-theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: none;
  width: 100%;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.wf-theme-option:hover,
.wf-theme-option:active {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.wf-theme-option.active {
  color: var(--accent-text);
}

.wf-theme-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(128,128,128,0.2);
}

.wf-theme-option.active .wf-theme-swatch {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}


/* ═══════════════════════════════════════════════
   Input Area
   ═══════════════════════════════════════════════ */
.wf-input-area {
  background: var(--surface);
  border-radius: 14px;
  padding: 18px;
  border: 1px solid var(--surface-border);
  margin-bottom: 16px;
  transition: background 0.3s, border-color 0.3s;
}

.wf-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.wf-input {
  flex: 1;
  min-width: 0;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 17px;
  font-family: 'DM Mono', monospace;
  color: var(--text-primary);
  outline: none;
  letter-spacing: 0.06em;
  transition: border-color 0.2s;
}

.wf-input:focus {
  border-color: var(--accent);
}

.wf-input::placeholder {
  color: var(--text-faint);
}

.wf-submit-btn {
  background: var(--btn-gradient);
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.wf-submit-btn:active {
  transform: scale(0.97);
}

.wf-clear-btn {
  background: var(--surface-hover);
  border: none;
  border-radius: 10px;
  padding: 12px 13px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.wf-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 8px;
}


/* ═══════════════════════════════════════════════
   Letter Tiles
   ═══════════════════════════════════════════════ */
.wf-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.wf-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  font-family: 'DM Mono', monospace;
  font-weight: 500;
  font-size: 15px;
  color: var(--accent-text);
  transition: background 0.2s;
}


/* ═══════════════════════════════════════════════
   Toggle Switch (Reuse letters)
   ═══════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════
   Controls Row (toggle + min/max)
   ═══════════════════════════════════════════════ */
.wf-controls-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.wf-length-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.wf-len-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.wf-len-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.wf-len-input {
  width: 48px;
  padding: 6px 4px;
  text-align: center;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 7px;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  -moz-appearance: textfield;
}

.wf-len-input::-webkit-outer-spin-button,
.wf-len-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.wf-len-input:focus {
  border-color: var(--accent);
}

.wf-len-dash {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 12px;
}

.wf-len-suffix {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 12px;
}

.wf-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.wf-switch {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  background: var(--switch-off);
  flex-shrink: 0;
}

.wf-switch.on {
  background: var(--accent);
}

.wf-switch-knob {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.wf-switch.on .wf-switch-knob {
  transform: translateX(18px);
}

.wf-toggle-label {
  font-size: 14px;
  color: var(--text-secondary);
  user-select: none;
}


/* ═══════════════════════════════════════════════
   Filter Chips
   ═══════════════════════════════════════════════ */
.wf-filter-bar {
  margin-bottom: 16px;
}

.wf-filter-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  margin-bottom: 8px;
  display: block;
}

.wf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wf-chip {
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 20px;
  padding: 6px 12px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-weight: 400;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.wf-chip.active {
  background: var(--chip-active-bg);
  border-color: var(--chip-active-border);
  color: var(--accent-text);
  font-weight: 500;
}


/* ═══════════════════════════════════════════════
   Results
   ═══════════════════════════════════════════════ */
.wf-results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wf-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  padding: 36px 16px;
}

.wf-group {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  overflow: hidden;
  animation: fadeIn 0.25s ease-out;
  transition: background 0.3s, border-color 0.3s;
}

.wf-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--group-header-border);
}

.wf-group-len {
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  font-weight: 500;
  color: var(--accent);
  width: 26px;
}

.wf-group-label {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
}

.wf-group-count {
  font-size: 12px;
  color: var(--text-faint);
  font-family: 'DM Mono', monospace;
}

.wf-word-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 12px 14px;
}

.wf-word {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--word-bg);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--word-text);
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.wf-word:hover {
  background: var(--accent-soft);
}

.wf-word.active {
  background: var(--word-active-bg);
  border-color: var(--word-active-border);
  color: var(--word-active-text);
}


/* ═══════════════════════════════════════════════
   Hint (empty state)
   ═══════════════════════════════════════════════ */
.wf-hint {
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
  padding: 48px 16px;
  line-height: 1.7;
}

.wf-hint strong {
  color: var(--text-muted);
}

.wf-hint-sub {
  color: var(--text-faint);
  font-size: 12px;
}


/* ═══════════════════════════════════════════════
   Definition Popover
   ═══════════════════════════════════════════════ */
.wf-popover {
  background: var(--popover-bg);
  border: 1px solid var(--popover-border);
  border-radius: 14px;
  box-shadow: var(--popover-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: 'Outfit', sans-serif;
  animation: popIn 0.18s ease-out;
  position: fixed;
  z-index: 9999;
}

.wf-pop-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--surface-border);
}

.wf-pop-word {
  font-family: 'DM Mono', monospace;
  font-weight: 500;
  font-size: 17px;
  color: var(--text-primary);
  text-transform: lowercase;
}

.wf-pop-phonetic {
  font-size: 13px;
  color: var(--accent);
  font-style: italic;
  flex: 1;
}

.wf-pop-close {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  margin-left: auto;
  -webkit-tap-highlight-color: transparent;
}

.wf-pop-body {
  padding: 10px 14px 12px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.wf-pop-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px 0;
}

.wf-pop-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.wf-pop-error {
  color: var(--error);
  font-size: 13px;
  padding: 8px 0;
}

.wf-pop-def {
  margin-bottom: 10px;
  line-height: 1.5;
}

.wf-pop-pos {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 8px;
  text-transform: lowercase;
  font-style: italic;
}

.wf-pop-def-text {
  color: var(--word-text);
  font-size: 13px;
}

.wf-pop-example {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  margin-top: 3px;
  padding-left: 12px;
  border-left: 2px solid var(--example-border);
}

.wf-pop-source {
  font-size: 10px;
  color: var(--source-text);
  text-align: center;
  padding: 6px 14px 8px;
  border-top: 1px solid var(--surface-border);
}


/* ═══════════════════════════════════════════════
   About Section
   ═══════════════════════════════════════════════ */
.wf-about {
  margin-top: 40px;
  padding: 24px 20px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  transition: background 0.3s, border-color 0.3s;
}

.wf-about-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.wf-about-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

.wf-about-text:last-child {
  margin-bottom: 0;
}

.wf-about-text strong {
  color: var(--text-primary);
  font-weight: 500;
}


/* ═══════════════════════════════════════════════
   Responsive — Tablet
   ═══════════════════════════════════════════════ */
@media (min-width: 480px) {
  .wf-page {
    padding: 32px 16px 48px;
  }

  .wf-header {
    margin-bottom: 32px;
  }

  .wf-logo {
    width: 48px;
    height: 48px;
    font-size: 24px;
    border-radius: 12px;
  }

  .wf-title {
    font-size: 28px;
  }

  .wf-subtitle {
    font-size: 14px;
  }

  .wf-input-area {
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 20px;
  }

  .wf-input {
    padding: 12px 16px;
    font-size: 18px;
  }

  .wf-submit-btn {
    padding: 12px 24px;
  }

  .wf-tile {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .wf-group {
    border-radius: 14px;
  }

  .wf-group-header {
    padding: 12px 18px;
  }

  .wf-group-len {
    font-size: 20px;
    width: 28px;
  }

  .wf-word-grid {
    gap: 6px;
    padding: 14px 18px;
  }

  .wf-word {
    font-size: 14px;
    padding: 4px 12px;
  }

  .wf-results {
    gap: 20px;
  }
}


/* ═══════════════════════════════════════════════
   Responsive — Mobile-specific touch
   ═══════════════════════════════════════════════ */
@media (max-width: 479px) {
  .wf-popover {
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-height: 55vh !important;
  }

  .wf-chip {
    padding: 7px 11px;
    font-size: 12px;
  }

  .wf-word {
    padding: 5px 9px;
    font-size: 12px;
  }

  .wf-theme-menu {
    right: -4px;
  }

  .wf-controls-row {
    gap: 12px;
  }

  .wf-length-controls {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
}


/* ═══════════════════════════════════════════════
   Touch — larger tap targets on mobile
   ═══════════════════════════════════════════════ */
@media (hover: none) and (pointer: coarse) {
  .wf-word {
    padding: 7px 11px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
  }

  .wf-chip {
    padding: 9px 14px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
  }

  .wf-theme-btn {
    width: 42px;
    height: 42px;
  }

  .wf-pop-close {
    padding: 8px 12px;
  }
}
