:root {
  --bg: #0c0f14;
  --bg-elevated: #141a22;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef2f7;
  --text-muted: #9aa8b8;
  --accent: #6ee7b7;
  --accent-soft: rgba(110, 231, 183, 0.14);
  --danger: #f87171;
  --radius: 16px;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  --page-max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-family: "DM Sans", system-ui, sans-serif; color: var(--text); background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(110, 231, 183, 0.12), transparent), var(--bg); }
.vocab-app.page { max-width: var(--page-max); margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.top-bar-actions { display: flex; align-items: center; gap: 0.5rem; }
.plan-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}
.plan-badge--pro {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(110, 231, 183, 0.35);
}
.plan-badge--free {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}
.back-portfolio { color: var(--text-muted); text-decoration: none; font-size: 0.875rem; }
.back-portfolio:hover { color: var(--text); }
.site-hero { display: flex; gap: 1.25rem; align-items: center; margin-bottom: 1.5rem; }
.site-hero-icon { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow); }
.site-hero h1 { margin: 0 0 0.25rem; font-size: clamp(1.75rem, 4vw, 2.25rem); }
.site-hero-lead { margin: 0; color: var(--text-muted); max-width: 36rem; }
.site-nav { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.nav-tab { padding: 0.55rem 1rem; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); color: var(--text-muted); font: inherit; cursor: pointer; }
.nav-tab[aria-selected="true"] { color: var(--text); border-color: rgba(110,231,183,0.45); background: var(--accent-soft); }
.app-panel { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: 1.25rem 1.5rem; box-shadow: var(--shadow); }
.lang-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.lang-field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--text-muted); }
.lang-field select { padding: 0.55rem 0.65rem; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text); font: inherit; }
.lang-field select:disabled { opacity: 0.5; cursor: not-allowed; }
.empty-card, .muted-card { padding: 1.25rem; border: 1px dashed var(--border); border-radius: var(--radius); text-align: center; color: var(--text-muted); margin-bottom: 1rem; }
.manual-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 1rem;
}
.manual-title { margin: 0 0 0.75rem; font-size: 1rem; font-weight: 650; color: var(--text); }
.manual-fields { display: flex; flex-direction: column; gap: 0.6rem; }
.manual-row { display: flex; gap: 0.6rem; align-items: center; }
.manual-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
}
.manual-input::placeholder { color: var(--text-muted); }
.manual-row .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.learn-back { margin-bottom: 0.75rem; }
.photo-stage { position: relative; margin-bottom: 0.75rem; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #000; display: flex; justify-content: center; align-items: center; }
.photo-frame { position: relative; display: inline-block; line-height: 0; max-width: 100%; }
.photo-bg { display: block; max-width: 100%; max-height: 420px; width: auto; height: auto; }
.photo-overlay { position: absolute; inset: 0; pointer-events: none; }
.word-hotspot { position: absolute; border: 1px solid rgba(110,231,183,0.45); background: rgba(110,231,183,0.18); color: transparent; font-size: 0; cursor: pointer; border-radius: 4px; padding: 0; pointer-events: auto; min-width: 10px; min-height: 14px; touch-action: manipulation; }
.word-hotspot--active { background: rgba(110,231,183,0.35); border-color: var(--accent); }
.photo-loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.45); color: #fff; font-weight: 600; }
.card { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin-top: 1rem; }
.lookup-word { margin: 0; font-size: 1.4rem; font-weight: 700; }
.lookup-ipa { color: var(--accent); margin: 0.2rem 0; }
.lookup-pos { color: var(--text-muted); margin: 0; font-size: 0.85rem; }
.lookup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.75rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.chip { padding: 0.4rem 0.75rem; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); color: var(--text-muted); font: inherit; cursor: pointer; }
.chip[aria-pressed="true"], .chip[aria-selected="true"] { color: var(--text); border-color: rgba(110,231,183,0.45); background: var(--accent-soft); }
.library-tabs { margin-bottom: 1rem; }

