@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: dark;
  font-family: "DM Sans", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --page: #111312;
  --panel: #171a18;
  --panel-raised: #1c201d;
  --panel-hover: #222723;
  --line: #292e2a;
  --line-soft: #222724;
  --text: #f0f1ec;
  --text-muted: #9a9f98;
  --text-faint: #696f69;
  --green: #b6d59a;
  --green-strong: #9ac578;
  --green-dark: #283426;
  --amber: #e6ba82;
  --blue: #a1bdd4;
  --radius-card: 14px;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 87% 1%, rgba(80, 107, 69, .11), transparent 31rem),
    var(--page);
  color: var(--text);
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.app-shell { width: min(1120px, calc(100% - 64px)); margin: 0 auto; }

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}

.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--text); text-decoration: none; }
.brand-mark { width: 35px; height: 35px; color: var(--green); }
.brand-mark svg { display: block; width: 100%; height: 100%; }
.brand-name { font: 800 17px/1 "Manrope", sans-serif; letter-spacing: -.7px; }
.brand-period { color: var(--green); }
.topbar-right { display: flex; align-items: center; gap: 19px; }
.topbar-note { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-strong); box-shadow: 0 0 10px rgba(154, 197, 120, .4); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #3a4238; border-radius: 50%; background: #222920; color: var(--green); font-size: 17px; }

