:root {
    --brand: #1f7a72;
    --brand-dark: #14524d;
    --brand-soft: #dff3ee;
    --accent: #f2a93b;
    --accent-soft: #fff2dc;
    --danger: #c94545;
    --danger-soft: #fff0f0;
    --success: #26825f;
    --success-soft: #e9f7f0;
    --ink: #19242f;
    --muted: #6d7b8a;
    --line: #d9e2e8;
    --surface: #ffffff;
    --surface-soft: #f7faf9;
    --shadow-soft: 0 18px 55px rgba(25, 36, 47, 0.11);
    --shadow-card: 0 10px 28px rgba(25, 36, 47, 0.08);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --font-main: "Trebuchet MS", "Aptos", "Segoe UI", sans-serif;
    --font-display: Georgia, "Times New Roman", serif;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 12%, rgba(31, 122, 114, 0.16), transparent 28rem),
        radial-gradient(circle at 86% 4%, rgba(242, 169, 59, 0.18), transparent 24rem),
        linear-gradient(135deg, #fbf9f2 0%, #eef7f4 48%, #f8fbfb 100%);
    padding-top: 76px;
    overflow-y: scroll;
    font-family: var(--font-main);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(25, 36, 47, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(25, 36, 47, 0.035) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 72%);
}

img {
    max-width: 100%;
}

a {
    color: var(--brand-dark);
}

.site-navbar {
    min-height: 64px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.38);
    background: rgba(20, 82, 77, 0.92);
    backdrop-filter: blur(18px);
    box-shadow: 0 10px 30px rgba(20, 82, 77, 0.2);
}

.site-navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 64px;
}

.site-navbar .navbar-brand,
.site-navbar .navbar-text {
    color: #fff !important;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    color: #fff;
    text-decoration: none;
}

.site-brand:hover {
    color: #fff;
}

.site-brand__logo {
    display: block;
    width: 146px;
    height: 38px;
    object-fit: contain;
    padding: 5px 12px;
    border-radius: 12px;
    background: #fff;
}

.site-shell {
    padding-bottom: 54px;
}

.site-shell > .container {
    max-width: min(1520px, calc(100vw - 44px));
}

.nav-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex: 1 1 auto;
    margin-left: auto;
}

.language-selector,
.auth-widget {
    color: #fff;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

.language-selector__label {
    margin: 0;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    font-weight: 800;
}

.language-selector__select {
    min-width: 150px;
    height: 36px;
    padding: 0 34px 0 12px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-weight: 800;
}

.language-selector__select option {
    color: #17212b;
}

.auth-form {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.auth-input {
    width: 150px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    outline: none;
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.78);
}

.auth-button,
.auth-link {
    min-height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-weight: 800;
    text-decoration: none;
}

.auth-button:hover,
.auth-link:hover {
    background: #fff;
    color: var(--brand-dark);
}

.auth-user {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    margin-right: 8px;
    font-weight: 900;
}

.account-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.account-settings-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1.05rem;
    line-height: 1;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.account-settings-button:hover,
.account-settings-button[aria-expanded="true"] {
    background: #fff;
    color: var(--brand-dark);
    transform: translateY(-1px);
}

.account-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 1090;
    width: min(340px, calc(100vw - 28px));
    padding: 14px;
    border: 1px solid rgba(217, 226, 232, 0.95);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--ink);
    box-shadow: 0 24px 70px rgba(8, 18, 22, 0.24);
    backdrop-filter: blur(14px);
}

.account-dropdown::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 18px;
    width: 14px;
    height: 14px;
    border-top: 1px solid rgba(217, 226, 232, 0.95);
    border-left: 1px solid rgba(217, 226, 232, 0.95);
    background: rgba(255, 255, 255, 0.96);
    transform: rotate(45deg);
}

.account-dropdown__head {
    display: grid;
    gap: 4px;
    padding: 8px 10px 12px;
    border-bottom: 1px solid var(--line);
}

.account-dropdown__head span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.account-dropdown__head strong {
    color: var(--ink);
    font-size: 1rem;
    word-break: break-word;
}

.account-language {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
    color: var(--ink);
    font-weight: 900;
}

