:root {
  --paper: #f4f0e7;
  --paper-2: #ebe5d9;
  --ink: #17221c;
  --muted: #6e756f;
  --forest: #214d3a;
  --forest-dark: #143426;
  --lime: #d8ef80;
  --coral: #ff7b63;
  --white: #fffdf8;
  --shadow: 0 30px 80px rgba(22, 45, 34, .16);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--paper);
  font-family: Vazirmatn, system-ui, sans-serif; overflow-x: hidden;
}
body::before, body::after { content: ""; position: fixed; border-radius: 50%; filter: blur(2px); pointer-events: none; z-index: -1; }
body::before { width: 480px; height: 480px; left: -180px; top: -190px; background: rgba(216, 239, 128, .22); }
body::after { width: 420px; height: 420px; right: -190px; bottom: -220px; background: rgba(255, 123, 99, .12); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.grain { position: fixed; inset: 0; opacity: .2; pointer-events: none; z-index: 10; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.11'/%3E%3C/svg%3E"); }
.app-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(23,34,28,.13); padding-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; direction: ltr; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; color: var(--lime); background: var(--forest); border-radius: 10px 10px 10px 3px; font: 700 23px DM Sans; transform: rotate(-3deg); }
.brand-copy { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.brand-copy b { font: 700 17px DM Sans; }
.brand-copy small { font: 500 9px DM Sans; color: var(--muted); letter-spacing: .08em; margin-top: 5px; }
.top-actions { display: flex; gap: 10px; }
.icon-button, .round-close { border: 1px solid rgba(23,34,28,.13); background: rgba(255,255,255,.45); color: var(--ink); display: grid; place-items: center; transition: .2s; }
.icon-button { width: 44px; height: 44px; border-radius: 12px; }
.icon-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-button:hover, .round-close:hover { background: var(--white); transform: translateY(-2px); }
.add-button { height: 44px; border: 0; border-radius: 12px; background: var(--forest); color: #fff; padding: 0 16px; display: flex; align-items: center; gap: 9px; box-shadow: 0 8px 20px rgba(33,77,58,.18); }
.add-button span { font-size: 25px; font-weight: 300; margin-top: -2px; }
.add-button b { font-size: 13px; }
.hero { display: flex; justify-content: space-between; align-items: end; padding: 48px 0 30px; }
.eyebrow { margin: 0 0 11px; color: var(--forest); direction: ltr; text-align: right; font: 700 10px DM Sans; letter-spacing: .16em; }
.hero h1 { margin: 0; font-size: clamp(32px, 5vw, 59px); line-height: 1.18; letter-spacing: -.045em; font-weight: 800; }
.hero h1 em { color: var(--forest); font-style: normal; position: relative; }
.hero h1 em::after { content: ""; position: absolute; right: 0; bottom: -3px; width: 42%; height: 5px; border-radius: 20px; background: var(--coral); transform: rotate(-1deg); }
.streak-card { direction: rtl; min-width: 155px; padding: 15px 17px; border: 1px solid rgba(23,34,28,.13); border-radius: 16px; background: rgba(255,253,248,.65); display: flex; gap: 12px; align-items: center; }
.streak-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--lime); display: grid; place-items: center; color: var(--forest); font-size: 20px; }
.streak-card div { display: flex; flex-direction: column; }
.streak-card strong { font-size: 20px; line-height: 1; }
.streak-card small { color: var(--muted); font-size: 10px; margin-top: 5px; }
.filters { display: grid; grid-template-columns: 160px 170px 1fr; align-items: end; gap: 14px; padding: 16px 18px; border: 1px solid rgba(23,34,28,.12); border-radius: 18px; background: rgba(255,253,248,.62); }
.select-wrap { display: flex; flex-direction: column; gap: 6px; }
.select-wrap > span { font-size: 10px; color: var(--muted); }
.select-wrap select { appearance: none; border: 0; outline: none; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Cpath d='m2 4 4 4 4-4' fill='none' stroke='%2317221c' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat left 5px center; color: var(--ink); font-weight: 700; font-size: 13px; padding: 0 0 0 22px; }
.session-progress { align-self: center; margin-right: 25px; }
.progress-copy { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.progress-copy b { color: var(--ink); }
.progress-track { height: 7px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--forest); border-radius: inherit; transition: width .45s ease; }
.study-area { position: relative; text-align: center; padding-top: 32px; }
.card-stage { width: min(510px, 100%); height: 380px; margin: 0 auto; perspective: 1400px; touch-action: none; position: relative; }
.card-stage::before, .card-stage::after { content: ""; position: absolute; inset: 17px 26px -10px; border-radius: 27px; border: 1px solid rgba(23,34,28,.11); background: #e9e3d6; z-index: -2; transform: rotate(-2.4deg); }
.card-stage::after { inset: 8px 13px -4px; background: #f0ebe1; z-index: -1; transform: rotate(1.3deg); }
.flashcard { width: 100%; height: 100%; border-radius: 27px; outline: none; user-select: none; -webkit-user-select: none; will-change: transform; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .25s; }
.flashcard:focus-visible { box-shadow: 0 0 0 4px rgba(33,77,58,.25); }
.card-inner { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform .72s cubic-bezier(.2,.75,.15,1); }
.flashcard.flipped .card-inner { transform: rotateY(180deg); }
.card-face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 27px; padding: 24px 27px 21px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow); }
.card-front { color: #fff; background: var(--forest); }
.card-front::before { content: ""; position: absolute; width: 210px; height: 210px; right: -85px; top: 65px; border: 1px solid rgba(216,239,128,.22); border-radius: 50%; box-shadow: 0 0 0 34px rgba(216,239,128,.05), 0 0 0 69px rgba(216,239,128,.04); }
.card-back { background: var(--lime); color: var(--ink); transform: rotateY(180deg); }
.card-back::before { content: "Ü"; position: absolute; font: 700 230px DM Sans; color: rgba(33,77,58,.055); left: -15px; top: 30px; }
.card-meta { position: relative; display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: rgba(255,255,255,.64); }
.card-back .card-meta { color: rgba(23,34,28,.65); }
.level-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 45px; height: 25px; padding: 0 10px; border-radius: 20px; border: 1px solid rgba(255,255,255,.28); color: var(--lime); font: 700 11px DM Sans; }
.card-back .level-pill { border-color: rgba(23,34,28,.2); color: var(--forest); font-family: Vazirmatn; }
.word-block, .meaning-block { position: relative; margin-top: 8px; }
.article { font: 500 24px DM Sans; color: var(--lime); display: block; margin-bottom: 2px; }
.word-block h2 { font: 600 clamp(44px, 8vw, 71px) DM Sans; letter-spacing: -.05em; margin: 0; direction: ltr; }
.phonetic { direction: ltr; font: 400 13px DM Sans; color: rgba(255,255,255,.54); margin: 7px 0 0; }
.sound-button { width: 41px; height: 41px; margin: 19px auto 0; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(216,239,128,.5); color: var(--lime); background: rgba(216,239,128,.08); transition: .2s; }
.sound-button:hover { background: var(--lime); color: var(--forest); transform: scale(1.07); }
.sound-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sound-button.speaking { animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(216,239,128,0); } 0% { box-shadow: 0 0 0 0 rgba(216,239,128,.35); } }
.tap-hint { position: relative; display: flex; align-items: center; justify-content: center; gap: 9px; color: rgba(255,255,255,.45); font-size: 9px; }
.card-back .tap-hint { color: rgba(23,34,28,.46); }
.tap-hint i { width: 3px; height: 3px; background: currentColor; border-radius: 50%; }
.meaning-block small { font-size: 11px; color: rgba(23,34,28,.55); }
.meaning-block h2 { margin: 10px auto 18px; font-size: clamp(36px, 7vw, 56px); line-height: 1.25; letter-spacing: -.04em; }
.word-reminder { display: inline-flex; direction: ltr; gap: 8px; align-items: center; padding: 8px 15px; border: 1px solid rgba(23,34,28,.17); border-radius: 99px; font: 500 14px DM Sans; }
.feedback-chip { position: absolute; top: 88px; z-index: 5; padding: 8px 15px; border: 3px solid currentColor; border-radius: 9px; font-size: 16px; font-weight: 800; opacity: 0; pointer-events: none; }
.feedback-no { right: calc(50% + 155px); color: var(--coral); transform: rotate(8deg); }
.feedback-yes { left: calc(50% + 155px); color: var(--forest); transform: rotate(-8deg); }
.gesture-guide { display: flex; justify-content: center; gap: 24px; margin: 27px 0 19px; color: var(--muted); }
.gesture-guide div { display: flex; align-items: center; gap: 6px; font-size: 9px; }
.gesture-guide kbd { border: 1px solid rgba(23,34,28,.13); background: rgba(255,255,255,.45); min-width: 25px; height: 25px; padding: 0 5px; border-radius: 7px; display: grid; place-items: center; font: 500 13px DM Sans; color: var(--ink); }
.desktop-actions { display: flex; justify-content: center; gap: 10px; }
.desktop-actions button { border-radius: 12px; height: 43px; padding: 0 16px; border: 1px solid rgba(23,34,28,.12); background: transparent; font-size: 11px; font-weight: 700; display: flex; align-items: center; gap: 8px; transition: .2s; }
.desktop-actions button:hover { transform: translateY(-2px); background: rgba(255,255,255,.6); }
.action-no { color: #bd4f3d; }.action-yes { color: var(--forest); }.action-info { color: var(--muted); }
.desktop-actions span { font: 600 18px DM Sans; }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(11,22,16,.33); backdrop-filter: blur(6px); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .35s; }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.info-sheet { position: fixed; z-index: 51; width: min(560px, calc(100% - 20px)); left: 50%; bottom: 0; transform: translate(-50%, 105%); background: var(--white); border-radius: 28px 28px 0 0; padding: 12px 28px max(30px, env(safe-area-inset-bottom)); box-shadow: 0 -30px 80px rgba(12,31,21,.22); transition: transform .52s cubic-bezier(.2,.85,.25,1); }
.info-sheet.open { transform: translate(-50%, 0); }
.sheet-handle { width: 42px; height: 5px; border-radius: 5px; background: #d6d2c9; margin: 0 auto 18px; }
.sheet-top { display: flex; justify-content: space-between; align-items: start; }
.sheet-top > div { direction: ltr; text-align: left; }
.sheet-article { font: 500 17px DM Sans; color: var(--forest); }
.sheet-top h2 { margin: 0; font: 600 37px DM Sans; letter-spacing: -.04em; }
.round-close { width: 34px; height: 34px; border-radius: 50%; font: 400 20px DM Sans; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0; }
.detail-grid div { background: var(--paper); border-radius: 13px; padding: 12px 14px; display: flex; flex-direction: column; text-align: right; }
.detail-grid small { color: var(--muted); font-size: 9px; margin-bottom: 4px; }
.detail-grid strong { font-size: 13px; }
.example-box { text-align: left; direction: ltr; background: var(--forest); color: #fff; border-radius: 17px; padding: 17px 19px; }
.example-label { display: flex; justify-content: space-between; color: var(--lime); font: 700 10px DM Sans; text-transform: uppercase; letter-spacing: .12em; }
.example-label button { border: 0; color: var(--lime); background: none; font: 700 13px DM Sans; }
.example-box p { font: 500 19px/1.45 DM Sans; margin: 14px 0 7px; }
.example-box small { display: block; direction: rtl; text-align: right; color: rgba(255,255,255,.6); font-size: 11px; }
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(11,22,16,.42); backdrop-filter: blur(7px); opacity: 0; visibility: hidden; transition: .25s; }
.modal.open { opacity: 1; visibility: visible; }
.modal-panel { width: min(700px, 100%); max-height: 92vh; overflow: auto; background: var(--white); border-radius: 24px; padding: 25px; box-shadow: 0 35px 100px rgba(11,22,16,.28); transform: translateY(15px) scale(.98); transition: .3s; }
.modal.open .modal-panel { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: start; padding-bottom: 18px; border-bottom: 1px solid rgba(23,34,28,.1); }
.modal-head span { color: var(--forest); font-size: 9px; font-weight: 700; }
.modal-head h2 { margin: 3px 0 0; font-size: 23px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; padding: 20px 0; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: right; }
.field-wide { grid-column: 1 / -1; }
.field span { font-size: 10px; color: var(--muted); }
.field input, .field select { width: 100%; border: 1px solid rgba(23,34,28,.13); border-radius: 11px; background: var(--paper); outline: none; padding: 11px 12px; color: var(--ink); transition: .2s; }
.field input:focus, .field select:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(33,77,58,.09); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.ghost-button, .submit-button { height: 42px; padding: 0 19px; border-radius: 11px; font-weight: 700; font-size: 12px; }
.ghost-button { border: 1px solid rgba(23,34,28,.13); background: transparent; color: var(--muted); }
.submit-button { border: 0; background: var(--forest); color: #fff; }
.submit-button span { margin-right: 10px; }.submit-button.full { width: 100%; margin-top: 20px; }
.stats-panel { max-width: 520px; }
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 22px; }
.stats-grid div { padding: 20px 10px; border-radius: 15px; text-align: center; background: var(--paper); }
.stats-grid strong { display: block; color: var(--forest); font: 700 30px DM Sans; }
.stats-grid span { color: var(--muted); font-size: 9px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; transform: translate(-50%, 30px); opacity: 0; padding: 11px 18px; background: var(--ink); color: #fff; border-radius: 99px; font-size: 11px; box-shadow: 0 12px 35px rgba(0,0,0,.2); transition: .3s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.empty-state { text-align: center; padding: 80px 20px; }.empty-state > div { font-size: 54px; color: var(--forest); }.empty-state h2 { margin: 8px 0; }.empty-state p { color: var(--muted); }.empty-state .add-button { margin: 20px auto; }
@media (max-width: 720px) {
  .app-shell { width: min(100% - 26px, 560px); padding-top: 15px; }
  .brand-copy small { display: none; }.brand-mark { width: 36px; height: 36px; }.add-button b { display: none; }.add-button { width: 44px; padding: 0; justify-content: center; }
  .hero { padding: 30px 2px 22px; align-items: center; }.hero h1 { font-size: clamp(29px, 9vw, 44px); }.eyebrow { font-size: 8px; }
  .streak-card { min-width: 0; padding: 10px; border-radius: 13px; }.streak-card small { display: none; }.streak-card strong { font-size: 16px; }.streak-icon { width: 31px; height: 31px; }
  .filters { grid-template-columns: 1fr 1fr; padding: 13px; }.session-progress { grid-column: 1 / -1; margin: 4px 0 0; }
  .study-area { padding-top: 23px; }.card-stage { height: min(385px, 56vh); min-height: 330px; }.card-face { padding: 21px 22px 18px; }
  .gesture-guide { gap: 12px; justify-content: space-between; margin: 23px 4px 14px; }.gesture-guide div { flex-direction: column; gap: 4px; }.gesture-guide span { font-size: 8px; }
  .desktop-actions { display: none; }.feedback-no { right: auto; left: 12px; }.feedback-yes { left: auto; right: 12px; }
  .info-sheet { padding-inline: 20px; }.form-grid { grid-template-columns: 1fr; }.field-wide { grid-column: auto; }.modal { align-items: end; padding: 10px; }.modal-panel { border-radius: 23px 23px 14px 14px; max-height: 94vh; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
