:root {
    color-scheme: light;
    --page: #f5f7fc;
    --page-glow: rgb(95 116 238 / 16%);
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --surface-muted: #f7f8fc;
    --surface-subtle: #f1f4fb;
    --border: #e1e6f0;
    --border-strong: #cbd4e4;
    --text: #182238;
    --muted: #69758b;
    --muted-strong: #47566e;
    --primary: #4666d8;
    --primary-hover: #3857c4;
    --primary-accent: #6f85ec;
    --primary-soft: #eef1ff;
    --primary-ring: rgb(70 102 216 / 28%);
    --on-primary: #ffffff;
    --success: #178359;
    --success-hover: #116e4a;
    --success-soft: #e9f8f0;
    --warning: #ce661d;
    --warning-hover: #b85210;
    --warning-soft: #fff2e6;
    --gold: #b88318;
    --gold-hover: #9d6d09;
    --gold-soft: #fff7df;
    --error: #d34545;
    --error-hover: #b93636;
    --error-soft: #fff0f0;
    --on-danger: #ffffff;
    --shadow-sm: 0 4px 12px rgb(34 52 85 / 5%);
    --shadow: 0 16px 42px rgb(34 52 85 / 8%);
    --shadow-dialog: 0 28px 80px rgb(20 34 61 / 24%);
    --radius: 18px;
    --ease: 180ms cubic-bezier(.2, .8, .2, 1);
}

html[data-theme='dark'] {
    color-scheme: dark;
    --page: #0d1320;
    --page-glow: rgb(101 120 255 / 14%);
    --surface: #151d2d;
    --surface-raised: #1a2436;
    --surface-muted: #111a29;
    --surface-subtle: #202b40;
    --border: #2b3951;
    --border-strong: #40506b;
    --text: #edf3ff;
    --muted: #aab7cb;
    --muted-strong: #c6d1e1;
    --primary: #93a8ff;
    --primary-hover: #b0c0ff;
    --primary-accent: #7189ed;
    --primary-soft: #202b57;
    --primary-ring: rgb(147 168 255 / 34%);
    --on-primary: #141c36;
    --success: #67cf9a;
    --success-hover: #8ae3b5;
    --success-soft: #163a31;
    --warning: #ff9d5a;
    --warning-hover: #ffb17d;
    --warning-soft: #422918;
    --gold: #e7bd58;
    --gold-hover: #f5cf72;
    --gold-soft: #40351c;
    --error: #ff8b8b;
    --error-hover: #ffaaa8;
    --error-soft: #402525;
    --on-danger: #35191d;
    --shadow-sm: 0 4px 12px rgb(0 0 0 / 18%);
    --shadow: 0 18px 48px rgb(0 0 0 / 23%);
    --shadow-dialog: 0 30px 90px rgb(0 0 0 / 48%);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-width: 320px;
    background: var(--page);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(62rem 36rem at 8% -18%, var(--page-glow), transparent 68%),
        var(--page);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
    transition: color var(--ease), background-color var(--ease);
}

button,
input,
select {
    font: inherit;
}

button,
select {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
}

svg {
    display: block;
}

.app-shell {
    position: relative;
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
    padding: 48px 0 78px;
}

.app-preferences {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-raised) 92%, transparent);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
}

.preference-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.language-picker {
    position: relative;
    min-width: 144px;
}

.language-select {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    min-height: 40px;
    gap: 9px;
    padding: 0 10px 0 11px;
    border: 1px solid var(--border);
    border-radius: 11px;
    color: var(--text);
    background-color: var(--surface-subtle);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-align: left;
    transition: border-color var(--ease), background-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.language-select:hover,
.language-select[aria-expanded='true'] {
    border-color: var(--border-strong);
    background-color: var(--surface-raised);
}

.language-select:focus-visible,
.language-option:focus-visible {
    outline: 3px solid var(--primary-ring);
    outline-offset: 2px;
}

.language-select:active {
    transform: translateY(1px);
}

.language-current-flag,
.language-option .language-flag {
    display: inline-grid;
    width: 23px;
    height: 16px;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid rgb(16 33 67 / 17%);
    border-radius: 4px;
    box-shadow: 0 1px 2px rgb(20 36 66 / 12%);
}

.language-flag {
    display: block;
    width: 100%;
    height: 100%;
}

.language-current-flag .language-flag {
    display: none;
}

.language-current-flag .language-flag-en {
    display: block;
}

#language-picker[data-language='ru'] .language-current-flag .language-flag-en {
    display: none;
}

#language-picker[data-language='ru'] .language-current-flag .language-flag-ru {
    display: block;
}

.language-current-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.language-chevron {
    width: 17px;
    height: 17px;
    color: var(--muted);
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    transition: transform var(--ease), color var(--ease);
}

.language-select[aria-expanded='true'] .language-chevron {
    color: var(--primary);
    transform: rotate(180deg);
}

.language-options {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    right: 0;
    width: max(100%, 172px);
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-raised);
    box-shadow: var(--shadow-dialog);
}

.language-options[hidden] {
    display: none;
}

.language-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    min-height: 40px;
    gap: 10px;
    padding: 0 10px;
    border-radius: 9px;
    color: var(--text);
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: left;
    transition: color var(--ease), background-color var(--ease), transform var(--ease);
}

.language-option:hover {
    background: var(--surface-subtle);
}

.language-option:active {
    transform: translateY(1px);
}

.language-option[aria-checked='true'] {
    color: var(--primary);
    background: var(--primary-soft);
}

.language-option-check {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.5;
    opacity: 0;
}

.language-option[aria-checked='true'] .language-option-check {
    opacity: 1;
}

html[data-theme='dark'] .language-current-flag,
html[data-theme='dark'] .language-option .language-flag {
    border-color: rgb(235 243 255 / 20%);
    box-shadow: 0 1px 3px rgb(0 0 0 / 26%);
}

html[data-theme='dark'] .language-options {
    border-color: var(--border-strong);
}

.theme-toggle {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--primary);
    background: var(--primary-soft);
    cursor: pointer;
    transition: color var(--ease), background-color var(--ease), border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.theme-toggle:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
    color: var(--primary-hover);
    background: var(--surface-raised);
    box-shadow: 0 5px 12px color-mix(in srgb, var(--primary) 14%, transparent);
    transform: translateY(-1px);
}

.theme-toggle:active:not(:disabled) {
    transform: translateY(1px);
}

.theme-toggle svg,
.theme-toggle .icon {
    width: 19px;
    height: 19px;
    transition: transform var(--ease);
}

