/* ============================================================
   SAPPHIRE TESTING SYSTEM v3.9.8 «ЧИСТАЯ РОСА»
   Полный style.css
   
   Темы по времени суток:
   - 07:00–17:00 → body.theme-light  (светлая)
   - 17:00–20:00 → body.theme-dim    (приглушённая, сепия)
   - 20:00–07:00 → body.theme-dark   (тёмная)
   
   Класс темы ставится через JavaScript в base.html.
   ============================================================ */

:root {
    --sapphire-deep: #1e3a8a;
    --sapphire-bright: #3b82f6;
    --sapphire-light: #60a5fa;
    --sapphire-glow: #93c5fd;
    --gradient-sapphire: linear-gradient(135deg, var(--sapphire-deep), var(--sapphire-bright));
    --glass-bg: rgba(255, 255, 255, 0.7);
    --border-light: #e2e8f0;
    --bg-light: #f8fafc;
    --text-primary: #0f1729;
    --text-secondary: #64748b;
}

/* ==================== БАЗОВЫЕ СТИЛИ ==================== */

* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
}

body {
    background: var(--bg-light);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background 0.8s ease, color 0.8s ease;
    position: relative;
}

.container {
    flex: 1 0 auto;
    position: relative;
    z-index: 1;
}

/* ============================================================
   АНИМИРОВАННЫЙ ФОН САПФИРА — С БОКУ
   ============================================================ */

.sapphire-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
    background: linear-gradient(135deg, #e0e7ff 0%, #f1f5f9 50%, #dbeafe 100%);
    transition: background 0.8s ease;
    pointer-events: none;
}

/* ==================== КРИСТАЛЛЫ СБОКУ ==================== */

.sapphire-crystal {
    position: absolute;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(147, 197, 253, 0.08));
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    filter: blur(2px);
    z-index: -1;
    pointer-events: none;
    box-shadow:
        inset 0 0 60px rgba(147, 197, 253, 0.35),
        0 0 80px rgba(59, 130, 246, 0.18);
    transition: background 0.8s ease, box-shadow 0.8s ease;
}

.sapphire-crystal-1 {
    width: 340px;
    height: 340px;
    top: 8%;
    left: -180px;
    animation:
        crystalSideLeft 20s ease-in-out infinite alternate,
        crystalMorph1 14s ease-in-out infinite;
    opacity: 0.75;
}

.sapphire-crystal-2 {
    width: 300px;
    height: 300px;
    bottom: 5%;
    right: -160px;
    animation:
        crystalSideRight 24s ease-in-out infinite alternate,
        crystalMorph2 18s ease-in-out infinite;
    opacity: 0.65;
}

.sapphire-crystal-3 {
    width: 220px;
    height: 220px;
    top: 45%;
    left: -100px;
    animation:
        crystalSideLeft 28s ease-in-out infinite alternate-reverse,
        crystalMorph1 20s ease-in-out infinite;
    opacity: 0.5;
}

/* ==================== ПИКСЕЛИ-КРИСТАЛЛИКИ ==================== */

.sapphire-pixel {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(191, 219, 254, 0.95), rgba(96, 165, 250, 0.6));
    box-shadow:
        0 0 8px rgba(96, 165, 250, 0.7),
        inset 0 0 4px rgba(255, 255, 255, 0.8);
    pointer-events: none;
    z-index: -1;
    transition: background 0.8s ease, box-shadow 0.8s ease;
}

.sapphire-pixel-1  { width: 4px; height: 4px; top: 12%; left: 8%;   animation: pixelTwinkle 6s ease-in-out infinite; }
.sapphire-pixel-2  { width: 6px; height: 6px; top: 22%; left: 15%;  animation: pixelTwinkle 8s ease-in-out infinite -2s; }
.sapphire-pixel-3  { width: 3px; height: 3px; top: 35%; left: 5%;   animation: pixelTwinkle 5s ease-in-out infinite -1s; }
.sapphire-pixel-4  { width: 5px; height: 5px; top: 48%; left: 12%;  animation: pixelTwinkle 7s ease-in-out infinite -3s; }
.sapphire-pixel-5  { width: 4px; height: 4px; top: 62%; left: 7%;   animation: pixelTwinkle 9s ease-in-out infinite -4s; }
.sapphire-pixel-6  { width: 6px; height: 6px; top: 75%; left: 18%;  animation: pixelTwinkle 6s ease-in-out infinite -5s; }
.sapphire-pixel-7  { width: 3px; height: 3px; top: 88%; left: 10%;  animation: pixelTwinkle 8s ease-in-out infinite -6s; }
.sapphire-pixel-8  { width: 5px; height: 5px; top: 10%; right: 8%;  animation: pixelTwinkle 7s ease-in-out infinite -1.5s; }
.sapphire-pixel-9  { width: 4px; height: 4px; top: 25%; right: 14%; animation: pixelTwinkle 6s ease-in-out infinite -2.5s; }
.sapphire-pixel-10 { width: 6px; height: 6px; top: 40%; right: 5%;  animation: pixelTwinkle 9s ease-in-out infinite -3.5s; }
.sapphire-pixel-11 { width: 3px; height: 3px; top: 55%; right: 11%; animation: pixelTwinkle 5s ease-in-out infinite -4.5s; }
.sapphire-pixel-12 { width: 5px; height: 5px; top: 70%; right: 7%;  animation: pixelTwinkle 8s ease-in-out infinite -5.5s; }
.sapphire-pixel-13 { width: 4px; height: 4px; top: 85%; right: 15%; animation: pixelTwinkle 7s ease-in-out infinite -6.5s; }
.sapphire-pixel-14 { width: 6px; height: 6px; top: 18%; left: 25%;  animation: pixelTwinkle 10s ease-in-out infinite; }
.sapphire-pixel-15 { width: 5px; height: 5px; bottom: 15%; right: 22%; animation: pixelTwinkle 8s ease-in-out infinite -2s; }
.sapphire-pixel-16 { width: 4px; height: 4px; top: 33%; right: 25%; animation: pixelTwinkle 6s ease-in-out infinite -3s; }