.account-language span {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.account-language select {
    min-height: 42px;
    border-radius: 14px;
    font-weight: 900;
}

.account-dropdown__link {
    width: 100%;
    min-height: 42px;
    margin-top: 8px;
    padding: 0.65rem 0.75rem;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--ink);
    text-align: left;
    font-weight: 900;
}

.account-dropdown__link:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.account-dropdown__link--danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.account-password-form {
    display: grid;
    gap: 10px;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-soft);
}

.account-password-form label {
    display: grid;
    gap: 6px;
    color: var(--ink);
    font-weight: 900;
}

.account-password-form label span,
.account-password-form small {
    color: var(--muted);
    font-size: 0.84rem;
}

.account-save-button {
    width: 100%;
    background: var(--brand);
    border-color: var(--brand);
}

.account-menu-message {
    padding: 9px 11px;
    border-radius: 13px;
    font-size: 0.88rem;
    font-weight: 900;
}

.account-menu-message.is-success {
    background: var(--success-soft);
    color: var(--success);
}

.account-menu-message.is-error {
    background: var(--danger-soft);
    color: var(--danger);
}

.auth-error {
    width: 100%;
    color: #ffe3e3;
    font-size: 0.85rem;
    text-align: right;
}

.page-card,
.question-card,
.auth-card,
.learn-card,
.summary-metric,
.practice-stat,
.text-answer-card {
    border: 1px solid rgba(217, 226, 232, 0.95);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(10px);
}

.page-card {
    position: relative;
    overflow: hidden;
    padding: clamp(18px, 2.3vw, 32px);
    border-radius: var(--radius-lg);
}

.page-head,
.result-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.page-title-simple,
.page-head h1,
.auth-card__head h1 {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3.15rem);
    line-height: 0.96;
    letter-spacing: -0.045em;
}

.page-head p,
.auth-card__head p {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 1rem;
}

.btn {
    border-radius: 999px;
    font-weight: 900;
    letter-spacing: 0.01em;
}

.btn-brand {
    border-color: var(--brand);
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    box-shadow: 0 10px 22px rgba(31, 122, 114, 0.22);
}

