:root {
    --blue-950: #031246;
    --blue-900: #071d69;
    --blue-800: #0a2c91;
    --blue-700: #1244c5;
    --blue-600: #1762ed;
    --blue-100: #eaf1ff;

    --yellow-500: #ffc400;
    --yellow-400: #ffd43b;
    --yellow-300: #ffe477;

    --white: #ffffff;
    --surface: #f6f8ff;
    --surface-2: #eef2ff;

    --text: #111b42;
    --muted: #687198;
    --border: #dde3f3;

    --success: #0f9f4a;
    --danger: #d83b3b;

    --shadow:
        0 20px 55px rgba(3, 18, 70, 0.14);

    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    font-family:
        Arial,
        Helvetica,
        sans-serif;
    color: var(--text);
    background:
        radial-gradient(
            circle at 10% 0%,
            rgba(255, 196, 0, 0.18),
            transparent 25%
        ),
        linear-gradient(
            180deg,
            var(--blue-950) 0,
            var(--blue-900) 360px,
            var(--surface) 360px,
            var(--surface) 100%
        );
}

button,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.site-shell {
    min-height: 100vh;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    color: var(--white);
    background: rgba(3, 18, 70, 0.94);
    border-bottom:
        1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(14px);
}

.header-inner {
    width: min(1160px, calc(100% - 32px));
    min-height: 76px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 900;
    color: var(--blue-950);
    background:
        linear-gradient(
            135deg,
            var(--yellow-500),
            var(--yellow-300)
        );
    box-shadow:
        0 10px 25px rgba(255, 196, 0, 0.25);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.brand-text strong {
    font-size: 18px;
}

.brand-text span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 13px;
    border:
        1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
}

.live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--yellow-500);
    box-shadow:
        0 0 0 5px rgba(255, 196, 0, 0.15);
    animation: pulse 1.6s infinite;
}

.live-indicator.is-online .live-dot {
    background: #35e67a;
    box-shadow:
        0 0 0 5px rgba(53, 230, 122, 0.16);
}

.live-indicator.is-error .live-dot {
    background: #ff5757;
    box-shadow:
        0 0 0 5px rgba(255, 87, 87, 0.16);
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(0.75);
        opacity: 0.6;
    }
}

.main-content {
    width: min(1160px, calc(100% - 32px));
    margin: 0 auto;
    padding-bottom: 70px;
}

.hero {
    position: relative;
    min-height: 275px;
    padding: 55px 0 45px;
    display: flex;
    align-items: center;
    overflow: hidden;
    color: var(--white);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 700px;
}

.eyebrow,
.section-label {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.4px;
    color: var(--yellow-500);
}

.hero h1 {
    max-width: 680px;
    margin: 0 0 16px;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.05;
    letter-spacing: -1.8px;
}

.hero p {
    max-width: 650px;
    margin: 0;
    font-size: 17px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.76);
}

.hero-decoration {
    position: absolute;
    right: 20px;
    bottom: 15px;
    width: 280px;
    height: 220px;
    opacity: 0.55;
}

.hero-decoration span {
    position: absolute;
    display: block;
    border-radius: 50%;
    border: 2px solid rgba(255, 196, 0, 0.4);
}

.hero-decoration span:nth-child(1) {
    width: 190px;
    height: 190px;
    right: 0;
    bottom: 0;
}

.hero-decoration span:nth-child(2) {
    width: 130px;
    height: 130px;
    right: 30px;
    bottom: 30px;
}

.hero-decoration span:nth-child(3) {
    width: 70px;
    height: 70px;
    right: 60px;
    bottom: 60px;
    background: rgba(255, 196, 0, 0.18);
}

.toolbar-card,
.result-card,
.history-card,
.information-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: var(--shadow);
}

.toolbar-card {
    position: relative;
    z-index: 4;
    margin-bottom: 24px;
    padding: 20px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

.market-control {
    width: min(100%, 440px);
}

.market-control label {
    display: block;
    margin-bottom: 9px;
    font-size: 13px;
    font-weight: 800;
    color: var(--muted);
}

.market-control select {
    width: 100%;
    height: 50px;
    padding: 0 45px 0 15px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    color: var(--text);
    background: var(--surface);
}

.market-control select:focus {
    border-color: var(--blue-600);
    box-shadow:
        0 0 0 4px rgba(23, 98, 237, 0.12);
}

.refresh-button {
    min-height: 50px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    border-radius: 12px;
    font-weight: 800;
    color: var(--blue-950);
    background:
        linear-gradient(
            135deg,
            var(--yellow-500),
            var(--yellow-300)
        );
    box-shadow:
        0 10px 20px rgba(255, 196, 0, 0.2);
}

.refresh-button:hover {
    transform: translateY(-1px);
}

.refresh-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.refresh-icon {
    font-size: 21px;
}

.refresh-button.is-loading .refresh-icon {
    animation: rotate 0.8s linear infinite;
}

@keyframes rotate {
    to {
        transform: rotate(360deg);
    }
}

.result-card {
    margin-bottom: 24px;
    overflow: hidden;
}

.result-card-head {
    padding: 24px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-bottom: 1px solid var(--border);
}

.result-card-head h2,
.section-heading h2,
.information-card h2 {
    margin: 0;
    font-size: 25px;
}

.result-badge {
    padding: 8px 13px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--white);
    background: var(--success);
}

