@font-face {
    font-family: 'Sarabun';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/static/fonts/sarabun/sarabun-400-thai.woff2') format('woff2');
    unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

@font-face {
    font-family: 'Sarabun';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/static/fonts/sarabun/sarabun-400-vietnamese.woff2') format('woff2');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: 'Sarabun';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/static/fonts/sarabun/sarabun-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Sarabun';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/static/fonts/sarabun/sarabun-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Sarabun';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/static/fonts/sarabun/sarabun-500-thai.woff2') format('woff2');
    unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

@font-face {
    font-family: 'Sarabun';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/static/fonts/sarabun/sarabun-500-vietnamese.woff2') format('woff2');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: 'Sarabun';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/static/fonts/sarabun/sarabun-500-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Sarabun';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/static/fonts/sarabun/sarabun-500-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Sarabun';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/static/fonts/sarabun/sarabun-700-thai.woff2') format('woff2');
    unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

@font-face {
    font-family: 'Sarabun';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/static/fonts/sarabun/sarabun-700-vietnamese.woff2') format('woff2');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: 'Sarabun';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/static/fonts/sarabun/sarabun-700-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Sarabun';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/static/fonts/sarabun/sarabun-700-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --bg: #f6f0e8;
    --page-bg-radial: rgb(186 142 111 / 55%);
    --page-bg-start: #f9f1e7;
    --page-bg-mid: #f3e8da;
    --page-bg-end: #f7f3ee;
    --surface: rgba(255, 250, 244, 0.88);
    --surface-strong: #fffaf4;
    --ink: #23160b;
    --muted: #6e5a4c;
    --accent: #b64d1f;
    --accent-deep: #7b2e13;
    --line: rgba(35, 22, 11, 0.12);
    --shadow: 0 18px 45px rgba(75, 34, 8, 0.12);
}

html {
    scrollbar-gutter: stable;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow-y: scroll;
    font-family: "Sarabun", "Noto Sans Thai", "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, var(--page-bg-radial), transparent 30%),
        linear-gradient(180deg, var(--page-bg-start) 0%, var(--page-bg-mid) 48%, var(--page-bg-end) 100%);
    background-attachment: fixed, fixed;
    min-height: 100vh;
}

body.sync-busy {
    overflow: hidden;
}

a {
    color: var(--accent-deep);
}

.page-shell {
    max-width: 1160px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.site-disclaimer {
    margin-top: 36px;
    padding: 18px 22px 0;
    border-top: 1px solid rgba(35, 22, 11, 0.08);
    color: var(--muted);
    text-align: center;
}

.site-disclaimer p {
    max-width: 76ch;
    margin: 0 auto;
    font-size: 0.92rem;
    line-height: 1.65;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    padding: 12px 0 28px;
}

.site-header h1 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 3.4rem);
    line-height: 0.95;
}

.site-header h1 a {
    color: var(--ink);
    text-decoration: none;
}

.site-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.admin-nav-card {
    padding: 14px 18px;
    margin-bottom: 24px;
    background: rgba(255, 250, 244, 0.94);
}

.admin-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    margin-bottom: 12px;
}

.admin-nav-header h3 {
    margin: 0;
    font-size: 1.12rem;
}

.admin-nav-current {
    margin: 0;
    color: var(--muted);
    text-align: right;
    font-size: 0.88rem;
}

.admin-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px 20px;
}

.admin-nav-group {
    display: grid;
    gap: 8px;
}

.admin-nav-group .eyebrow {
    margin-bottom: 0;
}

.admin-nav-links {
    display: grid;
    gap: 8px;
}

.admin-nav-link {
    display: grid;
    gap: 2px;
    align-content: center;
    min-height: 58px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.62);
    color: var(--accent-deep);
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.admin-nav-link-title {
    font-size: 0.95rem;
    line-height: 1.15;
}

.admin-nav-link-meta {
    color: var(--muted);
    font-size: 0.79rem;
    line-height: 1.25;
    font-weight: 500;
}

.admin-nav-link:hover {
    transform: translateY(-1px);
    background: rgba(255, 240, 229, 0.92);
    border-color: rgba(182, 77, 31, 0.24);
}

.admin-nav-link.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 10px 24px rgba(123, 46, 19, 0.16);
}

.admin-nav-link.is-active .admin-nav-link-meta {
    color: rgba(255, 255, 255, 0.86);
}

.nav-inline-form {
    margin: 0;
}

.site-header nav a,
.button-link,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease;
}