.btn-brand:hover,
.btn-brand:focus,
.btn-brand:active {
    border-color: var(--brand-dark) !important;
    background: linear-gradient(135deg, var(--brand-dark), #0c3835) !important;
    color: #fff !important;
}

.btn-outline-secondary {
    border-color: #b8c6cf;
    color: #425261;
    background: rgba(255, 255, 255, 0.68);
}

.btn-outline-secondary:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.mode-tabs,
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mode-tabs {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.category-tabs {
    margin-bottom: 22px;
}

.mode-tab,
.category-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--brand-dark);
    text-decoration: none;
    font-weight: 900;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.mode-tab {
    padding: 0.52rem 1.05rem;
    background: #fff;
    border-color: var(--line);
}

.category-tab {
    padding: 0.52rem 1rem;
    background: rgba(255, 255, 255, 0.58);
}

.mode-tab:hover,
.category-tab:hover,
.home-test-button:hover,
.learn-card:hover {
    transform: translateY(-2px);
}

.mode-tab.is-active,
.category-tab.is-active {
    border-color: transparent;
    background: var(--brand-dark);
    color: #fff;
    box-shadow: 0 10px 24px rgba(20, 82, 77, 0.22);
}

.category-tab.is-disabled {
    color: #9aa8b2;
    background: rgba(255, 255, 255, 0.4);
    cursor: default;
}

.home-tests-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.home-test-button {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(31, 122, 114, 0.18);
    border-radius: 18px;
    background: linear-gradient(180deg, #fff, #f9fcfb);
    color: var(--ink);
    text-decoration: none;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(25, 36, 47, 0.06);
}

.home-test-button small {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
}

.home-test-button--summary {
    grid-column: span 4;
}

.home-test-button--wide {
    grid-column: span 2;
    background: linear-gradient(135deg, var(--accent-soft), #fff);
}

.question-card {
    padding: clamp(18px, 2vw, 28px);
    min-height: 360px;
    border-radius: 24px;
}

.question-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.question-prompt {
    max-width: 980px;
    margin-bottom: 22px;
    color: var(--ink);
    font-size: clamp(1.08rem, 1.5vw, 1.28rem);
    font-weight: 900;
    line-height: 1.35;
}

.question-layout {
    display: grid;
    grid-template-columns: minmax(230px, 310px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.text-question-layout {
    display: grid;
    grid-template-columns: minmax(220px, 330px) minmax(260px, 430px);
    gap: 24px;
    align-items: start;
}

.question-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 230px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background:
        linear-gradient(135deg, rgba(31, 122, 114, 0.06), rgba(242, 169, 59, 0.06)),
        #fff;
}

.question-image img {
    max-height: 245px;
    object-fit: contain;
}

.answer-stack {
    display: grid;
    gap: 12px;
}

.answer-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 66px;
    padding: 15px 18px 15px 20px;
    border: 1px solid rgba(184, 198, 207, 0.78);
    border-radius: 20px;
    background:
        linear-gradient(90deg, rgba(31, 122, 114, 0.06), transparent 16px),
        rgba(255, 255, 255, 0.9);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(25, 36, 47, 0.045);
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.answer-option::before {
    content: "";
    position: absolute;
    inset: 12px auto 12px 0;
    width: 4px;
    border-radius: 0 999px 999px 0;
    background: transparent;
    transition: background 0.16s ease;
}

.answer-option:hover {
    border-color: rgba(31, 122, 114, 0.48);
    background:
        linear-gradient(90deg, rgba(31, 122, 114, 0.11), transparent 20px),
        #fff;
    box-shadow: 0 14px 30px rgba(25, 36, 47, 0.08);
    transform: translateY(-2px);
}

.answer-option.is-selected {
    border-color: var(--brand);
    background:
        linear-gradient(90deg, rgba(31, 122, 114, 0.2), transparent 36px),
        #f3fbf8;
    box-shadow: 0 14px 32px rgba(31, 122, 114, 0.14);
}

.answer-option.is-selected::before {
    background: var(--brand);
}

.answer-option.is-correct {
    border-color: rgba(38, 130, 95, 0.62);
    background:
        linear-gradient(90deg, rgba(38, 130, 95, 0.22), transparent 36px),
        var(--success-soft);
}

.answer-option.is-correct::before {
    background: var(--success);
}

.answer-option.is-wrong {
    border-color: rgba(201, 69, 69, 0.55);
    background:
        linear-gradient(90deg, rgba(201, 69, 69, 0.2), transparent 36px),
        var(--danger-soft);
}

.answer-option.is-wrong::before {
    background: var(--danger);
}

.answer-option input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--brand);
}

.answer-option__content {
    flex: 1;
    min-width: 0;
    color: #24313d;
    font-size: 1.02rem;
    font-weight: 800;
    line-height: 1.38;
}

.answer-option__content img {
    max-height: 96px;
    object-fit: contain;
}

.zoomable-image,
.matching-image-button {
    appearance: none;
    cursor: zoom-in;
}

.matching-image-button {
    width: 100%;
    padding: 0;
    margin-bottom: 10px;
    border: 0;
    background: transparent;
}

.matching-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.matching-item {
    position: relative;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    text-align: center;
}

.matching-item__slot {
    position: absolute;
    top: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 900;
    box-shadow: 0 6px 14px rgba(31, 122, 114, 0.22);
}

.matching-item img {
    max-height: 92px;
    margin-bottom: 10px;
}

.matching-item input,
.text-answer input {
    max-width: 116px;
    margin: 0 auto;
    border-radius: 999px;
    text-align: center;
}

.matching-legend {
    margin-top: 14px;
    padding-left: 20px;
    color: var(--muted);
}

.matching-answer-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.matching-answer-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-height: 38px;
    padding: 6px 9px;
    border: 1px solid rgba(31, 122, 114, 0.18);
    border-radius: 14px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-weight: 900;
}

.matching-answer-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #fff;
    color: var(--brand-dark);
    font-size: 0.78rem;
}

.matching-answer-chip strong {
    min-width: 18px;
    color: var(--ink);
    font-size: 1rem;
    text-align: right;
}

.matching-legend--chips {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 8px;
    padding-left: 0;
    list-style: none;
}