.theme-toggle:hover:not(:disabled) svg,
.theme-toggle:hover:not(:disabled) .icon {
    transform: rotate(14deg) scale(1.05);
}

html[data-theme='dark'] .theme-toggle {
    border-color: color-mix(in srgb, var(--gold) 34%, var(--border));
    color: var(--gold);
    background: var(--gold-soft);
}

.hero {
    max-width: none;
    margin-bottom: 38px;
}

.hero-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.hero-topline .eyebrow {
    margin-bottom: 0;
}

.hero-topline + h1 {
    margin-top: 24px;
}

.hero h1,
.hero-text,
.known-summary {
    max-width: 830px;
}

.eyebrow {
    margin: 0 0 9px;
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 14px;
    font-size: clamp(2rem, 4.2vw, 3.55rem);
    line-height: 1.05;
    letter-spacing: -0.052em;
}

h2 {
    margin-bottom: 3px;
    font-size: 1.05rem;
    line-height: 1.3;
    letter-spacing: -0.015em;
}

.hero-text {
    max-width: 710px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1rem;
}

.known-summary {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    margin: 20px 0 0;
    padding: 7px 11px;
    border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
    border-radius: 999px;
    color: var(--muted-strong);
    background: var(--primary-soft);
    font-size: 0.88rem;
    font-weight: 600;
}

.known-summary strong {
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.app-navigation {
    display: flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 22px;
    padding: 5px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: color-mix(in srgb, var(--surface-raised) 92%, transparent);
    box-shadow: var(--shadow-sm);
    scrollbar-width: none;
}

.app-navigation::-webkit-scrollbar {
    display: none;
}

.app-nav-tab {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    gap: 8px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--muted-strong);
    background: transparent;
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 750;
    letter-spacing: -0.01em;
    white-space: nowrap;
    transition: color var(--ease), background-color var(--ease), border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.app-nav-tab svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.app-nav-tab:hover:not([aria-selected='true']) {
    color: var(--primary);
    background: var(--surface-subtle);
}

.app-nav-tab:active {
    transform: translateY(1px);
}

.app-nav-tab.is-active,
.app-nav-tab[aria-selected='true'] {
    border-color: color-mix(in srgb, var(--primary) 20%, var(--border));
    color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 2px 7px color-mix(in srgb, var(--primary) 11%, transparent);
}

.app-nav-tab:focus-visible,
.file-group-tab:focus-visible {
    outline: 3px solid var(--primary-ring);
    outline-offset: 3px;
}

.app-page {
    min-width: 0;
}

.app-page-active {
    animation: app-page-in 200ms cubic-bezier(.2, .8, .2, 1) both;
}

.text-groups {
    display: grid;
    gap: 16px;
    margin-bottom: 22px;
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 90%, var(--primary-soft));
    box-shadow: var(--shadow-sm);
}

.text-groups-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.text-groups-heading .eyebrow {
    margin-bottom: 5px;
}

.text-groups-heading h2 {
    margin-bottom: 0;
}

.text-groups-heading .muted {
    max-width: 570px;
    text-align: right;
}

.file-group-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.file-group-tab {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    gap: 8px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    color: var(--muted-strong);
    background: var(--surface-raised);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 750;
    white-space: nowrap;
    transition: color var(--ease), background-color var(--ease), border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.file-group-tab svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.file-group-tab:hover:not([aria-selected='true']) {
    border-color: var(--border-strong);
    color: var(--primary);
    background: var(--surface-subtle);
}

.file-group-tab:active {
    transform: translateY(1px);
}

.file-group-tab.is-active,
.file-group-tab[aria-selected='true'],
.file-group-tab[data-drop-active='true'] {
    border-color: color-mix(in srgb, var(--primary) 34%, var(--border));
    color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 4px 10px color-mix(in srgb, var(--primary) 10%, transparent);
}

.file-group-tab[data-drop-active='true'] {
    outline: 3px solid var(--primary-ring);
    outline-offset: 2px;
}

.future-page {
    display: grid;
    min-height: 430px;
    place-items: center;
}

.future-page-card {
    width: min(100%, 620px);
    padding: 42px 34px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}

.future-page-card .eyebrow {
    margin-bottom: 8px;
}

.future-page-card h2 {
    margin-bottom: 9px;
    font-size: clamp(1.45rem, 3vw, 2rem);
    letter-spacing: -0.035em;
}

.future-page-card .muted {
    max-width: 460px;
    margin: 0 auto;
}

.future-page-icon {
    display: inline-grid;
    width: 52px;
    height: 52px;
    place-items: center;
    margin-bottom: 18px;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
    border-radius: 16px;
    color: var(--primary);
    background: var(--primary-soft);
}

.future-page-icon svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.grammar-page {
    min-width: 0;
}

.grammar-library {
    width: min(100%, 820px);
    margin: 0 auto;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
        radial-gradient(38rem 20rem at 100% 0, color-mix(in srgb, var(--primary-soft) 80%, transparent), transparent 72%),
        var(--surface);
    box-shadow: var(--shadow);
}

.grammar-heading {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.grammar-heading-icon,
.grammar-book-icon,
.grammar-resume-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
}

.grammar-heading-icon {
    width: 48px;
    height: 48px;
    border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
    border-radius: 15px;
}

.grammar-heading-icon svg,
.grammar-book-icon svg,
.grammar-resume-icon svg,
.grammar-book-open svg {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.grammar-heading-icon svg {
    width: 24px;
    height: 24px;
}

.grammar-heading .eyebrow {
    margin-bottom: 4px;
}

.grammar-heading h2 {
    margin-bottom: 6px;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.035em;
}

.grammar-heading .muted {
    max-width: 560px;
    margin: 0;
}

.grammar-book-list {
    display: grid;
    gap: 10px;
    margin-top: 26px;
}

.grammar-book,
.grammar-resume {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    color: inherit;
    text-decoration: none;
    transition: border-color var(--ease), background-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.grammar-book {
    padding: 14px 15px;
    background: color-mix(in srgb, var(--surface-raised) 96%, var(--primary-soft));
}

.grammar-book:hover {
    border-color: color-mix(in srgb, var(--primary) 36%, var(--border));
    background: var(--surface-raised);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 12%, transparent);
    transform: translateY(-1px);
}

.grammar-book:active,
.grammar-resume:active {
    transform: translateY(0);
}

.grammar-book:focus-visible,
.grammar-resume:focus-visible {
    outline: 3px solid var(--primary-ring);
    outline-offset: 3px;
}

.grammar-book-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
}

.grammar-book-icon svg {
    width: 21px;
    height: 21px;
}

.grammar-book-copy,
.grammar-resume-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.grammar-book-copy strong,
.grammar-resume-copy strong {
    overflow: hidden;
    color: var(--text);
    font-size: 0.96rem;
    letter-spacing: -0.012em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grammar-book-level {
    width: fit-content;
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--muted-strong);
    background: var(--surface-subtle);
    font-size: 0.73rem;
    font-weight: 750;
    line-height: 1.45;
}

.grammar-book-open {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    font-size: 0.79rem;
    font-weight: 750;
    white-space: nowrap;
}

.grammar-book-open svg {
    width: 17px;
    height: 17px;
}

.grammar-resume {
    margin-top: 18px;
    padding: 12px 14px;
    border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
    background: var(--primary-soft);
}

.grammar-resume:hover {
    border-color: color-mix(in srgb, var(--primary) 48%, var(--border));
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 10%, transparent);
    transform: translateY(-1px);
}

