/* ══════════════════════════════════════════
   REMAO — Stylesheet v2
   Aesthetic: Refined editorial with ink-press warmth
   Fonts: Fraunces + IBM Plex Mono + DM Sans
══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,700;0,9..144,900;1,9..144,400&family=IBM+Plex+Mono:wght@400;500;600&family=DM+Sans:wght@400;500;600;700&display=swap');

/* ── Tokens ── */
:root {
  --bg:        #f6f2ea;
  --bg2:       #eee9de;
  --bg3:       #e5dfd1;
  --surface:   #fdfaf4;
  --surface2:  #f9f5ed;
  --border:    #d8d0c0;
  --border2:   #c8bfaa;
  --text:      #1a1612;
  --text2:     #4a4438;
  --text3:     #847c6e;
  --accent:    #b5311c;
  --accent2:   #d44228;
  --accent-bg: #fdf0ed;
  --accent-glow: rgba(181, 49, 28, 0.12);
  --gold:      #b08a20;
  --gold-bg:   #fdf8e8;
  --teal:      #1d7a6e;
  --mono:      'IBM Plex Mono', monospace;
  --sans:      'DM Sans', sans-serif;
  --serif:     'Fraunces', serif;
  --r:         10px;
  --r2:        18px;
  --r3:        24px;
  --shadow:    0 2px 16px rgba(26,22,18,.07), 0 1px 4px rgba(26,22,18,.05);
  --shadow2:   0 12px 40px rgba(26,22,18,.12), 0 4px 12px rgba(26,22,18,.06);
  --shadow3:   0 24px 64px rgba(26,22,18,.16), 0 8px 24px rgba(26,22,18,.08);
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg:        #100f0c;
  --bg2:       #181612;
  --bg3:       #201e18;
  --surface:   #1c1a15;
  --surface2:  #201e18;
  --border:    #2c2920;
  --border2:   #3a362c;
  --text:      #f0ebe0;
  --text2:     #b0a898;
  --text3:     #7a7264;
  --accent:    #d84e38;
  --accent2:   #e86a56;
  --accent-bg: #2a1410;
  --accent-glow: rgba(216, 78, 56, 0.15);
  --gold:      #c8a030;
  --gold-bg:   #1e1a0c;
  --teal:      #28a090;
  --shadow:    0 2px 16px rgba(0,0,0,.4), 0 1px 4px rgba(0,0,0,.3);
  --shadow2:   0 12px 40px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.3);
  --shadow3:   0 24px 64px rgba(0,0,0,.6), 0 8px 24px rgba(0,0,0,.4);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