.secondary-link {
    background: #e9d8ca;
    color: var(--accent-deep);
}

.secondary-link:hover {
    background: #dbc4b1;
}

.site-header nav a:hover,
.button-link:hover,
button:hover {
    background: var(--accent-deep);
    transform: translateY(-1px);
}

.eyebrow {
    margin: 0 0 6px;
    font-size: 0.82rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash-message {
    border-radius: 18px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
}

.flash-success {
    border-color: rgba(31, 125, 76, 0.28);
    background: rgba(224, 247, 235, 0.92);
}

.flash-error {
    border-color: rgba(170, 47, 47, 0.22);
    background: rgba(255, 232, 228, 0.94);
}

.flash-info {
    border-color: rgba(56, 97, 156, 0.22);
    background: rgba(234, 243, 255, 0.94);
}

.hero,
.card {
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    border-radius: 28px;
}

.hero {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 28px;
    padding: 30px;
    margin-bottom: 28px;
}

.hero h2 {
    margin: 0;
    font-size: clamp(2rem, 3.6vw, 4rem);
    line-height: 0.95;
}

.hero-copy {
    max-width: 58ch;
    margin-top: 14px;
    color: var(--muted);
    font-size: 1.05rem;
}

.hero-panel {
    display: grid;
    gap: 14px;
}

.stat-chip {
    border-radius: 20px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    padding: 18px;
}

.stat-chip .label {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.stat-chip strong {
    font-size: 1.5rem;
}

.card {
    padding: 24px;
    margin-bottom: 24px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    margin-bottom: 18px;
}

.section-heading h2,
.section-heading h3 {
    margin: 0;
    font-size: clamp(1.5rem, 2vw, 2.2rem);
}

.section-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.section-actions form {
    margin: 0;
}

.section-actions .button-link,
.section-actions button {
    white-space: nowrap;
}

.table-wrap {
    overflow-x: auto;
}

.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.pagination-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.pagination-meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.94rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.award-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.random-hero {
    align-items: start;
}

.random-hero h2 {
    font-size: clamp(1.45rem, 2.2vw, 2.4rem);
    line-height: 1;
    max-width: none;
    white-space: nowrap;
}

.random-hero .hero-panel {
    gap: 10px;
}

.random-hero .stat-chip {
    padding: 14px 16px;
    border-radius: 18px;
}

.random-hero .stat-chip .label {
    margin-bottom: 4px;
    font-size: 0.82rem;
}

.random-hero .stat-chip strong {
    font-size: 1.22rem;
    line-height: 1.15;
}

.random-generator-form {
    display: flex;
    align-items: end;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.random-generator-control {
    display: grid;
    gap: 8px;
    font-weight: 700;
}

.random-generator-control select {
    min-width: 150px;
    margin-left: 0;
}

.random-generator-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.random-results-note {
    margin-top: 14px;
}

.random-inline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.random-inline-meta-compact {
    justify-content: flex-end;
    margin-top: 0;
}

.random-inline-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 250, 244, 0.84);
    color: var(--ink);
    font-size: 0.92rem;
}

.random-inline-link {
    color: var(--accent-deep);
    text-decoration: none;
}

.random-inline-link:hover {
    border-color: rgba(182, 77, 31, 0.28);
    background: rgba(182, 77, 31, 0.06);
}

.random-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 18px;
}

.random-result-card {
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 22px;
    background: var(--surface-strong);
    display: grid;
    gap: 18px;
}

.random-result-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
}

.random-card-eyebrow {
    margin-bottom: 8px;
}

.random-result-number {
    margin: 0;
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    line-height: 0.92;
    letter-spacing: 0.08em;
    color: var(--accent-deep);
}

.random-score-badge {
    min-width: 100px;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(182, 77, 31, 0.08);
    display: grid;
    gap: 4px;
    text-align: right;
}

.random-score-badge .label {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
}

.random-score-badge strong {
    font-size: 1.15rem;
    color: var(--accent-deep);
}

.random-result-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.random-result-stat,
.random-signal-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 250, 244, 0.84);
    padding: 12px 14px;
    display: grid;
    gap: 6px;
}

.random-result-stat .label,
.random-signal-card .label {
    color: var(--muted);
    font-size: 0.84rem;
}

.random-result-stat strong,
.random-signal-card strong {
    font-size: 1rem;
}

.random-result-stat-wide {
    grid-column: span 2;
}