.grammar-resume-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
}

.grammar-resume-icon svg {
    width: 19px;
    height: 19px;
}

.grammar-resume-copy > span {
    color: var(--muted-strong);
    font-size: 0.76rem;
    font-weight: 700;
}

.grammar-resume-copy strong {
    font-size: 0.88rem;
}

.grammar-resume-open {
    color: var(--primary);
    font-size: 0.79rem;
    font-weight: 750;
    white-space: nowrap;
}

.upload-card,
.panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.upload-card {
    display: grid;
    gap: 20px;
    padding: 24px;
    margin-bottom: 22px;
}

.muted {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.875rem;
}

code {
    padding: 1px 5px;
    border-radius: 5px;
    color: var(--muted-strong);
    background: var(--surface-subtle);
    font-size: 0.9em;
}

.upload-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.selected-file {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    padding: 0 4px;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 42px;
    padding: 0 15px;
    border: 1px solid var(--primary);
    border-radius: 11px;
    color: var(--on-primary);
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 82%, var(--primary-accent)));
    box-shadow: 0 4px 10px color-mix(in srgb, var(--primary) 22%, transparent);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 750;
    line-height: 1;
    text-decoration: none;
    transition: color var(--ease), background-color var(--ease), border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.button:hover:not(:disabled) {
    border-color: var(--primary-hover);
    color: var(--on-primary);
    background: var(--primary-hover);
    box-shadow: 0 7px 16px color-mix(in srgb, var(--primary) 26%, transparent);
    transform: translateY(-1px);
}

.button:active:not(:disabled) {
    box-shadow: none;
    transform: translateY(1px);
}

.button-secondary {
    border-color: var(--border);
    color: var(--text);
    background: var(--surface-raised);
    box-shadow: 0 2px 5px rgb(25 38 63 / 4%);
}

.button-secondary:hover:not(:disabled) {
    border-color: var(--border-strong);
    color: var(--primary);
    background: var(--primary-soft);
}

.button-danger {
    border-color: var(--error);
    color: var(--on-danger);
    background: var(--error);
    box-shadow: 0 4px 10px color-mix(in srgb, var(--error) 18%, transparent);
}

.button-danger:hover:not(:disabled) {
    border-color: var(--error-hover);
    color: var(--on-danger);
    background: var(--error-hover);
}

.button-small {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 0.82rem;
}

.button > svg,
.button > .icon {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.button:disabled,
.icon-button:disabled,
.study-action:disabled,
.theme-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.52;
    transform: none;
}

.button:focus-visible,
.icon-button:focus-visible,
.theme-toggle:focus-visible,
.study-reveal:focus-visible,
.study-action:focus-visible,
.file-input:focus-visible + .button-secondary {
    outline: 3px solid var(--primary-ring);
    outline-offset: 3px;
}

.button.icon-button,
.icon-button {
    display: inline-grid;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    place-items: center;
    padding: 0;
    border-color: var(--border);
    border-radius: 10px;
    color: var(--muted-strong);
    background: var(--surface-raised);
    box-shadow: 0 2px 5px rgb(25 38 63 / 4%);
}

.button.icon-button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
    border-color: var(--border-strong);
    color: var(--primary);
    background: var(--primary-soft);
}

.button.icon-button.button-danger {
    border-color: color-mix(in srgb, var(--error) 35%, var(--border));
    color: var(--error);
    background: var(--error-soft);
    box-shadow: none;
}

.button.icon-button.button-danger:hover:not(:disabled) {
    border-color: var(--error);
    color: var(--on-danger);
    background: var(--error);
}

.icon-button.theme-toggle {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    border-color: var(--border);
    color: var(--primary);
    background: var(--primary-soft);
    box-shadow: none;
}

.icon-button.theme-toggle:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
    color: var(--primary-hover);
    background: var(--surface-raised);
    box-shadow: 0 5px 12px color-mix(in srgb, var(--primary) 14%, transparent);
}

html[data-theme='dark'] .icon-button.theme-toggle {
    border-color: color-mix(in srgb, var(--gold) 34%, var(--border));
    color: var(--gold);
    background: var(--gold-soft);
}

html[data-theme='dark'] .icon-button.theme-toggle:hover:not(:disabled) {
    border-color: var(--gold);
    color: var(--gold-hover);
    background: var(--surface-raised);
    box-shadow: 0 5px 12px color-mix(in srgb, var(--gold) 14%, transparent);
}

.icon-button svg,
.study-action svg,
.study-completed-icon svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.feedback {
    min-height: 1.45em;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.feedback.success {
    color: var(--success);
}

.feedback.error {
    color: var(--error);
}

.file-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: start;
    gap: 20px;
}