.result-main {
    padding: 42px 25px;
    text-align: center;
    background:
        radial-gradient(
            circle at center,
            rgba(23, 98, 237, 0.08),
            transparent 55%
        ),
        var(--surface);
}

.number-label {
    margin-bottom: 18px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1.6px;
    color: var(--muted);
}

.number-display {
    display: flex;
    justify-content: center;
    gap: clamp(8px, 2vw, 16px);
}

.number-digit {
    width: clamp(61px, 11vw, 96px);
    height: clamp(78px, 13vw, 116px);
    display: grid;
    place-items: center;
    border:
        2px solid rgba(255, 255, 255, 0.18);
    border-radius: 19px;
    font-size: clamp(41px, 8vw, 70px);
    font-weight: 900;
    line-height: 1;
    color: var(--yellow-500);
    background:
        linear-gradient(
            150deg,
            var(--blue-700),
            var(--blue-950)
        );
    box-shadow:
        0 18px 32px rgba(3, 18, 70, 0.25),
        inset 0 1px rgba(255, 255, 255, 0.16);
    text-shadow:
        0 4px 10px rgba(0, 0, 0, 0.32);
}

.result-information {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.information-item {
    min-height: 98px;
    padding: 21px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    text-align: center;
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.information-item:last-child {
    border-right: 0;
}

.information-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

.information-item strong {
    font-size: 16px;
    overflow-wrap: anywhere;
}

.history-card {
    margin-bottom: 24px;
    padding: 26px;
}

.section-heading {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.history-count {
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    color: var(--blue-700);
    background: var(--blue-100);
}

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.history-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 16px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.history-table th {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: var(--blue-950);
    background:
        linear-gradient(
            135deg,
            var(--yellow-500),
            var(--yellow-300)
        );
}

.history-table td {
    font-size: 14px;
}

.history-table tbody tr:last-child td {
    border-bottom: 0;
}

.history-table tbody tr:hover {
    background: var(--surface);
}

.history-number {
    display: inline-block;
    min-width: 90px;
    padding: 8px 12px;
    border-radius: 9px;
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--yellow-500);
    background: var(--blue-900);
}

.table-state {
    padding: 30px;
    color: var(--muted);
}

.pagination {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

.pagination button {
    min-height: 42px;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-weight: 700;
    color: var(--blue-800);
    background: var(--white);
}

.pagination button:hover:not(:disabled) {
    border-color: var(--blue-600);
    background: var(--blue-100);
}

.pagination button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

#pageInformation {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

.information-card {
    padding: 27px;
}

.information-card > p {
    max-width: 850px;
    margin: 12px 0 24px;
    line-height: 1.75;
    color: var(--muted);
}

.information-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.information-grid div {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
}

.information-grid strong {
    font-size: 14px;
}

.information-grid span {
    font-size: 13px;
    color: var(--muted);
}

.site-footer {
    color: rgba(255, 255, 255, 0.72);
    background: var(--blue-950);
}

.footer-inner {
    width: min(1160px, calc(100% - 32px));
    min-height: 88px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    font-size: 13px;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 100;
    max-width: min(380px, calc(100% - 40px));
    padding: 14px 17px;
    border-radius: 12px;
    color: var(--white);
    background: var(--blue-950);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: 0.25s ease;
}

.toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.toast.is-error {
    background: var(--danger);
}

@media (max-width: 850px) {
    .result-information {
        grid-template-columns: repeat(2, 1fr);
    }

    .information-item:nth-child(2) {
        border-right: 0;
    }

    .information-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    body {
        background:
            linear-gradient(
                180deg,
                var(--blue-950) 0,
                var(--blue-900) 310px,
                var(--surface) 310px
            );
    }

    .header-inner,
    .main-content,
    .footer-inner {
        width: min(100% - 22px, 1160px);
    }

    .header-inner {
        min-height: 68px;
    }

    .brand-text span {
        display: none;
    }

    .live-indicator {
        padding: 8px 10px;
        font-size: 11px;
    }

    .hero {
        min-height: 225px;
        padding: 36px 0;
    }

    .hero h1 {
        font-size: 35px;
        letter-spacing: -1px;
    }

    .hero p {
        font-size: 15px;
    }

    .hero-decoration {
        display: none;
    }

    .toolbar-card {
        padding: 15px;
        align-items: stretch;
        flex-direction: column;
    }

    .market-control {
        width: 100%;
    }

    .refresh-button {
        width: 100%;
    }

    .result-card-head,
    .history-card,
    .information-card {
        padding: 20px;
    }

    .result-main {
        padding: 32px 12px;
    }

    .number-display {
        gap: 7px;
    }

    .number-digit {
        width: min(20vw, 74px);
        height: min(25vw, 92px);
        border-radius: 14px;
        font-size: min(14vw, 56px);
    }

    .result-information {
        grid-template-columns: 1fr;
    }

    .information-item,
    .information-item:nth-child(2) {
        border-right: 0;
    }

    .section-heading {
        align-items: flex-start;
    }

    .pagination {
        gap: 8px;
    }

    .pagination button {
        padding: 0 10px;
        font-size: 12px;
    }

    .footer-inner {
        padding: 20px 0;
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
    }

    .footer-inner p {
        margin: 0;
    }
}