/* static/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@700&family=Rubik:wght@400;500&display=swap');
:root {
    --deep-blue: #0A192F;
    --light-blue: #172A45;
    --accent-purple: #8A4FFF;
    --accent-aqua: #64FFDA;
    --light-slate: #CCD6F6;
    --slate: #8892B0;
    --font-sans: 'Rubik', sans-serif;
    --font-mono: 'Fira Code', 'Consolas', monospace;
    --font-fancy: 'Comfortaa', cursive;
    --accent-coral: #FF8A80;
}
body {
    font-family: var(--font-sans);
    background: transparent;
    color: var(--light-slate);
    line-height: 1.6;
    padding-bottom: 100px !important;
}
.ocean {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background-color: var(--deep-blue);
}
.bubble {
    position: absolute;
    bottom: -100px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    opacity: 0.5;
    animation: rise 10s infinite ease-in;
}
@keyframes rise {
    0% { bottom: -100px; transform: translateX(0); }
    50% { transform: translateX(100px); }
    100% { bottom: 1080px; transform: translateX(-200px); }
}
.bubble:nth-child(1) { left: 10%; animation-duration: 56s; }
.bubble:nth-child(2) { left: 20%; animation-duration: 50s; animation-delay: 2s; }
.bubble:nth-child(3) { left: 25%; animation-duration: 50s; animation-delay: 3s; }
.bubble:nth-child(4) { left: 40%; animation-duration: 50s; animation-delay: 4s; width: 20px; height: 20px; }
.bubble:nth-child(5) { left: 70%; animation-duration: 50s; animation-delay: 0s; }
.bubble:nth-child(6) { left: 80%; animation-duration: 50s; animation-delay: 2s; width: 30px; height: 30px; }
.bubble:nth-child(7) { left: 90%; animation-duration: 50s; animation-delay: 3s; }
.slow-down .bubble:nth-child(1) { animation-duration: 190s; }
.slow-down .bubble:nth-child(2) { animation-duration: 250s; }
.slow-down .bubble:nth-child(3) { animation-duration: 195s; }
.slow-down .bubble:nth-child(4) { animation-duration: 244s; }
.slow-down .bubble:nth-child(5) { animation-duration: 222s; }
.slow-down .bubble:nth-child(6) { animation-duration: 250s; }
.slow-down .bubble:nth-child(7) { animation-duration: 230s; }
.seaweed {
    position: absolute;
    bottom: 0;
    transform-origin: bottom center;
}
.seaweed svg { width: 100%; height: 100%; }
.seaweed svg path { fill: none; stroke-linecap: round; stroke: var(--accent-aqua); opacity: 0.15; stroke-width: 5px; }
@keyframes sway { 0% { transform: rotateZ(-5deg) skewX(8deg); } 100% { transform: rotateZ(5deg) skewX(-8deg); } }
.seaweed:nth-of-type(1) { left: 15%; width: 55px; height: 150px; animation: sway 45s ease-in-out infinite alternate; animation-delay: -7s; }
.seaweed:nth-of-type(2) { left: 45%; width: 45px; height: 120px; animation: sway 60s ease-in-out infinite alternate; animation-delay: -4s; }
.seaweed:nth-of-type(3) { right: 10%; width: 65px; height: 180px; animation: sway 50s ease-in-out infinite alternate; }
.slow-down .seaweed { animation-duration: 200s; }
.slow-down .seaweed:nth-of-type(1) { animation-duration: 210s; }
.slow-down .seaweed:nth-of-type(2) { animation-duration: 230s; }

/* === НАЧАЛО ИЗМЕНЕНИЙ === */
/* Замедление для особых рыб */
.slow-down .swordfish.swim { animation-duration: 200s; }
.slow-down .jaws-shark.swim { animation-duration: 200s; }
.slow-down .fish-school.swim { animation-duration: 250s; }
/* Замедление для рандомных рыб с сохранением их относительной скорости */
.slow-down .generic-fish.swim {
    animation-duration: calc(var(--swim-duration) * 19);
}
/* === КОНЕЦ ИЗМЕНЕНИЙ === */