.panel {
    min-width: 0;
    min-height: 260px;
    padding: 21px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.panel-header > div {
    min-width: 0;
}

.count {
    display: inline-grid;
    min-width: 30px;
    min-height: 30px;
    place-items: center;
    padding: 0 8px;
    border: 1px solid color-mix(in srgb, var(--primary) 15%, var(--border));
    border-radius: 999px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 0.8rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.file-list {
    display: grid;
    gap: 11px;
    padding-top: 16px;
}

.file-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-muted);
    transition: border-color var(--ease), background-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.file-row[draggable='true'] {
    cursor: grab;
}

.file-row[draggable='true']:active {
    cursor: grabbing;
}

.file-row[data-dragging='true'] {
    border-style: dashed;
    border-color: color-mix(in srgb, var(--primary) 56%, var(--border));
    opacity: 0.5;
    transform: scale(.985);
}

.file-row:hover {
    border-color: var(--border-strong);
    background: var(--surface-raised);
    box-shadow: 0 5px 14px rgb(27 46 81 / 6%);
}

.file-details {
    min-width: 0;
}

.file-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.file-name {
    display: -webkit-box;
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 0.93rem;
    font-weight: 750;
    line-height: 1.42;
    overflow-wrap: break-word;
    word-break: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.file-meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.79rem;
    font-variant-numeric: tabular-nums;
}

.status {
    margin-top: 4px;
    color: var(--success);
    font-size: 0.78rem;
    font-weight: 750;
}

.empty-state,
.loading-state,
.error-state {
    padding: 26px 8px;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

.error-state {
    color: var(--error);
}

.study-dialog {
    width: min(720px, calc(100% - 28px));
    max-height: min(780px, calc(100% - 28px));
    margin: auto;
    padding: 0;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow-dialog);
}

.study-dialog[open] {
    animation: dialog-in 200ms cubic-bezier(.2, .8, .2, 1) both;
}

.study-dialog::backdrop {
    background: rgb(10 18 34 / 58%);
    backdrop-filter: blur(5px);
}

.study-dialog-content {
    padding: 30px;
}

.study-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.study-dialog-header > div {
    min-width: 0;
}

.study-dialog-header .eyebrow {
    margin-bottom: 5px;
}

.study-dialog-header h2 {
    margin-bottom: 5px;
    overflow-wrap: break-word;
    font-size: 1.2rem;
}

.study-dialog-controls {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}

.dialog-close {
    flex: 0 0 auto;
}

.study-progress {
    min-height: 1.5em;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
}

.study-card-view {
    display: grid;
    gap: 16px;
}

.study-card {
    display: grid;
    width: 100%;
    min-height: 290px;
    align-content: center;
    justify-items: center;
    gap: 16px;
    padding: 32px;
    border: 1px solid color-mix(in srgb, var(--primary) 23%, var(--border));
    border-radius: 20px;
    color: var(--text);
    background: linear-gradient(145deg, var(--surface-raised) 0%, var(--primary-soft) 155%);
    box-shadow: 0 12px 28px rgb(37 66 127 / 10%);
    cursor: text;
    text-align: center;
    user-select: text;
    -webkit-user-select: text;
    transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease), background-color var(--ease);
}

.study-card:hover,
.study-card.revealed {
    border-color: color-mix(in srgb, var(--primary) 56%, var(--border));
    box-shadow: 0 17px 34px rgb(37 66 127 / 16%);
}

.study-card-label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.study-translation,
.study-answer {
    max-width: 100%;
    overflow-wrap: break-word;
    font-size: clamp(1.4rem, 3vw, 2.1rem);
    font-weight: 800;
    line-height: 1.24;
    user-select: text;
    -webkit-user-select: text;
}

.study-answer {
    width: min(100%, 520px);
    padding-top: 14px;
    border-top: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
    color: var(--primary);
    font-size: clamp(1.08rem, 2.4vw, 1.42rem);
    font-weight: 750;
}

.study-card.revealed .study-answer {
    animation: study-answer-in 190ms cubic-bezier(.16, 1, .3, 1) both;
}

.study-card.revealed .study-translation {
    animation: study-translation-settle 180ms ease-out both;
}

.study-reveal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 15px;
    border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
    border-radius: 999px;
    color: var(--primary);
    background: color-mix(in srgb, var(--surface-raised) 76%, var(--primary-soft));
    box-shadow: 0 4px 10px color-mix(in srgb, var(--primary) 12%, transparent);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
    transition: color var(--ease), background-color var(--ease), border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.study-reveal svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.study-reveal:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary-hover);
    background: var(--surface-raised);
    box-shadow: 0 7px 15px color-mix(in srgb, var(--primary) 18%, transparent);
    transform: translateY(-1px);
}

.study-reveal:active:not(:disabled) {
    box-shadow: none;
    transform: translateY(1px);
}

.study-card.revealed .study-reveal {
    border-color: color-mix(in srgb, var(--success) 35%, var(--border));
    color: var(--success);
    background: var(--success-soft);
}

.study-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.study-action {
    position: relative;
    display: grid;
    min-height: 58px;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 3px 9px rgb(22 34 61 / 5%);
    transition: color var(--ease), background-color var(--ease), border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.study-action svg {
    width: 24px;
    height: 24px;
    stroke-width: 2.25;
}

.study-action:hover:not(:disabled) {
    box-shadow: 0 8px 16px rgb(22 34 61 / 11%);
    transform: translateY(-2px);
}

.study-action:active:not(:disabled) {
    box-shadow: none;
    transform: translateY(1px);
}

.study-action-dont-know {
    border-color: color-mix(in srgb, var(--warning) 31%, var(--border));
    color: var(--warning);
    background: var(--warning-soft);
}

.study-action-dont-know:hover:not(:disabled) {
    border-color: var(--warning);
    color: var(--warning-hover);
}

.study-action-know {
    border-color: color-mix(in srgb, var(--success) 31%, var(--border));
    color: var(--success);
    background: var(--success-soft);
}

.study-action-know:hover:not(:disabled) {
    border-color: var(--success);
    color: var(--success-hover);
}

.study-action-definitely-know {
    border-color: color-mix(in srgb, var(--gold) 35%, var(--border));
    color: var(--gold);
    background: var(--gold-soft);
}

.study-action-definitely-know:hover:not(:disabled) {
    border-color: var(--gold);
    color: var(--gold-hover);
}

.study-completed {
    display: grid;
    justify-items: center;
    padding: 32px 14px 10px;
    text-align: center;
}

.study-completed h3 {
    margin: 16px 0 8px;
    font-size: 1.38rem;
    letter-spacing: -0.025em;
}

.study-completed p {
    max-width: 430px;
    margin-bottom: 24px;
    color: var(--muted);
}

.study-completed-icon {
    display: grid;
    width: 62px;
    height: 62px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--success) 24%, transparent);
    border-radius: 50%;
    color: var(--success);
    background: var(--success-soft);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--success) 16%, transparent);
}

.study-completed-icon svg {
    width: 32px;
    height: 32px;
}

.shadowing-page {
    min-width: 0;
}

.shadowing-library {
    display: grid;
    gap: 20px;
    width: min(100%, 1120px);
    margin: 0 auto;
}

.shadowing-heading {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 27px 28px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
        radial-gradient(38rem 21rem at 100% 0, color-mix(in srgb, var(--primary-soft) 86%, transparent), transparent 72%),
        var(--surface);
    box-shadow: var(--shadow);
}

.shadowing-heading-icon,
.shadowing-history-heading-icon {
    display: grid;
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
    border-radius: 16px;
    color: var(--primary);
    background: var(--primary-soft);
}