.random-signal-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.random-reason-block {
    display: grid;
    gap: 10px;
}

.random-reason-heading {
    margin: 0;
    font-weight: 700;
}

.random-reason-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.random-reason-list li {
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(182, 77, 31, 0.06);
    padding: 10px 12px;
    color: var(--ink);
}

.random-signal-chip {
    display: flex;
    align-items: center;
}

.random-signal-overview {
    margin-top: 18px;
}

.random-signal-chip strong {
    font-size: 1.05rem;
}

.random-summary-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.random-scoring-panel {
    display: grid;
}

.random-scoring-summary {
    cursor: pointer;
    list-style: none;
    align-items: center;
    margin-bottom: 0;
}

.random-scoring-summary::-webkit-details-marker {
    display: none;
}

.random-scoring-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(35, 22, 11, 0.04);
    color: var(--muted);
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.random-scoring-toggle::before {
    content: "+";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -54%);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.random-scoring-panel[open] .random-scoring-toggle::before {
    content: "−";
}

.random-scoring-summary:hover .random-scoring-toggle,
.random-scoring-panel[open] .random-scoring-toggle {
    background: rgba(182, 77, 31, 0.09);
    border-color: rgba(182, 77, 31, 0.18);
    color: var(--accent-deep);
}

.random-scoring-panel[open] .random-scoring-summary {
    margin-bottom: 18px;
}

.random-scoring-body {
    display: grid;
}

.random-backtest-summary-grid {
    margin-bottom: 18px;
}

.random-weight-subheading {
    margin-top: 10px;
}

.random-weight-grid {
    margin-bottom: 18px;
}

.random-weight-chip {
    align-content: start;
    display: grid;
    gap: 10px;
}

.random-weight-chip-inactive {
    opacity: 0.86;
    background: rgba(255, 250, 244, 0.55);
}

.random-weight-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
}

.random-weight-title {
    display: block;
    font-size: 1.05rem;
    line-height: 1.35;
    color: var(--ink);
}

.random-weight-key {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    word-break: break-word;
}

.random-weight-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    background: rgba(35, 22, 11, 0.05);
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 700;
}

.random-weight-badge-positive {
    border-color: rgba(32, 152, 97, 0.25);
    background: rgba(224, 247, 235, 0.94);
    color: #166744;
}

.random-weight-badge-negative {
    border-color: rgba(210, 94, 37, 0.25);
    background: rgba(255, 239, 230, 0.94);
    color: #8d3113;
}

.random-weight-badge-inactive {
    color: var(--muted);
}

.random-weight-description {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.random-weight-meta {
    margin: 0;
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    align-items: baseline;
    color: var(--muted);
    font-size: 0.9rem;
}

.random-backtest-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.random-subheading {
    margin-top: 8px;
}

.random-score-band-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.random-score-band-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 250, 244, 0.8);
    padding: 14px;
    display: grid;
    gap: 10px;
}

.random-score-band-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
}

.random-score-band-head strong {
    font-size: 1rem;
    color: var(--ink);
}

.random-score-band-head span {
    color: var(--muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.random-score-band-bar {
    height: 10px;
}

.random-score-band-fill {
    background: linear-gradient(90deg, #d25e25, #8d3113);
}

.random-band-driver-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.random-band-driver-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 250, 244, 0.8);
    padding: 16px;
    display: grid;
    gap: 12px;
}

.random-band-driver-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.random-band-driver-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(182, 77, 31, 0.05);
    padding: 10px 12px;
}

.random-band-driver-item-muted {
    background: rgba(123, 108, 90, 0.05);
    color: var(--muted);
}

.random-band-driver-label {
    color: var(--ink);
}

.random-band-driver-item-muted .random-band-driver-label,
.random-band-driver-item-muted .random-band-driver-share {
    color: var(--muted);
}

.random-band-driver-share {
    color: var(--accent-deep);
    white-space: nowrap;
}

.random-markov-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.random-markov-card {
    align-content: start;
}

.random-markov-list {
    gap: 10px;
}

.random-backtest-table-wrap {
    margin-top: 4px;
}

.random-backtest-table {
    min-width: 920px;
}

.random-backtest-table th,
.random-backtest-table td {
    white-space: nowrap;
}

.random-backtest-table-number {
    font-weight: 700;
    color: var(--accent-deep);
    letter-spacing: 0.08em;
}

.random-backtest-table-number a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed rgba(33, 52, 39, 0.28);
}