/* Smooth theme transitions on EVERYTHING */
*,
*::before,
*::after {
  transition:
    background-color 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    border-color     0.45s cubic-bezier(0.4, 0, 0.2, 1),
    color            0.35s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow       0.35s cubic-bezier(0.4, 0, 0.2, 1),
    fill             0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Don't slow down transform-based animations */
button, a, .dict-card, .quick-card, .az-btn, .nav-links a,
.brand-mark, .dictionary-link, #translateButton, .secondary-button,
.theme-toggle, .swap-button, .dialog-close {
  transition:
    background-color 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    border-color     0.45s cubic-bezier(0.4, 0, 0.2, 1),
    color            0.35s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow       0.28s cubic-bezier(0.4, 0, 0.2, 1),
    transform        0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity          0.22s ease;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ── Theme transition overlay flash ── */
body.theme-transitioning::after {
  content: '';
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none;
  animation: themeFlash 0.45s ease forwards;
}
@keyframes themeFlash {
  0%   { opacity: 0.18; background: var(--bg); }
  50%  { opacity: 0.08; }
  100% { opacity: 0; }
}

/* ── Noise texture overlay ── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* ── Header ── */
.site-header {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .875rem 2.5rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  transition: background var(--transition), border-color var(--transition);
}

.brand {
  display: flex; align-items: center; gap: .65rem;
  text-decoration: none; color: var(--text);
  font-family: var(--serif); font-weight: 700; font-size: 1.05rem;
  letter-spacing: -0.01em;
  transition: opacity var(--transition);
}
.brand:hover { opacity: 0.75; }
.brand-mark {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 900; font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--accent-glow), 0 1px 3px rgba(0,0,0,.15);
  transition: transform var(--transition), box-shadow var(--transition);
}
.brand:hover .brand-mark { transform: rotate(-4deg) scale(1.05); box-shadow: 0 4px 16px var(--accent-glow); }

.nav-links { display: flex; gap: .2rem; margin-left: auto; }
.nav-links a {
  padding: .42rem 1rem;
  border-radius: 8px;
  font-size: .84rem; font-weight: 500;
  color: var(--text2); text-decoration: none;
  transition: all var(--transition);
  position: relative;
}
.nav-links a:hover { background: var(--bg2); color: var(--text); }
.nav-links a.active {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ── Theme Toggle — pill switch ── */
.theme-toggle {
  position: relative;
  width: 72px; height: 34px;
  border: none;
  border-radius: 34px;
  background: var(--bg3);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  box-shadow: inset 0 1px 4px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.08);
  overflow: visible;
}
[data-theme="dark"] .theme-toggle {
  background: #2a2820;
  box-shadow: inset 0 1px 4px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
}

/* The sliding knob */
.theme-toggle::before {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff8e8 0%, #f0e8d0 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,.18), 0 1px 3px rgba(0,0,0,.12);
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.35s ease,
              box-shadow 0.25s ease;
}
[data-theme="dark"] .theme-toggle::before {
  transform: translateX(38px);
  background: linear-gradient(145deg, #3a3830 0%, #252318 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,.5), 0 1px 3px rgba(0,0,0,.3);
}

/* Sun icon (light mode) */
.sun-icon {
  position: absolute;
  left: 9px; top: 50%;
  transform: translateY(-50%);
  font-size: 13px; line-height: 1;
  transition: opacity 0.25s ease, transform 0.3s ease;
  pointer-events: none;
}
[data-theme="dark"] .sun-icon {
  opacity: 0; transform: translateY(-50%) scale(0.5);
}

/* Moon icon (dark mode) */
.moon-icon {
  position: absolute;
  right: 9px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px; line-height: 1;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.3s ease;
  pointer-events: none;
}
[data-theme="dark"] .moon-icon {
  opacity: 1; transform: translateY(-50%) scale(1);
}

/* Press-down feel */
.theme-toggle:active::before {
  transform: translateX(2px) scaleX(1.1);
}
[data-theme="dark"] .theme-toggle:active::before {
  transform: translateX(36px) scaleX(1.1);
}
.theme-toggle:hover {
  box-shadow: inset 0 1px 4px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.14);
}


/* ── App shell ── */
.app-shell { max-width: 1140px; margin: 0 auto; padding: 2.5rem 2.5rem 5rem; position: relative; z-index: 1; }

/* ── Eyebrow ── */
.eyebrow {
  font-family: var(--mono); font-size: .7rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .5rem;
  display: flex; align-items: center; gap: .5rem;
}
.eyebrow::before {
  content: ''; display: block;
  width: 16px; height: 2px;
  background: var(--accent); border-radius: 2px;
}

/* ── Fade-in animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: none; }
}

.hero-panel, .translator-panel, .quick-panel,
.dictionary-hero, .sticky-search, .dictionary-results {
  animation: fadeUp .5s ease both;
}
.translator-panel { animation-delay: .08s; }
.quick-panel { animation-delay: .16s; }
.dictionary-layout { animation-delay: .1s; }

/* ══════════════════════════════════════════
   TRANSLATOR PAGE
══════════════════════════════════════════ */

.translator-shell { display: flex; flex-direction: column; gap: 2rem; }

/* Hero panel */
.hero-panel {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem;
  padding: 2.75rem 3.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.hero-panel::before {
  content: 'R';
  position: absolute; right: -1.5rem; top: -2.5rem;
  font-family: var(--serif); font-size: 16rem; font-weight: 900;
  color: var(--border); line-height: 1;
  pointer-events: none; user-select: none;
  opacity: .6;
}
.hero-panel::after {
  content: '';
  position: absolute; left: 0; bottom: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--gold) 50%, var(--teal) 100%);
  opacity: .5;
}
.title-area h1 {
  font-family: var(--serif); font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 900; line-height: 1.1; margin-bottom: .65rem;
  max-width: 520px; letter-spacing: -0.02em;
}
.title-area p { color: var(--text2); font-size: .9rem; max-width: 480px; line-height: 1.7; }