.shadowing-heading-icon svg,
.shadowing-history-heading-icon svg,
.shadowing-input-wrap > svg,
.shadowing-placeholder-icon svg,
.shadowing-mode-icon svg,
.shadowing-primary-action-icon,
.shadowing-stop svg,
.shadowing-select-wrap > svg,
.shadowing-recordings-empty-icon svg {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.shadowing-heading-icon svg {
    width: 25px;
    height: 25px;
    stroke-width: 1.8;
}

.shadowing-heading-copy {
    min-width: 0;
}

.shadowing-heading-copy .eyebrow,
.shadowing-section-heading .eyebrow,
.shadowing-player-header .eyebrow,
.shadowing-history-heading .eyebrow {
    margin-bottom: 4px;
}

.shadowing-heading-copy h2 {
    margin-bottom: 6px;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.035em;
}

.shadowing-heading-copy .muted {
    max-width: 740px;
}

.shadowing-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.7fr);
    align-items: start;
    gap: 20px;
}

.shadowing-studio {
    display: grid;
    min-width: 0;
    gap: 20px;
}

.shadowing-clip-card,
.shadowing-player-card,
.shadowing-history {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.shadowing-clip-card {
    padding: 21px;
}

.shadowing-section-heading,
.shadowing-player-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.shadowing-section-heading h3,
.shadowing-player-header h3,
.shadowing-history-heading h3 {
    margin-bottom: 0;
    font-size: 1.05rem;
    letter-spacing: -0.015em;
}

.shadowing-clip-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 25px;
    padding: 0 9px;
    border: 1px solid color-mix(in srgb, var(--success) 25%, var(--border));
    border-radius: 999px;
    color: var(--success);
    background: var(--success-soft);
    font-size: 0.71rem;
    font-weight: 800;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    white-space: nowrap;
}

.shadowing-clip-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(218px, 0.58fr);
    align-items: end;
    gap: 14px;
    margin-top: 18px;
}

.shadowing-field {
    display: grid;
    min-width: 0;
    gap: 7px;
}

.shadowing-field-url {
    grid-column: 1 / -1;
}

.shadowing-field-label,
.shadowing-recording-picker > span:first-child {
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 800;
}

.shadowing-input-wrap,
.shadowing-select-wrap {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    min-height: 44px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    color: var(--muted);
    background: var(--surface-muted);
    transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease);
}

.shadowing-input-wrap {
    gap: 9px;
    padding-left: 13px;
}

.shadowing-input-wrap > svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.8;
}

.shadowing-input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    color: var(--text);
    background: var(--surface-muted);
    font: inherit;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    outline: 0;
    transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease);
}

.shadowing-input-wrap .shadowing-input {
    padding: 0 12px 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.shadowing-input::placeholder {
    color: var(--muted);
    opacity: 0.82;
}

.shadowing-input:hover,
.shadowing-input-wrap:hover,
.shadowing-select-wrap:hover {
    border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
}

.shadowing-input:focus,
.shadowing-input-wrap:focus-within,
.shadowing-select-wrap:focus-within {
    border-color: var(--primary);
    background: var(--surface-raised);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

.shadowing-input-wrap .shadowing-input:focus {
    box-shadow: none;
}

.shadowing-time-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.shadowing-time-input {
    padding-right: 8px;
}

.shadowing-clip-actions {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.shadowing-loop-control {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 9px;
    color: var(--muted-strong);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 700;
}

.shadowing-loop-control input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.shadowing-loop-switch {
    position: relative;
    width: 35px;
    height: 21px;
    flex: 0 0 auto;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface-subtle);
    box-shadow: inset 0 1px 2px rgb(25 38 63 / 6%);
    transition: background-color var(--ease), border-color var(--ease);
}

.shadowing-loop-switch::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--muted);
    content: '';
    transition: transform var(--ease), background-color var(--ease);
}

.shadowing-loop-control input:checked + .shadowing-loop-switch {
    border-color: var(--primary);
    background: var(--primary);
}

.shadowing-loop-control input:checked + .shadowing-loop-switch::after {
    transform: translateX(14px);
    background: var(--on-primary);
}

.shadowing-loop-control input:focus-visible + .shadowing-loop-switch {
    outline: 3px solid var(--primary-ring);
    outline-offset: 3px;
}

.shadowing-load {
    flex: 0 0 auto;
}

.shadowing-load > svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.shadowing-clip-hint {
    margin: 13px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.48;
}

.shadowing-player-card {
    padding: 21px;
}

.shadowing-live-indicator {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
    border-radius: 999px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 0.72rem;
    font-weight: 800;
}

.shadowing-live-indicator > span:first-child {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 16%, transparent);
}

.shadowing-player-stage {
    position: relative;
    display: grid;
    aspect-ratio: 16 / 9;
    min-height: 230px;
    margin-top: 17px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
    border-radius: 16px;
    background: #0d1525;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 6%);
}

.shadowing-youtube-player,
.shadowing-youtube-player iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.shadowing-youtube-player {
    position: relative;
    z-index: 1;
}

.shadowing-player-placeholder {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 8px;
    padding: 24px;
    color: #edf3ff;
    background:
        radial-gradient(18rem 10rem at 50% 15%, rgb(111 133 236 / 25%), transparent 75%),
        linear-gradient(150deg, #111d33, #0b1120);
    text-align: center;
}

.shadowing-player-placeholder::before,
.shadowing-player-placeholder::after {
    position: absolute;
    width: 118px;
    height: 118px;
    border: 1px solid rgb(147 168 255 / 16%);
    border-radius: 50%;
    content: '';
}

.shadowing-player-placeholder::before {
    transform: translate(-78px, -34px);
}

.shadowing-player-placeholder::after {
    transform: translate(92px, 46px);
}

.shadowing-placeholder-icon,
.shadowing-player-placeholder strong,
.shadowing-player-placeholder > span {
    position: relative;
    z-index: 1;
}

.shadowing-placeholder-icon {
    display: grid;
    width: 49px;
    height: 49px;
    place-items: center;
    margin-bottom: 2px;
    border: 1px solid rgb(207 218 255 / 26%);
    border-radius: 15px;
    color: #cfdafe;
    background: rgb(152 171 255 / 12%);
}

.shadowing-placeholder-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.8;
}

.shadowing-player-placeholder strong {
    font-size: 1rem;
    letter-spacing: -0.012em;
}

.shadowing-player-placeholder > span {
    max-width: 330px;
    color: #bdc9df;
    font-size: 0.82rem;
}

