* {
    box-sizing: border-box;
}

:root {
    color-scheme: light;
    --bg-color: #eef2f7;
    --surface-color: #ffffff;
    --surface-soft: #f8fafc;
    --text-color: #111827;
    --muted-color: #64748b;
    --border-color: #dbe3ee;
    --shadow-color: rgba(15, 23, 42, 0.12);
    --primary-color: #116a7b;
    --primary-hover: #0e5b6a;
    --primary-text: #ffffff;
    --soft-button: #e8f4f6;
    --soft-button-text: #0f5968;
    --ball-text: #ffffff;
    --yellow-ball: #f5a623;
    --blue-ball: #3478f6;
    --red-ball: #ef4444;
    --gray-ball: #64748b;
    --green-ball: #16a34a;
}

body.dark-mode {
    color-scheme: dark;
    --bg-color: #0f172a;
    --surface-color: #182235;
    --surface-soft: #101827;
    --text-color: #f8fafc;
    --muted-color: #aeb8c7;
    --border-color: #2d3a50;
    --shadow-color: rgba(0, 0, 0, 0.28);
    --primary-color: #2dd4bf;
    --primary-hover: #14b8a6;
    --primary-text: #062923;
    --soft-button: #233449;
    --soft-button-text: #d5eef4;
    --gray-ball: #94a3b8;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(17, 106, 123, 0.16), transparent 32rem),
        var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.2s ease, color 0.2s ease;
}

button {
    min-height: 42px;
    border: 0;
    border-radius: 7px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

button:active {
    transform: translateY(1px);
}

.app-shell {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 32px 20px;
}

.app-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.eyebrow,
.section-label {
    margin: 0 0 6px;
    color: var(--muted-color);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    line-height: 1.2;
}

h1 {
    font-size: clamp(30px, 7vw, 48px);
}

h2 {
    font-size: 22px;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 14px;
    background: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 26px var(--shadow-color);
    white-space: nowrap;
}

.theme-toggle__icon {
    width: 18px;
    color: var(--muted-color);
}

.hero-panel,
.panel {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 18px 40px var(--shadow-color);
}

.hero-panel {
    padding: 24px;
    margin-bottom: 18px;
}

.panel {
    padding: 20px;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
}

.panel-head.compact {
    margin-bottom: 16px;
}

.draw-time,
.history-count {
    color: var(--muted-color);
    font-size: 14px;
    white-space: nowrap;
}

.numbers-container {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 20px;
    margin-bottom: 20px;
    background: var(--surface-soft);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
}

.empty-state {
    margin: 0;
    color: var(--muted-color);
    font-weight: 700;
}

.number {
    display: inline-flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--ball-text);
    font-size: 18px;
    font-weight: 800;
    box-shadow: inset 0 -5px 10px rgba(0, 0, 0, 0.18), 0 8px 16px rgba(15, 23, 42, 0.14);
}

.ball-yellow { background: var(--yellow-ball); }
.ball-blue { background: var(--blue-ball); }
.ball-red { background: var(--red-ball); }
.ball-gray { background: var(--gray-ball); }
.ball-green { background: var(--green-ball); }

.action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.primary-button {
    flex: 1 1 180px;
    padding: 0 20px;
    background: var(--primary-color);
    color: var(--primary-text);
}

.primary-button:hover {
    background: var(--primary-hover);
}

.secondary-button {
    flex: 0 1 160px;
    padding: 0 16px;
    background: var(--soft-button);
    color: var(--soft-button-text);
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 18px;
}

.odds-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 18px;
}

.odds-list div,
.range-item,
.history-item {
    background: var(--surface-soft);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.odds-list div {
    padding: 14px;
}

.odds-list dt {
    margin-bottom: 6px;
    color: var(--muted-color);
    font-size: 13px;
    font-weight: 700;
}

.odds-list dd {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.range-stats {
    display: grid;
    gap: 8px;
}

.range-item {
    display: grid;
    grid-template-columns: 72px 1fr 38px;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--muted-color);
    font-size: 14px;
    font-weight: 700;
}

.range-bar {
    height: 8px;
    overflow: hidden;
    background: var(--border-color);
    border-radius: 999px;
}

.range-bar span {
    display: block;
    height: 100%;
    background: var(--primary-color);
    border-radius: inherit;
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-item {
    display: grid;
    grid-template-columns: 74px 1fr;
    align-items: center;
    gap: 12px;
    padding: 12px;
}

.history-meta {
    color: var(--muted-color);
    font-size: 13px;
    font-weight: 700;
}

.history-balls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.history-balls .number {
    width: 30px;
    height: 30px;
    font-size: 13px;
    box-shadow: inset 0 -3px 7px rgba(0, 0, 0, 0.18);
}

@media (max-width: 760px) {
    .app-shell {
        padding: 22px 14px;
    }

    .app-header,
    .panel-head {
        align-items: stretch;
    }

    .content-grid,
    .odds-list {
        grid-template-columns: 1fr;
    }

    .hero-panel,
    .panel {
        padding: 18px;
    }

    .numbers-container {
        padding: 16px 10px;
    }

    .number {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }

    .secondary-button {
        flex: 1 1 160px;
    }
}