.random-backtest-table-number a:hover {
    border-bottom-color: rgba(33, 52, 39, 0.62);
}

.random-backtest-reason {
    white-space: normal;
    min-width: 300px;
}

.random-pattern-compare-table {
    min-width: 760px;
}

.random-pattern-label {
    font-weight: 700;
    color: var(--ink);
}

.random-delta-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--muted);
    background: rgba(35, 22, 11, 0.04);
}

.random-delta-badge-positive {
    border-color: rgba(32, 152, 97, 0.25);
    background: rgba(224, 247, 235, 0.94);
    color: #166744;
}

.random-delta-badge-negative {
    border-color: rgba(210, 94, 37, 0.25);
    background: rgba(255, 239, 230, 0.94);
    color: #8d3113;
}

.random-delta-badge-neutral {
    color: var(--muted);
}

.random-delta-badge-high {
    border-color: rgba(210, 94, 37, 0.32);
    background: rgba(255, 231, 224, 0.96);
    color: #8d3113;
}

.random-delta-badge-medium {
    border-color: rgba(177, 124, 29, 0.28);
    background: rgba(255, 246, 221, 0.98);
    color: #8a5a06;
}

.random-top-pool-row-high {
    background: rgba(210, 94, 37, 0.045);
}

.random-top-pool-row-medium {
    background: rgba(177, 124, 29, 0.05);
}

.random-backtest-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.84rem;
    color: var(--muted);
    background: rgba(35, 22, 11, 0.04);
}

.random-backtest-badge-hit {
    border-color: rgba(32, 152, 97, 0.25);
    background: rgba(224, 247, 235, 0.94);
    color: #166744;
}

.random-summary-chip {
    height: 100%;
}

.random-note {
    margin: 0;
    color: var(--muted);
}

.award-card {
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 18px;
    background: var(--surface-strong);
}

.draw-award-layout {
    display: grid;
    gap: 22px;
}

.draw-award-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 18px;
}

.draw-award-stack {
    display: grid;
    gap: 18px;
    align-content: start;
}

.draw-award-bottom-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.award-card-featured {
    padding: 22px;
}

.award-card h3 {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 1.1rem;
}

.award-number-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}

.award-number-list li {
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(182, 77, 31, 0.06);
    padding: 12px 14px;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--accent-deep);
}

.filter-panel {
    display: grid;
    gap: 18px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.checkbox-card {
    display: flex;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    border-radius: 18px;
    padding: 14px 16px;
}

.actions-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.stats-search-row {
    display: flex;
    align-items: end;
    gap: 14px;
    flex-wrap: wrap;
}

.stats-search-label {
    display: grid;
    gap: 8px;
    min-width: min(100%, 320px);
    font-weight: 700;
}

.stats-search-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

input[type="date"],
input[type="number"],
input[type="search"],
input[type="text"],
input[type="password"],
select {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 10px;
    background: white;
    margin-left: 8px;
}

.check-prize-form {
    display: grid;
    gap: 14px;
}

.check-prize-form label {
    font-weight: 700;
}

.check-prize-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.check-prize-controls select {
    min-width: min(100%, 320px);
    margin-left: 0;
}

.check-prize-results-layout {
    display: grid;
    gap: 26px;
}

.check-prize-highlight-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.check-prize-secondary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.check-prize-secondary-stack {
    display: grid;
    gap: 22px;
}

.compact-award-card {
    display: grid;
    gap: 18px;
    align-content: start;
    min-height: 100%;
    min-width: 0;
}

.compact-award-card h3 {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.15;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-award-card-featured h3 {
    font-size: 1.05rem;
}

.compact-award-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 22px 10px;
    align-items: center;
}

.compact-award-list-featured {
    display: grid;
    grid-template-columns: max-content;
    justify-content: start;
    justify-items: start;
}

.compact-award-item {
    padding: 0;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--accent-deep);
    line-height: 1;
}

.compact-award-item-featured {
    display: inline-block;
    min-width: 0;
    text-align: left;
    font-size: 1.45rem;
}

.line-award-card {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.line-award-card h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.15;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .compact-award-card h3,
    .compact-award-card-featured h3,
    .line-award-card h3 {
        font-size: 0.82rem;
    }
}

.line-award-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 22px 14px;
    justify-content: flex-start;
}

.line-award-list li {
    min-width: 0;
    text-align: left;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--accent-deep);
    line-height: 1;
}