.dictionary-link {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.4rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  border-radius: 10px; text-decoration: none;
  font-size: .85rem; font-weight: 600; white-space: nowrap;
  transition: all var(--transition); flex-shrink: 0;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.dictionary-link::after { content: '→'; transition: transform var(--transition); }
.dictionary-link:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--accent-glow); }
.dictionary-link:hover::after { transform: translateX(3px); }

/* Translator panel */
.translator-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.language-bar {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.language-bar label {
  display: flex; flex-direction: column; gap: .35rem;
  font-family: var(--mono); font-size: .7rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text3);
  flex: 1;
}
.language-bar select {
  padding: .6rem .9rem;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border2); border-radius: 10px;
  font-family: var(--sans); font-size: .9rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition); appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a7268' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center;
  padding-right: 2.4rem;
}
.language-bar select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.language-bar select:hover { border-color: var(--border2); background-color: var(--bg3); }

.swap-button {
  padding: .6rem 1rem;
  background: var(--bg3); color: var(--text2);
  border: 1px solid var(--border2); border-radius: 10px;
  font-family: var(--mono); font-size: .85rem;
  cursor: pointer; flex-shrink: 0;
  margin-top: 1.4rem;
  display: flex; align-items: center; gap: .35rem;
  user-select: none;
}
.swap-button:hover {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
  transform: scale(1.06);
  box-shadow: 0 4px 12px var(--accent-glow);
}
.swap-button:active {
  transform: scale(0.93) rotate(180deg);
  box-shadow: none;
}

.text-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.text-box {
  display: flex; flex-direction: column; gap: .45rem;
  font-family: var(--mono); font-size: .7rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text3);
}
.text-box textarea {
  padding: 1.1rem 1.2rem;
  background: var(--bg2); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 12px;
  font-family: var(--sans); font-size: .95rem; line-height: 1.7;
  resize: vertical; min-height: 175px;
  transition: all var(--transition);
}
.text-box textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
  background: var(--surface);
}
.text-box textarea::placeholder { color: var(--text3); font-style: italic; }
.output-box textarea {
  background: var(--accent-bg);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  color: var(--text); font-style: italic;
  font-weight: 500;
}

.actions { display: flex; gap: .75rem; align-items: center; }
#translateButton {
  padding: .75rem 1.875rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  border: none; border-radius: 10px;
  font-family: var(--sans); font-size: .9rem; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-glow), 0 1px 3px rgba(0,0,0,.1);
  letter-spacing: .01em;
  position: relative; overflow: hidden;
  user-select: none;
}
#translateButton::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.15) 0%, transparent 100%);
  border-radius: 10px;
}
#translateButton:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow), 0 2px 6px rgba(0,0,0,.12);
}
#translateButton:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.secondary-button {
  padding: .75rem 1.25rem;
  background: transparent; color: var(--text2);
  border: 1.5px solid var(--border2); border-radius: 10px;
  font-family: var(--sans); font-size: .9rem; font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.secondary-button:hover { background: var(--bg2); color: var(--text); border-color: var(--border2); }
.secondary-button:active { transform: scale(0.96); background: var(--bg3); }

/* Translate shortcut hint */
.translate-hint {
  font-family: var(--mono); font-size: .7rem; color: var(--text3);
  margin-left: auto; letter-spacing: .04em;
}

/* Quick panel */
.quick-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.quick-panel-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.quick-panel-header h2 { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }

