/* ===== Токены тем (значения из ТЗ, раздел 5) ===== */
:root {
    --color-bg: #FFFBF4;
    --color-surface: #FFFFFF;
    --color-panel: #F6F1E7;
    --color-text: #35322E;
    --color-text-muted: #6E6862;
    --color-border: #E6DED1;
    --color-border-strong: #CFC4B2;
    --color-accent: #F2A79F;
    --color-accent-hover: #E89189;
    --color-accent-soft: #FDEDEA;
    --color-secondary: #A9C9E4;
    --color-secondary-soft: #EBF3FA;
    --color-error: #C25B52;
    --color-on-accent: #35322E;

    --state-none: #F6F1E7;
    --state-prevo: #F6E3C4;
    --state-caught: #D8E8D3;
    --state-prevo-solid: #C9954A;
    --state-caught-solid: #5E9158;

    --shadow-card: 0 1px 2px rgba(53, 50, 46, 0.04);
    --radius: 10px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --color-bg: #24272E;
    --color-surface: #30343C;
    --color-panel: #1E2127;
    --color-text: #EDEAE3;
    --color-text-muted: #A6A9B0;
    --color-border: #3C414A;
    --color-border-strong: #50565F;
    --color-accent: #E39199;
    --color-accent-hover: #EBA3AA;
    --color-accent-soft: #3F3236;
    --color-secondary: #93B6DE;
    --color-secondary-soft: #2C3744;
    --color-error: #E58880;
    --color-on-accent: #24272E;

    --state-none: #2A2E35;
    --state-prevo: #453A28;
    --state-caught: #2C3D2E;
    --state-prevo-solid: #C9954A;
    --state-caught-solid: #6FA56A;

    --shadow-card: none;
    color-scheme: dark;
}

/* ===== Шрифты ===== */
@font-face {
    font-family: "Nunito";
    src: url("../fonts/Nunito-ExtraBold.ttf");
    font-weight: 900;
    font-display: swap;
}
@font-face {
    font-family: "Nunito";
    src: url("../fonts/Nunito-Bold.ttf");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "Nunito";
    src: url("../fonts/Nunito-Regular.ttf");
    font-weight: 400;
    font-display: swap;
}

/* ===== Основа ===== */
body {
    font-family: "Nunito", sans-serif;
    color: var(--color-text);
    background-color: var(--color-bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
body > main { flex: 1; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
ul { list-style: none; }
[hidden] { display: none !important; }

.container {
    width: 100%;
    max-width: 1220px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Шапка ===== */
.site-header {
    background-color: var(--color-surface);
    border-bottom: 2px solid var(--color-border);
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 20;
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    min-height: 64px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 24px;
    font-weight: 700;
    padding: 8px 0;
}
.logo img { width: 48px; height: 48px; }
.header-nav { display: flex; align-items: center; gap: 8px; }
.header-links { display: flex; align-items: center; gap: 4px; }
.header-links a {
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--color-text-muted);
    transition: color 0.2s, background-color 0.2s;
}
.header-links a:hover { color: var(--color-text); background-color: var(--color-panel); }
.header-links a[aria-current="page"] { color: var(--color-text); background-color: var(--color-panel); }
.header-buttons { display: flex; gap: 10px; align-items: center; }
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--color-secondary-soft);
    border: 1px solid var(--color-secondary);
    display: grid;
    place-items: center;
    font-weight: 900;
    text-transform: uppercase;
    margin-left: 8px;
}

/* ===== Кнопки ===== */
.btn, .login-button, .register-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 6px;
    border: 2px solid var(--color-border-strong);
    background-color: var(--color-surface);
    color: var(--color-text);
    transition: transform 0.15s, box-shadow 0.2s, background-color 0.2s;
    text-align: center;
}
.register-button, .btn-primary {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-on-accent);
}
.register-button:hover, .btn-primary:hover {
    background-color: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    box-shadow: 0 6px 14px rgba(227, 120, 110, 0.25);
}
.login-button:hover, .btn:hover { box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12); }
.btn:active, .login-button:active, .register-button:active { transform: scale(0.97); }
.btn-danger { color: var(--color-error); border-color: var(--color-error); }
.btn[disabled], .btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-sm { padding: 3px 12px; font-size: 14px; }
:focus-visible { outline: 2px solid var(--color-secondary); outline-offset: 2px; }

/* ===== Формы ===== */
.form-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.form-field label, .field-label { font-size: 16px; font-weight: 700; }
.form-field input, .form-field select {
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    background-color: var(--color-bg);
    border-radius: 10px;
    width: 100%;
}
.form-field input:focus, .form-field select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(242, 167, 159, 0.3);
}
.form-field .hint {
    color: var(--color-text-muted);
    font-size: 14px;
    min-height: 21px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.form-field .hint svg { flex: none; }
.form-field.is-error .hint { color: var(--color-error); }
.form-field.is-error input {
    border: 2px solid var(--color-accent);
    animation: shake 0.3s;
}
.form-error {
    color: var(--color-error);
    font-size: 14px;
    margin-bottom: 8px;
    min-height: 20px;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ===== Бейджи/чипы ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 99px;
    background-color: var(--color-panel);
    color: var(--color-text-muted);
    font-size: 13px;
    width: fit-content;
}
.badge-shiny { background-color: var(--color-accent-soft); color: var(--color-text); }

/* ===== Модальное окно ===== */
.modal {
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 28px;
    background: var(--color-surface);
    color: var(--color-text);
    width: min(480px, calc(100vw - 32px));
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    margin: auto;
}
.modal::backdrop { background: rgba(20, 20, 24, 0.5); }
.modal h2 { font-size: 24px; font-weight: 900; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.modal p.modal-text { color: var(--color-text-muted); margin-bottom: 16px; }

/* ===== Уведомления ===== */
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 20px);
    background: var(--color-text);
    color: var(--color-bg);
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 100;
    pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.page-loading { text-align: center; color: var(--color-text-muted); padding: 80px 0; }

/* ===== Адаптив ===== */
@media (max-width: 720px) {
    .logo { font-size: 18px; gap: 10px; }
    .logo img { width: 38px; height: 38px; }
    .header-inner { flex-wrap: wrap; padding-bottom: 6px; }
    .header-links a { padding: 6px 8px; font-size: 14px; white-space: nowrap; }
    .header-nav { width: 100%; justify-content: space-between; }
    .avatar { margin-left: 0; flex: none; }
    .header-inner { gap: 4px; }
}
@media (max-width: 480px) {
    .logo p { display: none; }
}