.stats-search-input {
    min-width: min(100%, 320px);
    width: 100%;
    margin-left: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 10px;
    background: white;
    color: var(--ink);
    font: inherit;
    line-height: 1.35;
    box-shadow: inset 0 1px 2px rgba(35, 22, 11, 0.04);
}

.stats-search-input::placeholder {
    color: rgba(110, 90, 76, 0.72);
}

.stats-search-input:focus {
    outline: none;
    border-color: rgba(182, 77, 31, 0.42);
    box-shadow: 0 0 0 3px rgba(182, 77, 31, 0.12);
}

.three-digit-stats-table th {
    padding: 14px 10px;
    text-align: left;
    vertical-align: bottom;
    border-bottom: 1px solid var(--line);
}

.three-digit-stats-table .stats-col-rank,
.three-digit-stats-table .stats-col-number,
.three-digit-stats-table .stats-col-total {
    text-align: center;
}

.three-digit-stats-table .stats-col-rank {
    width: 88px;
    white-space: nowrap;
}

.three-digit-stats-table .stats-col-number {
    min-width: 132px;
}

.three-digit-stats-table .stats-col-total {
    width: 140px;
    white-space: nowrap;
}

.three-digit-stats-table .stats-col-breakdown {
    min-width: 240px;
}

.three-digit-stats-root {
    display: grid;
    gap: 0;
}

.three-digit-stats-root.stats-loading {
    opacity: 0.72;
    transition: opacity 0.18s ease;
}

.form-card {
    max-width: 680px;
}

.date-form {
    display: grid;
    gap: 14px;
}

.date-form label {
    font-weight: 700;
}

.status-pill {
    display: inline-flex;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid var(--line);
}

.status-pending {
    background: rgba(255, 213, 120, 0.22);
    color: #8a5a06;
}

.status-completed {
    background: rgba(32, 152, 97, 0.18);
    color: #166744;
}

.status-failed {
    background: rgba(190, 71, 57, 0.16);
    color: #8b291e;
}

.status-completed_with_errors {
    background: rgba(177, 124, 29, 0.18);
    color: #825808;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.table-actions form {
    margin: 0;
}

.table-actions a,
.table-actions button {
    font-size: 0.86rem;
    padding: 8px 12px;
}

.table-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.8);
    color: var(--accent-deep);
}

.danger-button {
    background: #842c23;
}

.message-cell {
    max-width: 280px;
    color: var(--muted);
}

.results-note {
    color: var(--muted);
    font-size: 0.95rem;
}

.results-summary {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.98rem;
}

.breakdown-list {
    display: grid;
    gap: 8px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(182, 77, 31, 0.06);
}

.breakdown-label {
    color: var(--ink);
}

.breakdown-count {
    color: var(--accent-deep);
    font-weight: 700;
    white-space: nowrap;
}

.stats-number-main,
.number-cell {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.permutation-members {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.three-digit-stats-table .permutation-members {
    justify-content: center;
}

.permutation-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    background: rgba(35, 22, 11, 0.06);
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
}

.permutation-chip-button {
    border: 1px solid rgba(35, 22, 11, 0.08);
    cursor: pointer;
}

.permutation-chip-button:hover {
    background: rgba(182, 77, 31, 0.12);
}

.permutation-chip-disabled {
    border: 1px dashed rgba(35, 22, 11, 0.14);
    background: rgba(35, 22, 11, 0.03);
    color: rgba(110, 90, 76, 0.62);
    cursor: not-allowed;
    opacity: 0.78;
}

.hidden {
    display: none !important;
}

.support-dock {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 9980;
    width: min(300px, calc(100vw - 92px));
    border: 1px solid rgba(35, 22, 11, 0.14);
    border-radius: 22px;
    background: rgba(255, 250, 241, 0.97);
    box-shadow: 0 14px 36px rgba(35, 22, 11, 0.12);
    padding: 14px 14px 12px;
    display: grid;
    gap: 10px;
}

.support-dock-eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.support-dock-copy {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--ink);
}

.support-dock-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.support-dock-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    width: 100%;
    box-sizing: border-box;
    min-height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(35, 22, 11, 0.12);
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.86rem;
    white-space: normal;
    text-align: center;
    overflow: hidden;
    overflow-wrap: anywhere;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.support-dock-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(35, 22, 11, 0.12);
    background: #fffdf8;
}

.support-dock-link svg {
    width: 16px;
    height: 16px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}