.shadowing-status {
    min-height: 1.45em;
    margin: 11px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.shadowing-status.is-error {
    color: var(--error);
}

.shadowing-status.is-success {
    color: var(--success);
}

.shadowing-mode-section {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.shadowing-mode-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.shadowing-mode-heading h4 {
    margin: 0;
    font-size: 0.9rem;
}

.shadowing-mode-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 0.77rem;
    text-align: right;
}

.shadowing-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin-top: 11px;
}

.shadowing-mode {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    min-height: 65px;
    gap: 9px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 13px;
    color: var(--muted-strong);
    background: var(--surface-muted);
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: color var(--ease), background-color var(--ease), border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.shadowing-mode:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--primary) 38%, var(--border));
    color: var(--primary);
    background: var(--surface-raised);
    transform: translateY(-1px);
}

.shadowing-mode:active:not(:disabled) {
    transform: translateY(1px);
}

.shadowing-mode.is-active,
.shadowing-mode[aria-pressed='true'] {
    border-color: color-mix(in srgb, var(--primary) 46%, var(--border));
    color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 5px 13px color-mix(in srgb, var(--primary) 12%, transparent);
}

.shadowing-mode:focus-visible,
.shadowing-recording-picker select:focus-visible {
    outline: 3px solid var(--primary-ring);
    outline-offset: 3px;
}

.shadowing-mode-icon {
    display: grid;
    width: 29px;
    height: 29px;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 9px;
    color: inherit;
    opacity: 0.9;
}

.shadowing-mode-icon svg {
    width: 17px;
    height: 17px;
    stroke-width: 1.8;
}

.shadowing-mode-copy {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.shadowing-mode-copy strong {
    overflow: hidden;
    font-size: 0.79rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shadowing-mode-copy small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.69rem;
    font-weight: 650;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shadowing-player-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-top: 17px;
}

.shadowing-primary-action {
    min-width: 162px;
}

.shadowing-primary-action-icon,
.shadowing-stop svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.shadowing-history {
    display: grid;
    grid-template-rows: auto auto auto minmax(170px, 1fr);
    align-self: stretch;
    gap: 17px;
    min-height: 100%;
    padding: 21px;
}

.shadowing-history-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
}

.shadowing-history-heading-icon {
    width: 41px;
    height: 41px;
    border-radius: 13px;
}

.shadowing-history-heading-icon svg {
    width: 21px;
    height: 21px;
    stroke-width: 1.8;
}

.shadowing-history-description {
    margin: -7px 0 0;
    color: var(--muted);
    font-size: 0.81rem;
    line-height: 1.48;
}

.shadowing-recording-picker {
    display: grid;
    gap: 7px;
}

.shadowing-select-wrap {
    position: relative;
    display: block;
}

.shadowing-recording-picker select {
    width: 100%;
    min-height: 44px;
    padding: 0 39px 0 13px;
    border: 0;
    border-radius: 12px;
    color: var(--text);
    appearance: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: 0.86rem;
    outline: 0;
}

.shadowing-select-wrap > svg {
    position: absolute;
    top: 50%;
    right: 12px;
    width: 17px;
    height: 17px;
    pointer-events: none;
    stroke-width: 2;
    transform: translateY(-50%);
}

.shadowing-recordings {
    display: grid;
    align-content: start;
    gap: 9px;
    min-height: 170px;
    max-height: 420px;
    overflow: auto;
    padding-right: 2px;
}

.shadowing-recordings-empty {
    display: grid;
    justify-items: center;
    gap: 7px;
    min-height: 170px;
    padding: 20px 14px;
    border: 1px dashed var(--border-strong);
    border-radius: 15px;
    color: var(--muted);
    background: var(--surface-muted);
    text-align: center;
}

.shadowing-recordings-empty-icon {
    display: grid;
    width: 39px;
    height: 39px;
    place-items: center;
    margin-bottom: 2px;
    border-radius: 12px;
    color: var(--primary);
    background: var(--primary-soft);
}

.shadowing-recordings-empty-icon svg {
    width: 21px;
    height: 21px;
    stroke-width: 1.8;
}

.shadowing-recordings-empty strong {
    color: var(--muted-strong);
    font-size: 0.88rem;
}

.shadowing-recordings-empty > span:last-child {
    max-width: 245px;
    font-size: 0.76rem;
    line-height: 1.45;
}

.shadowing-recording-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-muted);
}

.shadowing-recording-item.is-selected {
    border-color: color-mix(in srgb, var(--primary) 48%, var(--border));
    background: var(--primary-soft);
}

.shadowing-recordings-error {
    margin: 0;
    padding: 13px;
    border: 1px solid color-mix(in srgb, var(--error) 35%, var(--border));
    border-radius: 13px;
    color: var(--error);
    background: var(--error-soft);
    font-size: 0.82rem;
    line-height: 1.45;
}

