:root {
    --blue: #385d8a;
    --blue-deep: #2f4f78;
    --blue-soft: #4a6f9c;
    --yellow: #f5d76e;
    --text: #2f4f78;
    --muted: #8a8a8a;
    --border: #c9d3df;
    --bg: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Nunito", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(56, 93, 138, 0.08), transparent 40%),
        radial-gradient(circle at bottom right, rgba(245, 215, 110, 0.12), transparent 35%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
}

body.page-history {
    background: #e9ecef;
}

.app-shell {
    width: min(520px, 100%);
    margin: 0 auto;
    padding: 0 16px 40px;
}

.home-pad {
    padding-top: 18px;
}

.page-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 -16px 18px;
    padding: 14px 16px;
    background: var(--blue);
    color: #fff;
    min-height: 52px;
}

.page-topbar__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    flex-shrink: 0;
}

.page-topbar__back:hover {
    background: rgba(255, 255, 255, 0.12);
}

.page-topbar__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.history-2d {
    padding-top: 4px;
}

.history-2d__day {
    margin-bottom: 22px;
}

.history-2d__date {
    width: fit-content;
    margin: 0 auto 14px;
    background: var(--blue);
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    padding: 8px 22px;
    border-radius: 999px;
}

.history-2d__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.history-2d__card {
    background: var(--blue);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(47, 79, 120, 0.18);
    text-align: center;
}

.history-2d__time {
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 10px 8px 8px;
}

.history-2d__number {
    color: #f1d345;
    font-size: 2.15rem;
    font-weight: 900;
    line-height: 1;
    padding: 10px 8px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.app-shell:has(.docs-page) {
    width: min(760px, 100%);
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.brand-row h1 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #222;
}

.badge-new {
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    background: linear-gradient(90deg, #ff4d8d, #8b5cf6, #f5d76e);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-number {
    text-align: center;
    margin: 10px 0 4px;
    font-size: clamp(4.5rem, 18vw, 6.5rem);
    font-weight: 900;
    line-height: 1;
    color: var(--blue-deep);
    letter-spacing: 0.02em;
    display: inline-block;
    width: 100%;
}

.hero-number.pulse {
    animation: number-pop 1s ease;
}

.hero-number.fade-tick {
    animation: number-fade 1s ease-in-out;
}

@keyframes number-pop {
    0% { transform: scale(0.72); opacity: 0.35; }
    45% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes number-fade {
    0% { opacity: 0; }
    25% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0.2; }
}

.hero-meta {
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: #9aa7b8;
    border: 1px solid #d5dde7;
    border-radius: 999px;
    padding: 3px 9px;
}

.live-pill.is-on {
    color: #0f7a3f;
    border-color: #9ed4b4;
    background: #eefaf3;
}

.live-pill.is-on::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: live-pulse 1.4s infinite;
}

@keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.slot-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 22px;
}

.slot-card {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(47, 79, 120, 0.18);
    background: var(--blue-soft);
}

.slot-card__header {
    background: var(--blue);
    color: #fff;
    text-align: center;
    font-weight: 700;
    font-size: 0.98rem;
    padding: 10px 8px;
}

.slot-card.is-live-pending .slot-card__body {
    color: var(--yellow);
}

.slot-card__body {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #5a7eaa 0%, #4d739f 100%);
    color: var(--yellow);
    font-size: 2.4rem;
    font-weight: 900;
}

.slot-card__body.is-waiting {
    font-size: 1.55rem;
    letter-spacing: 0.04em;
    color: #d7e4f5;
}

.slot-card.is-imminent {
    box-shadow: 0 0 0 2px #f5d76e, 0 4px 14px rgba(47, 79, 120, 0.25);
}

.slot-card.is-imminent .slot-card__body {
    color: var(--yellow);
    animation: imminent-blink 0.9s ease infinite;
}

@keyframes imminent-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.slot-card__body.is-live-random {
    color: var(--yellow);
    font-size: 2.4rem;
    animation: live-number-flash 0.35s ease;
}

@keyframes live-number-flash {
    0% { transform: scale(0.92); opacity: 0.55; }
    100% { transform: scale(1); opacity: 1; }
}


.nav-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--blue-deep);
    text-decoration: none;
    font-weight: 800;
    font-size: 0.98rem;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.nav-btn:hover {
    background: #f7fafc;
    border-color: var(--blue);
    transform: translateY(-1px);
}

.nav-btn.is-active {
    border-color: var(--blue);
    background: #eef4fb;
}

.page-title {
    margin: 0 0 16px;
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--blue-deep);
}

.list-card,
.history-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 22px;
}

.history-row,
.holiday-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #edf1f5;
}

.history-row:last-child,
.holiday-row:last-child {
    border-bottom: none;
}

.history-result {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--yellow);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
    background: var(--blue);
    padding: 4px 12px;
    border-radius: 6px;
}

.history-date,
.holiday-date {
    color: var(--muted);
    font-weight: 700;
}

.holiday-name {
    font-weight: 800;
    color: var(--blue-deep);
}

.empty-state {
    padding: 24px 16px;
    text-align: center;
    color: var(--muted);
    font-weight: 700;
}

.nav-btn--wide {
    grid-column: 1 / -1;
}

.docs-page {
    width: min(720px, 100%);
    margin: 0 auto;
}

.docs-lead {
    margin: 0 0 18px;
    color: var(--muted);
    font-weight: 700;
    line-height: 1.45;
}

.docs-card,
.docs-endpoint {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 14px;
}

.docs-h2 {
    margin: 0 0 10px;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--blue-deep);
}

.docs-h3 {
    margin: 10px 0 6px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--blue-deep);
}

.docs-h4 {
    margin: 14px 0 6px;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.docs-desc {
    margin: 0;
    color: #44566d;
    font-weight: 600;
    line-height: 1.45;
}

.docs-list {
    margin: 10px 0 0;
    padding-left: 18px;
    color: #44566d;
    font-weight: 600;
}

.docs-code-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.docs-code {
    flex: 1;
    display: block;
    background: #f3f6fa;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
    overflow-x: auto;
    white-space: nowrap;
}

.docs-copy,
.docs-try {
    border: 1.5px solid var(--blue);
    background: #eef4fb;
    color: var(--blue-deep);
    border-radius: 8px;
    font-weight: 800;
    padding: 0 12px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.docs-pre {
    margin: 8px 0 0;
    background: #1f2d3d;
    color: #e8eef6;
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.45;
}

.docs-note {
    margin: 0 0 8px;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: 8px;
}

.docs-note.ok {
    background: #eefaf3;
    color: #0f7a3f;
}

.docs-note.warn {
    background: #fff7e8;
    color: #9a6700;
}

.docs-muted {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.docs-quick {
    display: grid;
    gap: 8px;
}

.docs-quick-link {
    display: flex;
    gap: 10px;
    align-items: center;
    text-decoration: none;
    color: var(--blue-deep);
    font-weight: 700;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f7fafc;
    border: 1px solid #e5ecf3;
}

.docs-endpoint__head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.docs-endpoint__head code {
    flex: 1;
    font-weight: 700;
    color: var(--blue-deep);
}

.method {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 4px 8px;
    border-radius: 6px;
    background: #385d8a;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.method-get {
    background: #0f7a3f;
}

.docs-group {
    margin-top: 22px;
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.docs-table th,
.docs-table td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid #edf1f5;
    font-weight: 700;
}

.docs-table th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

@media (max-width: 420px) {
    .slot-card__body {
        min-height: 64px;
        font-size: 2rem;
    }

    .nav-btn {
        font-size: 0.9rem;
        min-height: 48px;
    }
}