.support-qr-modal {
    width: min(480px, 100%);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
}
.support-qr-body {
    display: grid;
    justify-items: center;
    margin-top: 16px;
}
.support-qr-image {
    display: block;
    width: auto;
    max-width: min(100%, 380px);
    max-height: min(56dvh, 520px);
    height: auto;
    border-radius: 24px;
    box-shadow: 0 20px 42px rgba(35, 22, 11, 0.14);
    background: white;
}
.support-qr-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 160px));
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
}
.support-qr-dismiss,
.support-qr-save {
    width: 100%;
}

.scroll-top-button {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9990;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(35, 22, 11, 0.14);
    border-radius: 999px;
    background: rgba(255, 250, 241, 0.96);
    color: var(--ink);
    box-shadow: 0 10px 24px rgba(35, 22, 11, 0.12);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.scroll-top-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(35, 22, 11, 0.16);
    background: #fffdf7;
}

.scroll-top-button:active {
    transform: translateY(0);
}

.stats-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(35, 22, 11, 0.45);
}

.stats-detail-modal {
    width: min(560px, 100%);
    border-radius: 28px;
    border: 1px solid var(--line);
    background: rgba(255, 249, 242, 0.98);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.18);
    padding: 24px;
}

.stats-detail-close {
    border: none;
}

.search-highlight {
    background: rgba(255, 214, 102, 0.9);
    color: var(--ink);
    padding: 0 2px;
    border-radius: 4px;
}

.first-prize-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.subtab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.subtab-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--accent-deep);
    text-decoration: none;
    font-size: 0.95rem;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.subtab-link:hover {
    background: #efe0d0;
    transform: translateY(-1px);
}

.subtab-link-active {
    border-color: rgba(123, 46, 19, 0.28);
    background: var(--accent);
    color: white;
}

.first-prize-position-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}

.first-prize-position-card {
    margin-bottom: 0;
}
.first-prize-markov-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}
.first-prize-markov-filter {
    display: grid;
    gap: 6px;
    font-weight: 700;
    color: var(--ink);
}
.first-prize-markov-filter span {
    font-size: 0.82rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}
.first-prize-markov-filter select {
    min-width: min(100%, 320px);
    margin-left: 0;
}
.first-prize-markov-card {
    display: grid;
    gap: 14px;
    align-content: start;
}
.first-prize-markov-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
}
.first-prize-markov-head h4 {
    margin: 4px 0 0;
    font-size: 1.05rem;
}
.first-prize-markov-source {
    display: grid;
    gap: 4px;
    justify-items: end;
    text-align: right;
}
.first-prize-markov-source-label {
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}
.first-prize-markov-source strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 42px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(182, 77, 31, 0.08);
    color: var(--accent-deep);
    font-size: 1.15rem;
}
.first-prize-markov-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}
.first-prize-markov-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(182, 77, 31, 0.05);
    padding: 10px 12px;
}
.first-prize-markov-item-hit {
    border-color: rgba(123, 46, 19, 0.28);
    background: linear-gradient(135deg, rgba(210, 94, 37, 0.18), rgba(255, 222, 183, 0.42));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}
.first-prize-markov-digit {
    color: var(--ink);
}
.first-prize-markov-meta {
    color: var(--accent-deep);
    white-space: nowrap;
    font-size: 0.95rem;
}

.next-draw-summary-grid {
    margin-bottom: 20px;
}

.next-draw-history-table {
    min-width: 960px;
}

.next-draw-col-rank {
    width: 72px;
}

.next-draw-history-table td {
    white-space: nowrap;
}

.next-draw-history-date {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
    color: var(--ink);
    font-weight: 600;
}

.next-draw-history-date-stack {
    display: grid;
    gap: 6px;
}

.next-draw-history-date-strong {
    background: rgba(182, 77, 31, 0.1);
    border-color: rgba(123, 46, 19, 0.22);
    color: var(--accent-deep);
}

.next-draw-history-shift-note {
    color: var(--muted);
    font-size: 0.85rem;
}

.next-draw-history-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 140px;
}

.next-draw-history-chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
    color: var(--accent-deep);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.next-draw-history-chip-featured {
    border-color: rgba(123, 46, 19, 0.28);
    background: linear-gradient(135deg, rgba(210, 94, 37, 0.18), rgba(255, 222, 183, 0.42));
}

.next-draw-history-empty {
    color: var(--muted);
}

.public-top50-summary-grid {
    margin-bottom: 20px;
}

.public-top50-table {
    min-width: 900px;
}

