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

:root {
    --bg-base: #060814;
    --bg-deep: #090c1b;
    --bg-mid: #0f1428;
    --glass: rgba(20, 26, 48, 0.52);
    --glass-strong: rgba(15, 21, 40, 0.76);
    --glass-soft: rgba(255, 255, 255, 0.06);
    --border: rgba(148, 164, 204, 0.22);
    --text-main: #eef3ff;
    --text-muted: #adb7d4;
    --accent-gold: #66e8ff;
    --accent-violet: #7f5bff;
    --accent-blue: #57b8ff;
    --success: #70e8b8;
    --danger: #ff8ea0;
    --radius-lg: 26px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}

html {
    scrollbar-gutter: stable;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at 8% 14%, rgba(113, 78, 255, 0.2) 0%, transparent 34%),
        radial-gradient(circle at 88% 12%, rgba(64, 159, 246, 0.22) 0%, transparent 30%),
        radial-gradient(circle at 74% 80%, rgba(104, 185, 255, 0.2) 0%, transparent 32%),
        linear-gradient(165deg, var(--bg-base) 0%, var(--bg-deep) 38%, var(--bg-mid) 100%);
    overflow-x: hidden;
    position: relative;
}

body.profile-open {
    overflow: hidden;
}

html.theme-switching body,
html.theme-switching .header-inner,
html.theme-switching .page-card,
html.theme-switching .hero-panel,
html.theme-switching .container,
html.theme-switching .chat-container,
html.theme-switching .chat-messages,
html.theme-switching .message-content,
html.theme-switching .site-footer,
html.theme-switching .nav-list a,
html.theme-switching .theme-toggle,
html.theme-switching input,
html.theme-switching textarea,
html.theme-switching button,
html.theme-switching .summary-article .summary-callout,
html.theme-switching .summary-article .summary-code-wrap,
html.theme-switching .message.assistant .message-content .summary-code-wrap,
html.theme-switching .summary-article .katex-display {
    transition: background-color 0.38s ease, color 0.38s ease, border-color 0.38s ease, box-shadow 0.38s ease;
}

.app-bg-orb {
    position: fixed;
    filter: blur(105px);
    pointer-events: none;
    z-index: -2;
    opacity: 0.75;
}

.orb-a {
    top: -140px;
    left: -130px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(123, 84, 255, 0.5), rgba(123, 84, 255, 0));
}

.orb-b {
    right: -140px;
    bottom: -160px;
    width: 560px;
    height: 560px;
    background: radial-gradient(circle, rgba(61, 174, 255, 0.5), rgba(61, 174, 255, 0));
}

.app-bg-grid {
    position: fixed;
    inset: 0;
    z-index: -3;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.032) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.032) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(circle at center, black 30%, transparent 84%);
}

.site-header,
.page-shell,
.site-footer {
    width: min(1280px, calc(100% - 36px));
    margin-inline: auto;
}

.site-header {
    position: sticky;
    top: 14px;
    z-index: 20;
    margin-top: 14px;
    transform: translateY(0);
    transition: transform 0.26s ease, opacity 0.2s ease;
    will-change: transform;
}

.site-header.is-hidden {
    transform: translateY(calc(-100% - 18px));
    opacity: 0;
    pointer-events: none;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 12px 16px;
    border-radius: 18px;
    background: rgba(10, 15, 32, 0.52);
    border: 1px solid rgba(162, 178, 220, 0.22);
    backdrop-filter: blur(30px) saturate(170%);
    box-shadow: var(--shadow);
}

.logo-group {
    flex-shrink: 0;
    display: inline-flex;
    align-items: flex-end;
    gap: 8px;
}

.logo {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    font-size: clamp(1.3rem, 2vw, 1.85rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #f8fbff;
    text-decoration: none;
    line-height: 1;
}

.logo-text {
    line-height: 1;
}

.logo-group .logo-mark {
    align-self: flex-start;
    transform: translateY(-0.2em);
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(171, 187, 255, 0.36);
    background: rgba(22, 33, 63, 0.62);
    display: grid;
    place-items: center;
    cursor: pointer;
    backdrop-filter: blur(12px) saturate(160%);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    font-size: inherit;
    font-weight: 600;
    color: inherit;
}

.logo-group .logo-mark:hover {
    transform: translateY(-0.22em) scale(1.05);
    border-color: rgba(178, 200, 255, 0.58);
    box-shadow: 0 0 0 4px rgba(116, 143, 242, 0.16), 0 12px 24px rgba(4, 10, 28, 0.42);
}

.logo-group .logo-mark:focus-visible {
    outline: none;
    border-color: rgba(184, 205, 255, 0.7);
    box-shadow: 0 0 0 4px rgba(104, 143, 255, 0.22), 0 8px 18px rgba(6, 13, 34, 0.45);
}

.assistant-logo-image {
    width: 76%;
    height: 76%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.logo:hover {
    color: #f8fbff;
    text-decoration: none;
}

.site-nav-inline {
    flex: 1;
    display: flex;
    justify-content: center;
}

.header-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.assistant-profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    padding: 18px;
    display: grid;
    place-items: center;
    background: rgba(5, 9, 23, 0.58);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.24s ease, visibility 0.24s ease;
    pointer-events: none;
}

.assistant-profile-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.assistant-profile-card {
    width: min(440px, 100%);
    border-radius: 22px;
    border: 1px solid rgba(163, 183, 232, 0.34);
    background: rgba(10, 16, 34, 0.86);
    backdrop-filter: blur(20px) saturate(155%);
    box-shadow: 0 28px 52px rgba(0, 0, 0, 0.45);
    padding: 18px;
    position: relative;
    overflow: hidden;
    transform: translateY(16px);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.24s ease, border-color 0.24s ease;
}

.assistant-profile-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.assistant-profile-overlay.is-open .assistant-profile-card {
    transform: translateY(0);
    opacity: 1;
}

.assistant-profile-card .assistant-profile-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(163, 183, 232, 0.3);
    background: rgba(255, 255, 255, 0.05);
    color: #dbe7ff;
    line-height: 0;
    display: grid;
    place-items: center;
    cursor: pointer;
    transform: scale(0.75) rotate(-80deg);
    opacity: 0;
    transition: transform 0.24s cubic-bezier(0.24, 0.74, 0.32, 1), opacity 0.22s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.assistant-profile-overlay.is-open .assistant-profile-card .assistant-profile-close {
    transform: scale(1) rotate(0deg);
    opacity: 1;
    transition-delay: 0.08s;
}

.assistant-profile-card .assistant-profile-close svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.6;
    stroke-linecap: round;
}

.assistant-profile-card .assistant-profile-close:hover {
    background: rgba(116, 143, 242, 0.22);
    border-color: rgba(163, 183, 232, 0.5);
    box-shadow: 0 6px 16px rgba(51, 86, 170, 0.24);
}

.assistant-profile-main {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 34px;
}

.assistant-profile-avatar {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 1px solid rgba(163, 183, 232, 0.38);
    background: rgba(17, 27, 52, 0.86);
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.assistant-profile-avatar::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(from 10deg, rgba(120, 94, 255, 0.1), rgba(93, 196, 255, 0.95), rgba(120, 94, 255, 0.1), rgba(120, 94, 255, 0.92));
    z-index: -2;
    animation: avatar-ring-spin 3.6s linear infinite;
}

.assistant-profile-avatar::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: inherit;
    background: rgba(8, 15, 34, 0.94);
    z-index: -1;
}

.assistant-profile-avatar .assistant-logo-image {
    width: 72%;
    height: 72%;
}

.assistant-profile-meta h2 {
    margin: 0;
    font-size: 1.18rem;
    line-height: 1.2;
}

.assistant-profile-handle {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.assistant-profile-description {
    margin: 14px 0 16px;
    color: #d4def4;
    line-height: 1.6;
}

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

.assistant-profile-link {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(171, 188, 255, 0.34);
    background: linear-gradient(130deg, rgba(122, 98, 255, 0.96), rgba(84, 160, 255, 0.94));
    color: #f7fbff;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 12px 24px rgba(76, 117, 223, 0.3);
}

.assistant-profile-link-primary {
    background: linear-gradient(130deg, rgba(122, 98, 255, 0.96), rgba(84, 160, 255, 0.94));
}

.assistant-profile-link-secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(166, 184, 223, 0.32);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.assistant-profile-link:hover {
    color: #ffffff;
    text-decoration: none;
    filter: saturate(1.07);
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.nav-list li {
    margin: 0;
    padding: 0;
}

.nav-list li::before {
    content: none;
}

.nav-list a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
    color: #d8e3ff;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 600;
    transition: transform 0.34s cubic-bezier(0.2, 0.65, 0.2, 1), border-color 0.34s ease, background 0.34s ease, color 0.34s ease, box-shadow 0.34s ease;
    position: relative;
    overflow: hidden;
}

.nav-list a:hover {
    transform: translateY(-1px);
    border-color: rgba(132, 166, 255, 0.6);
    background: rgba(132, 166, 255, 0.12);
    box-shadow: 0 8px 18px rgba(72, 112, 255, 0.28);
    color: #edf3ff;
    text-decoration: none;
}

.nav-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 22px;
    border-radius: 14px;
    text-decoration: none;
    color: #f5f7ff;
    font-weight: 700;
    background: linear-gradient(135deg, #6f58ff 0%, #8a5dff 55%, #4f89ff 100%);
    box-shadow: 0 16px 34px rgba(96, 95, 255, 0.4);
    transition: transform 0.28s cubic-bezier(0.2, 0.65, 0.2, 1), filter 0.28s ease;
    border: 1px solid rgba(175, 187, 255, 0.38);
    cursor: pointer;
}

.nav-cta:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    text-decoration: none;
}

.nav-cta-secondary {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(175, 187, 255, 0.32);
    box-shadow: none;
}

.nav-cta-secondary:hover {
    background: rgba(132, 166, 255, 0.14);
}

.header-auth-form {
    margin: 0;
    display: inline-flex;
}

.user-chip {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    padding: 0 12px;
    border: 1px solid rgba(175, 187, 255, 0.28);
    background: rgba(255, 255, 255, 0.06);
    color: #e4edff;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.user-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(175, 187, 255, 0.44);
    background: rgba(132, 166, 255, 0.14);
    text-decoration: none;
}

.user-chip:focus-visible {
    outline: none;
    border-color: rgba(175, 187, 255, 0.58);
    box-shadow: 0 0 0 4px rgba(132, 166, 255, 0.18);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    min-width: 46px;
    padding: 0;
    border-radius: 14px;
    border: 1px solid rgba(175, 187, 255, 0.32);
    background: rgba(255, 255, 255, 0.06);
    color: #e4edff;
    cursor: pointer;
    transition: transform 0.28s cubic-bezier(0.2, 0.65, 0.2, 1), border-color 0.28s ease, background 0.28s ease, color 0.28s ease;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    border-color: rgba(146, 171, 255, 0.62);
    background: rgba(146, 171, 255, 0.14);
}

.theme-icon {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-icon-moon {
    display: none;
}

html[data-theme='light'] .theme-icon-sun {
    display: none;
}

html[data-theme='light'] .theme-icon-moon {
    display: grid;
}

.theme-toggle:hover .theme-icon {
    transform: scale(1.05);
}

.page-shell {
    margin-top: 20px;
    margin-bottom: 20px;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.page-card,
.hero-panel,
.container {
    width: min(1160px, 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--glass);
    backdrop-filter: blur(36px) saturate(175%);
    box-shadow: var(--shadow);
    padding: clamp(22px, 3vw, 40px);
    animation: fade-up 0.5s ease both;
}

.glass-card {
    position: relative;
    isolation: isolate;
}

.glass-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.015));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.landing-hero {
    display: grid;
    grid-template-columns: 1.18fr 0.9fr;
    gap: clamp(20px, 3vw, 34px);
    align-items: stretch;
}

.hero-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.fast-badge {
    width: fit-content;
    margin: 0 0 16px;
    padding: 8px 14px;
    border-radius: 999px;
    color: #8fe9ff;
    font-weight: 600;
    border: 1px solid rgba(143, 233, 255, 0.4);
    background: rgba(143, 233, 255, 0.11);
}

.hero-title,
.page-title,
h1 {
    margin: 0 0 14px;
    line-height: 1.06;
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    font-size: clamp(2.05rem, 4.2vw, 4.45rem);
    color: #f4f7ff;
}