/* ==================== КАПЛИ САПФИРА ==================== */

.sapphire-drop {
    position: absolute;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle at 30% 30%, rgba(191, 219, 254, 0.95), rgba(59, 130, 246, 0.5));
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    z-index: -1;
    pointer-events: none;
    box-shadow:
        0 0 15px rgba(59, 130, 246, 0.6),
        inset 0 0 6px rgba(255, 255, 255, 0.7);
    opacity: 0.85;
    transition: background 0.8s ease, box-shadow 0.8s ease;
}

.sapphire-drop::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 3px;
    height: 3px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    filter: blur(0.5px);
}

.sapphire-drop-1 {
    top: 5%;
    left: 10%;
    animation: dropFallLeft 10s ease-in-out infinite;
}

.sapphire-drop-2 {
    top: 15%;
    right: 12%;
    animation: dropFallRight 13s ease-in-out infinite -3s;
}

.sapphire-drop-3 {
    top: 25%;
    left: 18%;
    animation: dropFallLeft 16s ease-in-out infinite -6s;
}

/* ==================== АНИМАЦИИ ФОНА ==================== */

@keyframes crystalSideLeft {
    0%   { transform: translateX(0) rotate(0deg) scale(1); }
    50%  { transform: translateX(60px) rotate(45deg) scale(1.1); }
    100% { transform: translateX(20px) rotate(90deg) scale(1.05); }
}

@keyframes crystalSideRight {
    0%   { transform: translateX(0) rotate(0deg) scale(1); }
    50%  { transform: translateX(-60px) rotate(-45deg) scale(1.15); }
    100% { transform: translateX(-20px) rotate(-90deg) scale(1.05); }
}