.public-top50-number {
    font-weight: 700;
    color: var(--accent-deep);
    letter-spacing: 0.05em;
}

.public-top50-note {
    margin-top: 14px;
}

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

.digit-frequency-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
}

.digit-frequency-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    font-weight: 700;
    color: var(--accent-deep);
}

.digit-frequency-bar {
    position: relative;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(35, 22, 11, 0.08);
}

.digit-frequency-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #d25e25, #8d3113);
}

.digit-frequency-count,
.digit-frequency-percent {
    white-space: nowrap;
    font-size: 0.95rem;
}

.digit-frequency-count {
    font-weight: 700;
    color: var(--accent-deep);
}

.digit-frequency-percent {
    color: var(--muted);
}

.parity-breakdown {
    display: grid;
    gap: 14px;
}

.frequency-summary-card {
    display: grid;
    gap: 10px;
}

.frequency-summary-card .label {
    font-weight: 700;
    color: var(--ink);
}

.frequency-summary-card > strong {
    display: block;
    width: 100%;
    text-align: center;
}

.frequency-summary-card .random-note {
    text-align: center;
}

.drought-summary-card {
    display: grid;
    gap: 10px;
}

.drought-summary-card .label {
    font-weight: 700;
    color: var(--ink);
}

.drought-summary-card > strong {
    display: block;
    width: 100%;
    text-align: center;
}

.drought-summary-card .random-note {
    text-align: center;
}

.parity-summary-card {
    display: grid;
    gap: 10px;
}

.parity-summary-card .label {
    font-weight: 700;
    color: var(--ink);
}

.parity-summary-card > strong {
    display: block;
    width: 100%;
    text-align: center;
}

.parity-compact-breakdown {
    display: grid;
    gap: 10px;
}

.parity-compact-item {
    display: grid;
    gap: 6px;
}

.parity-compact-bar-track {
    position: relative;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(35, 22, 11, 0.08);
}

.parity-compact-bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
}

.parity-item {
    display: grid;
    gap: 8px;
}

.parity-item-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.parity-label {
    font-weight: 700;
    color: var(--ink);
}

.parity-text-even {
    color: #8d3113;
}

.parity-text-odd {
    color: #3d5b0f;
}

.parity-text-neutral {
    color: var(--muted);
}

.level-text-zero {
    color: #41607f;
}

.level-text-low {
    color: #a15714;
}

.level-text-mid {
    color: #567121;
}

.level-text-high {
    color: #8a2a22;
}

.parity-meta {
    color: var(--muted);
    font-size: 0.95rem;
    white-space: nowrap;
}