.matching-legend--chips li {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
    color: var(--muted);
}

.matching-legend--chips li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #fff;
    color: var(--brand-dark);
    font-weight: 900;
}

.matching-answer,
.text-answer-note,
.text-answer-help {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.95rem;
}

.text-answer-card {
    width: 100%;
    max-width: 430px;
    padding: 18px;
    border-radius: 22px;
}

.text-answer-label {
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.text-answer-input {
    width: 100%;
    max-width: none !important;
    min-height: 52px;
    margin: 0;
    padding: 0.8rem 1rem;
    border-radius: 16px !important;
    font-size: 1.05rem;
    font-weight: 900;
    text-align: left !important;
}

.question-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
}

.question-tab {
    width: 42px;
    min-width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    font-weight: 900;
}

.question-tab:hover {
    border-color: var(--brand);
}

.question-tab.is-active {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
    box-shadow: 0 10px 20px rgba(31, 122, 114, 0.18);
}

.question-tab.is-correct {
    border-color: var(--success);
    background: var(--success);
    color: #fff;
}

.question-tab.is-wrong {
    border-color: var(--danger);
    background: var(--danger);
    color: #fff;
}

.question-tab.is-solved:not(.is-active) {
    border-color: rgba(38, 130, 95, 0.5);
    color: var(--success);
    background: var(--success-soft);
}

.question-tab.is-unsolved:not(.is-active) {
    border-color: rgba(201, 69, 69, 0.32);
    color: #733;
}

.question-tabs--bank,
.question-tabs--learn {
    max-height: 220px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.58);
}

.question-tabs--learn {
    max-height: 170px;
}

.practice-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.practice-stats,
.practice-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.practice-stat {
    padding: 10px 14px;
    border-radius: 16px;
    color: var(--muted);
}

.practice-stat strong {
    color: var(--ink);
}

.practice-filter {
    min-height: 38px;
    padding: 0.48rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-weight: 900;
}

.practice-filter.is-active {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.practice-feedback {
    margin-top: 18px;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 18px;
    font-weight: 900;
}

.practice-feedback.is-correct {
    border-color: rgba(38, 130, 95, 0.55);
    background: var(--success-soft);
    color: var(--success);
}

.practice-feedback.is-wrong {
    border-color: rgba(201, 69, 69, 0.55);
    background: var(--danger-soft);
    color: var(--danger);
}

.learn-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.learn-plan-summary {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: linear-gradient(135deg, var(--brand-soft), #fff);
    color: var(--muted);
}

.learn-plan-summary strong {
    color: var(--ink);
}

.learn-card {
    min-height: 188px;
    padding: 18px;
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.learn-card:hover {
    box-shadow: var(--shadow-soft);
}

.learn-card h3 {
    margin: 0 0 8px;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 1.35rem;
    line-height: 1.05;
}

.learn-card__meta {
    margin-bottom: 10px;
    color: var(--brand-dark);
    font-size: 0.92rem;
    font-weight: 900;
}

.learn-card p {
    flex: 1;
    margin: 0 0 16px;
    color: var(--muted);
}

.learn-answer-box {
    display: grid;
    gap: 6px;
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(38, 130, 95, 0.45);
    border-radius: 18px;
    background: var(--success-soft);
    color: var(--ink);
}

.learn-answer-box strong {
    color: var(--success);
}

.summary-state {
    margin-bottom: 12px;
    font-size: 1.22rem;
    font-weight: 900;
}

.summary-state.fail {
    color: var(--danger);
}

.summary-state.pass {
    color: var(--success);
}

.summary-metrics {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.summary-metric {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border-radius: 16px;
}

.summary-metrics-inline {
    display: flex;
    flex-wrap: wrap;
}

.summary-metrics-inline .summary-metric {
    min-width: 220px;
    flex: 1 1 220px;
}

.action-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
}

.action-row .btn {
    min-width: 148px;
}

.empty-state {
    padding: 44px 24px;
    border: 1px dashed rgba(31, 122, 114, 0.35);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.62);
    color: var(--muted);
    text-align: center;
}

.about-notice {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: clamp(22px, 3vw, 42px);
    margin-top: 26px;
    padding: clamp(26px, 4vw, 48px);
    border: 1px solid rgba(31, 122, 114, 0.18);
    border-radius: 32px;
    background:
        radial-gradient(circle at 8% 8%, rgba(242, 169, 59, 0.2), transparent 18rem),
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 250, 246, 0.92));
    box-shadow: var(--shadow-soft);
}