@keyframes crystalMorph1 {
    0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    50%      { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

@keyframes crystalMorph2 {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    50%      { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
}

@keyframes pixelTwinkle {
    0%, 100% { opacity: 0.9; transform: scale(1) translateY(0); }
    30%      { opacity: 0.3; transform: scale(0.7) translateY(-3px); }
    60%      { opacity: 1;   transform: scale(1.2) translateY(2px); }
}

@keyframes dropFallLeft {
    0%   { transform: translate(0, 0) rotate(-45deg) scale(1); opacity: 0; }
    10%  { opacity: 0.85; }
    90%  { opacity: 0.85; }
    100% { transform: translate(40px, 450px) rotate(-45deg) scale(0.6); opacity: 0; }
}

@keyframes dropFallRight {
    0%   { transform: translate(0, 0) rotate(-45deg) scale(1); opacity: 0; }
    15%  { opacity: 0.75; }
    85%  { opacity: 0.75; }
    100% { transform: translate(-40px, 500px) rotate(-45deg) scale(0.5); opacity: 0; }
}

/* ============================================================
   NAVBAR
   ============================================================ */

.navbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    z-index: 1030 !important;
    position: relative;
    transition: background 0.8s ease, border-color 0.8s ease;
}

.navbar-light .navbar-brand {
    color: #1e3a8a;
    font-weight: 600;
    transition: color 0.2s ease;
}

.navbar-light .navbar-brand:hover {
    color: #3b82f6;
}

.navbar-light .navbar-nav .nav-link {
    color: #1e3a8a;
    font-weight: 500;
    transition: color 0.2s ease;
}

.navbar-light .navbar-nav .nav-link:hover {
    color: #3b82f6;
}

.navbar-light .navbar-nav .nav-link.active {
    color: #3b82f6;
}

.navbar-light .navbar-toggler {
    border-color: #1e3a8a;
}

.navbar-light .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(30, 58, 138, 0.75)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ==================== DROPDOWN ==================== */

.dropdown {
    position: relative;
    z-index: 1000;
}

.dropdown.show {
    z-index: 1051 !important;
}

.dropdown-menu {
    z-index: 1050 !important;
    position: absolute !important;
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: 0.5rem;
    min-width: 200px;
    animation: dropdownFadeIn 0.2s ease;
    transition: background 0.8s ease, border-color 0.8s ease;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.navbar-nav .dropdown-menu {
    z-index: 1050 !important;
}

.dropdown-menu .dropdown-item {
    border-radius: 10px;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    font-weight: 500;
}

.dropdown-menu .dropdown-item:hover {
    background: #eef2ff;
    color: #1e3a8a;
}

.dropdown-menu .dropdown-divider {
    margin: 0.25rem 0;
}

/* ==================== CARD ==================== */

.card {
    border: none;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    background: white;
    transition: box-shadow 0.3s ease, transform 0.3s ease, background 0.8s ease;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(30, 58, 138, 0.08);
}

.card-header {
    border-bottom: 1px solid var(--border-light);
    border-radius: 24px 24px 0 0 !important;
    padding: 1rem 1.5rem;
    z-index: 1;
    transition: background 0.8s ease, border-color 0.8s ease;
}

.card-body {
    padding: 1.5rem;
}

/* ==================== BUTTONS ==================== */

.btn {
    border-radius: 40px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-sapphire {
    background: var(--gradient-sapphire);
    border: none;
    color: white;
    transition: all 0.3s ease;
}

.btn-sapphire:hover {
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 58, 138, 0.2);
    color: white;
}

.btn-group-sm > .btn {
    border-radius: 20px;
    padding: 0.25rem 0.6rem;
}

.btn-group > .btn:first-child { border-radius: 20px 0 0 20px; }
.btn-group > .btn:last-child  { border-radius: 0 20px 20px 0; }
.btn-group > .btn:only-child  { border-radius: 20px; }

/* ==================== FORMS ==================== */

.form-control,
.form-select {
    border-radius: 16px;
    border: 1px solid var(--border-light);
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    background-color: #ffffff;
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--sapphire-light);
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
    background-color: #ffffff;
    color: var(--text-primary);
}

.form-control::placeholder {
    color: #94a3b8;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-check-input {
    width: 1.2em;
    height: 1.2em;
    margin-top: 0.15em;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--sapphire-bright);
    border-color: var(--sapphire-bright);
}

.form-check-label {
    cursor: pointer;
}

/* ==================== PROGRESS ==================== */

.progress {
    border-radius: 30px;
    background-color: #e2e8f0;
    overflow: hidden;
    transition: background-color 0.8s ease;
}

.progress-bar {
    background: linear-gradient(90deg, var(--sapphire-bright), var(--sapphire-deep));
    transition: width 0.4s ease;
}

/* ==================== BADGES ==================== */

.badge {
    padding: 0.35em 0.75em;
    border-radius: 30px;
    font-weight: 500;
}

/* ==================== ALERTS ==================== */

.alert {
    border-radius: 16px;
    border: none;
    padding: 1rem 1.25rem;
    transition: background-color 0.8s ease, color 0.8s ease;
}

.alert-success {
    background: #e6f0ff;
    color: #1e3a8a;
    border-left: 4px solid var(--sapphire-bright);
}

/* ==================== ПЕРЕОПРЕДЕЛЕНИЕ ЦВЕТОВ ==================== */

.bg-success,
.badge.bg-success,
.btn-success,
.alert-success {
    background: var(--sapphire-bright) !important;
    color: white;
}

.btn-success:hover {
    background: var(--sapphire-deep) !important;
    color: white;
}

.btn-outline-success {
    border-color: var(--sapphire-bright);
    color: var(--sapphire-deep);
}

.btn-outline-success:hover {
    background: var(--sapphire-bright);
    color: white;
    border-color: var(--sapphire-bright);
}

.progress-bar.bg-success {
    background: var(--sapphire-bright) !important;
}

.badge.bg-primary {
    background: var(--sapphire-bright) !important;
}

.btn-primary {
    background: var(--sapphire-bright);
    border-color: var(--sapphire-bright);
}

.btn-primary:hover {
    background: var(--sapphire-deep);
    border-color: var(--sapphire-deep);
}

.btn-outline-primary {
    border-color: var(--sapphire-bright);
    color: var(--sapphire-deep);
}

.btn-outline-primary:hover {
    background: var(--sapphire-bright);
    border-color: var(--sapphire-bright);
    color: white;
}

/* ==================== GRADE BADGES ==================== */

.grade-5 { background: linear-gradient(135deg, #1e3a8a, #3b82f6) !important; }
.grade-4 { background: linear-gradient(135deg, #3b82f6, #60a5fa) !important; }
.grade-3 { background: linear-gradient(135deg, #f59e0b, #f97316) !important; }
.grade-2 { background: linear-gradient(135deg, #ef4444, #dc2626) !important; }

.grade-badge {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.8rem;
    color: white;
    margin: 0 auto;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* ==================== TIMER ==================== */

.timer-display {
    background: var(--gradient-sapphire);
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    padding: 0.5rem 1.5rem;
    border-radius: 40px;
    display: inline-block;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
}

.timer-warning {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.9; transform: scale(1.02); }
}

/* ==================== TEST CONTENT ==================== */

.test-content {
    user-select: none;
    -webkit-user-select: none;
}

.test-content input,
.test-content textarea,
.test-content select {
    user-select: text !important;
    -webkit-user-select: text !important;
}

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

/* ==================== QUESTION CARD ==================== */

.question-card {
    margin-bottom: 1.5rem;
    border-radius: 24px;
    overflow: hidden;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.1);
}

.question-card .card-header {
    background: linear-gradient(135deg, #1E4A8C, #0F2C59);
    color: white;
    padding: 1rem 1.5rem;
    transition: background 0.8s ease;
}

.option-label {
    cursor: pointer;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    display: block;
    margin-bottom: 0.75rem;
    background: white;
}

.option-label:hover {
    background: #eef2ff;
    border-color: #3B71CA;
    transform: translateX(4px);
}

.option-label input {
    margin-right: 12px;
    accent-color: #1E4A8C;
}

.option-label.selected {
    background: #eef2ff;
    border-color: #3B71CA;
}

/* ==================== PROGRESS BAR CONTAINER ==================== */

.progress-bar-container {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: 0 10px 15px -3px rgba(15, 44, 89, 0.1);
    margin-bottom: 2rem;
    transition: background 0.8s ease;
}

/* ==================== PAGINATION ==================== */

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-weight: 500;
}

.page-btn:hover:not(:disabled) {
    background: #eef2ff;
    border-color: #3B71CA;
    transform: translateY(-2px);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-weight: 500;
    color: var(--text-secondary);
}

/* ==================== MATCHING ==================== */

.matching-row {
    margin-bottom: 10px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 12px;
    transition: background 0.8s ease;
}

.match-select {
    border-radius: 12px;
}

/* ==================== MODAL ==================== */

.modal {
    z-index: 1060 !important;
}

.modal-backdrop {
    z-index: 1055 !important;
}

.modal-content {
    border: none;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    transition: background 0.8s ease, color 0.8s ease;
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-light);
    padding: 1rem 1.5rem;
}

.system-info-modal .modal-content {
    border-radius: 24px;
    overflow: hidden;
}

.system-info-modal .modal-header {
    background: linear-gradient(135deg, #1b5e20, #2e7d32);
    color: white;
    border-bottom: none;
    padding: 1.5rem;
}

.system-info-modal .modal-body {
    padding: 1.5rem;
}

.version-badge {
    background: linear-gradient(135deg, #2e7d32, #43a047);
    color: white;
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 600;
}

.info-card {
    background: #f1f8e9;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid #2e7d32;
    transition: background 0.8s ease, color 0.8s ease;
}

.info-icon {
    width: 40px;
    height: 40px;
    background: #e8f5e9;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: #1b5e20;
}

/* ==================== TABLE ==================== */

.table {
    border-radius: 16px;
    overflow: visible;
    transition: color 0.8s ease;
}

.table-responsive {
    border-radius: 16px;
    overflow-x: auto;
    overflow-y: visible;
}

.table thead th {
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    transition: background 0.8s ease, border-color 0.8s ease;
}

.table-hover tbody tr {
    transition: background 0.2s ease;
}

/* ==================== STICKY ==================== */

.sticky-top {
    z-index: 1020 !important;
}

/* ==================== FOOTER ==================== */

footer {
    margin-top: 3rem;
    padding: 1.5rem;
    color: #64748b;
    text-align: center;
    border-top: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.6);
    transition: background 0.8s ease, border-color 0.8s ease;
    position: relative;
    z-index: 1;
}

/* ==================== MISC ==================== */

.text-muted { color: var(--text-secondary) !important; }

hr {
    border-color: var(--border-light);
    opacity: 1;
    transition: border-color 0.8s ease;
}

blockquote.blockquote {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    border-radius: 16px;
    border-left: 4px solid var(--sapphire-bright);
    transition: background 0.8s ease;
}

pre {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1rem;
    overflow-x: auto;
    border: 1px solid var(--border-light);
    transition: background 0.8s ease, border-color 0.8s ease;
}

code {
    color: #be185d;
    background: #fdf2f8;
    padding: 0.15em 0.4em;
    border-radius: 6px;
    font-size: 0.9em;
    transition: background 0.8s ease, color 0.8s ease;
}

pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.list-group-item {
    border-color: var(--border-light);
    transition: background 0.8s ease, color 0.8s ease, border-color 0.8s ease;
}

/* ============================================================
   СИСТЕМА ТЕМ ПО ВРЕМЕНИ СУТОК
   ============================================================ */

/* ==================== СВЕТЛАЯ ТЕМА (07:00–17:00) ==================== */

body.theme-light {
    --bg-light: #f8fafc;
    --text-primary: #0f1729;
    --text-secondary: #64748b;
    --border-light: #e2e8f0;
    background: var(--bg-light);
    color: var(--text-primary);
}

body.theme-light .sapphire-bg {
    background: linear-gradient(135deg, #e0e7ff 0%, #f1f5f9 50%, #dbeafe 100%);
}

/* ==================== ПРИГЛУШЁННАЯ ТЕМА (17:00–20:00) ==================== */

body.theme-dim {
    --bg-light: #e8e4d9;
    --text-primary: #2c2416;
    --text-secondary: #6b5d48;
    --border-light: #d4cbb8;
    background: #e8e4d9 !important;
    color: #2c2416 !important;
}

body.theme-dim .sapphire-bg {
    background: linear-gradient(135deg, #d4cfc0 0%, #e8e4d9 50%, #cdc4b0 100%) !important;
}

body.theme-dim .sapphire-crystal {
    background: linear-gradient(135deg, rgba(180, 130, 70, 0.15), rgba(210, 170, 120, 0.08)) !important;
    box-shadow:
        inset 0 0 60px rgba(210, 170, 120, 0.3),
        0 0 80px rgba(180, 130, 70, 0.15) !important;
}

body.theme-dim .sapphire-pixel {
    background: radial-gradient(circle at 30% 30%, rgba(255, 220, 160, 0.95), rgba(220, 170, 100, 0.6)) !important;
    box-shadow:
        0 0 10px rgba(220, 170, 100, 0.7),
        inset 0 0 4px rgba(255, 240, 220, 0.8) !important;
}

body.theme-dim .sapphire-drop {
    background: radial-gradient(circle at 30% 30%, rgba(255, 230, 180, 0.95), rgba(200, 150, 80, 0.5)) !important;
    box-shadow:
        0 0 15px rgba(200, 150, 80, 0.5),
        inset 0 0 6px rgba(255, 240, 220, 0.6) !important;
}

body.theme-dim .navbar {
    background: rgba(232, 228, 217, 0.9) !important;
    border-bottom-color: #d4cbb8 !important;
}

body.theme-dim .navbar-light .navbar-brand,
body.theme-dim .navbar-light .navbar-nav .nav-link {
    color: #6b4423 !important;
}

body.theme-dim .navbar-light .navbar-nav .nav-link:hover,
body.theme-dim .navbar-light .navbar-nav .nav-link.active {
    color: #a06030 !important;
}

body.theme-dim .navbar-light .navbar-toggler {
    border-color: #6b4423 !important;
}

body.theme-dim .navbar-light .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(107, 68, 35, 0.75)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

body.theme-dim .card,
body.theme-dim .modal-content {
    background-color: #f5f0e6 !important;
    color: #2c2416 !important;
    box-shadow: 0 4px 12px rgba(107, 68, 35, 0.1);
}

body.theme-dim .card-header {
    background-color: #ddd5c3 !important;
    color: #2c2416 !important;
    border-color: #d4cbb8 !important;
}

body.theme-dim .dropdown-menu {
    background-color: #f5f0e6 !important;
    border-color: #d4cbb8 !important;
}

body.theme-dim .dropdown-menu .dropdown-item {
    color: #2c2416 !important;
}

body.theme-dim .dropdown-menu .dropdown-item:hover {
    background-color: #ddd5c3 !important;
    color: #6b4423 !important;
}

body.theme-dim .dropdown-menu .dropdown-divider {
    border-color: #d4cbb8 !important;
}

body.theme-dim .form-control,
body.theme-dim .form-select {
    background-color: #faf6ed !important;
    color: #2c2416 !important;
    border-color: #d4cbb8 !important;
}

body.theme-dim .form-control::placeholder {
    color: #8b7d68 !important;
}

body.theme-dim .form-select option {
    background-color: #faf6ed !important;
    color: #2c2416 !important;
}

body.theme-dim .form-label {
    color: #2c2416 !important;
}

body.theme-dim .form-text {
    color: #6b5d48 !important;
}

body.theme-dim .form-check-label {
    color: #2c2416 !important;
}

body.theme-dim .form-check-input {
    background-color: #faf6ed !important;
    border-color: #b8a992 !important;
}

body.theme-dim .form-check-input:checked {
    background-color: #a06030 !important;
    border-color: #a06030 !important;
}

body.theme-dim .table {
    color: #2c2416 !important;
}

body.theme-dim .table thead th {
    background-color: #ddd5c3 !important;
    color: #2c2416 !important;
    border-color: #d4cbb8 !important;
}

body.theme-dim .table td {
    border-color: #d4cbb8 !important;
}

body.theme-dim .table-hover tbody tr:hover {
    background-color: #ece5d5 !important;
    color: #2c2416 !important;
}

body.theme-dim .table-light {
    background-color: #ddd5c3 !important;
}

body.theme-dim .table-light th {
    background-color: #ddd5c3 !important;
    color: #2c2416 !important;
    border-color: #d4cbb8 !important;
}

body.theme-dim .text-muted {
    color: #6b5d48 !important;
}

body.theme-dim .btn-primary {
    background: #a06030 !important;
    border-color: #a06030 !important;
}

body.theme-dim .btn-primary:hover {
    background: #805020 !important;
    border-color: #805020 !important;
}

body.theme-dim .btn-outline-primary {
    color: #6b4423 !important;
    border-color: #a06030 !important;
}

body.theme-dim .btn-outline-primary:hover {
    background: #a06030 !important;
    color: #fff !important;
}

body.theme-dim .btn-secondary {
    background: #8b7d68 !important;
    border-color: #8b7d68 !important;
}

body.theme-dim .btn-secondary:hover {
    background: #6b5d48 !important;
    border-color: #6b5d48 !important;
}

body.theme-dim .btn-sapphire {
    background: linear-gradient(135deg, #6b4423, #a06030) !important;
    border: none !important;
}

body.theme-dim .btn-sapphire:hover {
    background: linear-gradient(135deg, #805020, #a06030) !important;
}

body.theme-dim .badge.bg-primary {
    background: #a06030 !important;
}

body.theme-dim .bg-success,
body.theme-dim .badge.bg-success,
body.theme-dim .btn-success {
    background: #6b8e3f !important;
}

body.theme-dim .alert-info {
    background: #e5ddd0 !important;
    color: #4a3820 !important;
    border-color: #b8a992 !important;
}

body.theme-dim .alert-warning {
    background: #f0e0b8 !important;
    color: #6b4423 !important;
    border-color: #c9a668 !important;
}

body.theme-dim .alert-success {
    background: #d8e4c0 !important;
    color: #3d5220 !important;
    border-color: #9cb870 !important;
}

body.theme-dim .alert-danger {
    background: #ecd0c0 !important;
    color: #6b2018 !important;
    border-color: #c08070 !important;
}

body.theme-dim .progress {
    background-color: #d4cbb8 !important;
}

body.theme-dim .progress-bar {
    background: linear-gradient(90deg, #a06030, #6b4423) !important;
}

body.theme-dim .progress-bar-container {
    background: rgba(232, 228, 217, 0.9) !important;
    box-shadow: 0 10px 15px -3px rgba(107, 68, 35, 0.15) !important;
}

body.theme-dim .page-btn {
    background: #f5f0e6 !important;
    border-color: #d4cbb8 !important;
    color: #2c2416 !important;
}

body.theme-dim .page-btn:hover:not(:disabled) {
    background: #ddd5c3 !important;
    border-color: #a06030 !important;
}

body.theme-dim .option-label {
    background: #f5f0e6 !important;
    border-color: #d4cbb8 !important;
    color: #2c2416 !important;
}

body.theme-dim .option-label:hover {
    background: #ece5d5 !important;
    border-color: #a06030 !important;
}

body.theme-dim .option-label.selected {
    background: #ece5d5 !important;
    border-color: #a06030 !important;
}

body.theme-dim .question-card .card-header {
    background: linear-gradient(135deg, #6b4423, #4a2f18) !important;
}

body.theme-dim .matching-row {
    background: #ece5d5 !important;
}

body.theme-dim .matching-row .list-group-item {
    background: #f5f0e6 !important;
    color: #2c2416 !important;
    border-color: #d4cbb8 !important;
}

body.theme-dim footer {
    color: #6b5d48 !important;
    border-top-color: #d4cbb8 !important;
    background: rgba(232, 228, 217, 0.6) !important;
}

body.theme-dim .list-group-item {
    background: #f5f0e6 !important;
    color: #2c2416 !important;
    border-color: #d4cbb8 !important;
}

body.theme-dim a {
    color: #6b4423;
}

body.theme-dim a:hover {
    color: #a06030;
}

body.theme-dim code {
    color: #6b2018 !important;
    background: #e5ddd0 !important;
}

body.theme-dim pre {
    background: #ddd5c3 !important;
    border-color: #b8a992 !important;
    color: #2c2416 !important;
}

body.theme-dim hr {
    border-color: #d4cbb8 !important;
}

body.theme-dim .btn-close {
    filter: invert(0.3) sepia(0.3) !important;
}

body.theme-dim blockquote.blockquote {
    background: #ece5d5 !important;
}

body.theme-dim .info-card {
    background: #ece5d5 !important;
    border-left-color: #6b8e3f !important;
    color: #2c2416 !important;
}

body.theme-dim .info-icon {
    background: #d8e4c0 !important;
    color: #3d5220 !important;
}

body.theme-dim .text-dark {
    color: #2c2416 !important;
}

body.theme-dim .text-body {
    color: #2c2416 !important;
}

body.theme-dim .bg-light {
    background-color: #ddd5c3 !important;
    color: #2c2416 !important;
}

body.theme-dim .bg-white {
    background-color: #f5f0e6 !important;
}

body.theme-dim .bg-secondary {
    background-color: #8b7d68 !important;
}

body.theme-dim .btn-outline-secondary {
    color: #6b5d48 !important;
    border-color: #8b7d68 !important;
}

body.theme-dim .btn-outline-secondary:hover {
    background: #8b7d68 !important;
    color: white !important;
}

body.theme-dim .btn-outline-info {
    color: #6b4423 !important;
    border-color: #a06030 !important;
}

body.theme-dim .btn-outline-info:hover {
    background: #a06030 !important;
    color: white !important;
}

body.theme-dim .btn-outline-warning {
    color: #805020 !important;
    border-color: #c9a668 !important;
}

body.theme-dim .btn-outline-warning:hover {
    background: #c9a668 !important;
    color: #2c2416 !important;
}

body.theme-dim .btn-outline-danger {
    color: #6b2018 !important;
    border-color: #c08070 !important;
}

body.theme-dim .btn-outline-danger:hover {
    background: #c08070 !important;
    color: white !important;
}

/* ==================== ТЁМНАЯ ТЕМА (20:00–07:00) ==================== */

body.theme-dark {
    --bg-light: #0f172a;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border-light: #334155;
    background: #0f172a !important;
    color: #e2e8f0 !important;
}

body.theme-dark .sapphire-bg {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0a1020 100%) !important;
}

body.theme-dark .sapphire-crystal {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(30, 58, 138, 0.08)) !important;
    box-shadow:
        inset 0 0 60px rgba(59, 130, 246, 0.25),
        0 0 80px rgba(30, 58, 138, 0.2) !important;
}

body.theme-dark .sapphire-pixel {
    background: radial-gradient(circle at 30% 30%, rgba(147, 197, 253, 0.95), rgba(96, 165, 250, 0.5)) !important;
    box-shadow:
        0 0 12px rgba(96, 165, 250, 0.9),
        inset 0 0 4px rgba(191, 219, 254, 0.9) !important;
}

body.theme-dark .sapphire-drop {
    background: radial-gradient(circle at 30% 30%, rgba(147, 197, 253, 0.95), rgba(59, 130, 246, 0.4)) !important;
    box-shadow:
        0 0 20px rgba(96, 165, 250, 0.7),
        inset 0 0 8px rgba(191, 219, 254, 0.5) !important;
}

body.theme-dark .navbar {
    background: rgba(15, 23, 42, 0.9) !important;
    border-bottom-color: #334155 !important;
}

body.theme-dark .navbar-light .navbar-brand,
body.theme-dark .navbar-light .navbar-nav .nav-link {
    color: #e2e8f0 !important;
}

body.theme-dark .navbar-light .navbar-brand:hover,
body.theme-dark .navbar-light .navbar-nav .nav-link:hover,
body.theme-dark .navbar-light .navbar-nav .nav-link.active {
    color: #60a5fa !important;
}

body.theme-dark .navbar-light .navbar-toggler {
    border-color: #60a5fa !important;
}

body.theme-dark .navbar-light .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(96, 165, 250, 0.75)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

body.theme-dark .dropdown-menu {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4) !important;
}

body.theme-dark .dropdown-menu .dropdown-item {
    color: #e2e8f0 !important;
}

body.theme-dark .dropdown-menu .dropdown-item:hover,
body.theme-dark .dropdown-menu .dropdown-item:focus {
    background-color: #334155 !important;
    color: #ffffff !important;
}

body.theme-dark .dropdown-menu .dropdown-divider {
    border-color: #334155 !important;
}

body.theme-dark .card,
body.theme-dark .modal-content {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

body.theme-dark .card-header {
    border-bottom-color: #334155 !important;
    color: #e2e8f0 !important;
}

body.theme-dark .card-body {
    color: #e2e8f0 !important;
}

body.theme-dark .modal-header {
    border-bottom-color: #334155 !important;
    color: #e2e8f0 !important;
}

body.theme-dark .modal-footer {
    border-top-color: #334155 !important;
}

body.theme-dark .modal-body {
    color: #e2e8f0 !important;
}

body.theme-dark .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%) !important;
}

body.theme-dark .form-control,
body.theme-dark .form-select {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

body.theme-dark .form-control:focus,
body.theme-dark .form-select:focus {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #60a5fa !important;
    box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.25) !important;
}

body.theme-dark .form-control::placeholder {
    color: #64748b !important;
}

body.theme-dark .form-select option {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

body.theme-dark .form-text {
    color: #94a3b8 !important;
}

body.theme-dark .form-label {
    color: #e2e8f0 !important;
}

body.theme-dark .form-check-input {
    background-color: #1e293b !important;
    border-color: #475569 !important;
}

body.theme-dark .form-check-input:checked {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

body.theme-dark .form-check-label {
    color: #e2e8f0 !important;
}

body.theme-dark .table {
    color: #e2e8f0 !important;
}

body.theme-dark .table thead th {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

body.theme-dark .table td {
    border-color: #334155 !important;
}

body.theme-dark .table-hover tbody tr:hover {
    background-color: #334155 !important;
    color: #ffffff !important;
}

body.theme-dark .table-light {
    background-color: #0f172a !important;
}

body.theme-dark .table-light th {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

body.theme-dark .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #1a2332 !important;
    color: #e2e8f0 !important;
}

body.theme-dark .table-striped > tbody > tr:nth-of-type(even) > * {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

body.theme-dark .alert-info {
    background-color: #1e3a5f !important;
    color: #93c5fd !important;
    border-color: #1e40af !important;
}

body.theme-dark .alert-warning {
    background-color: #4a3a0f !important;
    color: #fde68a !important;
    border-color: #78350f !important;
}

body.theme-dark .alert-success {
    background-color: #0f3a1f !important;
    color: #86efac !important;
    border-color: #166534 !important;
}

body.theme-dark .alert-danger {
    background-color: #3a0f0f !important;
    color: #fca5a5 !important;
    border-color: #7f1d1d !important;
}

body.theme-dark .bg-light {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

body.theme-dark .bg-white {
    background-color: #1e293b !important;
}

body.theme-dark .bg-secondary {
    background-color: #475569 !important;
}

body.theme-dark .text-muted {
    color: #94a3b8 !important;
}

body.theme-dark .text-dark {
    color: #e2e8f0 !important;
}

body.theme-dark .text-body {
    color: #e2e8f0 !important;
}

body.theme-dark .list-group-item {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

body.theme-dark .list-group-item.bg-light {
    background-color: #1e293b !important;
}

body.theme-dark .progress {
    background-color: #334155 !important;
}

body.theme-dark .progress-bar-container {
    background: rgba(15, 23, 42, 0.85) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3) !important;
}

body.theme-dark .page-btn {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

body.theme-dark .page-btn:hover:not(:disabled) {
    background-color: #334155 !important;
    border-color: #60a5fa !important;
}

body.theme-dark .option-label {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

body.theme-dark .option-label:hover {
    background-color: #334155 !important;
    border-color: #60a5fa !important;
}

body.theme-dark .option-label.selected {
    background-color: #1e3a5f !important;
    border-color: #60a5fa !important;
}

body.theme-dark .question-card .card-header {
    background: linear-gradient(135deg, #0f172a, #1e293b) !important;
}

body.theme-dark .matching-row {
    background-color: #1e293b !important;
}

body.theme-dark .btn-outline-primary {
    color: #60a5fa !important;
    border-color: #60a5fa !important;
}

body.theme-dark .btn-outline-primary:hover {
    background-color: #3b82f6 !important;
    color: white !important;
    border-color: #3b82f6 !important;
}

body.theme-dark .btn-outline-secondary {
    color: #94a3b8 !important;
    border-color: #94a3b8 !important;
}

body.theme-dark .btn-outline-secondary:hover {
    background-color: #64748b !important;
    color: white !important;
    border-color: #64748b !important;
}

body.theme-dark .btn-secondary {
    background-color: #475569 !important;
    border-color: #475569 !important;
}

body.theme-dark .btn-secondary:hover {
    background-color: #64748b !important;
    border-color: #64748b !important;
}

body.theme-dark .btn-outline-danger {
    color: #fca5a5 !important;
    border-color: #fca5a5 !important;
}

body.theme-dark .btn-outline-danger:hover {
    background-color: #ef4444 !important;
    color: white !important;
    border-color: #ef4444 !important;
}

body.theme-dark .btn-outline-info {
    color: #93c5fd !important;
    border-color: #93c5fd !important;
}

body.theme-dark .btn-outline-info:hover {
    background-color: #3b82f6 !important;
    color: white !important;
    border-color: #3b82f6 !important;
}

body.theme-dark .btn-outline-warning {
    color: #fde68a !important;
    border-color: #fde68a !important;
}

body.theme-dark .btn-outline-warning:hover {
    background-color: #f59e0b !important;
    color: white !important;
    border-color: #f59e0b !important;
}

body.theme-dark blockquote.blockquote {
    background: #1e293b !important;
}

body.theme-dark pre {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

body.theme-dark code {
    color: #f472b6 !important;
    background: #3a0f2a !important;
}

body.theme-dark pre code {
    background: transparent !important;
    color: inherit !important;
}

body.theme-dark footer {
    color: #94a3b8 !important;
    border-top-color: #334155 !important;
    background: rgba(15, 23, 42, 0.6) !important;
}

body.theme-dark .info-card {
    background: #1e293b !important;
    border-left-color: #43a047 !important;
    color: #e2e8f0 !important;
}

body.theme-dark .info-icon {
    background: #0f3a1f !important;
    color: #86efac !important;
}

body.theme-dark .breadcrumb-item.active {
    color: #94a3b8 !important;
}

body.theme-dark .breadcrumb-item + .breadcrumb-item::before {
    color: #64748b !important;
}

body.theme-dark hr {
    border-color: #334155 !important;
    opacity: 0.5;
}

body.theme-dark a {
    color: #60a5fa;
}

body.theme-dark a:hover {
    color: #93c5fd;
}

/* ============================================================
   РАДИАЛЬНОЕ (КОЛЬЦЕВОЕ) МЕНЮ ДЕЙСТВИЙ
   ============================================================ */

.radial-menu {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 34px;
    --radial-radius: 88px;
    --radial-count: 6;
    vertical-align: middle;
}

.radial-menu-trigger {
    position: relative;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #ced4da;
    color: #1e3a8a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    z-index: 3;
}

.radial-menu-trigger:hover {
    background: #eef2ff;
    border-color: #3b82f6;
    color: #1e3a8a;
    transform: scale(1.08);
}

.radial-menu.open .radial-menu-trigger {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
    transform: rotate(135deg);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

/* Контейнер иконок */
.radial-menu-items {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 2;
}

.radial-menu.open .radial-menu-items {
    pointer-events: auto;
}

/* Иконка действия */
.radial-menu-item {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #ced4da;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 1rem;
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.15);
    --angle: calc(90deg + 180deg / (var(--radial-count) - 1) * var(--i));
    --final-transform:
        translate(-50%, -50%)
        rotate(var(--angle))
        translate(var(--radial-radius))
        rotate(calc(-1 * var(--angle)))
        scale(1);
}

.radial-menu.open .radial-menu-item {
    transform: var(--final-transform);
    opacity: 1;
}

/* Задержка для эффекта каскада */
.radial-menu.open .radial-menu-item:nth-child(1) { transition-delay: 0.02s; }
.radial-menu.open .radial-menu-item:nth-child(2) { transition-delay: 0.06s; }
.radial-menu.open .radial-menu-item:nth-child(3) { transition-delay: 0.10s; }
.radial-menu.open .radial-menu-item:nth-child(4) { transition-delay: 0.14s; }
.radial-menu.open .radial-menu-item:nth-child(5) { transition-delay: 0.18s; }
.radial-menu.open .radial-menu-item:nth-child(6) { transition-delay: 0.22s; }
.radial-menu.open .radial-menu-item:nth-child(7) { transition-delay: 0.26s; }
.radial-menu.open .radial-menu-item:nth-child(8) { transition-delay: 0.30s; }

/* Индексы для раскладки по дуге */
.radial-menu-item:nth-child(1) { --i: 0; }
.radial-menu-item:nth-child(2) { --i: 1; }
.radial-menu-item:nth-child(3) { --i: 2; }
.radial-menu-item:nth-child(4) { --i: 3; }
.radial-menu-item:nth-child(5) { --i: 4; }
.radial-menu-item:nth-child(6) { --i: 5; }
.radial-menu-item:nth-child(7) { --i: 6; }
.radial-menu-item:nth-child(8) { --i: 7; }

/* Наведение на иконку */
.radial-menu-item:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
    z-index: 5;
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.45);
}

/* Цветовые темы для разных действий */
.radial-menu-item.item-settings:hover  { background: #06b6d4; border-color: #06b6d4; box-shadow: 0 6px 18px rgba(6, 182, 212, 0.45); }
.radial-menu-item.item-json:hover      { background: #0ea5e9; border-color: #0ea5e9; box-shadow: 0 6px 18px rgba(14, 165, 233, 0.45); }
.radial-menu-item.item-word:hover      { background: #2563eb; border-color: #2563eb; box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45); }
.radial-menu-item.item-toggle:hover    { background: #8b5cf6; border-color: #8b5cf6; box-shadow: 0 6px 18px rgba(139, 92, 246, 0.45); }
.radial-menu-item.item-archive:hover   { background: #f59e0b; border-color: #f59e0b; box-shadow: 0 6px 18px rgba(245, 158, 11, 0.45); }
.radial-menu-item.item-delete:hover    { background: #ef4444; border-color: #ef4444; box-shadow: 0 6px 18px rgba(239, 68, 68, 0.45); }

/* Tooltip с названием действия */
.radial-menu-item::after {
    content: attr(data-label);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) scale(0.85);
    background: #0f1729;
    color: #ffffff;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 10;
}

.radial-menu-item::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%) scale(0);
    border: 5px solid transparent;
    border-top-color: #0f1729;
    opacity: 0;
    transition: all 0.25s ease;
    z-index: 10;
}

.radial-menu-item:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.radial-menu-item:hover::before {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Убеждаемся что меню не обрезается */
.table-responsive,
.card-body,
.table,
.table tbody,
.table tr,
.table td {
    overflow: visible !important;
}

.table td:last-child {
    position: relative;
    z-index: 5;
}

.table tr:hover td:last-child {
    z-index: 20;
}

.radial-menu.open {
    z-index: 100;
}

/* ==================== АДАПТАЦИЯ РАДИАЛЬНОГО МЕНЮ ПОД ТЕМЫ ==================== */

body.theme-dim .radial-menu-trigger {
    background: #f5f0e6;
    border-color: #d4cbb8;
    color: #6b4423;
}

body.theme-dim .radial-menu-trigger:hover {
    background: #ece5d5;
    border-color: #a06030;
    color: #6b4423;
}

body.theme-dim .radial-menu.open .radial-menu-trigger {
    background: #a06030;
    border-color: #a06030;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(160, 96, 48, 0.4);
}

body.theme-dim .radial-menu-item {
    background: #f5f0e6;
    border-color: #d4cbb8;
    color: #6b4423;
}

body.theme-dim .radial-menu-item:hover {
    background: #a06030;
    border-color: #a06030;
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(160, 96, 48, 0.45);
}

body.theme-dim .radial-menu-item::after {
    background: #4a2f18;
    color: #f5f0e6;
}

body.theme-dim .radial-menu-item::before {
    border-top-color: #4a2f18;
}

body.theme-dark .radial-menu-trigger {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body.theme-dark .radial-menu-trigger:hover {
    background: #334155;
    border-color: #60a5fa;
    color: #ffffff;
}

body.theme-dark .radial-menu.open .radial-menu-trigger {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.5);
}

body.theme-dark .radial-menu-item {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body.theme-dark .radial-menu-item:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

body.theme-dark .radial-menu-item::after {
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #334155;
}

body.theme-dark .radial-menu-item::before {
    border-top-color: #0f172a;
}

/* На мобильных — уменьшаем радиус */
@media (max-width: 768px) {
    .radial-menu {
        --radial-radius: 70px;
    }
    .radial-menu-item {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }
}

/* ==================== ACTION-BTN (маленькие кнопки в строке теста) ==================== */

.action-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.action-btn i {
    font-size: 0.95rem;
}

.action-group {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */

@media (max-width: 768px) {
    .hero-section { padding: 3rem 0; }
    .hero-title { font-size: 2.2rem; }
    .hero-subtitle { font-size: 1rem; }
    .stat-number { font-size: 2rem; }
    .feature-card { padding: 1.5rem; }
    .help-hero h1 { font-size: 2rem; }
    .help-hero { padding: 2rem 0; }

    .timer-display {
        font-size: 1rem;
        padding: 0.4rem 1rem;
    }

    .card-body { padding: 1rem; }

    .btn {
        padding: 0.4rem 1rem;
        font-size: 0.9rem;
    }

    .table-responsive { font-size: 0.85rem; }

    /* Уменьшаем анимации на мобильных */
    .sapphire-crystal-1 { width: 220px; height: 220px; left: -120px; }
    .sapphire-crystal-2 { width: 200px; height: 200px; right: -110px; }
    .sapphire-crystal-3 { width: 150px; height: 150px; left: -70px; }
    .sapphire-drop { width: 8px; height: 8px; }

    .action-btn {
        width: 30px;
        height: 30px;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .hero-title { font-size: 1.8rem; }
    .card { border-radius: 18px; }
    .modal-content { border-radius: 18px; }

    .sapphire-crystal-1 { width: 160px; height: 160px; left: -90px; opacity: 0.5; }
    .sapphire-crystal-2 { width: 150px; height: 150px; right: -80px; opacity: 0.45; }
    .sapphire-crystal-3 { display: none; }
    .sapphire-pixel-14,
    .sapphire-pixel-15,
    .sapphire-pixel-16 { display: none; }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    .navbar,
    .sapphire-bg,
    .sapphire-crystal,
    .sapphire-pixel,
    .sapphire-drop,
    footer,
    .btn,
    .progress-bar-container,
    .page-btn,
    .radial-menu {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }

    .card-header {
        background: #f5f5f5 !important;
        color: black !important;
    }
}

/* ============================================================
   ДОСТУПНОСТЬ
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .sapphire-crystal,
    .sapphire-pixel,
    .sapphire-drop {
        animation: none !important;
    }

    .radial-menu-item {
        transition-duration: 0.01ms !important;
    }
}