.parity-fill-even {
    background: linear-gradient(90deg, #d25e25, #8d3113);
}

.parity-fill-odd {
    background: linear-gradient(90deg, #6b7a18, #3d5b0f);
}

.level-fill-zero {
    background: linear-gradient(90deg, #6b8eb1, #41607f);
}

.level-fill-low {
    background: linear-gradient(90deg, #d8893b, #a15714);
}

.level-fill-mid {
    background: linear-gradient(90deg, #8ba641, #567121);
}

.level-fill-high {
    background: linear-gradient(90deg, #cf6251, #8a2a22);
}

.level-fill-pattern {
    background: linear-gradient(90deg, #6b8eb1, #8a2a22);
}

.recent-pattern-cell {
    min-width: 280px;
}

.parity-pattern-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.parity-pattern-token {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    font-weight: 700;
}

.parity-pattern-separator {
    color: var(--muted);
}

.parity-tail-pattern-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.level-tail-pattern-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.parity-tail-pattern-card {
    display: grid;
    gap: 12px;
}

.drought-list {
    display: grid;
    gap: 14px;
}

.drought-item {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 250, 244, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.drought-item-hit {
    border-color: rgba(123, 46, 19, 0.28);
    background: linear-gradient(135deg, rgba(210, 94, 37, 0.18), rgba(255, 222, 183, 0.42));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.drought-digit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    min-width: 38px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    font-weight: 700;
    color: var(--accent-deep);
    font-size: 1rem;
    justify-self: start;
}

.drought-item-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
}

.drought-meta {
    display: grid;
    gap: 8px;
}

.drought-gap {
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    font-size: 0.94rem;
}

.drought-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.drought-average-side {
    font-weight: 600;
    color: var(--muted);
    font-size: 0.9rem;
    white-space: nowrap;
    text-align: right;
}

.drought-last-seen {
    display: inline-block;
    margin-left: auto;
    color: var(--muted);
    font-size: 0.92rem;
    white-space: nowrap;
    text-align: right;
}

.drought-average-label {
    display: inline-block;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    font-size: 0.94rem;
    line-height: 1.2;
}

.drought-single-bar {
    position: relative;
    overflow: visible;
}

.drought-average-marker {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    transform: translateX(-50%);
    background: var(--accent-deep);
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.drought-fill {
    background: linear-gradient(90deg, #7b2e13, #d25e25);
}

.drought-average-bar {
    margin-top: 0;
    height: 12px;
}

.drought-average-fill {
    background: linear-gradient(90deg, #c89d42, #d9b45b);
}

.drought-average-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.drought-history-panel {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 250, 244, 0.58);
    padding: 10px 12px;
}

.drought-history-panel summary {
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-deep);
    list-style: none;
}

.drought-history-panel summary::-webkit-details-marker {
    display: none;
}

.drought-history-panel[open] summary {
    margin-bottom: 10px;
}

.drought-history-list {
    display: grid;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.drought-history-item {
    display: grid;
    grid-template-columns: 114px minmax(0, 1fr) minmax(54px, auto);
    gap: 10px;
    align-items: center;
}

.drought-history-date {
    color: var(--muted);
    font-size: 0.82rem;
    white-space: nowrap;
}

.drought-history-bar {
    height: 8px;
    border-radius: 999px;
    background: rgba(35, 22, 11, 0.08);
    overflow: hidden;
}

.drought-history-fill {
    height: 100%;
    min-width: 10px;
    border-radius: inherit;
    background: linear-gradient(90deg, #8d3113, #d25e25);
}

.drought-history-count {
    color: var(--ink);
    font-size: 0.86rem;
    font-weight: 700;
    white-space: nowrap;
    text-align: right;
}

.empty-state {
    color: var(--muted);
}

@media (max-width: 800px) {
    .site-header,
    .section-heading,
    .hero {
        grid-template-columns: 1fr;
        display: grid;
    }

    .site-header {
        align-items: start;
    }

    .draw-award-top-grid,
    .draw-award-bottom-grid,
    .check-prize-highlight-grid,
    .check-prize-secondary-grid,
    .parity-tail-pattern-grid,
    .random-result-meta-grid,
    .random-signal-grid,
    .random-summary-strip,
    .random-backtest-strip {
        grid-template-columns: 1fr;
    }

    .random-generator-form,
    .random-generator-actions,
    .random-result-head {
        grid-template-columns: 1fr;
        display: grid;
    }

    .random-score-badge {
        text-align: left;
    }

    .random-result-stat-wide {
        grid-column: auto;
    }

    .random-inline-meta-compact {
        justify-content: flex-start;
    }

    .digit-frequency-item {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .first-prize-markov-head,
    .first-prize-markov-item {
        display: grid;
        gap: 8px;
    }

    .first-prize-markov-filter,
    .first-prize-markov-filter select {
        width: 100%;
    }

    .next-draw-history-table {
        min-width: 860px;
    }

    .next-draw-history-cell {
        min-width: 124px;
    }

    .public-top50-table {
        min-width: 760px;
    }

    .first-prize-markov-source {
        justify-items: start;
        text-align: left;
    }

    .drought-item-head,
    .drought-history-item {
        grid-template-columns: 1fr;
        display: grid;
    }

    .drought-last-seen {
        text-align: left;
    }

    .drought-history-item {
        gap: 6px;
    }

    .scroll-top-button {
        right: 16px;
        bottom: 16px;
        width: 44px;
        height: 44px;
    }

    .support-dock {
        left: 16px;
        right: 72px;
        bottom: 16px;
        width: auto;
        padding: 12px;
        border-radius: 18px;
    }

    .support-dock-copy {
        font-size: 0.9rem;
    }

    .random-hero h2 {
        white-space: normal;
    }

    .support-dock-actions {
        grid-template-columns: 1fr;
    }

    .support-qr-modal {
        max-height: calc(100dvh - 20px);
        padding: 16px;
    }

    .support-qr-body {
        margin-top: 12px;
    }

    .support-qr-image {
        max-width: min(100%, 300px);
        max-height: min(48dvh, 360px);
        border-radius: 18px;
    }

    .support-qr-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 14px;
    }

    .site-disclaimer {
        margin-top: 28px;
        padding: 16px 4px 0;
    }

    .site-disclaimer p {
        font-size: 0.88rem;
        line-height: 1.6;
    }
}