.about-notice::after {
    content: "";
    position: absolute;
    inset: auto -70px -95px auto;
    width: 260px;
    height: 260px;
    border-radius: 999px;
    background: rgba(31, 122, 114, 0.09);
}

.about-notice__badge {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 24px;
    border: 1px solid rgba(31, 122, 114, 0.22);
    border-radius: 28px;
    background:
        linear-gradient(145deg, var(--brand-dark), var(--brand)),
        var(--brand);
    color: #fff;
    font-family: var(--font-display);
    font-size: clamp(2rem, 3vw, 3rem);
    font-weight: 900;
    letter-spacing: -0.05em;
    text-align: center;
    box-shadow: 0 18px 42px rgba(20, 82, 77, 0.24);
}

.about-notice__content {
    position: relative;
    z-index: 1;
}

.about-notice h2 {
    margin: 0 0 18px;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 0.98;
    letter-spacing: -0.055em;
}

.about-notice p {
    max-width: 950px;
    margin: 0 0 14px;
    color: #3f4e5c;
    font-size: clamp(1.08rem, 1.35vw, 1.25rem);
    line-height: 1.65;
}

.about-notice strong {
    color: var(--brand-dark);
}

.about-notice__contact {
    margin-top: 20px !important;
    padding: 16px 18px;
    border-left: 5px solid var(--accent);
    border-radius: 16px;
    background: rgba(255, 242, 220, 0.78);
    color: var(--ink) !important;
    font-weight: 900;
}

.materials-page {
    display: grid;
    gap: 22px;
}

.materials-intro,
.materials-section {
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 26px rgba(25, 36, 47, 0.055);
}

.materials-intro {
    padding: clamp(20px, 3vw, 30px);
}

.materials-intro h2,
.materials-section h2 {
    margin: 0 0 12px;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(1.45rem, 2.2vw, 2.25rem);
    letter-spacing: -0.035em;
}

.materials-intro p {
    margin: 0 0 14px;
    color: #3f4e5c;
    font-size: 1.08rem;
    line-height: 1.65;
}

.materials-note {
    margin: 18px 0 0 !important;
    padding: 14px 16px;
    border-left: 5px solid var(--accent);
    border-radius: 16px;
    background: var(--accent-soft);
    color: var(--ink) !important;
    font-weight: 900;
}

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

.materials-section {
    padding: clamp(18px, 2.4vw, 26px);
}

.materials-list {
    display: grid;
    gap: 12px;
}

.material-link {
    display: grid;
    gap: 5px;
    padding: 16px 18px;
    border: 1px solid rgba(31, 122, 114, 0.18);
    border-radius: 18px;
    background:
        linear-gradient(90deg, rgba(31, 122, 114, 0.07), transparent 34px),
        #fff;
    color: var(--ink);
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(25, 36, 47, 0.05);
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.material-link:hover {
    border-color: rgba(31, 122, 114, 0.45);
    color: var(--brand-dark);
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(25, 36, 47, 0.08);
}

.material-link span {
    font-weight: 900;
}

.material-link small {
    color: var(--muted);
    font-weight: 800;
}

.auth-page {
    min-height: calc(100vh - 76px);
    display: flex;
    align-items: center;
}

.auth-card {
    width: min(480px, 100%);
    margin: 0 auto;
    padding: clamp(24px, 4vw, 38px);
    border-radius: 30px;
    box-shadow: var(--shadow-soft);
}

.auth-card__head {
    margin-bottom: 22px;
}

.auth-page-form {
    display: grid;
    gap: 15px;
}

.auth-page-form label {
    display: grid;
    gap: 8px;
    color: var(--ink);
    font-weight: 900;
}

.form-control {
    border-color: #cfdbe2;
    border-radius: 16px;
    min-height: 48px;
}

.form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 0.22rem rgba(31, 122, 114, 0.16);
}

