:root {
    --bg-start: #050b14;
    --bg-end: #0b1f33;
    --card-bg: rgba(18, 35, 54, 0.82);
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #4cc3ff;
    --primary-strong: #1a9bff;
    --accent: #8b7bff;
    --text-main: #f2f7ff;
    --text-muted: rgba(242, 247, 255, 0.68);
    --shadow-strong: 0 20px 45px rgba(2, 12, 24, 0.55);
    --shadow-soft: 0 8px 20px rgba(3, 15, 28, 0.4);
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

button {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: radial-gradient(1200px 600px at 10% -20%, rgba(76, 195, 255, 0.25), transparent 60%),
        radial-gradient(900px 600px at 90% 10%, rgba(139, 123, 255, 0.2), transparent 55%),
        linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 100%);
    min-height: 100vh;
    padding: 0;
    color: var(--text-main);
    position: relative;
    overflow-x: hidden;
    letter-spacing: 0.2px;
}

body::before {
    content: '';
    position: fixed;
    inset: -20% -10% auto -10%;
    height: 60%;
    background: radial-gradient(600px 300px at 40% 60%, rgba(76, 195, 255, 0.18), transparent 70%);
    opacity: 0.8;
    filter: blur(0px);
    animation: floatGlow 18s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.header {
    background: linear-gradient(140deg, rgba(20, 54, 92, 0.95), rgba(8, 23, 45, 0.92));
    padding: 22px 20px 18px;
    border-radius: 0 0 32px 32px;
    margin-bottom: 24px;
    position: relative;
    z-index: 2;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-strong);
    overflow: hidden;
}

.header::after {
    content: '';
    position: absolute;
    inset: -60% -10% auto -10%;
    height: 140%;
    background: radial-gradient(400px 200px at 50% 50%, rgba(76, 195, 255, 0.2), transparent 70%);
    opacity: 0.7;
    animation: headerGlow 12s ease-in-out infinite;
    pointer-events: none;
}

.header-content {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    width: 42px;
    height: 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 6px 6px 6px 4px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 18px rgba(2, 12, 24, 0.35);
}

.wave-line {
    height: 3px;
    background: linear-gradient(90deg, var(--primary), rgba(255, 255, 255, 0.9));
    border-radius: 2px;
    transform-origin: left;
    animation: wavePulse 3.6s ease-in-out infinite;
}

.wave-line:nth-child(1) {
    width: 100%;
    animation-delay: 0s;
}

.wave-line:nth-child(2) {
    width: 85%;
    animation-delay: 0.2s;
}

.wave-line:nth-child(3) {
    width: 70%;
    animation-delay: 0.4s;
}

.header-title {
    display: flex;
    flex-direction: column;
}

.header-title-main {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    letter-spacing: 0.4px;
}

.header-title-sub {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.25;
    margin-top: 3px;
}

.menu-icon {
    width: 28px;
    height: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.35s ease;
}

.menu-icon:hover {
    transform: rotate(-6deg);
}

.menu-line {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(76, 195, 255, 0.35);
}

.container {
    max-width: 640px;
    margin: 0 auto 24px auto;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-strong);
    position: relative;
    z-index: 1;
    clear: both;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
}

.container::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.06), transparent 60%);
    pointer-events: none;
}

.normatives-table {
    background: rgba(10, 24, 40, 0.75);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 26px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.table-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: linear-gradient(90deg, rgba(19, 44, 74, 0.9), rgba(13, 35, 62, 0.9));
    padding: 15px 20px;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-cell {
    text-align: center;
    color: rgba(242, 247, 255, 0.8);
}

.table-body {
    overflow: visible;
    max-height: none;
    height: auto;
}

.normative-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.25s ease, background-color 0.25s ease;
}

.normative-row:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(4px);
}

.normative-row:last-child {
    border-bottom: none;
}

.rank {
    color: var(--text-main);
    font-weight: 600;
    font-size: 15px;
    text-align: center;
    letter-spacing: 0.3px;
}

.rank.high-rank {
    color: #ffcc66;
    text-shadow: 0 0 10px rgba(255, 204, 102, 0.35);
}

.time {
    color: var(--primary);
    font-weight: 600;
    font-size: 15px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.time-value.is-updated {
    animation: timePulse 0.6s ease;
}

.time-icon {
    font-size: 12px;
    opacity: 0.6;
    color: rgba(242, 247, 255, 0.7);
    transform: translateY(1px);
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.control-row {
    display: flex;
    gap: 14px;
}

.control-btn {
    flex: 1;
    background: linear-gradient(135deg, rgba(25, 69, 114, 0.9), rgba(18, 53, 92, 0.95));
    border: 1px solid rgba(76, 195, 255, 0.2);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    box-shadow: 0 12px 20px rgba(2, 14, 28, 0.45);
    outline: none;
    position: relative;
    overflow: hidden;
}

.control-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.15) 50%, transparent 70%);
    opacity: 0;
    transform: translateX(-60%);
    transition: opacity 0.3s ease, transform 0.6s ease;
}

.control-btn:hover {
    transform: translateY(-3px);
    border-color: rgba(76, 195, 255, 0.45);
    box-shadow: 0 16px 25px rgba(2, 14, 28, 0.5);
}

.control-btn:hover::after {
    opacity: 1;
    transform: translateX(60%);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn:focus,
.control-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 195, 255, 0.25);
}

.arrow-left,
.arrow-right {
    font-size: 18px;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.control-btn:hover .arrow-left {
    opacity: 1;
    transform: translateX(-2px);
}

.control-btn:hover .arrow-right {
    opacity: 1;
    transform: translateX(2px);
}

.control-text {
    flex: 1;
    text-align: center;
    font-size: 15px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 16px;
}

.error {
    text-align: center;
    padding: 40px;
    color: #ff6b6b;
    font-size: 16px;
}

.table-body::-webkit-scrollbar {
    width: 8px;
}

.table-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.table-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
}

.table-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

@keyframes wavePulse {
    0% {
        transform: scaleX(0.96);
        opacity: 0.8;
    }
    50% {
        transform: scaleX(1.04);
        opacity: 1;
    }
    100% {
        transform: scaleX(0.96);
        opacity: 0.85;
    }
}

@keyframes headerGlow {
    0%,
    100% {
        transform: translateY(-6px);
        opacity: 0.6;
    }
    50% {
        transform: translateY(6px);
        opacity: 0.85;
    }
}

@keyframes floatGlow {
    0%,
    100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    50% {
        transform: translateY(18px);
        opacity: 0.9;
    }
}

@keyframes timePulse {
    0% {
        transform: scale(1);
        color: var(--primary);
    }
    50% {
        transform: scale(1.08);
        color: #9be6ff;
    }
    100% {
        transform: scale(1);
        color: var(--primary);
    }
}

@media (max-width: 480px) {
    .header {
        padding: 16px;
        border-radius: 0 0 20px 20px;
    }

    .header-title-main {
        font-size: 20px;
    }

    .header-title-sub {
        font-size: 12px;
    }

    .logo {
        width: 36px;
        height: 36px;
    }

    .container {
        padding: 20px;
        margin: 10px;
    }

    .control-btn {
        padding: 12px 14px;
        font-size: 14px;
    }

    .control-text {
        font-size: 14px;
    }

    .rank,
    .time {
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
