:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
    --background: #f7f8fc;
    --surface: #ffffff;
    --surface-muted: #f0f2f8;
    --text: #17203a;
    --text-muted: #677087;
    --border: #e1e5ef;
    --primary: #4f46e5;
    --primary-dark: #3730a3;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 20rem;
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at 12% 5%, rgba(99, 102, 241, 0.08), transparent 30rem),
        var(--background);
    color: var(--text);
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
}

body > div:first-of-type {
    display: flex;
    flex: 1;
    flex-direction: column;
}

a {
    color: var(--primary-dark);
}

button,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.35);
    outline-offset: 2px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2.25rem, 7vw, 4.5rem);
    letter-spacing: -0.055em;
    line-height: 1.02;
    margin-bottom: 1.4rem;
}

h2 {
    font-size: 1.15rem;
    line-height: 1.35;
}

.page-container {
    margin: 0 auto;
    max-width: 72rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    width: 100%;
}

.narrow-page {
    max-width: 52rem;
    padding-bottom: 5rem;
    padding-top: 5rem;
}

.eyebrow {
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.lead {
    color: var(--text-muted);
    font-size: 1.12rem;
    max-width: 44rem;
}

.hero {
    padding-bottom: 5rem;
    padding-top: clamp(5rem, 12vw, 9rem);
}

.hero h1 {
    max-width: 54rem;
}

.hero__description {
    color: var(--text-muted);
    font-size: clamp(1.05rem, 2.2vw, 1.3rem);
    max-width: 45rem;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 2.2rem;
}

.button {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 2.85rem;
    padding: 0.7rem 1.1rem;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.button:not(:disabled):hover {
    transform: translateY(-1px);
}

.button--primary {
    background: var(--primary);
    color: #fff;
}

.button--primary:not(:disabled):hover {
    background: var(--primary-dark);
}

.button--secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.button--secondary:not(:disabled):hover {
    background: #f4f5ff;
    border-color: #c7caef;
}

.button--compact {
    min-height: 2.45rem;
    padding: 0.5rem 0.85rem;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.feature-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, 1fr);
    padding-bottom: 6rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--border);
    border-radius: 1rem;
    min-height: 12rem;
    padding: 1.5rem;
}

.feature-card__number {
    color: #a0a7b8;
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    margin-bottom: 2.5rem;
}

.feature-card p {
    color: var(--text-muted);
    margin-bottom: 0;
}

.chat-page {
    max-width: 64rem;
    padding-bottom: 5rem;
    padding-top: 3.5rem;
}

.chat-heading {
    align-items: flex-end;
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.chat-heading h1 {
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    margin-bottom: 0.65rem;
}

.chat-heading p {
    color: var(--text-muted);
    margin-bottom: 0;
}

.status-chip {
    align-items: center;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    color: #166534;
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 700;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
}

.status-chip__dot {
    background: #22c55e;
    border-radius: 50%;
    height: 0.45rem;
    width: 0.45rem;
}

.message__answer {
    margin: 0;
}

.lottery-card {
    background: var(--surface);
    border: 1px solid #d9deeb;
    border-radius: 0.85rem;
    color: var(--text);
    overflow: hidden;
}

.lottery-card h3,
.lottery-card h4 {
    margin: 0;
}

.lottery-card__header {
    align-items: flex-start;
    display: flex;
    gap: 1.25rem;
    justify-content: space-between;
    padding: 1rem;
}

.lottery-card__header h3 {
    font-size: 1.25rem;
    line-height: 1.3;
}

.lottery-card__header p {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0.25rem 0 0;
}

.lottery-card__eyebrow {
    color: var(--primary-dark);
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
}

.lottery-card__summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0;
}

.lottery-card__summary div {
    background: var(--surface-muted);
    border-radius: 0.55rem;
    min-width: 6.5rem;
    padding: 0.5rem 0.65rem;
}

.lottery-card__summary dt {
    color: var(--text-muted);
    font-size: 0.67rem;
}

.lottery-card__summary dd {
    font-size: 0.82rem;
    font-weight: 750;
    margin: 0;
}

.lottery-table-wrap {
    border-top: 1px solid var(--border);
}

.lottery-result-table {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}

.lottery-result-table th,
.lottery-result-table td {
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 0.75rem;
    text-align: left;
    vertical-align: middle;
}

.lottery-result-table thead th {
    background: #f8f9fc;
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lottery-result-table th:first-child {
    font-size: 0.78rem;
    width: 7rem;
}

.lottery-result-table tbody tr:last-child th,
.lottery-result-table tbody tr:last-child td {
    border-bottom: 0;
}

.lottery-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
}

.lottery-numbers span,
.ticket-number strong,
.ticket-match__value span,
.payout-summary dd {
    font-variant-numeric: tabular-nums;
}