.auth-page-error {
    padding: 11px 13px;
    border: 1px solid rgba(201, 69, 69, 0.45);
    border-radius: 16px;
    background: var(--danger-soft);
    color: var(--danger);
}

.auth-switch {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
    color: var(--muted);
}

.auth-switch button {
    border: 0;
    background: transparent;
    color: var(--brand-dark);
    font-weight: 900;
}

.image-viewer {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(8, 18, 22, 0.88);
}

.image-viewer__image {
    max-width: min(1200px, 92vw);
    max-height: 88vh;
    object-fit: contain;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

.image-viewer__close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
}

body.viewer-open {
    overflow: hidden;
}

/* Simple clean theme override */
:root {
    --brand: #16834a;
    --brand-dark: #0f5f36;
    --brand-soft: #e9f8ef;
    --accent: #16834a;
    --accent-soft: #edf8f1;
    --danger: #d9534f;
    --danger-soft: #fff3f3;
    --success: #2f8f5b;
    --success-soft: #effaf3;
    --ink: #1f2933;
    --muted: #6b7785;
    --line: #d8e0e6;
    --surface: #ffffff;
    --surface-soft: #f7f9fb;
    --logo-bg: #ffffff;
    --shadow-soft: none;
    --shadow-card: none;
    --radius-lg: 4px;
    --radius-md: 4px;
    --radius-sm: 4px;
    --font-main: "Segoe UI", Tahoma, sans-serif;
    --font-display: "Segoe UI", Tahoma, sans-serif;
}

body {
    background: #ffffff;
    color: var(--ink);
}

body::before {
    display: none;
}

.site-navbar {
    min-height: 58px;
    border-bottom: 1px solid #d9eadf;
    background: var(--logo-bg);
    box-shadow: none;
    backdrop-filter: none;
}

.site-navbar .container {
    min-height: 58px;
}

.site-brand__logo {
    width: 142px;
    height: 36px;
    padding: 5px 11px;
    border-radius: 11px;
    background: var(--logo-bg);
}

.site-navbar .navbar-brand,
.site-navbar .navbar-text,
.language-selector,
.auth-widget {
    color: var(--ink) !important;
}

.site-shell > .container {
    max-width: 1180px;
}

.page-card,
.question-card,
.auth-card,
.learn-card,
.summary-metric,
.practice-stat,
.text-answer-card,
.materials-intro,
.materials-section {
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    box-shadow: none;
    backdrop-filter: none;
}

.page-card {
    padding: 24px;
}

.about-notice {
    display: none !important;
}

.home-tests-grid {
    margin-top: 18px;
}

.home-test-button--wide,
.learn-plan-summary,
.materials-note {
    background: var(--brand-soft);
}

.page-title-simple,
.page-head h1,
.auth-card__head h1,
.learn-card h3,
.about-notice h2,
.materials-intro h2,
.materials-section h2 {
    font-family: var(--font-main);
    letter-spacing: 0;
}

.page-head h1,
.auth-card__head h1 {
    font-size: 2rem;
    line-height: 1.15;
}

.btn,
.mode-tab,
.category-tab,
.home-test-button,
.question-tab,
.answer-option,
.question-image,
.matching-item,
.form-control,
.account-settings-button,
.account-dropdown,
.account-language,
.empty-state {
    border-radius: 4px !important;
}

.btn-brand,
.btn-brand:hover,
.btn-brand:focus,
.btn-brand:active {
    border-color: var(--brand) !important;
    background: var(--brand) !important;
    color: #fff !important;
    box-shadow: none;
}

.btn-outline-secondary {
    background: #fff;
}

.mode-tab,
.category-tab,
.home-test-button,
.practice-filter {
    background: #fff;
    box-shadow: none;
}

.mode-tab:hover,
.category-tab:hover,
.home-test-button:hover,
.learn-card:hover,
.material-link:hover,
.answer-option:hover {
    transform: none;
    box-shadow: none;
}

.mode-tab.is-active,
.category-tab.is-active,
.practice-filter.is-active,
.question-tab.is-active {
    background: var(--brand);
    border-color: var(--brand);
    box-shadow: none;
}