.fish {
    position: absolute;
    left: -350px;
    display: none;
    z-index: 5;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.4));
}
.fish svg {
    transform: scaleX(-1);
    transform-origin: center;
}
.fish.swim {
    display: block;
    animation: swim-across linear;
    animation-duration: var(--swim-duration, 10s);
}
@keyframes swim-across {
    from { transform: translateX(0); }
    to { transform: translateX(calc(100vw + 450px)); }
}
.swordfish { top: 30%; }
.swordfish.swim { animation-duration: 7s; }
.swordfish svg { width: 250px; fill: #233554; }
.jaws-shark { top: 70%; }
.jaws-shark.swim { animation-duration: 9s; }
.jaws-shark svg { width: 350px; fill: #0d1a2f; }
.fish-school { top: 80%; }
.fish-school.swim { animation-duration: 15s; }
.fish-school svg { width: 200px; fill: #233554; opacity: 0.8; }
.navbar { background-color: rgba(10, 25, 47, 0.85) !important; backdrop-filter: blur(10px); box-shadow: 0 10px 30px -10px rgba(2,12,27,0.7); }
.navbar-brand { display: inline-flex; align-items: center; padding-top: 0.25rem; padding-bottom: 0.25rem; }
.site-logo { display: block; width: auto; height: 38px; max-width: min(48vw, 210px); object-fit: contain; }
@media (max-width: 575.98px) {
    .site-logo { height: 31px; max-width: 170px; }
}
.nav-link { color: var(--light-slate) !important; transition: color 0.3s ease; font-weight: 500; }
.nav-link:hover, .nav-link.active { color: var(--accent-aqua) !important; }
.nav-link i { margin-right: 8px; }
h1, h2, h3, h4, h5 { font-family: var(--font-sans); font-weight: 500; color: var(--light-slate); }
.card { background-color: var(--light-blue); border: 1px solid #0d2a4e; box-shadow: 0 10px 30px -15px rgba(2,12,27,0.7); border-radius: 8px; transition: all 0.3s ease; overflow: hidden; position: relative; }
.card::before{ content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(circle at 50% 0, rgba(100, 255, 218, 0.1), transparent 80%); opacity: 0; transition: opacity 0.5s ease; }
.card:hover::before { opacity: 1; }
.card:hover { transform: translateY(-5px); box-shadow: 0 20px 30px -15px rgba(2,12,27,0.7); border-color: var(--accent-aqua); }
.card-header, .card-body { position: relative; z-index: 1; }
.card-header { background-color: rgba(23, 42, 69, 0.7); border-bottom: 1px solid #0d2a4e; color: var(--light-slate); }
.card-body { color: var(--light-slate); }
.card-body a { color: var(--accent-aqua); text-decoration: none; transition: color 0.3s ease; }
.card-body a:hover { color: #fff; text-decoration: underline; }
.btn-primary { background-color: transparent; border: 2px solid var(--accent-aqua); color: var(--accent-aqua); border-radius: 4px; padding: 0.75rem 1.5rem; font-weight: 500; transition: all 0.3s ease; }
.btn-primary:hover { background-color: rgba(100, 255, 218, 0.1); color: #fff; transform: translateY(-3px); box-shadow: 0 4px 10px rgba(100, 255, 218, 0.2); }
.footer { background-color: var(--light-blue); border-top: 1px solid #0d2a4e; padding-top: 1rem; padding-bottom: 1rem;  position: fixed;
    bottom: 0; z-index: 100; width: 100%; left: 0; right: 0;}
.footer, .footer .text-muted { color: var(--slate) !important; }
.teacher-contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--accent-aqua);
    padding: 6px 12px;
    border: 1px solid rgba(100, 255, 218, 0.45);
    border-radius: 999px;
    background: rgba(100, 255, 218, 0.08);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.teacher-contact-link:hover {
    color: #fff;
    border-color: var(--accent-aqua);
    background: rgba(100, 255, 218, 0.16);
    text-decoration: none;
}
code { background-color: var(--deep-blue); color: var(--accent-coral); padding: 0.2em 0.4em; margin: 0; font-size: 85%; border-radius: 3px; font-family: var(--font-mono); }
pre > code { background: none; color: inherit; padding: 0; font-size: inherit; }
.list-group-item { background-color: var(--light-blue); border-color: #0d2a4e; color: var(--light-slate); transition: background-color 0.3s ease; }
.list-group-item p { color: var(--slate); }
.list-group-item:hover { background-color: #1d3b5e; }
.list-group-item:hover p { color: var(--light-slate); }
.auth-page .card { position: relative; z-index: 10; }

/* Переключатель темы в верхнем меню */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border: 0;
    white-space: nowrap;
}

.notification-count {
    min-width: 18px;
    height: 18px;
    margin-left: 3px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #ff5d68;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
}

.task-notification-menu {
    width: min(390px, calc(100vw - 20px));
    max-height: 430px;
    overflow-y: auto;
    padding: 7px;
    border: 1px solid #344968;
    background: #101f35;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.35);
}

.task-notification-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px;
    border-radius: 8px;
    color: var(--light-slate);
    text-decoration: none;
}

.task-notification-item:hover {
    background: #1b3555;
    color: #fff;
}

.task-notification-item > span:last-child {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.task-notification-item strong {
    color: var(--accent-aqua);
    font-size: 13px;
}

.task-notification-item span span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-notification-item small {
    margin-top: 4px;
    color: var(--slate);
}

.task-notification-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 50%;
    background: rgba(100, 255, 218, 0.13);
    color: var(--accent-aqua);
}

.live-task-notification {
    position: fixed;
    right: 22px;
    top: 82px;
    z-index: 1100;
    width: min(390px, calc(100vw - 28px));
    padding: 16px 44px 16px 16px;
    border: 1px solid rgba(100, 255, 218, 0.65);
    border-radius: 13px;
    background: #102942;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.42);
    color: #e6efff;
    animation: live-task-notification-in 0.24s ease-out;
}

.live-task-notification strong,
.live-task-notification span {
    display: block;
}

.live-task-notification strong {
    color: var(--accent-aqua);
    font-size: 15px;
}

.live-task-notification span {
    margin-top: 4px;
}

.live-task-notification a {
    display: inline-flex;
    margin-top: 11px;
    padding: 7px 12px;
    border-radius: 8px;
    background: var(--accent-aqua);
    color: #071b2e;
    font-weight: 800;
    text-decoration: none;
}

.live-task-notification-close {
    position: absolute;
    right: 9px;
    top: 8px;
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    color: #a9b8ce;
    font-size: 20px;
}

@keyframes live-task-notification-in {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

html[data-theme="light"] .live-task-notification {
    border-color: #18a99b;
    background: #ffffff;
    color: #17233a;
}

@media (max-width: 600px) {
    .live-task-notification {
        right: 14px;
        top: 72px;
    }
}

/* Светлая тема сайта */
html[data-theme="light"] {
    --deep-blue: #e9f8f7;
    --light-blue: #ffffff;
    --accent-purple: #0ba89b;
    --accent-aqua: #0ba89b;
    --light-slate: #202a33;
    --slate: #60717c;
    --accent-coral: #d83b45;
    background: #e9f8f7;
}

html[data-theme="light"] .ocean {
    background:
        linear-gradient(rgba(233, 248, 247, 0.88), rgba(233, 248, 247, 0.88)),
        radial-gradient(circle at 18% 16%, #ffffff 0, transparent 34%),
        #e9f8f7;
}

html[data-theme="light"] .bubble {
    background: rgba(11, 168, 155, 0.13);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

html[data-theme="light"] .seaweed svg path {
    stroke: #0ba89b;
    opacity: 0.13;
}

html[data-theme="light"] .fish {
    opacity: 0.28;
    filter: drop-shadow(0 4px 12px rgba(37, 63, 82, 0.13));
}

html[data-theme="light"] body.problem-detail-page {
    background-color: transparent !important;
}

html[data-theme="light"] .navbar {
    background-color: rgba(255, 255, 255, 0.97) !important;
    border-bottom: 1px solid #c7d5dc;
    box-shadow: 0 5px 16px rgba(37, 63, 82, 0.1);
}


html[data-theme="light"] .navbar-toggler {
    border-color: #82939d;
}

html[data-theme="light"] .navbar-toggler-icon {
    filter: invert(1) grayscale(1);
}

html[data-theme="light"] .nav-link,
html[data-theme="light"] .navbar .btn-link {
    color: #263943 !important;
}

html[data-theme="light"] .nav-link:hover,
html[data-theme="light"] .nav-link.active,
html[data-theme="light"] .navbar .btn-link:hover {
    color: #087f76 !important;
}

html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] h4,
html[data-theme="light"] h5 {
    color: #202a33;
}

html[data-theme="light"] .card,
html[data-theme="light"] .list-group-item {
    background-color: #ffffff;
    border-color: #cad7dc;
    color: #202a33;
    box-shadow: 0 4px 12px rgba(37, 63, 82, 0.07);
}

html[data-theme="light"] .card::before {
    display: none;
}

html[data-theme="light"] .card:hover {
    transform: none;
    border-color: #0ba89b;
    box-shadow: 0 6px 18px rgba(37, 63, 82, 0.1);
}

html[data-theme="light"] .card-header {
    background-color: #f8fbfb;
    border-color: #cad7dc;
    color: #202a33;
}

html[data-theme="light"] .card-body {
    color: #202a33;
}

html[data-theme="light"] .card-body a {
    color: #087e75;
}

html[data-theme="light"] .card-body a:hover {
    color: #065e58;
}

html[data-theme="light"] .list-group-item:hover {
    background-color: #f3f9f8;
}

html[data-theme="light"] .list-group-item p,
html[data-theme="light"] .text-muted {
    color: #60717c !important;
}

html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select {
    background-color: #ffffff;
    border-color: #bdccd2;
    color: #202a33;
}

html[data-theme="light"] .form-control:focus,
html[data-theme="light"] .form-select:focus {
    border-color: #0ba89b;
    box-shadow: 0 0 0 0.2rem rgba(11, 168, 155, 0.15);
}

html[data-theme="light"] .btn-primary {
    background: #11b7a8;
    border-color: #11b7a8;
    color: #082b28;
    box-shadow: none;
}

html[data-theme="light"] .btn-primary:hover {
    background: #0da194;
    border-color: #0da194;
    color: #ffffff;
    transform: none;
}

html[data-theme="light"] .btn-outline-primary,
html[data-theme="light"] .btn-outline-light {
    border-color: #0ba89b !important;
    color: #087e75 !important;
    background: #ffffff;
}

html[data-theme="light"] .btn-outline-primary:hover,
html[data-theme="light"] .btn-outline-light:hover {
    background: #e5f7f5;
    color: #065e58 !important;
}

html[data-theme="light"] code {
    background-color: #edf5f5;
}

html[data-theme="light"] .footer {
    background-color: #ffffff;
    border-color: #cad7dc;
    box-shadow: 0 -4px 14px rgba(37, 63, 82, 0.06);
}

html[data-theme="light"] .footer,
html[data-theme="light"] .footer .text-muted {
    color: #60717c !important;
}

html[data-theme="light"] .teacher-contact-link {
    color: #087e75;
    border-color: rgba(8, 126, 117, 0.45);
    background: rgba(20, 184, 166, 0.08);
}

html[data-theme="light"] .teacher-contact-link:hover {
    color: #055f58;
    border-color: #087e75;
    background: rgba(20, 184, 166, 0.16);
}

html[data-theme="light"] .task-notification-menu {
    border-color: #cad7dc;
    background: #ffffff;
    box-shadow: 0 18px 38px rgba(37, 63, 82, 0.18);
}

html[data-theme="light"] .task-notification-item {
    color: #202a33;
}

html[data-theme="light"] .task-notification-item:hover {
    background: #edf8f7;
    color: #202a33;
}