/* My Words rows — match native LibraryScreen VocabListItem (navy card + accent border). */
.entry-list {
  --entry-surface: #1a2738;
  --entry-border: #354a62;
  --entry-text: #f5f5f5;
  --entry-text-secondary: #9e9e9e;
  --entry-star: #ffb300;
  --entry-learned: #c084fc;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.entry-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--entry-surface);
  border: 1px solid var(--entry-border);
  border-radius: 18px;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  min-height: 4.25rem;
}
.entry-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  padding: 0.85rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--entry-text);
  font: inherit;
  cursor: pointer;
  border-radius: 14px;
}
.entry-main:hover { background: rgba(255, 255, 255, 0.03); }
.entry-word {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--entry-text);
}
.entry-sub {
  color: var(--entry-text-secondary);
  font-size: 0.8125rem;
  line-height: 1.35;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
  padding-right: 0.25rem;
}
.entry-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--entry-text-secondary);
  cursor: pointer;
  padding: 0;
}
.entry-icon:hover { background: rgba(255, 255, 255, 0.05); }
.entry-icon.is-active { background: rgba(192, 132, 252, 0.12); border-color: rgba(192, 132, 252, 0.55); }
.entry-icon.is-star.is-active { color: var(--entry-star); background: rgba(255, 179, 0, 0.12); border-color: rgba(255, 179, 0, 0.45); }
.entry-icon.is-learned.is-active { color: var(--entry-learned); }
.entry-icon-svg { width: 1.5rem; height: 1.5rem; display: block; }
.btn, .icon-btn { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--border); }
.btn { padding: 0.55rem 0.9rem; font-weight: 600; }
.btn-primary { background: var(--accent-soft); border-color: rgba(110,231,183,0.45); color: var(--text); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-secondary { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.btn-danger { background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.35); color: #fecaca; }
.btn-sm { padding: 0.35rem 0.55rem; font-size: 0.85rem; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; margin-top: 0.75rem; }
.icon-btn { width: 2.25rem; height: 2.25rem; background: rgba(255,255,255,0.04); color: var(--text-muted); }
.error-banner { color: #fecaca; background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.35); padding: 0.65rem 0.85rem; border-radius: 10px; }
.muted-note { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 0.75rem; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: grid; place-items: center; padding: 1rem; z-index: 30; }
.modal { width: min(520px, 100%); max-height: 90vh; overflow: auto; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.modal-head h2 { margin: 0; font-size: 1.2rem; }

/* Word details (My Words) — mobile parity sheet */
.detail-backdrop {
  place-items: stretch center;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.72);
}
.detail-sheet {
  width: min(560px, 100%);
  max-height: min(96vh, 920px);
  display: flex;
  flex-direction: column;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.detail-topbar {
  display: grid;
  grid-template-columns: 2.25rem 1fr 2.25rem;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.detail-topbar-title {
  margin: 0;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
}
.detail-topbar-spacer { width: 2.25rem; height: 2.25rem; }
.detail-scroll {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0.85rem 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.detail-photo-card {
  min-height: 9.5rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.detail-photo-img {
  width: 100%;
  max-height: 14rem;
  object-fit: contain;
  display: block;
}
.detail-photo-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 2rem 1rem;
  text-align: center;
}
.detail-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 1rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.detail-word-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.detail-speak {
  flex: 0 0 auto;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 999px;
  border: 1px solid rgba(192, 132, 252, 0.4);
  background: rgba(192, 132, 252, 0.08);
  color: var(--accent);
  font-size: 1.25rem;
  cursor: pointer;
}
.detail-speak:hover { background: rgba(192, 132, 252, 0.16); }
.detail-word-copy { min-width: 0; flex: 1 1 auto; }
.detail-word-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.detail-word {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 750;
  line-height: 1.2;
}
.detail-ipa {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.detail-lang-pair {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.detail-section { display: flex; flex-direction: column; gap: 0.35rem; }
.detail-section-title {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.detail-section-body { color: var(--text); font-size: 0.95rem; line-height: 1.45; }
.detail-section-body p { margin: 0; }
.detail-meaning-text { font-size: 1.05rem; font-weight: 650; }
.detail-quote {
  margin: 0 0 0.45rem;
  padding: 0.15rem 0 0.15rem 0.75rem;
  border-left: 3px solid #60a5fa;
  color: var(--text-muted);
  font-style: normal;
}
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.detail-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(192, 132, 252, 0.55);
  color: #d8b4fe;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.detail-pos { flex: 0 0 auto; }
.detail-family {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.detail-family-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.detail-actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem 0.9rem;
  border-top: 1px solid var(--border);
  background: rgba(8, 12, 20, 0.92);
}
.detail-action {
  font: inherit;
  cursor: pointer;
  padding: 0.7rem 0.4rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}
.detail-action.is-active {
  border-color: rgba(192, 132, 252, 0.55);
  color: #e9d5ff;
  background: rgba(192, 132, 252, 0.1);
}
.detail-action.is-learned {
  border-color: rgba(110, 231, 183, 0.5);
  color: #bbf7d0;
  background: rgba(110, 231, 183, 0.1);
}
.detail-action--danger {
  border-color: rgba(248, 113, 113, 0.55);
  color: #fecaca;
}
.detail-action--danger:hover { background: rgba(248, 113, 113, 0.12); }

.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.field input { padding: 0.55rem 0.65rem; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text); font: inherit; }
.settings-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.settings-identity:hover { background: rgba(255, 255, 255, 0.06); }
.settings-identity-avatar {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  background: rgba(120, 31, 243, 0.28);
}
.settings-identity-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.settings-identity-name {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 650;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-identity-provider {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.provider-icon { width: 0.9rem; height: 0.9rem; flex: 0 0 auto; }
.settings-identity-meta {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  margin-left: 0.25rem;
}
.settings-identity-policy {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.settings-identity-policy:hover { color: var(--text); }
.settings-identity-version { color: var(--text-muted); font-size: 0.75rem; }
.settings-fan-unlock { margin-top: 0.25rem; }
.settings-fan-unlock-error { margin: 0; color: #fecaca; font-size: 0.8rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: #111827; border: 1px solid var(--border); padding: 0.65rem 1rem; border-radius: 999px; z-index: 40; }
.site-footer { margin-top: 1.5rem; color: var(--text-muted); font-size: 0.875rem; }
.site-footer a { color: inherit; }