.quick-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .65rem;
}
.quick-card {
  padding: .9rem 1.1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer; transition: all var(--transition);
  display: flex; flex-direction: column; gap: .25rem;
  position: relative; overflow: hidden;
}
.quick-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent);
  transform: scaleY(0); transform-origin: bottom;
  transition: transform var(--transition);
  border-radius: 2px;
}
.quick-card:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
  transform: translateY(-2px);
  box-shadow: var(--shadow2);
}
.quick-card:hover::before { transform: scaleY(1); }
.quick-card .qc-eng { font-weight: 600; font-size: .88rem; color: var(--text); }
.quick-card .qc-rem { font-family: var(--mono); font-size: .8rem; color: var(--accent); font-style: italic; }
.quick-card .qc-cat { font-family: var(--mono); font-size: .65rem; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin-top: .05rem; }

/* ══════════════════════════════════════════
   DICTIONARY PAGE
══════════════════════════════════════════ */

.dictionary-shell { display: flex; flex-direction: column; gap: 2rem; }

.dictionary-hero {
  padding: 2.75rem 3.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.dictionary-hero::before {
  content: '辞';
  position: absolute; right: 2.5rem; top: -.5rem;
  font-size: 11rem; line-height: 1;
  color: var(--border); pointer-events: none; user-select: none;
}
.dictionary-hero::after {
  content: '';
  position: absolute; left: 0; bottom: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal) 0%, var(--accent) 50%, var(--gold) 100%);
  opacity: .5;
}
.dictionary-hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3vw, 2.7rem);
  font-weight: 900; margin-bottom: .55rem;
  letter-spacing: -0.02em;
}
.dictionary-hero p { color: var(--text2); max-width: 520px; line-height: 1.7; }

.dictionary-layout {
  display: grid; grid-template-columns: 290px 1fr; gap: 1.75rem;
  align-items: start;
}

/* Sidebar */
.sticky-search {
  position: sticky; top: 5.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1.1rem;
  box-shadow: var(--shadow);
}
.sticky-search label {
  display: flex; flex-direction: column; gap: .4rem;
  font-family: var(--mono); font-size: .7rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text3);
}
.sticky-search input, .sticky-search select {
  padding: .65rem .9rem;
  background: var(--bg2); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 10px;
  font-family: var(--sans); font-size: .88rem;
  transition: all var(--transition); width: 100%;
}
.sticky-search input:focus, .sticky-search select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.sticky-search select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a7268' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center;
  padding-right: 2.4rem;
}

/* Search icon decoration */
.search-wrapper { position: relative; }
.search-wrapper input { padding-left: 2.4rem; }
.search-icon {
  position: absolute; left: .8rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text3); font-size: .85rem; pointer-events: none;
}

.stats-box {
  padding: .85rem 1.1rem;
  background: linear-gradient(135deg, var(--accent-bg) 0%, var(--bg2) 100%);
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
  display: flex; align-items: baseline; gap: .5rem;
}
.stats-box strong {
  font-family: var(--mono); font-size: 1.6rem;
  color: var(--accent); line-height: 1;
  font-weight: 600;
}
.stats-box span { font-size: .78rem; color: var(--text3); }

/* A–Z nav */
.az-nav {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.az-btn {
  width: 28px; height: 28px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 6px; font-family: var(--mono); font-size: .7rem; font-weight: 500;
  color: var(--text2); cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.az-btn:hover { background: var(--bg3); color: var(--text); border-color: var(--border2); }
.az-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Divider in sidebar */
.sidebar-divider {
  height: 1px; background: var(--border);
  margin: .1rem 0;
}

/* Dictionary results */
.dictionary-results { min-width: 0; }
.letter-section { margin-bottom: 2.5rem; }
.letter-heading {
  font-family: var(--serif); font-size: 2.8rem; font-weight: 900;
  color: var(--border2); line-height: 1;
  margin-bottom: .85rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--border);
  display: flex; align-items: baseline; gap: .75rem;
}
.letter-heading small {
  font-family: var(--mono); font-size: .72rem;
  color: var(--text3); font-weight: 500;
}

.dictionary-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: .7rem;
}