.shadowing-recording-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.shadowing-recording-title {
    overflow: hidden;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shadowing-recording-meta {
    color: var(--muted);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.shadowing-recording-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.shadowing-recording-action {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--primary);
    background: var(--surface-raised);
    cursor: pointer;
}

.shadowing-recording-action:hover {
    border-color: color-mix(in srgb, var(--primary) 36%, var(--border));
    background: var(--primary-soft);
}

.shadowing-recording-action.is-danger {
    color: var(--error);
}

.shadowing-recording-action svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

@media (max-width: 980px) {
    .shadowing-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .shadowing-history {
        grid-template-rows: auto auto auto auto;
        min-height: 0;
    }

    .shadowing-recordings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: none;
    }

    .shadowing-recordings-empty {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .shadowing-heading {
        padding: 22px;
        border-radius: 20px;
    }

    .shadowing-clip-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .shadowing-clip-actions {
        grid-column: auto;
    }

    .shadowing-player-stage {
        min-height: 0;
    }

    .shadowing-mode-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .shadowing-mode {
        min-height: 56px;
    }

    .shadowing-recordings {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 520px) {
    .shadowing-library {
        gap: 16px;
    }

    .shadowing-heading,
    .shadowing-clip-card,
    .shadowing-player-card,
    .shadowing-history {
        padding: 18px;
        border-radius: 16px;
    }

    .shadowing-heading {
        align-items: flex-start;
        gap: 12px;
    }

    .shadowing-heading-icon {
        width: 43px;
        height: 43px;
        border-radius: 13px;
    }

    .shadowing-heading-icon svg {
        width: 22px;
        height: 22px;
    }

    .shadowing-section-heading,
    .shadowing-player-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .shadowing-clip-badge,
    .shadowing-live-indicator {
        align-self: flex-start;
    }

    .shadowing-time-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .shadowing-clip-actions,
    .shadowing-player-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .shadowing-load,
    .shadowing-primary-action,
    .shadowing-stop {
        width: 100%;
    }

    .shadowing-mode-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .shadowing-mode-heading p {
        text-align: left;
    }
}

.writing-page {
    min-width: 0;
}

.writing-library {
    display: grid;
    gap: 20px;
    width: min(100%, 1080px);
    margin: 0 auto;
}

.writing-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 27px 28px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
        radial-gradient(38rem 21rem at 100% 0, color-mix(in srgb, var(--primary-soft) 84%, transparent), transparent 72%),
        var(--surface);
    box-shadow: var(--shadow);
}

.writing-heading-icon {
    display: grid;
    width: 50px;
    height: 50px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
    border-radius: 16px;
    color: var(--primary);
    background: var(--primary-soft);
}

.writing-heading-icon svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.writing-heading-copy {
    min-width: 0;
}

.writing-heading-copy .eyebrow {
    margin-bottom: 4px;
}

.writing-heading-copy h2 {
    margin-bottom: 6px;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.035em;
}

.writing-heading-copy .muted {
    max-width: 620px;
}

.writing-new {
    flex: 0 0 auto;
    white-space: nowrap;
}

.writing-new svg,
.writing-editor-actions .button svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.writing-summary {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 0.35rem;
    padding: 7px 11px;
    border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
    border-radius: 999px;
    color: var(--muted-strong);
    background: var(--primary-soft);
    font-size: 0.84rem;
    font-weight: 700;
}

.writing-summary-label {
    color: var(--muted);
}

.writing-summary strong {
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.writing-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 20px;
}

.writing-panel {
    min-width: 0;
    min-height: 280px;
    padding: 21px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.writing-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.writing-panel-header > div {
    min-width: 0;
}

.writing-panel-header h3 {
    margin-bottom: 4px;
    font-size: 1.04rem;
    letter-spacing: -0.015em;
}

.writing-list {
    display: grid;
    gap: 10px;
    padding-top: 16px;
}

.writing-list-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    background: var(--surface-muted);
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: border-color var(--ease), background-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.writing-list-item:hover {
    border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
    background: var(--surface-raised);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 9%, transparent);
    transform: translateY(-1px);
}

.writing-list-item:active {
    box-shadow: none;
    transform: translateY(1px);
}

.writing-list-item:focus-visible,
.writing-text:focus-visible {
    outline: 3px solid var(--primary-ring);
    outline-offset: 3px;
}

.writing-list-copy {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.writing-list-preview {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text);
    font-size: 0.91rem;
    font-weight: 750;
    line-height: 1.4;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.writing-list-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 8px;
    color: var(--muted);
    font-size: 0.77rem;
    font-weight: 650;
}

.writing-list-status {
    display: inline-flex;
    align-items: center;
    min-height: 21px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 0.69rem;
    font-weight: 800;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.writing-list-status.is-draft {
    color: var(--gold);
    background: var(--gold-soft);
}

.writing-list-status.is-checked {
    color: var(--success);
    background: var(--success-soft);
}

.writing-list-open {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--primary);
    background: var(--primary-soft);
}

.writing-list-open svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.writing-list-empty,
.writing-list-error {
    padding: 30px 8px;
    color: var(--muted);
    font-size: 0.89rem;
    text-align: center;
}

.writing-list-error {
    color: var(--error);
}

.writing-retry {
    justify-self: center;
}

.writing-dialog {
    width: min(860px, calc(100% - 28px));
    max-height: min(880px, calc(100% - 28px));
    margin: auto;
    padding: 0;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow-dialog);
}

.writing-dialog[open] {
    animation: dialog-in 200ms cubic-bezier(.2, .8, .2, 1) both;
}

.writing-dialog::backdrop {
    background: rgb(10 18 34 / 58%);
    backdrop-filter: blur(5px);
}

.writing-dialog-content {
    padding: 30px;
}

.writing-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.writing-dialog-header > div {
    min-width: 0;
}

.writing-dialog-header .eyebrow {
    margin-bottom: 5px;
}

.writing-dialog-header h2 {
    margin-bottom: 5px;
    font-size: clamp(1.28rem, 3vw, 1.62rem);
    letter-spacing: -0.028em;
}

.writing-dialog-subtitle {
    max-width: 660px;
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.writing-form {
    display: grid;
    gap: 10px;
}

.writing-text-label {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 800;
}

.writing-text {
    width: 100%;
    min-height: 270px;
    resize: vertical;
    padding: 16px;
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    color: var(--text);
    background: var(--surface-muted);
    caret-color: var(--primary);
    font: inherit;
    font-size: 0.96rem;
    line-height: 1.64;
    transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease);
}

.writing-text::placeholder {
    color: var(--muted);
    opacity: 0.85;
}

.writing-text:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
}

.writing-text:focus {
    border-color: var(--primary);
    background: var(--surface-raised);
    box-shadow: 0 0 0 4px var(--primary-ring);
    outline: 0;
}