.main-content { min-height: calc(100vh - 132px); }
.welcome-row { display: flex; justify-content: space-between; align-items: end; gap: 30px; padding: 51px 0 34px; }
.eyebrow { margin: 0 0 12px; color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: 1.65px; }
.eyebrow-line { display: inline-block; width: 17px; height: 1px; margin: 0 7px 3px 0; background: var(--green); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 11px; font: 600 clamp(28px, 4vw, 39px)/1.2 "Manrope", sans-serif; letter-spacing: -1.65px; }
h1 span { color: var(--green); }
.welcome-copy { margin-bottom: 0; color: var(--text-muted); font-size: 14px; }
.dialect-note { min-width: 258px; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid #31382f; border-radius: 11px; background: linear-gradient(125deg, rgba(42, 52, 40, .82), rgba(29, 34, 30, .7)); }
.dialect-note-icon { color: var(--green); font-size: 23px; }
.dialect-note div { display: grid; gap: 4px; }
.dialect-note strong { font-size: 11px; font-weight: 600; }
.dialect-note div span { color: var(--text-muted); font-size: 10px; }

.learning-strip { display: flex; align-items: center; gap: 29px; min-height: 88px; padding: 17px 22px; border: 1px solid #30362f; border-radius: 13px; background: linear-gradient(105deg, rgba(38, 47, 36, .72), rgba(25, 29, 26, .9) 54%, rgba(25, 29, 26, .85)); }
.strip-intro { display: flex; align-items: center; gap: 12px; min-width: 235px; }
.strip-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #46533f; border-radius: 10px; background: rgba(182, 213, 154, .08); color: var(--green); }
.strip-icon svg { width: 21px; height: 21px; }
.strip-intro div { display: grid; gap: 5px; }
.strip-label { color: var(--green); font-size: 9px; font-weight: 700; letter-spacing: 1.15px; }
.strip-intro strong { font-size: 12px; font-weight: 600; }
.strip-divider { width: 1px; height: 37px; background: #374035; }
.strip-stat { display: grid; gap: 3px; min-width: 84px; }
.stat-number { font: 700 17px/1 "Manrope", sans-serif; }
.stat-label { color: var(--text-muted); font-size: 10px; }
.practice-cta { min-height: 42px; display: inline-flex; align-items: center; gap: 9px; margin-left: auto; padding: 0 12px 0 10px; border: 1px solid #53634a; border-radius: 8px; background: #313e2d; color: #e4efd9; font-size: 11px; font-weight: 600; cursor: pointer; transition: background .2s, border-color .2s, transform .2s; }
.practice-cta:hover { transform: translateY(-1px); border-color: var(--green-strong); background: #3a4b34; }
.practice-cta-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: #546648; color: #e3efd7; }
.practice-cta-icon svg { width: 15px; height: 15px; }
.arrow-icon { width: 14px; height: 14px; margin-left: 4px; }

.library { padding-top: 48px; }
.library-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 21px; }
.library-heading .eyebrow { margin-bottom: 7px; color: var(--text-faint); font-size: 9px; letter-spacing: 1.45px; }
h2 { margin-bottom: 0; font: 600 22px/1.35 "Manrope", sans-serif; letter-spacing: -.65px; }
.saved-toggle { min-height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: #181b19; color: var(--text-muted); font-size: 11px; cursor: pointer; transition: .2s; }
.saved-toggle:hover, .saved-toggle.is-active { border-color: #56664c; background: #232b20; color: var(--green); }
.saved-toggle svg { width: 16px; height: 16px; }
.saved-toggle-count { min-width: 19px; padding: 2px 5px; border-radius: 10px; background: #292e29; color: var(--text); text-align: center; font-size: 9px; }
.search-panel { display: flex; align-items: center; gap: 13px; }
.search-box { min-height: 46px; flex: 1; display: flex; align-items: center; gap: 11px; padding: 0 13px; border: 1px solid #303531; border-radius: 9px; background: #191c1a; transition: border-color .2s, box-shadow .2s; }
.search-box:focus-within { border-color: #71835f; box-shadow: 0 0 0 3px rgba(182, 213, 154, .06); }
.search-box > svg { width: 18px; height: 18px; color: #838a81; flex: none; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.search-box input::placeholder { color: #777e77; }
.search-box input::-webkit-search-cancel-button { cursor: pointer; }
kbd { width: 19px; height: 20px; display: grid; place-items: center; flex: none; border: 1px solid #393e3a; border-radius: 4px; color: #818780; font-size: 11px; }
.search-hint { color: var(--text-faint); font-size: 10px; white-space: nowrap; }
.filter-row { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.category-filters { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-chip { min-height: 29px; padding: 0 12px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text-muted); font-size: 10px; cursor: pointer; transition: .18s; }
.filter-chip:hover { background: #1d211e; color: var(--text); }
.filter-chip.is-active { border-color: #43513a; background: #283125; color: var(--green); }
.result-count { color: var(--text-faint); font-size: 10px; white-space: nowrap; }

.word-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding-bottom: 44px; }
.word-card { position: relative; min-height: 218px; overflow: hidden; padding: 15px 16px 13px; border: 1px solid color-mix(in srgb, var(--word-accent) 20%, var(--line)); border-radius: var(--radius-card); background: linear-gradient(145deg, color-mix(in srgb, var(--word-accent) 8%, #1a1d1b), color-mix(in srgb, var(--word-accent) 3%, #171a18) 74%); animation: card-enter .38s both; animation-delay: calc(var(--card-index, 0) * 25ms); transition: border-color .2s, background .2s, transform .2s; }
.word-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--word-accent) 52%, #414841); background: linear-gradient(145deg, color-mix(in srgb, var(--word-accent) 13%, #1d211e), color-mix(in srgb, var(--word-accent) 5%, #191c1a) 74%); }
.card-header { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.category-tag { display: inline-flex; align-items: center; min-height: 20px; padding: 0 7px; border: 1px solid color-mix(in srgb, var(--word-accent) 32%, #313a30); border-radius: 5px; background: color-mix(in srgb, var(--word-accent) 12%, #222920); color: color-mix(in srgb, var(--word-accent) 70%, #f0f1ec); font-size: 9px; }
.card-actions { display: flex; gap: 3px; }
.card-action, .sound-button, .icon-button { display: grid; place-items: center; padding: 0; border: 1px solid transparent; background: transparent; color: #747b74; cursor: pointer; transition: color .18s, background .18s, border-color .18s; }
.card-action { width: 28px; height: 28px; border-radius: 7px; }
.card-action:hover, .card-action.is-saved { border-color: #414c3a; background: #252d22; color: var(--green); }
.card-action svg { width: 16px; height: 16px; }
.word-primary { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: 66px; padding: 10px 11px; border: 1px solid color-mix(in srgb, var(--word-accent) 30%, #2d342d); border-radius: 9px; background: linear-gradient(105deg, color-mix(in srgb, var(--word-accent) 17%, #293426), color-mix(in srgb, var(--word-accent) 8%, #202621)); }
.word-primary-label { grid-column: 1; color: color-mix(in srgb, var(--word-accent) 72%, #f0f2ec); font-size: 9px; font-weight: 600; }
.word-primary-value { grid-column: 1; margin-top: 5px; color: color-mix(in srgb, var(--word-accent) 48%, #f0f2ec); font-size: 19px; font-weight: 600; line-height: 1.35; }
.sound-button { width: 28px; height: 28px; border: 1px solid color-mix(in srgb, var(--word-accent) 30%, #39423a); border-radius: 50%; color: color-mix(in srgb, var(--word-accent) 70%, #d2d7cd); }
.sound-button:hover { border-color: var(--word-accent); background: color-mix(in srgb, var(--word-accent) 22%, #313c2d); color: var(--word-accent); }
.word-primary .sound-button { grid-column: 2; grid-row: 1 / span 2; }
.sound-button svg { width: 16px; height: 16px; }
.translation-list { display: grid; gap: 0; margin-top: 5px; }
.translation-row { min-height: 32px; display: grid; grid-template-columns: 65px 1fr 25px; align-items: center; gap: 5px; border-bottom: 1px solid #252a26; }
.translation-row:last-child { border-bottom: 0; }
.dialect-label { color: var(--text-muted); font-size: 10px; }
.dialect-sorani { color: var(--green); }
.dialect-badini { color: var(--amber); }
.dialect-hawrami { color: var(--blue); }
.translation-value { color: #d8dad4; font-size: 13px; text-align: right; }
.small-sound { width: 23px; height: 23px; border: 0; }
.small-sound svg { width: 14px; height: 14px; }
.word-image { position: absolute; right: 12px; bottom: 12px; width: 27px; height: 27px; object-fit: cover; opacity: .14; filter: saturate(.72); border-radius: 6px; pointer-events: none; }
.word-card:has(.word-image) .translation-list { padding-right: 21px; }
.loading-card, .empty-state { grid-column: 1 / -1; min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 11px; padding: 25px; border: 1px dashed #353b35; border-radius: 12px; color: var(--text-muted); text-align: center; font-size: 12px; }
.empty-state h3 { margin: 0; color: var(--text); font: 600 16px "Manrope", sans-serif; }
.empty-state p { margin: 0; color: var(--text-muted); font-size: 12px; }
.empty-icon { color: var(--green); font-size: 26px; }
.loading-card { flex-direction: row; }
.loading-spinner { width: 16px; height: 16px; border: 2px solid #394136; border-top-color: var(--green); border-radius: 50%; animation: spin .75s linear infinite; }
.text-button { padding: 5px 8px; border: 0; background: transparent; color: var(--green); font-size: 11px; cursor: pointer; }
.text-button:hover { text-decoration: underline; }

.footer { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line-soft); color: var(--text-faint); font-size: 10px; }
.footer-languages { color: #858b82; font-family: "Segoe UI", sans-serif; }
.footer-languages i { padding: 0 5px; color: #555d53; font-style: normal; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; }
.icon-button:hover { border-color: #526148; background: #232b20; color: var(--green); }
.icon-button svg { width: 18px; height: 18px; }
.install-button[hidden] { display: none; }

.practice-dialog { width: min(440px, calc(100% - 32px)); max-width: none; max-height: min(700px, calc(100% - 32px)); padding: 24px; overflow: auto; border: 1px solid #394038; border-radius: 16px; background: #191d1a; color: var(--text); box-shadow: 0 25px 100px rgba(0, 0, 0, .6); }
.practice-dialog::backdrop { background: rgba(6, 8, 7, .76); backdrop-filter: blur(5px); }
.dialog-top { display: flex; align-items: center; justify-content: space-between; }
.dialog-kicker, .practice-progress { color: var(--green); font-size: 9px; font-weight: 700; letter-spacing: 1.3px; }
.close-dialog { width: 30px; height: 30px; border: 0; }
.practice-progress { margin: 20px 0 8px; color: var(--text-faint); }
.practice-progress-track { height: 3px; overflow: hidden; margin-bottom: 21px; border-radius: 4px; background: #2b312b; }
.practice-progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--green-strong); transition: width .3s ease; }
.practice-dialog h2 { margin-bottom: 17px; font-size: 20px; }
.practice-mode-description { margin: -7px 0 20px; color: var(--text-muted); font-size: 12px; line-height: 1.6; }
.practice-mode-options { display: grid; gap: 10px; }
.practice-mode-option { display: grid; gap: 6px; padding: 17px; border: 1px solid #343d33; border-radius: 10px; background: #1e241e; text-align: left; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.practice-mode-option:hover { transform: translateY(-1px); border-color: #70835e; background: #252e23; }
.practice-mode-option strong { color: var(--text); font-size: 13px; }
.practice-mode-option span { color: var(--text-muted); font-size: 11px; }
.practice-prompt { min-height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 11px; border: 1px solid #343d33; border-radius: 12px; background: radial-gradient(ellipse at 50% 10%, rgba(104, 128, 83, .14), transparent 70%), #1e241e; }
.practice-prompt .dialect-label { font-size: 11px; }
.practice-prompt strong { color: var(--text); font-size: 32px; font-weight: 500; }
.practice-targets { display: grid; gap: 10px; margin-top: 12px; }
.practice-target { min-width: 0; padding: 11px; border: 1px solid #303731; border-radius: 9px; background: #1d211e; transition: border-color .2s, background .2s; }
.practice-target h3 { margin: 0 0 8px; font-size: 11px; font-weight: 600; }
.practice-answer-input { width: 100%; min-height: 39px; padding: 8px 10px; border: 1px solid #3a413a; border-radius: 7px; background: #171a18; color: var(--text); font-size: 15px; }
.practice-answer-input::placeholder { color: #727871; font-size: 11px; }
.practice-answer-input:disabled { opacity: 1; }
.practice-answer-input.is-correct { border-color: #6ea87a; background: #1d2920; }
.practice-answer-input.is-incorrect { border-color: #bc6565; background: #2b2020; }
.practice-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.practice-choice { min-width: 0; min-height: 37px; padding: 7px; border: 1px solid #363d37; border-radius: 7px; background: #191d1a; color: #dce0d8; font-size: 14px; cursor: pointer; transition: .18s; }
.practice-choice:hover:not(:disabled), .practice-choice.is-selected { border-color: #738760; background: #283126; color: var(--green); }
.practice-choice:disabled { cursor: default; opacity: .7; }
.practice-choice.is-correct { border-color: #6ea87a; background: #1d2920; color: #acd8ae; opacity: 1; }
.practice-choice.is-incorrect { border-color: #bc6565; background: #2b2020; color: #f1aaaa; opacity: 1; }
.practice-target-result { display: none; margin-top: 8px; color: var(--text-muted); font-size: 10px; }
.practice-target.is-correct .practice-target-result, .practice-target.is-incorrect .practice-target-result { display: block; }
.practice-target.is-correct .practice-target-result { color: #9dc9a0; }
.practice-target.is-incorrect .practice-target-result { color: #e69b9b; }
.practice-score { margin: 13px 0 -7px; color: #e6aaa1; text-align: center; font-size: 11px; font-weight: 600; }
.practice-score.is-perfect { color: #a9d59e; }
.practice-controls { display: flex; gap: 9px; margin-top: 18px; }
.button-primary, .button-secondary { min-height: 40px; flex: 1; padding: 0 14px; border: 1px solid #536548; border-radius: 8px; background: #35432f; color: #e4efd9; font-size: 11px; font-weight: 600; cursor: pointer; transition: .2s; }
.button-primary:hover { background: #41543a; }
.button-secondary { border-color: #343a35; background: #222623; color: var(--text-muted); }
.button-secondary:hover { border-color: #536548; color: var(--text); }
.button-primary[hidden], .button-secondary[hidden] { display: none; }
.practice-complete { display: flex; flex-direction: column; align-items: center; gap: 11px; padding: 35px 5px 5px; text-align: center; }
.practice-complete > span { color: var(--green); font-size: 35px; }
.practice-complete h2 { margin: 0; }
.practice-complete p { max-width: 290px; margin: 0 0 7px; color: var(--text-muted); font-size: 12px; line-height: 1.7; }
.practice-complete button { align-self: stretch; }
.toast { position: fixed; z-index: 10; right: 24px; bottom: 22px; max-width: min(320px, calc(100% - 32px)); padding: 12px 15px; transform: translateY(12px); border: 1px solid #46533f; border-radius: 9px; background: #242c22; color: #dce8d2; font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.is-visible { transform: translateY(0); opacity: 1; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes card-enter { from { transform: translateY(7px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 820px) {
  .app-shell { width: min(100% - 40px, 700px); }
  .welcome-row { align-items: start; flex-direction: column; gap: 20px; padding-top: 40px; }
  .dialect-note { min-width: 0; }
  .learning-strip { flex-wrap: wrap; gap: 16px 23px; }
  .strip-intro { flex: 1 1 190px; }
  .strip-divider { display: none; }
  .practice-cta { margin-left: auto; }
  .word-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
  .app-shell { width: calc(100% - 32px); }
  .topbar { height: 64px; }
  .topbar-note { display: none; }
  .brand-name { font-size: 16px; }
  .welcome-row { padding: 34px 0 24px; }
  h1 { max-width: 420px; font-size: clamp(29px, 8vw, 36px); letter-spacing: -1.2px; }
  .welcome-copy { max-width: 340px; font-size: 13px; line-height: 1.65; }
  .learning-strip { gap: 16px 18px; padding: 15px; }
  .strip-intro { flex-basis: 100%; }
  .strip-stat { min-width: 68px; }
  .practice-cta { min-height: 38px; font-size: 10px; }
  .library { padding-top: 35px; }
  .library-heading { align-items: start; margin-bottom: 16px; }
  h2 { font-size: 20px; }
  .saved-toggle { gap: 6px; padding: 0 8px; font-size: 10px; }
  .search-panel { align-items: stretch; flex-direction: column; gap: 7px; }
  .search-box { min-height: 44px; }
  .search-hint { padding-left: 2px; font-size: 9px; }
  .filter-row { align-items: start; flex-direction: column; justify-content: center; gap: 7px; padding: 12px 0; }
  .category-filters { gap: 4px; }
  .filter-chip { padding: 0 9px; font-size: 9px; }
  .result-count { display: none; }
  .word-grid { grid-template-columns: 1fr; gap: 10px; padding-bottom: 30px; }
  .word-card { min-height: 203px; }
  .footer { align-items: start; flex-direction: column; justify-content: center; gap: 5px; padding: 13px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