.lottery-numbers span {
    font-size: clamp(0.9rem, 2.2vw, 1.08rem);
    font-weight: 750;
    letter-spacing: 0.055em;
    white-space: nowrap;
}

.ticket-number {
    background: #eef0ff;
    border-radius: 0.65rem;
    flex: 0 0 auto;
    padding: 0.55rem 0.75rem;
    text-align: right;
}

.ticket-number span {
    color: var(--text-muted);
    display: block;
    font-size: 0.67rem;
}

.ticket-number strong {
    font-size: 1.15rem;
    letter-spacing: 0.08em;
}

.ticket-status {
    background: #f3f4f8;
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
    font-size: 0.88rem;
    font-weight: 750;
    margin: 0;
    padding: 0.7rem 1rem;
}

.ticket-status--matched {
    background: #f0fdf4;
    color: #166534;
}

.ticket-matches {
    border-bottom: 1px solid var(--border);
    padding: 0.9rem 1rem;
}

.ticket-matches h4 {
    font-size: 0.85rem;
    margin-bottom: 0.55rem;
}

.ticket-matches ol {
    display: grid;
    gap: 0.5rem;
    list-style-position: inside;
    margin: 0;
    padding: 0;
}

.ticket-matches li {
    align-items: center;
    background: #f8f9fc;
    border-radius: 0.55rem;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 0.65rem 0.75rem;
}

.ticket-matches li > div:first-child strong,
.ticket-matches li > div:first-child span {
    display: block;
}

.ticket-matches li > div:first-child span {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.ticket-match__value {
    text-align: right;
}

.ticket-match__value span,
.ticket-match__value strong {
    display: block;
    overflow-wrap: anywhere;
}

.ticket-match__value strong {
    font-size: 0.78rem;
}

.payout-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.payout-summary div {
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
}

.payout-summary div:nth-child(odd) {
    border-right: 1px solid var(--border);
}

.payout-summary dt {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.payout-summary dd {
    font-size: 0.88rem;
    font-weight: 750;
    margin: 0.15rem 0 0;
    overflow-wrap: anywhere;
}

.payout-summary__net {
    background: #f4f5ff;
}

.lottery-disclaimer {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin: 0;
    padding: 0.8rem 1rem;
}

.lottery-card--clarification,
.lottery-card--error {
    padding: 1rem;
}

.lottery-card--clarification h3,
.lottery-card--error h3 {
    font-size: 1.05rem;
    margin-bottom: 0.45rem;
}

.lottery-card--clarification p,
.lottery-card--error p {
    margin-bottom: 0.7rem;
}

.clarification-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.clarification-fields li {
    background: #eef0ff;
    border: 1px solid #d6d9f5;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.25rem 0.55rem;
}

.lottery-card__hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 0.7rem 0 0 !important;
}

.lottery-card--error {
    background: #fffaf5;
    border-color: #fed7aa;
}

.lottery-card--error .lottery-card__eyebrow {
    color: #9a3412;
}

.visually-hidden {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.status-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    margin: 2rem 0 1rem;
    overflow: hidden;
}

.status-list div {
    align-items: center;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(9rem, 1fr) 1.5fr;
    padding: 1rem 1.2rem;
}

.status-list div + div {
    border-top: 1px solid var(--border);
}

.status-list dt {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.status-list dd {
    font-weight: 700;
    margin: 0;
}

.status-badge {
    background: #fff7ed;
    border-radius: 999px;
    color: #9a3412;
    display: inline-block;
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
}

.notice {
    background: #eef0ff;
    border-left: 3px solid var(--primary);
    border-radius: 0.5rem;
    color: #373b66;
    padding: 0.9rem 1rem;
}

.request-id {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #16a34a;
}

.invalid {
    outline: 1px solid #dc2626;
}

.validation-message {
    color: #b91c1c;
}

.blazor-error-boundary {
    background: #b91c1c;
    color: #fff;
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "Đã xảy ra lỗi."
}

@media (max-width: 48rem) {
    .page-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .feature-card {
        min-height: auto;
    }

    .feature-card__number {
        margin-bottom: 1.25rem;
    }

    .chat-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 1rem;
    }

    .lottery-card__header,
    .ticket-matches li {
        align-items: stretch;
        flex-direction: column;
    }

    .ticket-number,
    .ticket-match__value {
        text-align: left;
    }

    .lottery-card__summary {
        width: 100%;
    }

    .lottery-card__summary div {
        flex: 1;
    }

    .lottery-result-table th:first-child {
        width: 5.5rem;
    }

    .lottery-result-table th,
    .lottery-result-table td {
        padding: 0.55rem;
    }

    .payout-summary {
        grid-template-columns: 1fr;
    }

    .payout-summary div:nth-child(odd) {
        border-right: 0;
    }

    .status-list div {
        align-items: start;
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