.writing-text:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.writing-editor-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.writing-text-hint,
.writing-character-count {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.writing-text-hint {
    max-width: 580px;
}

.writing-character-count {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.writing-dialog-status {
    min-height: 1.45em;
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 0.87rem;
}

.writing-dialog-status.success {
    color: var(--success);
}

.writing-dialog-status.error {
    color: var(--error);
}

.writing-editor-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 2px;
}

.writing-review {
    display: grid;
    gap: 18px;
}

.writing-review-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.writing-review-heading .eyebrow {
    margin-bottom: 4px;
}

.writing-review-heading h3 {
    margin-bottom: 0;
    font-size: 1.12rem;
}

.writing-review-counts {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-align: right;
}

.writing-suggestions {
    padding: 17px;
    border: 1px solid color-mix(in srgb, var(--success) 27%, var(--border));
    border-radius: 16px;
    background: color-mix(in srgb, var(--success-soft) 72%, var(--surface));
}

.writing-suggestions-heading {
    display: flex;
    align-items: flex-start;
    gap: 11px;
}

.writing-suggestions-heading > svg {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    margin-top: 1px;
    fill: none;
    stroke: var(--success);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.writing-suggestions-heading h4,
.writing-annotated-heading h4 {
    margin-bottom: 3px;
    font-size: 0.96rem;
}

.writing-suggestions-heading p,
.writing-annotated-heading p {
    margin-bottom: 0;
    color: var(--muted-strong);
    font-size: 0.8rem;
}

.writing-suggestion-list {
    display: grid;
    gap: 9px;
    margin-top: 14px;
}

.writing-suggestion {
    display: grid;
    gap: 5px;
    padding: 11px 12px;
    border: 1px solid color-mix(in srgb, var(--success) 19%, var(--border));
    border-radius: 11px;
    background: color-mix(in srgb, var(--surface-raised) 78%, transparent);
}

.writing-suggestion-phrases {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    color: var(--success);
    font-size: 0.88rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.writing-suggestion-original {
    color: var(--muted-strong);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.writing-suggestion-arrow {
    color: var(--success);
}

.writing-suggestion-explanation {
    margin: 0;
    color: var(--muted-strong);
    font-size: 0.78rem;
}

.writing-annotated-section {
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-muted);
}

.writing-annotated-heading {
    margin-bottom: 13px;
}

.writing-annotated-text {
    min-height: 90px;
    padding: 15px;
    border: 1px solid color-mix(in srgb, var(--primary) 14%, var(--border));
    border-radius: 12px;
    color: var(--text);
    background: var(--surface-raised);
    font-size: 0.94rem;
    line-height: 1.68;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.writing-annotated-text:focus-visible {
    outline: 3px solid var(--primary-ring);
    outline-offset: 3px;
}

.writing-correction-deleted {
    color: var(--error);
    text-decoration-color: currentColor;
    text-decoration-thickness: 2px;
}

.writing-correction-added {
    margin-left: 0.16em;
    color: var(--error);
    font-weight: 800;
    text-decoration: none;
}

.writing-correction-added::before {
    content: '[';
    opacity: 0.72;
}

.writing-correction-added::after {
    content: ']';
    opacity: 0.72;
}

.writing-no-corrections {
    margin: 12px 0 0;
    color: var(--success);
    font-size: 0.84rem;
    font-weight: 700;
}

@keyframes dialog-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes study-answer-in {
    from {
        opacity: 0;
        transform: translateY(6px) scale(.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes study-translation-settle {
    from {
        transform: translateY(-2px);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes app-page-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 820px) {
    .app-shell {
        width: min(100% - 32px, 1240px);
        padding-top: 28px;
    }

    .hero-topline {
        align-items: flex-start;
    }

    .text-groups-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .text-groups-heading .muted {
        max-width: none;
        text-align: left;
    }

    .writing-heading {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .writing-new {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

@media (max-width: 700px) {
    .app-navigation {
        width: 100%;
    }

    .text-groups {
        padding: 18px;
    }

    .file-columns {
        grid-template-columns: minmax(0, 1fr);
    }

    .writing-columns {
        grid-template-columns: minmax(0, 1fr);
    }

    .upload-form {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .selected-file {
        flex-basis: 100%;
        order: 3;
        padding: 3px 0 0;
    }

    .upload-form .upload-submit {
        margin-left: auto;
    }

    .file-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .file-actions {
        justify-content: flex-start;
    }

    .future-page {
        min-height: 350px;
    }

    .grammar-library {
        padding: 21px;
        border-radius: 20px;
    }

    .writing-heading {
        padding: 22px;
        border-radius: 20px;
    }

    .writing-panel {
        min-height: 0;
    }
}

@media (max-width: 520px) {
    .app-shell {
        width: min(100% - 24px, 1240px);
        padding-bottom: 42px;
    }

    .hero-topline {
        flex-wrap: wrap;
        gap: 14px;
    }

    .app-preferences {
        margin-left: auto;
        max-width: 100%;
    }

    .language-picker {
        min-width: 130px;
    }

    h1 {
        font-size: clamp(2rem, 10vw, 2.65rem);
    }

    .upload-card,
    .panel {
        border-radius: 16px;
    }

    .upload-card,
    .panel {
        padding: 18px;
    }

    .app-navigation {
        margin-bottom: 18px;
        border-radius: 13px;
    }

    .app-nav-tab {
        min-height: 38px;
        padding: 0 11px;
        font-size: 0.82rem;
    }

    .app-nav-tab svg {
        width: 17px;
        height: 17px;
    }

    .text-groups {
        gap: 14px;
        margin-bottom: 18px;
        padding: 17px;
        border-radius: 16px;
    }

    .file-group-tabs {
        gap: 7px;
    }

    .file-group-tab {
        min-height: 38px;
        gap: 7px;
        padding: 0 11px;
        font-size: 0.82rem;
    }

    .future-page {
        min-height: 300px;
    }

    .future-page-card {
        padding: 31px 21px;
        border-radius: 19px;
    }

    .grammar-library {
        padding: 18px;
        border-radius: 18px;
    }

    .writing-library {
        gap: 16px;
    }

    .writing-heading {
        gap: 12px;
        padding: 18px;
        border-radius: 18px;
    }

    .writing-heading-icon {
        width: 43px;
        height: 43px;
        border-radius: 13px;
    }

    .writing-heading-icon svg {
        width: 22px;
        height: 22px;
    }

    .writing-new {
        width: 100%;
    }

    .writing-panel {
        padding: 18px;
        border-radius: 16px;
    }

    .grammar-heading {
        gap: 12px;
    }

    .grammar-heading-icon {
        width: 43px;
        height: 43px;
        border-radius: 13px;
    }

    .grammar-book,
    .grammar-resume {
        gap: 11px;
        padding: 12px;
        border-radius: 14px;
    }

    .grammar-book-icon {
        width: 38px;
        height: 38px;
        border-radius: 11px;
    }

    .grammar-book-open > span,
    .grammar-resume-open {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        clip-path: inset(50%);
    }

    .file-row {
        padding: 12px;
    }

    .file-name {
        -webkit-line-clamp: 4;
    }

    .study-dialog {
        width: min(100% - 16px, 720px);
        max-height: min(100% - 16px, 780px);
        border-radius: 19px;
    }

    .writing-dialog {
        width: min(100% - 16px, 860px);
        max-height: min(100% - 16px, 880px);
        border-radius: 19px;
    }

    .study-dialog-content {
        padding: 22px 18px;
    }

    .writing-dialog-content {
        padding: 22px 18px;
    }

    .writing-text {
        min-height: 235px;
        padding: 14px;
        border-radius: 14px;
    }

    .writing-editor-footer,
    .writing-review-heading {
        gap: 9px;
        flex-direction: column;
    }

    .writing-review-counts {
        text-align: left;
    }

    .writing-editor-actions {
        justify-content: stretch;
    }

    .writing-editor-actions .button {
        flex: 1 1 150px;
    }

    .study-card {
        min-height: 255px;
        padding: 26px 18px;
        border-radius: 16px;
    }

    .study-actions {
        gap: 8px;
    }

    .study-action {
        min-height: 54px;
        border-radius: 12px;
    }
}

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