.question-card {
    min-height: auto;
}

.answer-option {
    min-height: 54px;
    background: #fff;
    box-shadow: none;
}

.answer-option::before {
    display: none;
}

.answer-option.is-selected {
    background: var(--brand-soft);
    box-shadow: none;
}

.question-image {
    background: #fff;
}

.about-notice {
    grid-template-columns: 1fr;
    border-radius: 4px;
    box-shadow: none;
}

.about-notice::after {
    display: none;
}

.about-notice__badge {
    display: none;
}

.about-notice p {
    font-size: 1rem;
}

.account-settings-button {
    border-color: #d8d0c2;
    background: #fffaf0;
    color: var(--ink);
}

.account-settings-button:hover,
.account-settings-button[aria-expanded="true"] {
    background: #fff;
    color: var(--brand-dark);
    transform: none;
}

.account-dropdown {
    box-shadow: none;
    backdrop-filter: none;
}

.account-dropdown::before {
    display: none;
}

@media (max-width: 1199.98px) {
    .home-tests-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .learn-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    body {
        padding-top: 68px;
    }

    .question-layout,
    .text-question-layout {
        grid-template-columns: 1fr;
    }

    .about-notice {
        grid-template-columns: 1fr;
    }

    .materials-grid {
        grid-template-columns: 1fr;
    }

    .about-notice__badge {
        min-height: 120px;
    }

    .home-tests-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-test-button--wide {
        grid-column: span 2;
    }

    .home-test-button--summary {
        grid-column: span 2;
    }
}

