.lottery-page {
    color: white;
    font-family: Arial, sans-serif;
    color-scheme: dark;
}

.lottery-main {
    align-items: flex-start;
    padding: 100px 1rem 2rem;
}

.lottery-page footer {
    position: static;
    flex-shrink: 0;
}

.lottery-container {
    width: 100%;
    max-width: 760px;
}

.page-heading {
    text-align: center;
    margin-bottom: 1.5rem;
}

.page-heading h1 {
    font-size: clamp(2rem, 6vw, 3rem);
    margin: 0 0 0.75rem;
}

.page-heading p {
    margin: 0.5rem 0;
    line-height: 1.5;
}

.data-status, .field-hint {
    color: #ded9f7;
    font-size: 0.875rem;
}

.load-error {
    color: #ffd3d3;
}

.ticket-panel {
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
}

fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

legend {
    width: 100%;
    padding: 0;
    font-size: 1.2rem;
    font-weight: bold;
}

.selection-count {
    float: right;
    font-size: 1rem;
    font-weight: normal;
    color: #ded9f7;
}

.field-hint {
    margin: 0.5rem 0 1rem;
    line-height: 1.5;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 0.5rem;
}

.number-button {
    min-height: 44px;
    padding: 0.75rem 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.07);
    color: white;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.number-button:hover:not(:disabled):not([aria-pressed="true"]) {
    background: rgba(255, 255, 255, 0.22);
}

.number-button[aria-pressed="true"] {
    background: white;
    border-color: white;
    color: darkslateblue;
}

.number-button:disabled {
    opacity: 0.4;
    cursor: default;
}

.euro-section {
    margin-top: 1.75rem;
}

.euro-grid {
    max-width: 400px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.euro-grid .number-button[aria-pressed="true"] {
    background: #ffe29a;
    border-color: #ffe29a;
    color: #392c06;
}

.ticket-options {
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.filter-control label {
    display: block;
    margin-bottom: 0.5rem;
}

.filter-control select {
    width: 100%;
    max-width: 400px;
    min-height: 44px;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: #483d8b;
    color: white;
    font: inherit;
    cursor: pointer;
}

.actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.settings-button {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
}

.settings-button:hover {
    background: #5d51a1;
}

#settings-panel {
    position: fixed;
    inset: 0 auto auto 0;
    width: min(340px, calc(100% - 2rem));
    max-height: calc(100vh - 6rem);
    margin: 0;
    padding: 1.25rem;
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    background: #362f68;
    color: white;
    box-shadow: 0 8px 32px rgba(15, 10, 35, 0.3);
}

#settings-title {
    margin: 0 0 1rem;
    font-size: 1.125rem;
}

#settings-panel .field-hint {
    margin-bottom: 0;
}

.action-button {
    min-height: 44px;
    padding: 12px 32px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
}

.action-button.primary {
    background: rgba(255, 255, 255, 0.3);
}

.action-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.45);
}

.action-button:disabled {
    opacity: 0.45;
    cursor: default;
}

button:focus-visible, select:focus-visible, a:focus-visible, .results-table-wrap:focus-visible {
    outline: 3px solid #ffe29a;
    outline-offset: 3px;
}

.results-open {
    overflow: hidden;
}

dialog {
    width: min(660px, calc(100% - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    background: #362f68;
    color: white;
    overflow: hidden;
}

dialog[open] {
    display: flex;
    flex-direction: column;
}

dialog > p, .result-ticket {
    flex-shrink: 0;
}

dialog::backdrop {
    background: rgba(15, 10, 35, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
}

.dialog-header h2 {
    margin: 0;
}

.close-button {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font: inherit;
    font-size: 1.75rem;
    cursor: pointer;
}

dialog p {
    line-height: 1.5;
}

.result-ticket {
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
}

.result-ticket p {
    margin: 0.5rem 0;
}

.result-ticket span {
    display: inline-block;
    min-width: 3.5rem;
    color: #ded9f7;
}

#result-euro {
    color: #ffe29a;
}

.results-table-wrap {
    position: relative;
    min-height: 0;
    max-height: 45vh;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

th, td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

th {
    position: sticky;
    top: 0;
    background: #362f68;
}

.sort-button {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
}

.sort-button:hover {
    color: #ffe29a;
}

.sort-icon {
    min-width: 1ch;
    color: #ded9f7;
}

.draw-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.draw-euro {
    margin-top: 0.375rem;
}

.draw-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: #ded9f7;
    font-size: 0.75rem;
    font-weight: bold;
}

.draw-number.match-hit {
    background: white;
    border-color: white;
    color: darkslateblue;
}

.draw-euro .match-hit {
    background: #ffe29a;
    border-color: #ffe29a;
    color: #392c06;
}

.jackpot-row {
    color: #ffe29a;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

[hidden] {
    display: none !important;
}

@supports (height: 100dvh) {
    dialog {
        max-height: calc(100dvh - 2rem);
    }

    #settings-panel {
        max-height: calc(100dvh - 6rem);
    }
}

@media (max-width: 600px) {
    .ticket-panel, dialog {
        padding: 1rem;
    }

    .number-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.375rem;
    }

    .euro-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .actions .action-button {
        flex: 1;
        min-width: 0;
        padding: 12px 16px;
    }

    th, td {
        padding: 0.75rem 0.25rem;
        font-size: 0.875rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .number-button {
        transition: none;
    }
}

@media (max-height: 600px) {
    dialog {
        padding: 1rem;
    }

    dialog > p, .result-ticket {
        margin: 0.5rem 0;
    }

    .result-ticket {
        padding: 0.25rem 0.75rem;
    }

    .result-ticket p {
        margin: 0.25rem 0;
    }

    .results-table-wrap th {
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }

    #match-legend {
        margin-bottom: 0;
    }
}