.dict-card {
  padding: .9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer; transition: all var(--transition);
  display: flex; flex-direction: column; gap: .22rem;
  position: relative; overflow: hidden;
}
.dict-card::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 60%);
  opacity: 0; transition: opacity var(--transition);
}
.dict-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow2);
}
.dict-card:hover::after { opacity: 1; }
.dict-card:hover .dc-eng { color: var(--accent); }
.dc-eng { font-weight: 600; font-size: .88rem; color: var(--text); transition: color var(--transition); }
.dc-rem { font-family: var(--mono); font-size: .8rem; color: var(--accent); font-style: italic; }
.dc-cat {
  font-family: var(--mono); font-size: .64rem; color: var(--text3);
  text-transform: uppercase; letter-spacing: .06em; margin-top: .1rem;
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  padding: 4rem; text-align: center;
  color: var(--text3); font-family: var(--mono); font-size: .88rem;
}
.empty-state::before {
  content: '∅';
  display: block; font-size: 3rem; margin-bottom: 1rem;
  color: var(--border2);
}

/* ── Word Dialog ── */
.word-dialog {
  position: fixed; inset: 0; margin: auto;
  width: min(560px, 92vw);
  max-height: 82vh; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r3);
  padding: 0;
  box-shadow: var(--shadow3);
  color: var(--text);
  animation: dialogIn .28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.word-dialog::backdrop {
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  animation: fadeIn .2s ease;
}
@keyframes dialogIn {
  from { opacity: 0; transform: translateY(20px) scale(.94); }
  to   { opacity: 1; transform: none; }
}

.dialog-header {
  padding: 1.75rem 2rem 1.25rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.dialog-accent-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--gold) 50%, var(--teal) 100%);
  border-radius: var(--r3) var(--r3) 0 0;
}
.dialog-body { padding: 1.5rem 2rem 2rem; }

.dialog-close {
  position: absolute; top: 1.1rem; right: 1.1rem;
  width: 34px; height: 34px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 50%; color: var(--text2);
  font-size: .9rem; cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
}
.dialog-close:hover { background: var(--accent); color: #fff; border-color: var(--accent); transform: rotate(90deg); }

.word-dialog h2 {
  font-family: var(--serif); font-size: 2.4rem; font-weight: 900;
  margin-bottom: .3rem; letter-spacing: -0.02em;
}
.detail-remao {
  font-family: var(--mono); font-size: 1.5rem;
  color: var(--accent); font-style: italic;
  margin-bottom: .3rem;
}
.detail-pronunciation {
  font-family: var(--mono); font-size: .8rem;
  color: var(--text3); margin-bottom: 0;
  display: inline-flex; align-items: center; gap: .4rem;
}
.detail-pronunciation::before { content: '🔊'; font-size: .8rem; }

.translation-table {
  display: flex; flex-direction: column; gap: .45rem;
  margin-top: 1.25rem;
}
.trans-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem .85rem;
  background: var(--bg2); border-radius: 10px;
  font-size: .88rem;
  transition: background var(--transition);
}
.trans-row:hover { background: var(--bg3); }
.trans-row:first-child { background: var(--accent-bg); border: 1px solid color-mix(in srgb, var(--accent) 15%, var(--border)); }
.trans-lang {
  font-family: var(--mono); font-size: .68rem; font-weight: 600;
  color: var(--text3); text-transform: uppercase; letter-spacing: .06em;
  min-width: 88px; flex-shrink: 0;
}
.trans-val { color: var(--text); font-weight: 500; }

/* ── Responsive ── */
@media (max-width: 820px) {
  .app-shell { padding: 1.5rem 1.25rem 3rem; }
  .hero-panel { flex-direction: column; align-items: flex-start; padding: 1.75rem; }
  .hero-panel::before { font-size: 9rem; }
  .text-grid { grid-template-columns: 1fr; }
  .dictionary-layout { grid-template-columns: 1fr; }
  .sticky-search { position: static; }
  .site-header { padding: .7rem 1.25rem; gap: .75rem; }
  .brand-name-text { display: none; }
  .translate-hint { display: none; }
}

@media (max-width: 500px) {
  .quick-list { grid-template-columns: 1fr; }
  .dictionary-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Focus ring ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Selection ── */
::selection { background: var(--accent); color: #fff; }