.gradient-title {
    display: block;
    color: transparent;
    background: linear-gradient(95deg, #9ab7ff 0%, #5ef0ff 45%, #bba8ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.hero-subtitle,
p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.62;
    font-size: clamp(1rem, 1.35vw, 1.14rem);
}

.hero-kicker {
    width: fit-content;
    margin: 0 0 16px;
    padding: 8px 14px;
    border-radius: 999px;
    color: #8fe9ff;
    font-weight: 600;
    border: 1px solid rgba(143, 233, 255, 0.4);
    background: rgba(143, 233, 255, 0.11);
}

.action-grid {
    margin-top: 26px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.action-button {
    min-height: 56px;
    padding: 12px 14px;
    border-radius: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #f4f7ff;
    border: 1px solid rgba(145, 165, 255, 0.34);
    transition: transform 0.22s ease, filter 0.22s ease, box-shadow 0.22s ease;
}

.action-button-primary {
    background: linear-gradient(135deg, #6f58ff 0%, #835eff 52%, #4f89ff 100%);
}

.action-button-secondary {
    background: linear-gradient(135deg, #6f58ff 0%, #835eff 52%, #4f89ff 100%);
}

.action-button-accent {
    background: linear-gradient(135deg, #3ecbff 0%, #5f8bff 52%, #7a67ff 100%);
}

.action-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.07);
    box-shadow: 0 12px 26px rgba(90, 104, 255, 0.3);
    text-decoration: none;
}

.action-row {
    margin-top: 26px;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 12px;
}

.action-row > .back-button {
    flex: 1 1 220px;
    min-width: 220px;
}

.primary-btn,
.secondary-btn {
    min-height: 56px;
    padding: 12px 24px;
    border-radius: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: transform 0.22s ease, filter 0.22s ease, box-shadow 0.22s ease;
}

.primary-btn {
    color: #f4f7ff;
    background: linear-gradient(135deg, #6f58ff 0%, #8a5dff 50%, #4f89ff 100%);
    box-shadow: 0 15px 30px rgba(89, 99, 255, 0.45);
}

.secondary-btn {
    color: #d9e6ff;
    border: 1px solid rgba(166, 184, 223, 0.34);
    background: rgba(255, 255, 255, 0.05);
}

.primary-btn:hover,
.secondary-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    text-decoration: none;
}

.hero-note {
    margin-top: 16px;
    font-size: 0.96rem;
    color: #9aa8ca;
}

.hero-right {
    display: flex;
    align-items: center;
}

.offer-card {
    width: 100%;
    border-radius: 24px;
    padding: clamp(18px, 2.4vw, 26px);
    background: rgba(19, 26, 47, 0.6);
    border: 1px solid rgba(160, 178, 220, 0.28);
    backdrop-filter: blur(28px) saturate(150%);
}

.offer-top {
    border-radius: 18px;
    padding: 20px;
    background: linear-gradient(115deg, rgba(255, 255, 255, 0.07), rgba(73, 121, 232, 0.1));
    border: 1px solid rgba(166, 184, 223, 0.2);
}

.offer-title {
    font-weight: 700;
    font-size: 1.3rem;
    color: #f2f6ff;
    margin-bottom: 10px;
}

.offer-price {
    margin: 0;
    font-size: clamp(1.7rem, 2.8vw, 2.55rem);
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    color: #6ef2ff;
}

.offer-sub {
    margin-top: 8px;
}

.offer-list {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

.offer-item {
    min-height: 56px;
    border-radius: 14px;
    border: 1px solid rgba(160, 178, 220, 0.24);
    background: rgba(255, 255, 255, 0.04);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #d4dff5;
}

.offer-item strong {
    color: #f2f6ff;
    font-size: 1.12rem;
}

.page-title-sm {
    margin: 0;
    font-size: clamp(1.2rem, 2.2vw, 1.6rem);
}

.main-content {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.summary-main {
    max-width: 1120px;
}

.practice-generator-page {
    max-width: 1160px;
}

.practice-generator-page .page-title {
    text-align: center;
}

.generator-mode-switch {
    margin: 20px auto 0;
    width: min(620px, 100%);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 8px;
    border-radius: 999px;
    border: 1px solid rgba(162, 180, 222, 0.28);
    background: rgba(9, 14, 30, 0.58);
    backdrop-filter: blur(16px) saturate(150%);
    position: relative;
    isolation: isolate;
    overflow: hidden;
    will-change: transform;
}

.generator-mode-switch.is-switching {
    pointer-events: none;
}

.generator-menu-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.generator-mode-switch::before {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 8px;
    width: calc(50% - 10px);
    border-radius: 999px;
    background: linear-gradient(135deg, #6f58ff 0%, #835eff 52%, #4f89ff 100%);
    box-shadow: 0 10px 22px rgba(88, 110, 255, 0.36);
    transition: transform 0.28s cubic-bezier(0.16, 0.8, 0.24, 1);
    z-index: 0;
    will-change: transform;
}

.generator-mode-switch[data-mode='contest']::before {
    transform: translateX(calc(100% + 4px));
}

.generator-mode-btn {
    min-height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(162, 180, 222, 0.28);
    background: transparent;
    color: #dbe5ff;
    font-size: 0.98rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease, color 0.25s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.generator-mode-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(177, 194, 236, 0.48);
    box-shadow: 0 10px 20px rgba(23, 38, 78, 0.26);
}

.generator-mode-btn.is-active {
    color: #f5f8ff;
    border-color: rgba(164, 185, 255, 0.32);
}

.generator-panel {
    margin-top: 16px;
    display: none;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.generator-panel.is-visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    animation: generator-panel-in 0.24s cubic-bezier(0.2, 0.82, 0.26, 1);
}

.range-control {
    display: grid;
    gap: 10px;
    border-radius: 14px;
    border: 1px solid rgba(162, 180, 222, 0.26);
    background: rgba(7, 13, 28, 0.54);
    padding: 12px 14px;
}

.range-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #cfdbfb;
    font-size: 0.92rem;
}

.range-head strong {
    color: #f4f8ff;
    font-size: 0.95rem;
}

.range-hints {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.82rem;
    color: #9bb0df;
}

.custom-range {
    --range-fill: 50%;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 12px;
    border-radius: 999px;
    border: 1px solid rgba(163, 182, 232, 0.22);
    background: linear-gradient(90deg, rgba(126, 96, 255, 0.98) 0%, rgba(83, 156, 255, 0.98) var(--range-fill), rgba(42, 60, 103, 0.72) var(--range-fill), rgba(42, 60, 103, 0.72) 100%);
    box-shadow: inset 0 1px 4px rgba(5, 9, 21, 0.52);
    outline: none;
}

.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(224, 234, 255, 0.95);
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #c7dcff 35%, #7e5fff 100%);
    box-shadow: 0 8px 18px rgba(71, 105, 224, 0.42);
    cursor: pointer;
}

.custom-range::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(224, 234, 255, 0.95);
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #c7dcff 35%, #7e5fff 100%);
    box-shadow: 0 8px 18px rgba(71, 105, 224, 0.42);
    cursor: pointer;
}

.custom-range::-moz-range-track {
    height: 12px;
    border: 1px solid rgba(163, 182, 232, 0.22);
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(126, 96, 255, 0.98) 0%, rgba(83, 156, 255, 0.98) var(--range-fill), rgba(42, 60, 103, 0.72) var(--range-fill), rgba(42, 60, 103, 0.72) 100%);
}

.custom-range:focus-visible {
    box-shadow: 0 0 0 4px rgba(118, 149, 255, 0.2), inset 0 1px 4px rgba(5, 9, 21, 0.52);
}

#params-form,
#test-form {
    margin: 24px auto 0;
    max-width: 620px;
    display: grid;
    gap: 14px;
    border-radius: var(--radius-md);
    background: var(--glass-strong);
    border: 1px solid var(--border);
    backdrop-filter: blur(34px) saturate(165%);
    padding: 24px;
}

#contest-form {
    margin: 24px auto 0;
    max-width: 760px;
    display: grid;
    gap: 14px;
    border-radius: var(--radius-md);
    background: var(--glass-strong);
    border: 1px solid var(--border);
    backdrop-filter: blur(34px) saturate(165%);
    padding: 24px;
}

.auth-container {
    width: min(640px, 100%);
}

.auth-main {
    text-align: left;
}

.auth-subtitle {
    margin-bottom: 18px;
}

.auth-form {
    display: grid;
    gap: 14px;
    border-radius: var(--radius-md);
    background: var(--glass-strong);
    border: 1px solid var(--border);
    backdrop-filter: blur(34px) saturate(165%);
    padding: 24px;
}

.auth-error {
    margin-bottom: 14px;
    color: #ffd0d8;
    background: rgba(255, 142, 160, 0.17);
    border: 1px solid rgba(255, 142, 160, 0.45);
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 700;
}

.auth-hint {
    margin-top: 14px;
    font-size: 0.98rem;
}

#test-result {
    display: grid;
    gap: 12px;
}

#test-result > #newTestBtn {
    justify-self: start;
}

.test-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
}

.test-actions .submit-btn {
    min-width: 220px;
}

.test-save-hint {
    margin: 0;
    color: #c4d0f0;
    font-size: 0.95rem;
    flex: 1 1 320px;
}

.test-session-bar {
    display: flex;
    justify-content: flex-end;
}

.test-finish-btn {
    min-width: 240px;
    white-space: nowrap;
}

.test-finish-summary {
    margin-top: 10px;
}

.test-finish-modal-card {
    width: min(760px, 100%);
}

#testFinishModalBody {
    margin-top: 8px;
}

.test-finish-modal-card .profile-modal-actions {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.test-finish-modal-card .profile-modal-actions .secondary-btn,
.test-finish-modal-card .profile-modal-actions .back-button {
    width: 100%;
    min-width: 0;
}

.profile-page {
    text-align: left;
}

.profile-head {
    margin-bottom: 10px;
}

.profile-head-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.profile-lead {
    margin: 4px 0 0;
}

.profile-head-note {
    margin: 0;
    font-size: 0.9rem;
    color: #9eb2dd;
}

.profile-data-btn {
    margin-top: 0;
    min-height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255, 142, 160, 0.52);
    background: rgba(255, 142, 160, 0.14);
    color: #ffd8e3;
    font-size: 0.92rem;
    font-weight: 700;
    padding: 8px 14px;
}

.profile-data-btn:hover {
    background: rgba(255, 142, 160, 0.2);
    box-shadow: 0 8px 16px rgba(197, 72, 112, 0.24);
}

.profile-alert {
    margin-top: 10px;
    border-radius: 12px;
    border: 1px solid rgba(166, 184, 223, 0.28);
    padding: 10px 12px;
    font-weight: 600;
}

.profile-alert--success {
    border-color: rgba(112, 232, 184, 0.45);
    background: rgba(112, 232, 184, 0.12);
    color: #d7fff0;
}

.profile-alert--error {
    border-color: rgba(255, 142, 160, 0.46);
    background: rgba(255, 142, 160, 0.12);
    color: #ffe5ea;
}

.profile-stats {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.profile-stat-card {
    border-radius: 14px;
    border: 1px solid rgba(166, 184, 223, 0.24);
    background: linear-gradient(150deg, rgba(13, 20, 42, 0.74), rgba(14, 24, 48, 0.66));
    padding: 12px 14px;
    box-shadow: 0 8px 18px rgba(9, 18, 40, 0.2);
}

.profile-stat-label {
    margin: 0;
    font-size: 0.86rem;
    color: #acc0ea;
}

.profile-stat-value {
    margin: 4px 0 0;
    font-size: 1.28rem;
    font-weight: 800;
    color: #f4f8ff;
}

.profile-stat-value--combo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.profile-stat-slash {
    color: #88a3dd;
    opacity: 0.88;
    font-weight: 700;
}

.profile-stat-meta {
    margin: 6px 0 0;
    font-size: 0.88rem;
    color: #bfd0f2;
    line-height: 1.4;
}

.profile-modal {
    position: fixed;
    inset: 0;
    z-index: 1800;
    background: rgba(5, 10, 22, 0.68);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
}

.profile-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.profile-modal.hidden {
    display: none;
}

.profile-modal-card {
    width: min(520px, 100%);
    padding: 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 142, 160, 0.34);
    opacity: 0;
    transform: translateY(10px) scale(0.985);
    transition: transform 0.24s cubic-bezier(0.2, 0.82, 0.26, 1), opacity 0.24s ease;
}

