/* ==========================================================================
   GRAMMATIKA MASTERCLASS — minimalist premium uslub (styles.css tokenlari bilan)
   ========================================================================== */

mark.gm-hl { background: linear-gradient(180deg, transparent 58%, var(--marker) 58%); color: var(--marker-ink); font-weight: 700; padding: 0; }

/* ---------------- Dars ichidagi bo'lim ---------------- */
.gm-section { margin-top: 18px; }
.gm-section-head { padding: 0 var(--pad); }
.gm-kicker { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.gm-section-title { margin: 6px 0 0; font-size: 24px; line-height: 1.15; letter-spacing: -0.6px; font-weight: 600; }
.gm-cta {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 16px;
  height: 48px; padding: 0 18px; border-radius: var(--r-md);
  background: var(--inverse); color: var(--inverse-ink); font-size: 15px; font-weight: 600;
}
.gm-cta:active { transform: scale(.98); }
.gm-card-list { display: flex; flex-direction: column; gap: 10px; padding: 18px var(--pad) 0; }
.gm-card {
  display: block; width: 100%; text-align: left; background: var(--card); border-radius: var(--r-lg);
  padding: 18px; transition: transform .1s; position: relative;
}
.gm-card:active { transform: scale(.99); }
.gm-card-top { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.gm-card-status { display: inline-flex; align-items: center; gap: 4px; }
.gm-card.is-mastered .gm-card-status { color: var(--ok); }
.gm-card-pattern { margin-top: 12px; font-family: var(--ko); font-size: 22px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.25; }
.gm-card-title { margin-top: 4px; font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.gm-card-tagline { margin-top: 6px; font-size: 14.5px; color: var(--muted); line-height: 1.45; }
.gm-card-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.gm-card-preview:empty { display: none; }
.gm-pv-item { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; }
.gm-pv-when { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.gm-pv-arrow { color: var(--faint); }
.gm-pv-add { font-family: var(--ko); font-weight: 700; }

/* ---------------- Kutubxona ---------------- */
.gm-theme { font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 22px var(--pad) 0; }
.gm-theme .ko { font-family: var(--ko); color: var(--ink-2); font-size: 13px; }
.gm-unit { padding: 18px var(--pad) 0; }
.gm-unit-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 8px; }
.gm-unit-num { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.gm-unit-kor { font-family: var(--ko); font-weight: 700; font-size: 18px; letter-spacing: -0.3px; margin-top: 2px; }
.gm-unit-uzb { font-size: 14px; color: var(--muted); margin-top: 1px; }
.gm-unit-play { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; background: var(--inverse); color: var(--inverse-ink); display: flex; align-items: center; justify-content: center; }
.gm-unit-rows { border-top: 1px solid var(--line-2); }
.gm-row { display: grid; grid-template-columns: 30px 1fr 20px; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 13px 0; border-bottom: 1px solid var(--line-2); }
.gm-row:active { opacity: .6; }
.gm-row-check { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.gm-row.is-mastered .gm-row-check { background: var(--inverse); border-color: var(--inverse); color: var(--inverse-ink); }
.gm-row-main { display: flex; flex-direction: column; min-width: 0; }
.gm-row-pattern { font-family: var(--ko); font-size: 16.5px; font-weight: 700; letter-spacing: -0.2px; line-height: 1.3; }
.gm-row-title { font-size: 13.5px; color: var(--muted); margin-top: 1px; }
.gm-row-go { color: var(--faint); display: flex; }

/* ---------------- Taqdimot oynasi ---------------- */
body.gm-lock { overflow: hidden; }
.gm-modal { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: none; }
.gm-modal.active { display: block; animation: gmIn .22s ease both; }
@keyframes gmIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.gm-deck { max-width: var(--maxw); margin: 0 auto; height: 100%; display: flex; flex-direction: column; padding-top: var(--safe-t); }
.gm-deck-head { display: flex; align-items: center; gap: 12px; padding: 16px var(--pad) 0; }
.gm-icon-btn { flex: 0 0 auto; width: 44px; height: 44px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; justify-content: center; }
.gm-deck-meta { flex: 1; min-width: 0; }
.gm-deck-crumb { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-deck-name { font-family: var(--ko); font-size: 16px; font-weight: 700; letter-spacing: -0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-deck-name mark.gm-hl { background: none; color: inherit; }
.gm-deck-count { flex: 0 0 auto; font-family: var(--mono); font-size: 13px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 11px; }
.gm-segments { display: grid; gap: 5px; padding: 16px var(--pad) 0; }
.gm-seg { height: 18px; display: flex; align-items: center; }
.gm-seg span { display: block; width: 100%; height: 3px; border-radius: 3px; background: var(--track); transition: background .2s; }
.gm-seg.done span { background: var(--ink); }

.gm-slide-wrap { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; position: relative; overscroll-behavior: contain; }
.gm-slide-wrap.has-more { -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 46px), transparent); mask-image: linear-gradient(180deg, #000 calc(100% - 46px), transparent); }
.gm-slide { padding: 22px var(--pad) 36px; }
.gm-slide.gm-enter { animation: gmSlide .26s ease both; }
@keyframes gmSlide { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.gm-slide-kicker { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.gm-headline { margin: 8px 0 0; font-size: 26px; line-height: 1.18; letter-spacing: -0.7px; font-weight: 600; }
.gm-headline.big { font-size: 28px; letter-spacing: -0.8px; }

.gm-deck-foot { display: flex; gap: 10px; padding: 14px var(--pad) calc(18px + var(--safe-b)); border-top: 1px solid var(--line-2); background: var(--bg); }
.gm-nav-btn { height: 52px; border-radius: var(--r-md); font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.gm-nav-btn.ghost { flex: 0 0 116px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.gm-nav-btn.primary { flex: 1; background: var(--inverse); color: var(--inverse-ink); }
.gm-nav-btn:disabled { opacity: .4; }
.gm-nav-btn:active:not(:disabled) { transform: scale(.98); }

/* 01 Kirish */
.gm-hook-pattern { margin-top: 12px; font-family: var(--ko); font-size: 32px; font-weight: 700; letter-spacing: -1px; line-height: 1.15; }
.gm-slide-hook .gm-headline { font-size: 19px; letter-spacing: -0.3px; font-weight: 500; color: var(--ink-2); margin-top: 8px; line-height: 1.35; }
.gm-scene { margin-top: 16px; background: var(--card); border-radius: var(--r-lg); padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.gm-scene-ctx { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.gm-line { display: flex; flex-direction: column; max-width: 92%; }
.gm-line.r { align-self: flex-end; align-items: flex-end; }
.gm-who { font-family: var(--ko); font-size: 12px; color: var(--muted); margin: 0 6px 3px; }
.gm-bubble { background: var(--surface); border-radius: 16px 16px 16px 5px; padding: 10px 13px; border: 1px solid var(--line); }
.gm-line.r .gm-bubble { border-radius: 16px 16px 5px 16px; background: var(--bg); }
.gm-ko { font-family: var(--ko); font-size: 16.5px; font-weight: 500; line-height: 1.45; }
.gm-uz { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.gm-hook-story { margin-top: 14px; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.gm-outcome { margin-top: 14px; border-left: 2px solid var(--ink); padding: 2px 0 2px 14px; font-size: 15px; font-weight: 600; letter-spacing: -0.2px; line-height: 1.45; }
.gm-outcome-label { display: block; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--muted); }
.gm-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.gm-chip { font-family: var(--mono); font-size: 12px; padding: 6px 10px; border-radius: 999px; background: var(--inverse); color: var(--inverse-ink); }
.gm-chip.ghost { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }

/* 02 Mohiyat */
.gm-core-label { margin-top: 14px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.gm-slide-core .gm-headline { margin-top: 6px; }
.gm-pairs { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.gm-pair { background: var(--card); border-radius: var(--r-md); padding: 13px 16px; display: flex; flex-direction: column; gap: 2px; }
.gm-pair-kor { font-family: var(--ko); font-size: 19px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.35; }
.gm-pair-uzb { font-size: 14.5px; color: var(--muted); line-height: 1.4; }
.gm-bridge { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.gm-bridge-label { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.gm-bridge-text { margin-top: 4px; font-size: 15.5px; line-height: 1.55; color: var(--ink-2); }
.gm-analogy { margin-top: 12px; font-size: 15px; line-height: 1.55; color: var(--muted); padding-left: 14px; border-left: 2px solid var(--line); }

/* 03 Formula */
.gm-formula { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.gm-f-row { background: var(--card); border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.gm-f-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.gm-f-when-main { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; line-height: 1.3; }
.gm-f-when-sub { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.gm-f-when-sub, .gm-f-when-main { word-break: keep-all; }
.gm-f-add { flex: 0 0 auto; max-width: 52%; font-family: var(--ko); font-size: 20px; font-weight: 700; background: var(--inverse); color: var(--inverse-ink); border-radius: var(--r-sm); padding: 6px 13px; text-align: center; line-height: 1.3; }
.gm-f-add mark.gm-hl { background: none; color: inherit; }
.gm-f-ex { display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--ko); font-size: 16px; color: var(--ink-2); }
.gm-f-ex-item { display: inline-flex; align-items: baseline; gap: 6px; }
.gm-f-arrow { color: var(--faint); font-family: var(--mono); font-size: 13px; }
.gm-f-res { color: var(--ink); }
.gm-note { margin-top: 14px; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); padding: 12px 14px; border-radius: var(--r-md); border: 1px dashed var(--line); }

/* Nozik nuqtalar */
.gm-special { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.gm-special-item { background: var(--card); border-radius: var(--r-md); padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; font-family: var(--ko); font-size: 17px; }
.gm-special-item .gm-f-base { color: var(--muted); }
.gm-special-item .gm-f-res { font-weight: 700; }
.gm-special-note { flex-basis: 100%; font-family: var(--font); font-size: 13.5px; color: var(--muted); }

/* Misollar */
.gm-examples { margin-top: 18px; display: flex; flex-direction: column; }
.gm-ex { padding: 14px 0; border-bottom: 1px solid var(--line-2); animation: gmSlide .3s ease both; }
.gm-ex:first-child { padding-top: 4px; }
.gm-ex-ctx { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.gm-ex-kor { font-family: var(--ko); font-size: 19px; font-weight: 500; letter-spacing: -0.2px; line-height: 1.5; margin-top: 4px; }
.gm-ex-uzb { font-size: 14.5px; color: var(--muted); margin-top: 2px; line-height: 1.45; }

/* Tuzoq */
.gm-traps { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.gm-trap { background: var(--card); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.gm-trap-row { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; }
.gm-trap-badge { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.gm-trap-row.wrong .gm-trap-badge { border: 1.5px solid var(--bad); color: var(--bad); }
.gm-trap-row.right .gm-trap-badge { background: var(--ok); color: var(--surface); }
[data-theme="dark"] .gm-trap-row.right .gm-trap-badge { color: #0B0B0F; }
.gm-trap-text { font-family: var(--ko); font-size: 18px; font-weight: 700; line-height: 1.4; letter-spacing: -0.2px; }
.gm-trap-row.wrong .gm-trap-text { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 2px; }
.gm-trap-note { grid-column: 2; font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: -4px; }
.gm-trap-why { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); padding-top: 10px; border-top: 1px solid var(--line); }

/* Tekshiruv */
.gm-check-label { margin-top: 14px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.gm-slide-check .gm-headline { font-size: 22px; letter-spacing: -0.5px; margin-top: 6px; }
.gm-options { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.gm-option { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: center; width: 100%; min-height: 56px; padding: 10px 14px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); transition: background .15s, border-color .15s; }
.gm-option:not(:disabled):active { border-color: var(--ink); }
.gm-option-letter { width: 28px; height: 28px; border-radius: 8px; background: var(--card); font-family: var(--mono); font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.gm-option-text { font-family: var(--ko), var(--font); font-size: 16.5px; line-height: 1.4; }
.gm-option.correct { background: var(--ok-bg); border-color: var(--ok); }
.gm-option.correct .gm-option-letter { background: var(--ok); color: var(--surface); }
.gm-option.wrong { background: var(--bad-bg); border-color: var(--bad); }
.gm-option.wrong .gm-option-letter { background: var(--bad); color: var(--surface); }
[data-theme="dark"] .gm-option.correct .gm-option-letter, [data-theme="dark"] .gm-option.wrong .gm-option-letter { color: #0B0B0F; }
.gm-option.dim { opacity: .5; }
.gm-feedback { display: none; margin-top: 12px; padding: 14px 16px; border-radius: var(--r-md); }
.gm-feedback.show { display: block; animation: gmSlide .2s ease both; }
.gm-feedback.ok { background: var(--ok-bg); }
.gm-feedback.bad { background: var(--bad-bg); }
.gm-feedback-title { font-weight: 600; font-size: 15px; }
.gm-feedback-text { margin-top: 4px; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }

/* Xulosa */
.gm-take-card { margin-top: 16px; background: var(--inverse); color: var(--inverse-ink); border-radius: var(--r-xl); padding: 24px 20px; }
.gm-take-text { font-size: 23px; line-height: 1.3; letter-spacing: -0.6px; font-weight: 600; }
.gm-take-card mark.gm-hl { background: none; color: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.gm-recap { margin-top: 14px; display: flex; flex-direction: column; }
.gm-recap-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line-2); font-size: 15px; line-height: 1.45; }
.gm-recap-num { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.gm-cando { margin-top: 14px; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.gm-cando b { font-family: var(--mono); font-weight: 500; font-size: 12px; color: var(--muted); display: block; }
.gm-take-status { margin-top: 16px; font-family: var(--mono); font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.gm-take-status.ok { color: var(--ok); }

@media (max-height: 700px) {
  .gm-hook-pattern { font-size: 28px; }
  .gm-headline { font-size: 23px; }
  .gm-slide { padding-top: 16px; }
}