@media (max-width: 767.98px) {
    html {
        scroll-padding-top: 72px;
    }

    .site-navbar {
        position: sticky;
    }

    body {
        padding-top: 0;
    }

    .site-shell {
        padding-bottom: calc(92px + env(safe-area-inset-bottom));
    }

    .site-shell > .container {
        max-width: 100%;
        padding-right: 8px;
        padding-left: 8px;
    }

    .page-card,
    .question-card,
    .auth-card {
        border-radius: 4px;
        padding: 12px;
    }

    .page-head {
        gap: 10px;
        margin-bottom: 12px;
        padding-bottom: 12px;
    }

    .page-head h1 {
        font-size: 1.45rem;
    }

    .page-head p {
        margin-top: 4px;
        font-size: 0.82rem;
    }

    .mode-tabs,
    .category-tabs,
    .practice-filters {
        display: flex;
        flex-wrap: nowrap;
        gap: 7px;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .mode-tabs::-webkit-scrollbar,
    .category-tabs::-webkit-scrollbar,
    .practice-filters::-webkit-scrollbar {
        display: none;
    }

    .mode-tab,
    .category-tab,
    .practice-filter {
        flex: 0 0 auto;
        min-height: 36px;
        padding: 0.45rem 0.72rem;
        font-size: 0.82rem;
    }

    .practice-stats {
        gap: 7px;
        margin-bottom: 8px;
    }

    .practice-stat {
        padding: 8px 9px;
        font-size: 0.8rem;
    }

    .question-tabs--bank,
    .question-tabs--learn {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 36px;
        grid-template-rows: repeat(2, 36px);
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 6px;
        padding: 7px;
        scrollbar-width: thin;
    }

    .question-tab {
        width: 36px;
        min-width: 36px;
        height: 36px;
        font-size: 0.82rem;
    }

    .question-card {
        scroll-margin-top: 74px;
    }

    .question-meta {
        align-items: flex-start;
        margin-bottom: 12px;
        font-size: 0.76rem;
        line-height: 1.35;
        letter-spacing: 0;
    }

    .question-prompt {
        margin-bottom: 14px;
        font-size: 1rem;
        line-height: 1.32;
    }

    .question-layout,
    .text-question-layout {
        gap: 14px;
    }

    .answer-stack {
        gap: 8px;
    }

    .answer-option {
        min-height: 48px;
        gap: 10px;
        padding: 10px 11px;
    }

    .answer-option__content {
        font-size: 0.92rem;
        line-height: 1.32;
    }

    .question-image {
        min-height: 160px;
        padding: 10px;
    }

    .question-image img {
        max-height: 180px;
    }

    .matching-layout {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .matching-answer-strip {
        position: sticky;
        top: 0;
        z-index: 8;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        margin: -2px 0 0;
        padding: 7px;
        border: 1px solid rgba(31, 122, 114, 0.18);
        border-radius: 4px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 8px 22px rgba(25, 36, 47, 0.08);
    }

    .matching-answer-chip {
        min-height: 32px;
        padding: 4px 6px;
        border-radius: 4px;
        font-size: 0.8rem;
    }

    .matching-answer-chip span {
        width: 20px;
        height: 20px;
        font-size: 0.72rem;
    }

    .matching-answer-chip strong {
        font-size: 0.92rem;
    }

    .matching-legend {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
        max-height: 130px;
        overflow-y: auto;
        margin: 0;
        padding: 6px;
        border: 1px solid var(--line);
        border-radius: 4px;
        background: var(--surface-soft);
        font-size: 0.78rem;
        line-height: 1.22;
        list-style: none;
    }

    .matching-legend--chips li {
        grid-template-columns: 24px minmax(0, 1fr);
        gap: 7px;
        padding: 6px 7px;
        border-radius: 4px;
    }

    .matching-legend--chips li span {
        width: 22px;
        height: 22px;
        font-size: 0.78rem;
    }

    .matching-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .matching-item {
        padding: 8px 7px 9px;
        border-radius: 4px;
        scroll-margin-top: 78px;
    }

    .matching-item__slot {
        top: 5px;
        left: 5px;
        min-width: 24px;
        height: 24px;
        padding: 0 6px;
        font-size: 0.76rem;
    }

    .matching-image-button {
        margin-bottom: 7px;
    }

    .matching-item img {
        max-width: 100%;
        height: clamp(74px, 22vw, 112px);
        max-height: none;
        margin-bottom: 4px;
        object-fit: contain;
    }

    .matching-item input,
    .text-answer input {
        width: 100%;
        max-width: 104px;
        min-height: 40px;
        font-size: 1rem;
    }

    .matching-item input {
        max-width: 84px;
        padding: 0.45rem 0.6rem;
        border-radius: 4px;
        font-weight: 900;
    }

    .text-answer-card {
        max-width: none;
        padding: 12px;
    }

    .text-answer-input {
        min-height: 48px;
    }

    .practice-feedback {
        margin-top: 12px;
        padding: 10px 11px;
        font-size: 0.9rem;
    }

    .action-row {
        position: sticky;
        bottom: 0;
        z-index: 20;
        margin: 14px -12px -12px;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--line);
        background: rgba(255, 255, 255, 0.96);
    }

    .action-row > .btn,
    .action-row > div {
        flex: 1 1 auto;
    }

    .action-row > div {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px !important;
    }

    .action-row .btn {
        min-width: 0;
        min-height: 44px;
        padding-right: 8px;
        padding-left: 8px;
        font-size: 0.82rem;
    }

    .page-head,
    .result-header,
    .action-row,
    .practice-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .home-tests-grid,
    .learn-cards {
        grid-template-columns: 1fr;
    }

    .home-test-button,
    .home-test-button--wide,
    .home-test-button--summary,
    .action-row .btn {
        width: 100%;
        grid-column: auto;
    }

    .nav-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 8px 0;
    }

    .site-navbar .container {
        align-items: flex-start;
    }

    .site-brand {
        padding-top: 8px;
    }

    .site-brand__logo {
        width: 128px;
        height: 34px;
        padding: 5px 10px;
    }

    .language-selector {
        width: 100%;
        justify-content: space-between;
    }

    .auth-form {
        width: 100%;
    }

    .auth-input,
    .auth-button,
    .auth-link {
        width: 100%;
    }

    .account-menu {
        width: 100%;
        justify-content: space-between;
    }

    .account-dropdown {
        left: 0;
        right: auto;
        width: 100%;
    }

    .account-dropdown::before {
        left: 22px;
        right: auto;
    }
}

.question-tab.is-active.is-correct {
    border-color: var(--success);
    background: var(--success);
    color: #fff;
}

.question-tab.is-active.is-wrong {
    border-color: var(--danger);
    background: var(--danger);
    color: #fff;
}