.profile-modal.is-open .profile-modal-card {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.profile-modal-text {
    margin: 8px 0 12px;
    color: #cfdfff;
}

.profile-modal-hint {
    margin: -4px 0 12px;
    color: #9db3df;
    font-size: 0.9rem;
}

.profile-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.profile-modal-actions .secondary-btn {
    min-width: 170px;
}

.profile-modal-actions .danger-btn {
    min-width: 170px;
}

.profile-inline-error {
    margin: 2px 0 0;
    color: #ffb7c8;
    font-size: 0.9rem;
    font-weight: 600;
}

.profile-tabs {
    margin-top: 14px;
    width: min(760px, 100%);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    --tab-gap: 10px;
    gap: var(--tab-gap);
    padding: 8px;
    border-radius: 999px;
    border: 1px solid rgba(162, 180, 222, 0.28);
    background: rgba(9, 14, 30, 0.58);
    backdrop-filter: blur(16px) saturate(150%);
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.profile-tabs.is-switching {
    pointer-events: none;
}

.profile-tabs::before {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 8px;
    width: calc((100% - 16px - (var(--tab-gap) * 3)) / 4);
    border-radius: 999px;
    background: linear-gradient(135deg, #6f58ff 0%, #835eff 52%, #4f89ff 100%);
    box-shadow: 0 10px 22px rgba(88, 110, 255, 0.32);
    transition: transform 0.28s cubic-bezier(0.16, 0.8, 0.24, 1);
    z-index: 0;
    will-change: transform;
}

.profile-tabs[data-active-tab='chats']::before {
    transform: translateX(calc(100% + var(--tab-gap)));
}

.profile-tabs[data-active-tab='tests']::before {
    transform: translateX(calc((100% + var(--tab-gap)) * 2));
}

.profile-tabs[data-active-tab='contests']::before {
    transform: translateX(calc((100% + var(--tab-gap)) * 3));
}

.profile-tab {
    min-height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(162, 180, 222, 0.28);
    background: transparent;
    color: #dbe5ff;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, color 0.25s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    position: relative;
    z-index: 1;
}

.profile-tab:hover {
    transform: translateY(-1px);
    border-color: rgba(177, 194, 236, 0.48);
    box-shadow: 0 10px 20px rgba(23, 38, 78, 0.26);
    text-decoration: none;
    color: #e9f0ff;
}

.profile-tab.is-active {
    color: #f8fbff;
    border-color: rgba(164, 185, 255, 0.36);
    background: transparent;
    box-shadow: none;
}

.profile-panels {
    margin-top: 16px;
}

.profile-panel {
    display: none;
    opacity: 0;
    transform: translateY(10px);
}

.profile-panel.is-active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: profile-panel-in 0.26s cubic-bezier(0.2, 0.82, 0.26, 1);
}

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

.profile-item {
    margin: 0;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(166, 184, 223, 0.24);
    background: rgba(9, 14, 28, 0.58);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.profile-item:hover {
    border-color: rgba(178, 196, 236, 0.44);
    box-shadow: 0 12px 24px rgba(10, 20, 44, 0.28);
    transform: translateY(-1px);
}

.profile-item-title {
    margin: 0;
    font-size: 1.06rem;
    color: #f2f6ff;
}

.profile-item-title--contest {
    font-size: 1.22rem;
    letter-spacing: 0.01em;
}

.profile-item-meta {
    margin-top: 6px;
    color: #bcc9eb;
    line-height: 1.5;
}

.profile-item-meta--emphasis {
    color: #e7efff;
    font-weight: 700;
}

.profile-item-actions {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-date {
    font-size: 0.9rem;
    color: #9fb0da;
}

.profile-empty {
    margin-top: 14px;
    color: #b4c4ea;
}

.profile-danger {
    margin-top: 16px;
    border-radius: 14px;
    border: 1px dashed rgba(255, 142, 160, 0.44);
    background: rgba(49, 18, 28, 0.24);
    padding: 10px 12px;
}

.profile-danger > summary {
    cursor: pointer;
    font-weight: 700;
    color: #ffcfda;
    user-select: none;
}

.profile-danger p {
    margin: 10px 0;
    color: #ffc9d6;
}

.profile-danger-form {
    display: grid;
    gap: 10px;
    max-width: 420px;
}

.profile-danger-form label {
    color: #ffd9e2;
    font-size: 0.9rem;
}

.danger-btn {
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 142, 160, 0.58);
    background: linear-gradient(135deg, #c54167 0%, #df4f7d 55%, #ef7095 100%);
    color: #fff7fa;
    font-weight: 800;
}

.danger-btn:hover {
    filter: brightness(1.04);
    box-shadow: 0 10px 20px rgba(196, 63, 100, 0.34);
}

.form-group {
    display: grid;
    gap: 8px;
    text-align: left;
}

.form-group label {
    color: #dee7ff;
    font-weight: 600;
}

input[type='text'],
input[type='number'],
input[type='password'],
select,
textarea,
.chat-input {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(172, 190, 229, 0.34);
    background: rgba(8, 12, 25, 0.66);
    color: var(--text-main);
    padding: 13px 14px;
    outline: none;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input[type='number'] {
    padding-right: 42px;
}

input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
    opacity: 1;
    margin: 0;
    min-width: 26px;
    border-left: 1px solid rgba(172, 190, 229, 0.28);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
    filter: invert(0.9) hue-rotate(170deg) saturate(1.2);
}

input::placeholder,
textarea::placeholder {
    color: rgba(181, 194, 223, 0.86);
}

input:focus,
select:focus,
textarea:focus,
.chat-input:focus {
    border-color: rgba(118, 149, 255, 0.86);
    box-shadow: 0 0 0 4px rgba(118, 149, 255, 0.18);
    transform: translateY(-1px);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-main);
    caret-color: var(--text-main);
    -webkit-box-shadow: 0 0 0 1000px rgba(8, 12, 25, 0.66) inset;
    box-shadow: 0 0 0 1000px rgba(8, 12, 25, 0.66) inset;
    transition: background-color 0.01s ease, color 0.01s ease;
}

button,
.submit-btn,
.back-button,
.check-btn,
.send-button,
#params-form button,
#test-form button,
#contest-form button {
    min-height: 48px;
    border: 1px solid rgba(145, 165, 255, 0.38);
    border-radius: 12px;
    color: #f4f7ff;
    background: linear-gradient(135deg, #6f58ff 0%, #835eff 52%, #4f89ff 100%);
    font-size: 0.98rem;
    font-weight: 700;
    padding: 10px 16px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:hover,
.submit-btn:hover,
.back-button:hover,
.check-btn:hover,
.send-button:hover,
#params-form button:hover,
#test-form button:hover,
#contest-form button:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 10px 22px rgba(103, 112, 255, 0.35);
}

button:disabled,
.disabled-btn,
.check-btn:disabled,
.send-button:disabled {
    opacity: 0.62;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

.help-link,
.back-link,
a {
    color: #a9beff;
    font-weight: 600;
    text-decoration: none;
}

.help-link {
    margin-top: 14px;
    display: inline-block;
}

.help-link:hover,
.back-link:hover,
a:hover {
    color: #d8e3ff;
    text-decoration: underline;
}

.help-page {
    max-width: 980px;
}

.help-lead {
    margin-bottom: 18px;
    color: #c5d2f4;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.help-block {
    border: 1px solid rgba(166, 184, 223, 0.22);
    border-radius: var(--radius-md);
    background: rgba(9, 14, 28, 0.58);
    padding: 16px;
}

.help-page > .help-block + .help-block {
    margin-top: 14px;
}

.help-block h2 {
    margin: 0 0 10px;
    font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.help-block p {
    margin: 10px 0 0;
}

.help-actions {
    margin-top: 16px;
}

.help-back-btn {
    min-height: 48px;
    padding: 10px 18px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #f4f7ff;
    background: linear-gradient(135deg, #6f58ff 0%, #835eff 52%, #4f89ff 100%);
    border: 1px solid rgba(145, 165, 255, 0.38);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.help-back-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 10px 22px rgba(103, 112, 255, 0.35);
    text-decoration: none;
}

.error-text {
    color: var(--danger);
    font-weight: 700;
}

.result-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
}

.result-actions--top {
    margin-top: 2px;
    margin-bottom: 12px;
}

.result-actions .back-button {
    width: 220px;
    min-width: 220px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #f4f7ff;
    font-weight: 700;
    text-decoration: none;
}

.back-button--replay {
    width: 240px;
    min-width: 240px;
}

.back-button--chat-summary {
    min-width: 280px;
}

.profile-test-readonly {
    position: relative;
}

.profile-test-readonly .option-item,
.profile-test-readonly .check-btn,
.profile-test-readonly input,
.profile-test-readonly textarea,
.profile-test-readonly select,
.profile-test-readonly button {
    pointer-events: none !important;
}

.profile-test-readonly .check-btn,
.profile-test-readonly input,
.profile-test-readonly textarea,
.profile-test-readonly select,
.profile-test-readonly button {
    opacity: 0.78;
}

#result {
    margin-top: 20px;
    text-align: left;
    border-radius: var(--radius-md);
    border: 1px solid rgba(167, 183, 224, 0.23);
    background: linear-gradient(140deg, rgba(7, 12, 28, 0.82), rgba(8, 18, 42, 0.7));
    backdrop-filter: blur(24px) saturate(155%);
    padding: clamp(18px, 2.6vw, 30px);
    overflow: auto;
}

.summary-article {
    max-width: 1078px;
    margin: 0 auto;
    line-height: 1.72;
    color: #dbe6ff;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
}

.summary-article h1,
.summary-article h2,
.summary-article h3 {
    margin: 0 0 14px;
    line-height: 1.16;
    color: #f3f7ff;
    text-wrap: balance;
}

.summary-article h1 {
    font-size: clamp(2rem, 4vw, 3.6rem);
    margin-bottom: 18px;
}

.summary-article h2 {
    margin-top: 20px;
    font-size: clamp(1.45rem, 2.2vw, 2rem);
}

.summary-article h3 {
    margin-top: 16px;
    font-size: clamp(1.2rem, 1.8vw, 1.45rem);
}

.summary-article p {
    margin: 0 0 12px;
    color: #c7d3ef;
}

.summary-article ul,
.summary-article ol {
    margin: 8px 0 14px;
    padding-left: 22px;
}

.summary-article li {
    margin: 5px 0;
    color: #dde7ff;
}

.summary-article strong {
    color: #f3f7ff;
}

.summary-article .katex-display {
    margin: 14px 0;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(112, 142, 255, 0.08);
    border: 1px solid rgba(166, 184, 223, 0.22);
    overflow-x: auto;
}

.summary-article .katex {
    color: #eef4ff;
    font-size: 1.05em;
}

.summary-article .summary-callout,
.summary-article blockquote {
    margin: 14px 0;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(166, 184, 223, 0.26);
    background: linear-gradient(130deg, rgba(116, 130, 255, 0.14), rgba(95, 188, 255, 0.08));
}

.summary-article .summary-callout > :last-child,
.summary-article blockquote > :last-child {
    margin-bottom: 0;
}

.summary-article .summary-callout-definition {
    border-left: 4px solid rgba(88, 177, 255, 0.92);
    background: linear-gradient(130deg, rgba(64, 145, 255, 0.2), rgba(95, 188, 255, 0.1));
}

.summary-article .summary-callout-rule {
    border-left: 4px solid rgba(133, 123, 255, 0.92);
    background: linear-gradient(130deg, rgba(107, 94, 255, 0.2), rgba(139, 102, 255, 0.1));
}

.summary-article .summary-callout-warning {
    border-left: 4px solid rgba(255, 146, 162, 0.92);
    background: linear-gradient(130deg, rgba(255, 124, 146, 0.2), rgba(255, 180, 130, 0.08));
}

.summary-article .summary-callout-tip {
    border-left: 4px solid rgba(112, 232, 184, 0.92);
    background: linear-gradient(130deg, rgba(96, 214, 176, 0.2), rgba(123, 214, 255, 0.08));
}

.summary-article .summary-code-wrap,
.message.assistant .message-content .summary-code-wrap {
    margin: 14px 0;
    border-radius: 12px;
    border: 1px solid rgba(166, 184, 223, 0.26);
    background: rgba(8, 14, 30, 0.85);
    overflow: hidden;
}

.summary-article .summary-code-head,
.message.assistant .message-content .summary-code-head {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(166, 184, 223, 0.2);
    background: linear-gradient(130deg, rgba(114, 98, 255, 0.24), rgba(86, 171, 255, 0.16));
}

.summary-article .summary-code-lang,
.message.assistant .message-content .summary-code-lang {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #e8efff;
}

.summary-article .summary-copy-btn,
.message.assistant .message-content .summary-copy-btn {
    min-height: 32px;
    padding: 4px 12px;
    border-radius: 9px;
    border: 1px solid rgba(166, 184, 223, 0.34);
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5ff;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.summary-article .summary-copy-btn:hover,
.message.assistant .message-content .summary-copy-btn:hover {
    filter: brightness(1.08);
}

.summary-article pre,
.message.assistant .message-content pre {
    margin: 0;
    padding: 12px 14px;
    background: transparent !important;
    overflow-x: auto;
}

.summary-article pre code,
.message.assistant .message-content pre code {
    font-size: 0.95rem;
    line-height: 1.55;
}

.summary-article :not(pre) > code,
.message.assistant .message-content :not(pre) > code {
    padding: 2px 7px;
    border-radius: 7px;
    border: 1px solid rgba(166, 184, 223, 0.26);
    background: rgba(112, 142, 255, 0.12);
    color: #eef4ff;
    font-size: 0.9em;
}

html[data-theme='dark'] .summary-article .summary-code-wrap,
html[data-theme='dark'] .message.assistant .message-content .summary-code-wrap {
    border-color: rgba(138, 165, 226, 0.28);
    background: rgba(6, 12, 28, 0.94);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme='dark'] .summary-article .summary-code-head,
html[data-theme='dark'] .message.assistant .message-content .summary-code-head {
    border-bottom-color: rgba(138, 165, 226, 0.25);
    background: linear-gradient(130deg, rgba(88, 104, 240, 0.34), rgba(73, 152, 235, 0.22));
}

html[data-theme='dark'] .summary-article pre,
html[data-theme='dark'] .message.assistant .message-content pre {
    background: rgba(4, 9, 22, 0.96) !important;
}

html[data-theme='dark'] .summary-article pre code.hljs,
html[data-theme='dark'] .message.assistant .message-content pre code.hljs {
    background: transparent !important;
}

.spinner,
.loader {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    border: 2px solid rgba(171, 186, 224, 0.18);
    background:
        radial-gradient(closest-side, rgba(10, 16, 32, 0.95) 70%, transparent 72% 100%),
        conic-gradient(from 180deg, rgba(111, 88, 255, 0), rgba(111, 88, 255, 0.85), rgba(79, 137, 255, 0.95), rgba(111, 88, 255, 0));
    margin: 16px auto;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 22px rgba(99, 123, 255, 0.22);
}

.loading-hint {
    min-height: 24px;
    color: #b9c9f4;
    font-size: 0.95rem;
    line-height: 1.4;
    text-align: center;
    opacity: 0.92;
    animation: hint-fade 0.35s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-hint-strip {
    margin: 16px auto 0;
    width: min(100%, 980px);
    min-height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(166, 184, 223, 0.24);
    background: rgba(5, 10, 22, 0.72);
    padding: 8px 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

.no-copy {
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
}

ul,
ol {
    margin: 14px 0;
    padding-left: 22px;
}

li {
    color: #dbe5ff;
    line-height: 1.56;
    margin: 6px 0;
}

h2,
h3,
strong {
    color: #f4f7ff;
}


.container {
    text-align: left;
}

#test-loading,
#test-result,
#test-content,
.test-container {
    margin-top: 18px;
}

.test-loading-wrap {
    text-align: center;
}

.question-block,
.question {
    margin-bottom: 14px;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(166, 184, 223, 0.24);
    background: rgba(10, 16, 31, 0.66);
}

.question-text {
    font-weight: 700;
    margin-bottom: 12px;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
}

.options-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.option-item {
    margin: 8px 0;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(166, 184, 223, 0.22);
    background: rgba(255, 255, 255, 0.04);
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.option-item:hover:not(.correct-answer):not(.incorrect-answer) {
    transform: translateY(-1px);
    background: rgba(145, 165, 255, 0.12);
}

.option-item.option-selected:not(.correct-answer):not(.incorrect-answer) {
    border-color: rgba(145, 165, 255, 0.62);
    background: rgba(99, 123, 255, 0.2);
}

.option-item input[type='radio'] {
    margin-right: 10px;
    accent-color: #89a8ff;
    pointer-events: none;
}

.option-item label {
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
}

.open-question {
    margin-top: 10px;
}

.answer-input {
    min-height: 108px;
    resize: vertical;
}

.feedback {
    margin-top: 10px;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    display: none;
}

.correct-feedback {
    color: #0f2f20;
    background: linear-gradient(135deg, rgba(112, 232, 184, 0.95), rgba(168, 247, 214, 0.95));
}

.incorrect-feedback {
    color: #421019;
    background: linear-gradient(135deg, rgba(255, 142, 160, 0.95), rgba(255, 190, 120, 0.95));
}

.neutral-feedback {
    color: #dce6ff;
    background: rgba(58, 72, 103, 0.85);
}

.correct-answer,
.correct-answer-input {
    background: rgba(112, 232, 184, 0.2) !important;
    border-left: 4px solid var(--success) !important;
}

.incorrect-answer,
.incorrect-answer-input {
    background: rgba(255, 142, 160, 0.2) !important;
    border-left: 4px solid var(--danger) !important;
}

.correct-answer-text {
    color: #ddffe6;
}

.contest-container {
    max-width: 1180px;
}

.contest-lead {
    margin-top: 10px;
}

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

.contest-form-grid-extra {
    grid-template-columns: 1fr 1fr;
}

.contest-checkbox {
    min-height: 64px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(166, 184, 223, 0.26);
    background: rgba(7, 13, 28, 0.56);
    color: #dce8ff;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.contest-checkbox input[type='checkbox'] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.contest-checkbox-ui {
    width: 50px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(164, 185, 239, 0.34);
    background: rgba(255, 255, 255, 0.08);
    display: inline-flex;
    align-items: center;
    padding: 3px;
    flex-shrink: 0;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.22s ease;
}

.contest-checkbox-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(150deg, #dbe8ff 0%, #b9d1ff 100%);
    box-shadow: 0 4px 10px rgba(8, 14, 30, 0.44);
    transition: transform 0.22s cubic-bezier(0.2, 0.85, 0.28, 1), background 0.22s ease;
}

.contest-checkbox-text {
    color: #dce8ff;
    line-height: 1.35;
}

.contest-checkbox input[type='checkbox']:checked + .contest-checkbox-ui {
    background: linear-gradient(135deg, rgba(111, 88, 255, 0.92), rgba(79, 137, 255, 0.92));
    border-color: rgba(171, 192, 255, 0.64);
    box-shadow: 0 8px 20px rgba(88, 113, 246, 0.38);
}

.contest-checkbox input[type='checkbox']:checked + .contest-checkbox-ui .contest-checkbox-dot {
    transform: translateX(20px);
    background: linear-gradient(150deg, #ffffff 0%, #e6f0ff 100%);
}

.contest-checkbox:hover {
    border-color: rgba(178, 197, 241, 0.46);
    background: rgba(10, 18, 36, 0.74);
    box-shadow: 0 10px 20px rgba(10, 18, 35, 0.34);
}

.contest-checkbox input[type='checkbox']:focus-visible + .contest-checkbox-ui {
    box-shadow: 0 0 0 4px rgba(121, 156, 255, 0.25);
}

.contest-topics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.contest-topic-pill {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(166, 184, 223, 0.24);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.contest-topic-pill:hover {
    border-color: rgba(145, 165, 255, 0.56);
    background: rgba(145, 165, 255, 0.14);
    transform: translateY(-1px);
}

.contest-topic-pill input[type='checkbox'] {
    width: 16px;
    height: 16px;
    accent-color: #7f9bff;
}

.contest-result-wrap {
    margin-top: 16px;
}

.result-actions {
    margin-top: 6px;
    margin-bottom: 14px;
}

.contest-session-bar {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(166, 184, 223, 0.24);
    background: rgba(8, 14, 30, 0.62);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.contest-task-nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.contest-task-nav-btn {
    min-width: 44px;
    min-height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(166, 184, 223, 0.28);
    background: rgba(255, 255, 255, 0.04);
    color: #dbe5ff;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 6px 10px;
    box-shadow: none;
}

.contest-task-nav-btn.is-current {
    box-shadow: 0 0 0 2px rgba(120, 152, 255, 0.45);
}

.contest-task-nav-btn.idle {
    border-color: rgba(166, 184, 223, 0.32);
}

.contest-task-nav-btn.solved {
    border-color: rgba(112, 232, 184, 0.66);
    background: rgba(112, 232, 184, 0.18);
}

.contest-task-nav-btn.failed {
    border-color: rgba(255, 142, 160, 0.64);
    background: rgba(255, 142, 160, 0.16);
}

.contest-session-controls {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.contest-timer-box {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    border: 1px solid rgba(166, 184, 223, 0.26);
    background: rgba(255, 255, 255, 0.04);
    padding: 6px 12px;
    color: #d8e4ff;
    font-weight: 600;
}

.contest-timer-box strong {
    color: #f5f8ff;
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
}

.contest-finish-btn {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 0.9rem;
}

.contest-finish-summary {
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(166, 184, 223, 0.24);
    background: linear-gradient(145deg, rgba(8, 14, 30, 0.72), rgba(12, 21, 46, 0.72));
}

.contest-finish-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.contest-finish-summary h3 {
    margin: 0;
}

.contest-finish-score {
    min-width: 72px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(160, 182, 236, 0.42);
    background: linear-gradient(135deg, rgba(111, 88, 255, 0.3), rgba(79, 137, 255, 0.34));
    color: #f3f8ff;
    font-weight: 800;
}

.contest-finish-lead {
    margin: 10px 0 0;
    color: #d3e2ff;
    line-height: 1.5;
}

.contest-finish-progress {
    margin-top: 12px;
    height: 12px;
    border-radius: 999px;
    border: 1px solid rgba(166, 184, 223, 0.3);
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.contest-finish-progress-bar {
    height: 100%;
    min-width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #6f58ff 0%, #4f89ff 45%, #4dd4a2 100%);
    box-shadow: 0 0 12px rgba(94, 133, 255, 0.36);
    transition: width 0.35s ease;
}

.contest-finish-progress-label {
    margin: 8px 0 0;
    font-size: 0.94rem;
    color: #afc3ef;
}

.contest-finish-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.contest-finish-grid > div {
    border: 1px solid rgba(166, 184, 223, 0.22);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    padding: 9px 10px;
}

.contest-meta {
    margin-bottom: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(166, 184, 223, 0.24);
    background: rgba(8, 14, 30, 0.58);
}

.contest-meta h2 {
    margin: 0 0 8px;
}

.contest-tasks {
    display: grid;
    gap: 14px;
}

.contest-task-card {
    display: none;
    border-radius: 16px;
    border: 1px solid rgba(166, 184, 223, 0.24);
    background: rgba(9, 15, 31, 0.66);
    padding: 16px;
}

.contest-task-card.is-active {
    display: block;
}

.contest-task-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.contest-task-header h3 {
    margin: 0;
    font-size: 1.24rem;
}

.contest-difficulty-badge {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    border: 1px solid rgba(166, 184, 223, 0.3);
}

.contest-difficulty-easy {
    background: rgba(96, 214, 176, 0.2);
    color: #a3ffd9;
}

.contest-difficulty-medium {
    background: rgba(124, 145, 255, 0.2);
    color: #d2deff;
}

.contest-difficulty-hard,
.contest-difficulty-olymp {
    background: rgba(255, 142, 160, 0.18);
    color: #ffd7de;
}

.contest-statement {
    margin-top: 12px;
}

.contest-spec-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.contest-spec-item {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(166, 184, 223, 0.22);
    background: rgba(255, 255, 255, 0.04);
    color: #d9e4ff;
}

.contest-spec-item strong {
    color: #f2f6ff;
}

.contest-examples {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.contest-examples h4 {
    margin: 0;
    grid-column: 1 / -1;
}

.contest-example-card,
.contest-test-item,
.contest-run-test {
    border-radius: 12px;
    border: 1px solid rgba(166, 184, 223, 0.2);
    background: rgba(255, 255, 255, 0.035);
    padding: 10px 12px;
}

.contest-example-card h5,
.contest-test-item h5,
.contest-run-test h5 {
    margin: 0 0 8px;
    font-size: 0.95rem;
    color: #eaf1ff;
}

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

.contest-example-explanation {
    margin-top: 8px;
    font-size: 0.92rem;
}

.contest-hidden-tests-note {
    margin: 0;
    font-size: 0.88rem;
    color: #a9bcdf;
    grid-column: 1 / -1;
}

.contest-tests-details {
    margin-top: 12px;
}

.contest-tests-details > summary {
    cursor: pointer;
    font-weight: 700;
    color: #dce7ff;
}

.contest-tests-list {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.contest-io-block {
    margin: 8px 0 0;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(166, 184, 223, 0.2);
    background: rgba(4, 10, 24, 0.78);
    color: #e8f0ff;
    font-size: 0.88rem;
    line-height: 1.45;
    overflow-x: auto;
    white-space: pre-wrap;
}

.contest-runner {
    margin-top: 14px;
    border-radius: 12px;
    border: 1px solid rgba(166, 184, 223, 0.22);
    background: rgba(8, 14, 29, 0.64);
    padding: 12px;
}

.contest-runner h4 {
    margin: 0 0 10px;
}

.contest-runner-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.contest-language-control {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: default;
}

.contest-language-title {
    color: #d9e4ff;
    font-weight: 700;
}

.contest-language-dropdown {
    position: relative;
    min-width: 170px;
    user-select: none;
}

.contest-language-trigger {
    min-width: 170px;
    width: 170px;
    min-height: 46px;
    padding: 10px 38px 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(166, 184, 223, 0.36);
    background-color: rgba(10, 16, 34, 0.88);
    color: #e7f0ff;
    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image:
        linear-gradient(135deg, rgba(111, 88, 255, 0.14) 0%, rgba(79, 137, 255, 0.14) 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9L12 15L18 9' stroke='%23d8e6ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-size: 100% 100%, 14px 14px;
    background-position: center, right 12px center;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.contest-language-trigger:hover {
    border-color: rgba(186, 204, 248, 0.56);
    box-shadow: 0 8px 16px rgba(13, 24, 48, 0.24);
}

.contest-language-trigger:focus {
    border-color: rgba(129, 160, 255, 0.84);
    box-shadow: 0 0 0 4px rgba(122, 150, 255, 0.22);
    transform: translateY(-1px);
}

.contest-language-trigger:focus-visible {
    outline: none;
}

.contest-language-trigger:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.contest-language-trigger-arrow {
    position: absolute;
    right: 14px;
    top: 50%;
    width: 9px;
    height: 9px;
    border-right: 2px solid #d8e6ff;
    border-bottom: 2px solid #d8e6ff;
    transform: translateY(-58%) rotate(45deg);
    transition: transform 0.2s ease;
    pointer-events: none;
}

.contest-language-dropdown.is-open .contest-language-trigger {
    border-color: rgba(129, 160, 255, 0.84);
    box-shadow: 0 0 0 4px rgba(122, 150, 255, 0.2), 0 8px 16px rgba(13, 24, 48, 0.24);
}

.contest-language-dropdown.is-open .contest-language-trigger-arrow {
    transform: translateY(-36%) rotate(-135deg);
}

.contest-language-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid rgba(166, 184, 223, 0.36);
    background: rgba(7, 13, 31, 0.98);
    box-shadow: 0 18px 30px rgba(6, 12, 25, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: grid;
    gap: 4px;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 40;
}

.contest-language-dropdown.is-open .contest-language-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.contest-language-item {
    min-height: 38px;
    border-radius: 9px;
    border: 1px solid transparent;
    background: transparent;
    color: #dce8ff;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.contest-language-item:hover:not(:disabled) {
    border-color: rgba(153, 176, 236, 0.46);
    background: rgba(126, 146, 214, 0.16);
}

.contest-language-item:focus-visible {
    outline: none;
    border-color: rgba(167, 188, 247, 0.58);
    background: rgba(127, 149, 219, 0.2);
}

.contest-language-item.is-selected {
    border-color: rgba(162, 183, 255, 0.54);
    background: linear-gradient(135deg, #6f58ff 0%, #7d64ff 48%, #4f89ff 100%);
    color: #f8fbff;
}

.contest-language-item.is-selected::after {
    content: '';
    width: 6px;
    height: 11px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
    opacity: 0.95;
}

.contest-language-item:disabled {
    opacity: 0.62;
    cursor: not-allowed;
}

.contest-language-select {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.contest-code-input {
    margin-top: 0;
    min-height: 220px;
    width: 100%;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: #eaf2ff;
    caret-color: #eaf2ff;
    font-size: 16px;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
    line-height: 24px;
    padding: 12px 14px;
    resize: vertical;
    outline: none;
    position: relative;
    z-index: 2;
    white-space: pre;
    overflow-wrap: normal;
    tab-size: 4;
    -moz-tab-size: 4;
    box-sizing: border-box;
    font-variant-ligatures: none;
    font-feature-settings: 'liga' 0, 'calt' 0;
    font-kerning: none;
    font-synthesis: none;
    font-weight: 400;
    letter-spacing: 0;
    word-spacing: 0;
    text-shadow: none;
}

.contest-code-input::placeholder {
    color: rgba(177, 192, 224, 0.78);
}

.contest-code-input::selection {
    background: rgba(121, 150, 255, 0.35);
    color: rgba(232, 242, 255, 0.015);
}

.contest-code-editor {
    margin-top: 10px;
    border-radius: 12px;
    border: 1px solid rgba(166, 184, 223, 0.22);
    background: rgba(4, 9, 22, 0.92);
    overflow: hidden;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contest-code-editor:focus-within {
    border-color: rgba(130, 159, 255, 0.86);
    box-shadow: 0 0 0 4px rgba(122, 150, 255, 0.2);
}

.contest-code-editor .CodeMirror {
    min-height: 220px;
    height: auto;
    font-size: 16px;
    line-height: 24px;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
    background: linear-gradient(135deg, rgba(9, 16, 36, 0.96), rgba(6, 11, 28, 0.98));
    color: #eaf2ff;
    tab-size: 4;
    -moz-tab-size: 4;
}

.contest-code-editor .CodeMirror-scroll {
    min-height: 220px;
}

.contest-code-editor .CodeMirror-gutters {
    border-right: 1px solid rgba(165, 184, 232, 0.2);
    background: rgba(12, 22, 45, 0.88);
}

.contest-code-editor .CodeMirror-linenumber {
    color: rgba(154, 178, 228, 0.78);
}

.contest-code-editor .CodeMirror-cursor {
    border-left: 2px solid #eaf2ff;
}

.contest-code-editor .CodeMirror-selected,
.contest-code-editor .CodeMirror-line::selection,
.contest-code-editor .CodeMirror-line > span::selection,
.contest-code-editor .CodeMirror-line > span > span::selection {
    background: rgba(121, 150, 255, 0.3) !important;
}

.contest-code-editor .CodeMirror-focused {
    outline: none;
}

.contest-code-editor .CodeMirror pre {
    font-variant-ligatures: none;
    font-feature-settings: 'liga' 0, 'calt' 0;
}

.contest-code-editor .cm-s-material-darker .CodeMirror-gutters,
.contest-code-editor .cm-s-material-darker.CodeMirror-gutters {
    background: rgba(10, 18, 40, 0.94);
}

.contest-code-editor .cm-s-material-darker .cm-keyword {
    color: #c792ea;
}

.contest-code-editor .cm-s-material-darker .cm-operator,
.contest-code-editor .cm-s-material-darker .cm-meta {
    color: #89ddff;
}

.contest-code-editor .cm-s-material-darker .cm-number {
    color: #f78c6c;
}

.contest-code-editor .cm-s-material-darker .cm-atom,
.contest-code-editor .cm-s-material-darker .cm-builtin {
    color: #89ddff;
}

.contest-code-editor .cm-s-material-darker .cm-string {
    color: #c3e88d;
}

.contest-code-editor .cm-s-material-darker .cm-comment {
    color: #7fa0d4;
}

.contest-code-editor .cm-s-material-darker .cm-variable,
.contest-code-editor .cm-s-material-darker .cm-variable-2,
.contest-code-editor .cm-s-material-darker .cm-property {
    color: #d6e3ff;
}

.contest-code-editor .cm-s-material-darker .cm-def,
.contest-code-editor .cm-s-material-darker .cm-type,
.contest-code-editor .cm-s-material-darker .cm-tag {
    color: #82b1ff;
}

.contest-run-output {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.contest-run-details {
    display: grid;
    gap: 8px;
}

.contest-run-test.passed {
    border-left: 4px solid rgba(112, 232, 184, 0.85);
}

.contest-run-test.failed {
    border-left: 4px solid rgba(255, 142, 160, 0.85);
}

.contest-io-block .hljs,
.contest-io-block code {
    background: transparent !important;
    color: #e8f0ff !important;
}

.chat-page {
    width: min(1200px, 100%);
    position: relative;
}

.chat-context {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.context-pill {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid rgba(168, 186, 229, 0.27);
    background: rgba(255, 255, 255, 0.05);
    color: #d4e0ff;
    font-size: 0.82rem;
    font-weight: 600;
}

.chat-container {
    width: 100%;
    height: min(76vh, 820px);
    border-radius: 22px;
    border: 1px solid rgba(165, 183, 223, 0.24);
    background: rgba(10, 16, 32, 0.7);
    backdrop-filter: blur(38px) saturate(175%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-container::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(130deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.015) 40%, rgba(255, 255, 255, 0));
}

.chat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(7, 12, 26, 0.68), rgba(12, 18, 35, 0.84));
}

.message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    width: min(90%, 860px);
    margin-bottom: 12px;
    animation: message-in 0.28s ease both;
}

.message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message.assistant {
    margin-right: auto;
}

.message-container {
    max-width: 100%;
}

.message-content {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(166, 184, 223, 0.22);
    line-height: 1.5;
    overflow: auto;
    backdrop-filter: blur(10px) saturate(130%);
}

.message.assistant .message-content h1,
.message.assistant .message-content h2,
.message.assistant .message-content h3 {
    margin: 0 0 10px;
    line-height: 1.28;
    font-size: 1.08rem;
    user-select: text;
    -webkit-user-select: text;
}

.message.assistant .message-content p {
    margin: 0 0 10px;
    color: #e8efff;
    font-size: 0.98rem;
}

.message.assistant .message-content ul,
.message.assistant .message-content ol {
    margin: 0 0 10px;
    padding-left: 18px;
}

.message.assistant .message-content li {
    margin: 4px 0;
    color: #dce6ff;
    user-select: text;
    -webkit-user-select: text;
}

.message.assistant .message-content mark {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
}

.message.user .message-content {
    color: #f4f7ff;
    background: linear-gradient(135deg, rgba(115, 90, 255, 0.94), rgba(79, 137, 255, 0.9));
    white-space: pre-wrap;
}

.message.assistant .message-content {
    color: #e8efff;
    background: rgba(20, 31, 58, 0.86);
}

.message-time {
    margin-top: 4px;
    font-size: 0.72rem;
    color: rgba(201, 214, 243, 0.78);
}

.avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.avatar.user {
    color: #f3f7ff;
    background: rgba(114, 94, 255, 0.95);
}

.avatar.assistant {
    padding: 0;
    overflow: hidden;
    border-color: rgba(166, 186, 236, 0.38);
    background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.2), rgba(23, 35, 66, 0.78));
}

.avatar.assistant .assistant-logo-image {
    width: 74%;
    height: 74%;
}

.avatar.assistant.assistant-profile-trigger {
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.avatar.assistant.assistant-profile-trigger:hover {
    transform: translateY(-1px) scale(1.04);
    border-color: rgba(179, 198, 245, 0.62);
    box-shadow: 0 0 0 3px rgba(109, 143, 242, 0.18);
}

.avatar.assistant.assistant-profile-trigger:focus-visible {
    outline: none;
    border-color: rgba(181, 201, 248, 0.74);
    box-shadow: 0 0 0 4px rgba(97, 139, 255, 0.24);
}

.typing-indicator {
    display: none;
    width: fit-content;
    margin-bottom: 12px;
    padding: 11px 14px;
    border-radius: 999px;
    border: 1px solid rgba(166, 184, 223, 0.22);
    background: rgba(20, 31, 58, 0.86);
    animation: typing-pulse 1.2s ease-in-out infinite;
    user-select: none;
    -webkit-user-select: none;
}

.typing-dots {
    display: inline-flex;
    gap: 6px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #dce6ff;
    animation: typing 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.17s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.34s;
}

@keyframes typing {
    0%,
    75%,
    100% {
        opacity: 0.55;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

.chat-input-container {
    padding: 12px;
    border-top: 1px solid rgba(166, 184, 223, 0.2);
    display: flex;
    gap: 10px;
    background: rgba(10, 16, 32, 0.84);
}

.chat-input {
    border-radius: 999px;
}

.send-button {
    min-width: 132px;
    border-radius: 999px;
}

.summary-loading {
    text-align: center;
}

.site-footer {
    margin-bottom: 16px;
    border-radius: 16px;
    border: 1px solid rgba(167, 183, 224, 0.22);
    background: rgba(10, 15, 32, 0.56);
    backdrop-filter: blur(32px) saturate(165%);
    box-shadow: var(--shadow);
    text-align: center;
    padding: 14px 16px;
}

.site-footer p {
    margin: 0;
    color: #b7c4e6;
    font-size: 0.9rem;
}

html[data-theme='light'] {
    color-scheme: light;
    --bg-base: #f5f8ff;
    --bg-deep: #ecf2ff;
    --bg-mid: #e4ecff;
    --glass: rgba(255, 255, 255, 0.8);
    --glass-strong: rgba(255, 255, 255, 0.92);
    --glass-soft: rgba(65, 94, 156, 0.08);
    --border: rgba(93, 119, 179, 0.28);
    --text-main: #1a2745;
    --text-muted: #495d86;
    --accent-gold: #1382bf;
    --accent-violet: #5f6fff;
    --accent-blue: #2d9bdb;
    --success: #1f9462;
    --danger: #ca4462;
    --shadow: 0 20px 42px rgba(56, 84, 138, 0.18);
}

html[data-theme='light'] body {
    background:
        radial-gradient(circle at 8% 14%, rgba(123, 145, 255, 0.24) 0%, transparent 34%),
        radial-gradient(circle at 88% 12%, rgba(92, 176, 255, 0.22) 0%, transparent 30%),
        radial-gradient(circle at 74% 80%, rgba(110, 198, 255, 0.2) 0%, transparent 32%),
        linear-gradient(165deg, var(--bg-base) 0%, var(--bg-deep) 40%, var(--bg-mid) 100%);
}

html[data-theme='light'] .orb-a {
    background: radial-gradient(circle, rgba(126, 149, 255, 0.42), rgba(126, 149, 255, 0));
}

html[data-theme='light'] .orb-b {
    background: radial-gradient(circle, rgba(104, 185, 255, 0.42), rgba(104, 185, 255, 0));
}

html[data-theme='light'] .header-inner {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(97, 123, 182, 0.3);
}

html[data-theme='light'] .logo {
    color: #1c2b4d;
}

html[data-theme='light'] .logo-group .logo-mark {
    border-color: rgba(92, 121, 183, 0.34);
    background: rgba(245, 249, 255, 0.9);
}

html[data-theme='light'] .logo-group .logo-mark:hover {
    border-color: rgba(85, 117, 185, 0.5);
    box-shadow: 0 0 0 4px rgba(90, 126, 205, 0.14), 0 12px 24px rgba(63, 97, 164, 0.18);
}

html[data-theme='light'] .assistant-profile-overlay {
    background: rgba(31, 49, 86, 0.22);
}

html[data-theme='light'] .assistant-profile-card {
    border-color: rgba(97, 123, 182, 0.3);
    background: rgba(249, 252, 255, 0.95);
    box-shadow: 0 22px 48px rgba(53, 82, 146, 0.24);
}

html[data-theme='light'] .assistant-profile-card::before {
    border-color: rgba(255, 255, 255, 0.68);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

html[data-theme='light'] .assistant-profile-card .assistant-profile-close {
    border-color: rgba(97, 123, 182, 0.32);
    background: rgba(255, 255, 255, 0.88);
    color: #2f4676;
}

html[data-theme='light'] .assistant-profile-main h2 {
    color: #1f3563;
}

html[data-theme='light'] .assistant-profile-handle {
    color: #4b6190;
}

html[data-theme='light'] .assistant-profile-description {
    color: #35507f;
}

html[data-theme='light'] .assistant-profile-avatar {
    border-color: rgba(97, 123, 182, 0.35);
    background: rgba(240, 247, 255, 0.92);
}

html[data-theme='light'] .assistant-profile-link {
    color: #f8fbff;
}

html[data-theme='light'] .assistant-profile-link-secondary {
    color: #315289;
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(97, 123, 182, 0.32);
}

html[data-theme='light'] .avatar.assistant {
    border-color: rgba(97, 123, 182, 0.36);
    background: radial-gradient(circle at 28% 25%, rgba(255, 255, 255, 0.9), rgba(220, 234, 255, 0.9));
}

html[data-theme='light'] .nav-list a {
    color: #284071;
    background: rgba(78, 115, 192, 0.11);
    border-color: rgba(78, 115, 192, 0.25);
}

html[data-theme='light'] .nav-list a:hover {
    color: #1d3360;
    border-color: rgba(68, 101, 172, 0.5);
    background: rgba(96, 127, 194, 0.2);
    box-shadow: 0 8px 18px rgba(78, 109, 170, 0.24);
}

html[data-theme='light'] .theme-toggle {
    color: #2b4476;
    background: rgba(80, 117, 192, 0.1);
    border-color: rgba(80, 117, 192, 0.28);
}

html[data-theme='light'] .theme-toggle:hover {
    background: rgba(80, 117, 192, 0.16);
    border-color: rgba(80, 117, 192, 0.42);
}

html[data-theme='light'] .user-chip {
    color: #2f4b7f;
    background: rgba(80, 117, 192, 0.12);
    border-color: rgba(80, 117, 192, 0.32);
}

html[data-theme='light'] .user-chip:hover {
    color: #234171;
    border-color: rgba(80, 117, 192, 0.46);
    background: rgba(80, 117, 192, 0.2);
}

html[data-theme='light'] .nav-cta-secondary {
    color: #2f4b7f;
    background: rgba(80, 117, 192, 0.14);
    border-color: rgba(80, 117, 192, 0.3);
}

html[data-theme='light'] .nav-cta-secondary:hover {
    color: #234171;
    background: rgba(80, 117, 192, 0.2);
}

html[data-theme='light'] .hero-title,
html[data-theme='light'] .page-title,
html[data-theme='light'] h1,
html[data-theme='light'] h2,
html[data-theme='light'] h3,
html[data-theme='light'] strong {
    color: #1d2d50;
}

html[data-theme='light'] .hero-subtitle,
html[data-theme='light'] p {
    color: #495d86;
}

html[data-theme='light'] li {
    color: #3f537e;
}

html[data-theme='light'] .offer-card {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(98, 124, 183, 0.28);
}

html[data-theme='light'] .offer-top {
    background: linear-gradient(115deg, rgba(137, 166, 230, 0.22), rgba(139, 200, 244, 0.18));
    border-color: rgba(98, 124, 183, 0.26);
}

html[data-theme='light'] input[type='text'],
html[data-theme='light'] input[type='number'],
html[data-theme='light'] input[type='password'],
html[data-theme='light'] select,
html[data-theme='light'] textarea,
html[data-theme='light'] .chat-input {
    background: rgba(255, 255, 255, 0.92);
    color: #1a294a;
    border-color: rgba(94, 121, 183, 0.32);
}

html[data-theme='light'] input::placeholder,
html[data-theme='light'] textarea::placeholder {
    color: rgba(73, 95, 138, 0.78);
}

html[data-theme='light'] input:focus,
html[data-theme='light'] select:focus,
html[data-theme='light'] textarea:focus,
html[data-theme='light'] .chat-input:focus {
    border-color: rgba(79, 116, 201, 0.72);
    box-shadow: 0 0 0 4px rgba(79, 116, 201, 0.16);
}

html[data-theme='light'] input:-webkit-autofill,
html[data-theme='light'] input:-webkit-autofill:hover,
html[data-theme='light'] input:-webkit-autofill:focus,
html[data-theme='light'] textarea:-webkit-autofill,
html[data-theme='light'] textarea:-webkit-autofill:hover,
html[data-theme='light'] textarea:-webkit-autofill:focus {
    -webkit-text-fill-color: #1a294a;
    caret-color: #1a294a;
    -webkit-box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.92) inset;
    box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.92) inset;
}

html[data-theme='light'] .generator-mode-switch {
    border-color: rgba(97, 123, 182, 0.28);
    background: rgba(255, 255, 255, 0.82);
}

html[data-theme='light'] .generator-mode-switch::before {
    box-shadow: 0 10px 20px rgba(88, 120, 194, 0.32);
}

html[data-theme='light'] .generator-mode-btn {
    border-color: rgba(97, 123, 182, 0.26);
    background: transparent;
    color: #294476;
}

html[data-theme='light'] .generator-mode-btn:hover {
    border-color: rgba(97, 123, 182, 0.45);
    box-shadow: 0 8px 18px rgba(77, 112, 179, 0.2);
}

html[data-theme='light'] .generator-mode-btn.is-active {
    color: #f8fbff;
}

html[data-theme='light'] .range-control {
    border-color: rgba(97, 123, 182, 0.26);
    background: rgba(246, 251, 255, 0.84);
}

html[data-theme='light'] .range-head {
    color: #426194;
}

html[data-theme='light'] .range-hints {
    color: #5b74a4;
}

html[data-theme='light'] .custom-range {
    border-color: rgba(97, 123, 182, 0.24);
    background: linear-gradient(90deg, rgba(126, 96, 255, 0.96) 0%, rgba(83, 156, 255, 0.96) var(--range-fill), rgba(194, 212, 241, 0.9) var(--range-fill), rgba(194, 212, 241, 0.9) 100%);
    box-shadow: inset 0 1px 4px rgba(99, 128, 182, 0.15);
}

html[data-theme='light'] .contest-topic-pill {
    border-color: rgba(97, 123, 182, 0.24);
    background: rgba(255, 255, 255, 0.78);
    color: #2d4675;
}

html[data-theme='light'] .contest-topic-pill:hover {
    border-color: rgba(97, 123, 182, 0.42);
    background: rgba(205, 220, 246, 0.54);
}

html[data-theme='light'] .contest-checkbox,
html[data-theme='light'] .contest-session-bar,
html[data-theme='light'] .contest-finish-summary,
html[data-theme='light'] .contest-timer-box {
    border-color: rgba(97, 123, 182, 0.24);
    background: rgba(255, 255, 255, 0.8);
    color: #2f4a79;
}

html[data-theme='light'] .contest-checkbox-text {
    color: #2f4a79;
}

html[data-theme='light'] .contest-checkbox:hover {
    background: rgba(236, 245, 255, 0.96);
    border-color: rgba(102, 135, 210, 0.45);
    box-shadow: 0 8px 18px rgba(93, 125, 194, 0.22);
}

html[data-theme='light'] .contest-checkbox-ui {
    border-color: rgba(97, 123, 182, 0.34);
    background: rgba(226, 237, 255, 0.9);
}

html[data-theme='light'] .contest-checkbox-dot {
    background: linear-gradient(150deg, #ffffff 0%, #d5e5ff 100%);
    box-shadow: 0 3px 8px rgba(72, 104, 170, 0.22);
}

html[data-theme='light'] .contest-checkbox input[type='checkbox']:checked + .contest-checkbox-ui {
    border-color: rgba(102, 135, 210, 0.55);
    box-shadow: 0 8px 18px rgba(86, 121, 198, 0.3);
}

html[data-theme='light'] .contest-finish-score {
    border-color: rgba(96, 124, 186, 0.38);
    color: #ffffff;
}

html[data-theme='light'] .contest-finish-lead {
    color: #35537f;
}

html[data-theme='light'] .contest-finish-progress {
    border-color: rgba(97, 123, 182, 0.28);
    background: rgba(225, 235, 252, 0.86);
}

html[data-theme='light'] .contest-finish-progress-label {
    color: #476192;
}

html[data-theme='light'] .contest-finish-grid > div {
    border-color: rgba(97, 123, 182, 0.24);
    background: rgba(244, 249, 255, 0.88);
}

html[data-theme='light'] .contest-task-nav-btn {
    border-color: rgba(97, 123, 182, 0.3);
    background: rgba(241, 248, 255, 0.8);
    color: #2b4678;
}

html[data-theme='light'] .contest-task-nav-btn.is-current {
    box-shadow: 0 0 0 2px rgba(102, 133, 201, 0.48);
}

html[data-theme='light'] .contest-meta,
html[data-theme='light'] .contest-task-card,
html[data-theme='light'] .contest-runner,
html[data-theme='light'] .contest-example-card,
html[data-theme='light'] .contest-test-item,
html[data-theme='light'] .contest-run-test,
html[data-theme='light'] .contest-spec-item {
    border-color: rgba(97, 123, 182, 0.24);
    background: rgba(255, 255, 255, 0.8);
}

html[data-theme='light'] .contest-spec-item,
html[data-theme='light'] .contest-language-title,
html[data-theme='light'] .contest-tests-details > summary {
    color: #2f4a79;
}

html[data-theme='light'] .contest-spec-item strong,
html[data-theme='light'] .contest-task-header h3,
html[data-theme='light'] .contest-example-card h5,
html[data-theme='light'] .contest-test-item h5,
html[data-theme='light'] .contest-run-test h5 {
    color: #1e3561;
}

html[data-theme='light'] .contest-io-block {
    border-color: rgba(97, 123, 182, 0.24);
    background: rgba(244, 249, 255, 0.92);
    color: #1f355f;
}

html[data-theme='light'] .contest-code-editor {
    border-color: rgba(97, 123, 182, 0.24);
    background: rgba(246, 251, 255, 0.92);
}

html[data-theme='light'] .contest-code-editor:focus-within {
    border-color: rgba(100, 132, 208, 0.72);
    box-shadow: 0 0 0 4px rgba(97, 130, 206, 0.16);
}

html[data-theme='light'] .contest-code-editor .CodeMirror {
    color: #1f355f;
}

html[data-theme='light'] .contest-code-editor .CodeMirror-gutters {
    border-right-color: rgba(97, 123, 182, 0.24);
    background: rgba(229, 240, 255, 0.86);
}

html[data-theme='light'] .contest-code-editor .CodeMirror-linenumber {
    color: #5f79ad;
}

html[data-theme='light'] .contest-code-editor .CodeMirror-cursor {
    border-left-color: #1f355f;
}

html[data-theme='light'] .contest-code-editor .CodeMirror-selected,
html[data-theme='light'] .contest-code-editor .CodeMirror-line::selection,
html[data-theme='light'] .contest-code-editor .CodeMirror-line > span::selection,
html[data-theme='light'] .contest-code-editor .CodeMirror-line > span > span::selection {
    background: rgba(93, 126, 208, 0.24) !important;
}

html[data-theme='light'] .contest-language-trigger {
    border-color: rgba(98, 126, 188, 0.4);
    background-color: rgba(255, 255, 255, 0.92);
    color: #294577;
    background-image:
        linear-gradient(135deg, rgba(111, 88, 255, 0.12) 0%, rgba(79, 137, 255, 0.12) 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9L12 15L18 9' stroke='%2342659a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

html[data-theme='light'] .contest-language-trigger:hover {
    border-color: rgba(92, 123, 196, 0.56);
    box-shadow: 0 8px 16px rgba(83, 112, 175, 0.16);
}

html[data-theme='light'] .contest-language-trigger:focus {
    border-color: rgba(86, 118, 198, 0.74);
    box-shadow: 0 0 0 4px rgba(88, 122, 199, 0.16);
}

html[data-theme='light'] .contest-language-trigger-arrow {
    border-right-color: #42659a;
    border-bottom-color: #42659a;
}

html[data-theme='light'] .contest-language-dropdown.is-open .contest-language-trigger {
    border-color: rgba(86, 118, 198, 0.74);
    box-shadow: 0 0 0 4px rgba(88, 122, 199, 0.16), 0 8px 16px rgba(83, 112, 175, 0.16);
}

html[data-theme='light'] .contest-language-menu {
    border-color: rgba(98, 126, 188, 0.35);
    background: rgba(250, 253, 255, 0.98);
    box-shadow: 0 16px 24px rgba(82, 111, 172, 0.2);
}

html[data-theme='light'] .contest-language-item {
    color: #2f4b7d;
}

html[data-theme='light'] .contest-language-item:hover:not(:disabled) {
    border-color: rgba(102, 133, 208, 0.46);
    background: rgba(103, 132, 205, 0.15);
}

html[data-theme='light'] .contest-language-item:focus-visible {
    border-color: rgba(102, 133, 208, 0.54);
    background: rgba(103, 132, 205, 0.2);
}

html[data-theme='light'] .contest-language-item.is-selected {
    color: #f8fbff;
    border-color: rgba(102, 133, 208, 0.56);
    box-shadow: 0 6px 14px rgba(88, 120, 194, 0.28);
}

html[data-theme='light'] .contest-io-block .hljs,
html[data-theme='light'] .contest-io-block code {
    color: #1f355f !important;
}

html[data-theme='light'] .contest-hidden-tests-note {
    color: #4b6699;
}

html[data-theme='light'] .auth-form {
    background: rgba(255, 255, 255, 0.78);
    border-color: rgba(97, 123, 182, 0.28);
}

html[data-theme='light'] .auth-error {
    color: #7f2032;
    background: rgba(255, 182, 197, 0.35);
    border-color: rgba(195, 91, 117, 0.4);
}

html[data-theme='light'] .test-save-hint {
    color: #4a5f88;
}

html[data-theme='light'] .profile-tabs {
    border-color: rgba(97, 123, 182, 0.28);
    background: rgba(255, 255, 255, 0.82);
}

html[data-theme='light'] .profile-tab {
    border-color: rgba(97, 123, 182, 0.26);
    color: #294476;
}

html[data-theme='light'] .profile-tab:hover {
    border-color: rgba(97, 123, 182, 0.45);
    box-shadow: 0 8px 18px rgba(77, 112, 179, 0.2);
    color: #234171;
}

html[data-theme='light'] .profile-item {
    border-color: rgba(97, 123, 182, 0.28);
    background: rgba(255, 255, 255, 0.78);
}

html[data-theme='light'] .profile-item:hover {
    border-color: rgba(97, 123, 182, 0.44);
    box-shadow: 0 12px 24px rgba(74, 103, 163, 0.2);
}

html[data-theme='light'] .profile-item-title {
    color: #1d315b;
}

html[data-theme='light'] .profile-item-meta--emphasis {
    color: #2e4b80;
}

html[data-theme='light'] .profile-item-meta,
html[data-theme='light'] .profile-date,
html[data-theme='light'] .profile-empty,
html[data-theme='light'] .profile-lead {
    color: #405783;
}

html[data-theme='light'] .profile-alert {
    border-color: rgba(97, 123, 182, 0.3);
    background: rgba(255, 255, 255, 0.84);
    color: #35517e;
}

html[data-theme='light'] .profile-data-btn {
    border-color: rgba(203, 86, 118, 0.52);
    background: rgba(221, 94, 128, 0.14);
    color: #8b2f4f;
}

html[data-theme='light'] .profile-data-btn:hover {
    background: rgba(221, 94, 128, 0.2);
    box-shadow: 0 8px 16px rgba(184, 75, 108, 0.2);
}

html[data-theme='light'] .profile-alert--success {
    border-color: rgba(43, 154, 109, 0.36);
    background: rgba(53, 190, 136, 0.14);
    color: #1f6f52;
}

html[data-theme='light'] .profile-alert--error {
    border-color: rgba(203, 86, 118, 0.36);
    background: rgba(221, 94, 128, 0.14);
    color: #8b2f4f;
}

html[data-theme='light'] .profile-stat-card {
    border-color: rgba(97, 123, 182, 0.28);
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.84), rgba(243, 249, 255, 0.88));
}

html[data-theme='light'] .profile-stat-label {
    color: #4b6593;
}

html[data-theme='light'] .profile-stat-value {
    color: #1f3560;
}

html[data-theme='light'] .profile-stat-slash {
    color: #5f78a8;
}

html[data-theme='light'] .profile-stat-meta {
    color: #4a628f;
}

html[data-theme='light'] .profile-head-note {
    color: #5c77a8;
}

html[data-theme='light'] .profile-modal {
    background: rgba(32, 49, 84, 0.28);
}

html[data-theme='light'] .profile-modal-card {
    border-color: rgba(203, 86, 118, 0.34);
}

html[data-theme='light'] .profile-modal-text {
    color: #3e5c8d;
}

html[data-theme='light'] .profile-modal-hint {
    color: #5170a2;
}

html[data-theme='light'] .profile-inline-error {
    color: #b23b60;
}

html[data-theme='light'] .profile-danger {
    border-color: rgba(203, 86, 118, 0.46);
    background: rgba(255, 238, 244, 0.8);
}

html[data-theme='light'] .profile-danger > summary {
    color: #8f3151;
}

html[data-theme='light'] .profile-danger p {
    color: #90415e;
}

html[data-theme='light'] .profile-danger-form label {
    color: #7b3550;
}

html[data-theme='light'] .help-link,
html[data-theme='light'] .back-link,
html[data-theme='light'] .summary-article a,
html[data-theme='light'] .message.assistant .message-content a {
    color: #3a5ea2;
}

html[data-theme='light'] .help-link:hover,
html[data-theme='light'] .back-link:hover,
html[data-theme='light'] .summary-article a:hover,
html[data-theme='light'] .message.assistant .message-content a:hover {
    color: #2d4f8f;
}

html[data-theme='light'] .action-button,
html[data-theme='light'] .help-back-btn {
    color: #f4f7ff;
}

html[data-theme='light'] .action-button:hover,
html[data-theme='light'] .help-back-btn:hover {
    color: #ffffff;
}

html[data-theme='light'] .help-block {
    border-color: rgba(97, 123, 182, 0.28);
    background: rgba(255, 255, 255, 0.78);
}

html[data-theme='light'] .help-lead,
html[data-theme='light'] .help-block p,
html[data-theme='light'] .help-block li {
    color: #405783;
}

html[data-theme='light'] .form-group label {
    color: #38517f;
}

html[data-theme='light'] #result {
    border-color: rgba(98, 124, 183, 0.3);
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.95), rgba(242, 247, 255, 0.9));
}

html[data-theme='light'] .summary-article {
    color: #30446f;
}

html[data-theme='light'] .summary-article h1,
html[data-theme='light'] .summary-article h2,
html[data-theme='light'] .summary-article h3,
html[data-theme='light'] .summary-article strong {
    color: #1a2c51;
}

html[data-theme='light'] .summary-article p {
    color: #405783;
}

html[data-theme='light'] .summary-article li {
    color: #2f456f;
}

html[data-theme='light'] .summary-article .katex-display {
    background: rgba(89, 120, 193, 0.12);
    border-color: rgba(97, 123, 182, 0.3);
}

html[data-theme='light'] .summary-article .katex {
    color: #1f335e;
}

html[data-theme='light'] .summary-article .summary-callout,
html[data-theme='light'] .summary-article blockquote {
    border-color: rgba(97, 123, 182, 0.3);
    background: linear-gradient(130deg, rgba(121, 145, 211, 0.18), rgba(113, 187, 235, 0.14));
}

html[data-theme='light'] .summary-article .summary-code-wrap,
html[data-theme='light'] .message.assistant .message-content .summary-code-wrap {
    border-color: rgba(97, 123, 182, 0.3);
    background: rgba(245, 249, 255, 0.9);
}

html[data-theme='light'] .summary-article .summary-code-head,
html[data-theme='light'] .message.assistant .message-content .summary-code-head {
    border-bottom-color: rgba(97, 123, 182, 0.26);
    background: linear-gradient(130deg, rgba(108, 123, 220, 0.24), rgba(93, 168, 230, 0.2));
}

html[data-theme='light'] .summary-article .summary-code-lang,
html[data-theme='light'] .message.assistant .message-content .summary-code-lang {
    color: #223969;
}

html[data-theme='light'] .summary-article :not(pre) > code,
html[data-theme='light'] .message.assistant .message-content :not(pre) > code {
    border-color: rgba(97, 123, 182, 0.3);
    background: rgba(88, 120, 197, 0.12);
    color: #203866;
}

html[data-theme='light'] .summary-article pre,
html[data-theme='light'] .message.assistant .message-content pre {
    background: rgba(247, 251, 255, 0.95) !important;
}

html[data-theme='light'] .summary-article pre code.hljs,
html[data-theme='light'] .message.assistant .message-content pre code.hljs {
    background: transparent !important;
}

html[data-theme='light'] .summary-article .summary-copy-btn,
html[data-theme='light'] .message.assistant .message-content .summary-copy-btn {
    border-color: rgba(97, 123, 182, 0.34);
    background: rgba(255, 255, 255, 0.78);
    color: #29457a;
}

html[data-theme='light'] .loading-hint-strip {
    border-color: rgba(97, 123, 182, 0.3);
    background: rgba(255, 255, 255, 0.84);
}

html[data-theme='light'] .loading-hint {
    color: #425882;
}

html[data-theme='light'] .question-block,
html[data-theme='light'] .question,
html[data-theme='light'] .option-item {
    border-color: rgba(97, 123, 182, 0.26);
    background: rgba(255, 255, 255, 0.72);
}

html[data-theme='light'] .question-text,
html[data-theme='light'] .option-item label {
    color: #1f335e;
}

html[data-theme='light'] .option-item:hover:not(.correct-answer):not(.incorrect-answer) {
    background: rgba(90, 121, 194, 0.15);
}

html[data-theme='light'] .option-item.option-selected:not(.correct-answer):not(.incorrect-answer) {
    border-color: rgba(90, 121, 194, 0.5);
    background: rgba(90, 121, 194, 0.22);
}

html[data-theme='light'] .neutral-feedback {
    color: #26406f;
    background: rgba(179, 202, 243, 0.45);
}

html[data-theme='light'] .correct-answer-text {
    color: #1d6d4b;
}

html[data-theme='light'] .context-pill {
    border-color: rgba(97, 123, 182, 0.28);
    background: rgba(255, 255, 255, 0.78);
    color: #3c537f;
}

html[data-theme='light'] .offer-item {
    border-color: rgba(97, 123, 182, 0.24);
    background: rgba(255, 255, 255, 0.76);
    color: #3d547f;
}

html[data-theme='light'] .offer-item strong {
    color: #1d315b;
}

html[data-theme='light'] .spinner,
html[data-theme='light'] .loader {
    border-color: rgba(97, 123, 182, 0.26);
    background:
        radial-gradient(closest-side, rgba(244, 248, 255, 0.96) 70%, transparent 72% 100%),
        conic-gradient(from 180deg, rgba(111, 88, 255, 0), rgba(111, 88, 255, 0.74), rgba(79, 137, 255, 0.84), rgba(111, 88, 255, 0));
    box-shadow: 0 0 18px rgba(92, 126, 194, 0.24);
}

html[data-theme='light'] .chat-container {
    border-color: rgba(97, 123, 182, 0.28);
    background: rgba(255, 255, 255, 0.75);
}

html[data-theme='light'] .chat-messages {
    background: linear-gradient(180deg, rgba(249, 252, 255, 0.94), rgba(239, 246, 255, 0.94));
}

html[data-theme='light'] .message.assistant .message-content {
    color: #233a66;
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(97, 123, 182, 0.24);
}

html[data-theme='light'] .message.assistant .message-content p,
html[data-theme='light'] .message.assistant .message-content li {
    color: #314a77;
}

html[data-theme='light'] .message.assistant .message-content h1,
html[data-theme='light'] .message.assistant .message-content h2,
html[data-theme='light'] .message.assistant .message-content h3 {
    color: #1d315a;
}

html[data-theme='light'] .message.assistant .message-content :not(pre) > code {
    background: rgba(90, 121, 194, 0.1);
    border-color: rgba(97, 123, 182, 0.24);
}

html[data-theme='light'] .typing-indicator {
    border-color: rgba(97, 123, 182, 0.24);
    background: rgba(255, 255, 255, 0.86);
}

html[data-theme='light'] .typing-dots span {
    background: #45659f;
}

html[data-theme='light'] .chat-input-container {
    border-top-color: rgba(97, 123, 182, 0.24);
    background: rgba(250, 252, 255, 0.88);
}

html[data-theme='light'] .message-time,
html[data-theme='light'] .hero-note,
html[data-theme='light'] .site-footer p {
    color: #4d618a;
}

html[data-theme='light'] .site-footer {
    border-color: rgba(97, 123, 182, 0.28);
    background: rgba(255, 255, 255, 0.82);
}

html[data-theme='light'] *::-webkit-scrollbar-track {
    background: rgba(214, 224, 244, 0.84);
}

html[data-theme='light'] *::-webkit-scrollbar-thumb {
    border-color: rgba(214, 224, 244, 0.84);
    background: linear-gradient(180deg, rgba(107, 112, 242, 0.86), rgba(80, 144, 228, 0.86));
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: rgba(12, 18, 34, 0.78);
}

*::-webkit-scrollbar-thumb {
    border-radius: 999px;
    border: 2px solid rgba(12, 18, 34, 0.78);
    background: linear-gradient(180deg, rgba(124, 96, 255, 0.92), rgba(81, 139, 255, 0.86));
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes message-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes typing-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 rgba(112, 142, 255, 0);
    }
    50% {
        box-shadow: 0 0 16px rgba(112, 142, 255, 0.2);
    }
}

@keyframes hint-fade {
    from {
        opacity: 0.35;
        transform: translateY(2px);
    }
    to {
        opacity: 0.92;
        transform: translateY(0);
    }
}

@keyframes generator-panel-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes profile-panel-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes avatar-ring-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1080px) {
    .landing-hero {
        grid-template-columns: 1fr;
    }

    .hero-title,
    .page-title,
    h1 {
        font-size: clamp(2rem, 8vw, 3.3rem);
    }

    .hero-right {
        align-items: stretch;
    }

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

@media (max-width: 900px) {
    .site-header,
    .page-shell,
    .site-footer {
        width: calc(100% - 18px);
    }

    .header-inner {
        flex-wrap: wrap;
    }

    .site-nav-inline {
        order: 3;
        width: 100%;
        justify-content: flex-start;
    }

    .header-actions {
        width: auto;
    }

    .chat-container {
        height: min(78vh, 740px);
    }

    .message {
        width: 100%;
    }

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

    .contest-form-grid,
    .contest-spec-grid,
    .contest-examples {
        grid-template-columns: 1fr;
    }

    .contest-example-io {
        grid-template-columns: 1fr;
    }

    .contest-session-controls {
        width: 100%;
        justify-content: space-between;
    }

    .generator-menu-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .test-session-bar {
        justify-content: stretch;
    }

    .test-finish-btn {
        width: 100%;
        min-width: 100%;
    }

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

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

@media (max-width: 640px) {
    .page-card,
    .hero-panel,
    .container {
        border-radius: 18px;
        padding: 16px;
    }

    #params-form,
    #test-form,
    #contest-form,
    .auth-form {
        padding: 16px;
    }

    .profile-tabs {
        width: 100%;
        gap: 8px;
        padding: 6px;
    }

    .profile-tab {
        min-height: 40px;
        font-size: 0.94rem;
    }

    .profile-stats {
        grid-template-columns: 1fr;
    }

    .action-row {
        width: 100%;
        flex-direction: column;
    }

    .primary-btn,
    .secondary-btn,
    .result-actions .back-button,
    .back-button--replay {
        width: 100%;
        min-width: 100%;
    }

    .chat-input-container {
        flex-direction: column;
    }

    .assistant-profile-actions {
        grid-template-columns: 1fr;
    }

    .contest-topics-grid {
        grid-template-columns: 1fr;
    }

    .contest-finish-grid {
        grid-template-columns: 1fr;
    }

    .test-finish-modal-card .profile-modal-actions {
        grid-template-columns: 1fr;
    }

    .header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .send-button,
    .nav-cta,
    .theme-toggle {
        width: 100%;
    }

    .header-auth-form {
        width: 100%;
    }
}

@media (max-width: 760px) {
    html {
        -webkit-text-size-adjust: 100%;
    }

    body {
        min-width: 320px;
    }

    .app-bg-orb {
        opacity: 0.42;
        filter: blur(82px);
    }

    .site-header,
    .page-shell,
    .site-footer {
        width: calc(100% - 20px);
    }

    .site-header {
        top: max(8px, env(safe-area-inset-top));
        margin-top: 8px;
    }

    .header-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        padding: 10px;
        border-radius: 16px;
    }

    .logo-group {
        min-width: 0;
        align-items: center;
    }

    .logo {
        max-width: 100%;
        font-size: clamp(1.45rem, 7vw, 1.85rem);
    }

    .logo-text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .logo-group .logo-mark {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        transform: none;
    }

    .logo-group .logo-mark:hover {
        transform: scale(1.04);
    }

    .header-actions {
        grid-column: 1 / -1;
        width: 100%;
        margin-left: 0;
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
        align-items: stretch;
    }

    .header-actions:has(.user-chip) {
        grid-template-columns: 44px minmax(0, 1fr) auto;
    }

    .theme-toggle {
        width: 44px;
        min-width: 44px;
        min-height: 42px;
        border-radius: 12px;
    }

    .nav-cta,
    .user-chip,
    .header-auth-form .nav-cta {
        width: 100%;
        min-width: 0;
        min-height: 42px;
        padding: 8px 10px;
        border-radius: 12px;
        font-size: 0.92rem;
        white-space: nowrap;
    }

    .header-auth-form {
        width: auto;
        min-width: 0;
    }

    .user-chip {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .site-nav-inline {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
        order: initial;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .site-nav-inline::-webkit-scrollbar {
        display: none;
    }

    .nav-list {
        width: max-content;
        max-width: none;
        flex-wrap: nowrap;
        gap: 6px;
        padding-inline: 1px;
    }

    .nav-list a {
        min-height: 34px;
        padding: 6px 11px;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .page-shell {
        margin-top: 12px;
        margin-bottom: 12px;
    }

    .page-card,
    .hero-panel,
    .container {
        border-radius: 16px;
        padding: 16px;
        box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
    }

    .hero-kicker,
    .fast-badge {
        margin-bottom: 10px;
        padding: 6px 10px;
        font-size: 0.82rem;
        line-height: 1.25;
    }

    .hero-title,
    .page-title,
    h1 {
        margin-bottom: 8px;
        font-size: clamp(1.9rem, 10vw, 2.55rem);
        line-height: 1.08;
    }

    .page-title-sm {
        font-size: clamp(1.1rem, 5.5vw, 1.32rem);
        line-height: 1.18;
    }

    .hero-subtitle,
    p {
        font-size: 0.96rem;
        line-height: 1.5;
    }

    .action-grid {
        margin-top: 16px;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .action-button {
        min-height: 50px;
        padding: 10px 12px;
        border-radius: 12px;
        font-size: 1rem;
        text-align: center;
    }

    #params-form,
    #test-form,
    #contest-form,
    .auth-form {
        margin-top: 16px;
        padding: 14px;
        gap: 12px;
        border-radius: 14px;
    }

    input[type='text'],
    input[type='number'],
    input[type='password'],
    select,
    textarea,
    .chat-input {
        min-height: 46px;
        padding: 11px 12px;
        border-radius: 11px;
        font-size: 16px;
    }

    button,
    .submit-btn,
    .back-button,
    .check-btn,
    .send-button,
    #params-form button,
    #test-form button,
    #contest-form button {
        min-height: 46px;
        padding: 10px 13px;
        border-radius: 11px;
        font-size: 0.96rem;
    }

    .generator-mode-switch {
        margin-top: 14px;
        gap: 6px;
        padding: 6px;
        border-radius: 14px;
    }

    .generator-mode-switch::before {
        top: 6px;
        bottom: 6px;
        left: 6px;
        width: calc(50% - 7px);
        border-radius: 10px;
    }

    .generator-mode-switch[data-mode='contest']::before {
        transform: translateX(calc(100% + 2px));
    }

    .generator-mode-btn {
        min-height: 40px;
        border-radius: 10px;
        font-size: 0.94rem;
    }

    .form-group {
        gap: 6px;
    }

    .range-control,
    .contest-checkbox,
    .contest-session-bar,
    .contest-finish-summary,
    .contest-meta,
    .contest-task-card,
    .contest-runner,
    .contest-example-card,
    .contest-test-item,
    .contest-run-test,
    .help-block,
    .profile-item {
        border-radius: 12px;
        padding: 12px;
    }

    .contest-runner-controls,
    .contest-language-control {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .contest-language-dropdown,
    .contest-language-trigger {
        width: 100%;
        min-width: 0;
    }

    .contest-task-header,
    .contest-finish-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .contest-task-nav-list {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .contest-task-nav-list::-webkit-scrollbar {
        display: none;
    }

    .contest-task-nav-btn {
        flex: 0 0 auto;
    }

    #result {
        margin-top: 16px;
        padding: 14px;
        overflow-x: hidden;
    }

    .summary-article {
        font-size: 0.98rem;
        line-height: 1.62;
    }

    .summary-article h1 {
        font-size: clamp(1.55rem, 8vw, 2.15rem);
    }

    .summary-article h2 {
        font-size: clamp(1.28rem, 6.5vw, 1.58rem);
    }

    .summary-article h3 {
        font-size: clamp(1.08rem, 5.5vw, 1.28rem);
    }

    .summary-article ul,
    .summary-article ol {
        padding-left: 18px;
    }

    .summary-article .summary-callout,
    .summary-article blockquote {
        padding: 8px 10px;
    }

    .summary-article pre,
    .message.assistant .message-content pre {
        padding: 10px 12px;
    }

    .summary-article pre code,
    .message.assistant .message-content pre code {
        font-size: 0.88rem;
    }

    .loading-hint-strip {
        min-height: auto;
        margin-top: 12px;
        border-radius: 14px;
        padding: 8px 10px;
    }

    .spinner,
    .loader {
        width: 58px;
        height: 58px;
        margin: 14px auto;
    }

    .chat-page {
        padding: 8px;
    }

    .chat-container {
        height: min(68dvh, 620px);
        min-height: 430px;
        border-radius: 15px;
    }

    .chat-messages {
        padding: 10px;
    }

    .message {
        width: 100%;
        gap: 8px;
        margin-bottom: 10px;
    }

    .avatar {
        width: 30px;
        height: 30px;
        min-width: 30px;
        min-height: 30px;
        font-size: 0.68rem;
    }

    .message-content {
        padding: 10px 11px;
        border-radius: 13px;
    }

    .message.assistant .message-content p {
        font-size: 0.95rem;
    }

    .chat-input-container {
        flex-direction: row;
        gap: 8px;
        padding: 8px;
    }

    .chat-input {
        min-width: 0;
        border-radius: 999px;
    }

    .send-button {
        width: auto;
        min-width: 96px;
        border-radius: 999px;
        flex-shrink: 0;
    }

    .profile-tabs {
        display: flex;
        width: 100%;
        overflow-x: auto;
        border-radius: 14px;
        padding: 6px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .profile-tabs::-webkit-scrollbar {
        display: none;
    }

    .profile-tabs::before {
        content: none;
    }

    .profile-tab {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 8px 12px;
        border-radius: 10px;
        font-size: 0.9rem;
    }

    .profile-tab.is-active {
        background: linear-gradient(135deg, #6f58ff 0%, #835eff 52%, #4f89ff 100%);
    }

    .profile-item-actions,
    .test-actions,
    .result-actions,
    .profile-modal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .result-actions .back-button,
    .result-actions .secondary-btn,
    .test-actions .submit-btn,
    .profile-modal-actions .secondary-btn,
    .profile-modal-actions .danger-btn {
        width: 100%;
        min-width: 0;
    }

    .site-footer {
        margin-bottom: max(10px, env(safe-area-inset-bottom));
        padding: 11px 12px;
        border-radius: 14px;
    }

    .site-footer p {
        font-size: 0.78rem;
        line-height: 1.35;
    }
}

@media (max-width: 420px) {
    .site-header,
    .page-shell,
    .site-footer {
        width: calc(100% - 14px);
    }

    .header-inner {
        gap: 8px;
        padding: 8px;
    }

    .header-actions {
        grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr);
        gap: 6px;
    }

    .header-actions:has(.user-chip) {
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .header-actions:has(.user-chip) .header-auth-form {
        grid-column: 1 / -1;
    }

    .theme-toggle {
        width: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .nav-cta,
    .user-chip,
    .header-auth-form .nav-cta {
        min-height: 40px;
        padding-inline: 8px;
        font-size: 0.86rem;
    }

    .nav-list {
        width: 100%;
        gap: 4px;
        justify-content: space-between;
    }

    .nav-list a {
        min-height: 32px;
        padding: 5px 7px;
        font-size: 0.78rem;
    }

    .page-card,
    .hero-panel,
    .container {
        padding: 14px;
    }

    .hero-title,
    .page-title,
    h1 {
        font-size: clamp(1.72rem, 10vw, 2.2rem);
    }

    .hero-subtitle,
    p {
        font-size: 0.92rem;
    }

    .action-button {
        min-height: 48px;
        font-size: 0.96rem;
    }

    .send-button {
        min-width: 88px;
        padding-inline: 10px;
        font-size: 0.9rem;
    }
}

@media (max-width: 350px) {
    .logo {
        font-size: 1.32rem;
    }

    .header-actions {
        grid-template-columns: 38px 1fr;
    }

    .header-actions > .nav-cta-secondary,
    .header-actions > .header-auth-form {
        grid-column: 1 / -1;
    }

    .theme-toggle {
        width: 38px;
        min-width: 38px;
    }

    .nav-list {
        width: max-content;
        gap: 5px;
    }

    .nav-list a {
        padding-inline: 8px;
        font-size: 0.8rem;
    }

    .chat-input-container {
        flex-direction: column;
    }

    .send-button {
        width: 100%;
    }
}
