* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: #f4f7fc;
    color: #0b1a33;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}
.calculator-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    min-height: 66px;
    padding: 10px 28px;
    background: #fff;
    border-bottom: 1px solid #e7edf5;
}
.calculator-plan {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: .8rem;
    font-weight: 500;
}
.calculator-plan strong { font-size: .85rem; font-style: italic; font-weight: 800; }
.calculator-plan.is-free { color: #16803d; background: #eaf8ef; }
.calculator-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0;
    font-size: 1.325rem;
    font-weight: 700;
    line-height: 1.4;
}
.lottery-title-icon {
    width: 24px;
    height: 17px;
    margin: 0 6px;
    border: 2px solid currentColor;
    border-radius: 4px;
    color: #006acd;
    background:
        radial-gradient(circle at left, #fff 3px, currentColor 3.5px 5px, transparent 5.5px) -2px center / 8px 12px no-repeat,
        radial-gradient(circle at right, #fff 3px, currentColor 3.5px 5px, transparent 5.5px) calc(100% + 2px) center / 8px 12px no-repeat,
        repeating-linear-gradient(currentColor 0 2px, transparent 2px 4px) center / 2px 100% no-repeat;
}
.calculator-open-link {
    align-items: center;
    justify-self: end;
    gap: 6px;
    color: #69798d;
    font-size: .9rem;
    text-decoration: none;
    white-space: nowrap;
}
.calculator-open-link:hover { color: #006acd; }
.calculator-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
    padding: 32px 24px 16px;
}
.calculator-wrapper {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.calculator-layout {
    display: grid;
    grid-template-columns: minmax(0, 420px) minmax(0, 316px);
    gap: 24px;
    width: 100%;
    max-width: 760px;
}
.calculator-card, .calculator-history {
    min-width: 0;
    padding: 24px 20px;
    border: 1px solid #d2dce9;
    border-radius: 24px;
}
.calculator-card {
    padding: 24px 22px 28px;
    border-color: #e5ebf3;
    background: #fff;
    box-shadow: 0 12px 40px rgba(18, 61, 107, .06);
}
.lottery-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    padding: 4px;
    border-radius: 12px;
    background: #f0f4fa;
}
.lottery-tab {
    min-height: 38px;
    padding: 5px 2px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #526682;
    font: inherit;
    font-size: .875rem;
    font-weight: 650;
    cursor: pointer;
}
.lottery-tab:hover { color: #006acd; }
.lottery-tab[aria-selected="true"] { border-color: #d2e3f7; background: #fff; color: #075fac; }
.lottery-form { display: grid; gap: 14px; }
.lottery-description, .lottery-help, .lottery-status, .lottery-empty, .lottery-error { margin: 0; line-height: 1.6; }
.lottery-description { margin-top: 16px; color: #526682; font-size: .875rem; }
.lottery-options, .lottery-position-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.lottery-options > :only-child { grid-column: 1 / -1; }
.lottery-position-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lottery-field { display: grid; align-content: start; gap: 5px; min-width: 0; color: #315d8d; font-size: .875rem; font-weight: 650; }
.lottery-input {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 6px 8px;
    border: 1px solid #d2dce9;
    border-radius: 8px;
    background: #fff;
    color: #0b1a33;
    font: inherit;
    font-size: .9rem;
    font-weight: 400;
}
.lottery-input::placeholder { color: #68788d; }
.lottery-input[aria-invalid="true"] { border-color: #ba343f; }
.lottery-rules { display: grid; gap: 12px; padding: 12px; border-radius: 12px; background: #f4f7fc; }
.lottery-help, .lottery-empty { color: #66758a; font-size: .85rem; }
.lottery-pool { min-width: 0; margin: 0; padding: 0; border: 0; }
.lottery-pool legend { margin-bottom: 6px; padding: 0; color: #0b1a33; font-size: .875rem; font-weight: 650; }
.lottery-actions { align-items: end; }
.lottery-submit {
    min-height: 40px;
    padding: 7px 12px;
    border: 1px solid #006acd;
    border-radius: 8px;
    background: #006acd;
    color: #fff;
    font: inherit;
    font-size: .95rem;
    font-weight: 650;
    cursor: pointer;
}
.lottery-submit:hover { border-color: #0059af; background: #0059af; }
.lottery-error { padding: 8px 10px; border-radius: 8px; background: #fdf1f2; color: #9f2634; font-size: .875rem; }
.lottery-results-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lottery-results-heading h2 { margin: 0; color: #315d8d; font-size: 1rem; font-weight: 650; }
.lottery-copy {
    padding: 5px 8px;
    border: 1px solid #d2dce9;
    border-radius: 7px;
    background: #fff;
    color: #075fac;
    font: inherit;
    font-size: .85rem;
    white-space: nowrap;
    cursor: pointer;
}
.lottery-copy:not(:disabled):hover { border-color: #9bcafa; background: #edf5ff; }
.lottery-copy:disabled { opacity: .55; cursor: default; }
.lottery-status { color: #526682; font-size: .85rem; }
.lottery-status:not(:empty), .lottery-empty { margin-top: 12px; }
.lottery-results {
    max-height: 340px;
    margin: 8px 0 0;
    padding: 0 2px 0 1.5rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.lottery-result-row { padding: 8px 0; border-bottom: 1px solid #dce4ef; }
.lottery-result-row:last-child { border-bottom: 0; }
.lottery-result-row::marker { color: #526682; font-size: .75rem; font-variant-numeric: tabular-nums; }
.lottery-ball-group { display: inline-flex; flex-wrap: wrap; gap: 3px; max-width: 100%; vertical-align: middle; }
.lottery-ball-group.is-secondary { margin-left: 7px; padding-left: 7px; border-left: 1px solid #c6d4e7; }
.lottery-ball {
    display: grid;
    place-items: center;
    width: 21px;
    height: 24px;
    border-radius: 50%;
    background: #fae9ed;
    color: #a0263b;
    font-size: .75rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}
.lottery-ball-group.is-secondary .lottery-ball { background: #dfedff; color: #075fac; }
.calculator-open-link:focus-visible, .lottery-tab:focus-visible, .lottery-input:focus-visible, .lottery-submit:focus-visible, .lottery-copy:focus-visible {
    outline: 3px solid #8ec7ff;
    outline-offset: 2px;
}
.calculator-tips {
    width: 100%;
    max-width: 760px;
    padding: 18px 16px 0;
    border-top: 1px solid #eef2f8;
    color: #66758a;
    font-size: .9rem;
    line-height: 1.8;
    text-align: center;
}
.calculator-tips p { margin: 0; }
@media (max-width: 767.98px) {
    .calculator-header { padding: 8px 16px; gap: 10px; }
    .calculator-plan { padding: 5px 8px; font-size: .72rem; }
    .calculator-title { gap: 7px; font-size: 1.175rem; }
    .calculator-open-link { font-size: .8rem; }
    .calculator-main { padding: 24px 16px 16px; gap: 20px; }
}
@media (max-width: 675.98px) {
    .calculator-layout { max-width: 420px; grid-template-columns: minmax(0, 1fr); gap: 16px; }
}
@media (max-width: 575.98px) {
    .calculator-header { grid-template-columns: minmax(0, 1fr) auto; }
    .calculator-title { grid-column: 1 / -1; grid-row: 1; }
    .calculator-plan { grid-column: 1; grid-row: 2; }
    .calculator-open-link { grid-column: 2; grid-row: 2; }
    .calculator-card, .calculator-history { padding: 16px; border-radius: 22px; }
    .calculator-tips { padding: 18px 12px 0; font-size: .8rem; }
}
@media (max-width: 375.98px) {
    .lottery-position-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
