.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.webapp-page {
  --game-accent: #16a8d4;
  --game-accent-strong: #087ba7;
  --game-soft: #e9f8fc;
  --game-contrast: #071d55;
  background:
    radial-gradient(circle at 8% 3%, color-mix(in srgb, var(--game-accent) 12%, transparent), transparent 31rem),
    var(--surface);
}

.webapp-page.game-euromillions {
  --game-accent: #f5b71b;
  --game-accent-strong: #a86900;
  --game-soft: #fff8dc;
  --game-contrast: #071d55;
}

.webapp-page.game-eurodreams {
  --game-accent: #8f43d6;
  --game-accent-strong: #6324a5;
  --game-soft: #f6edff;
  --game-contrast: #fff;
}

.webapp-header { max-width: 1180px; }
.webapp-main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 72px 0 90px; }
.webapp-intro { display: flex; align-items: end; justify-content: space-between; gap: 45px; }
.webapp-intro h1 { max-width: 780px; font-size: clamp(2.9rem, 6vw, 5.35rem); }
.webapp-intro h1 em { color: var(--game-accent-strong); }
.webapp-intro .lead { max-width: 720px; }
.freshness-card { display: flex; flex: none; align-items: center; gap: 12px; min-width: 240px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.88); box-shadow: 0 10px 30px rgba(7,29,85,.07); }
.freshness-card div { display: flex; flex-direction: column; }
.freshness-card strong { color: var(--navy-900); font-size: .86rem; }
.freshness-card small { color: var(--muted); font-size: .72rem; }
.freshness-dot { width: 10px; height: 10px; border-radius: 50%; background: #21a86b; box-shadow: 0 0 0 6px rgba(33,168,107,.13); }

.game-picker { margin-top: 62px; }
.section-mini-heading h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); }
.section-mini-heading .eyebrow { margin-bottom: 8px; }
.game-picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 24px; }
.game-choice { display: flex; min-width: 0; align-items: center; gap: 16px; padding: 17px; border: 1px solid var(--line); border-radius: 22px; background: #fff; color: var(--ink); font: inherit; text-align: left; cursor: pointer; box-shadow: 0 8px 28px rgba(7,29,85,.05); transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.game-choice:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(7,29,85,.1); }
.game-choice:focus-visible, .app-navigation button:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid color-mix(in srgb, var(--game-accent) 55%, white); outline-offset: 3px; }
.game-choice.active { border-color: var(--game-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--game-accent) 16%, transparent), 0 14px 36px rgba(7,29,85,.1); }
.game-choice img { flex: none; border-radius: 17px; box-shadow: 0 8px 18px rgba(7,29,85,.14); }
.game-choice span { display: flex; min-width: 0; flex-direction: column; line-height: 1.2; }
.game-choice small { color: var(--blue); font-size: .58rem; font-weight: 900; letter-spacing: .1em; }
.game-choice strong { margin-top: 4px; color: var(--navy-900); font-size: 1.08rem; }
.game-choice em { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: .73rem; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.euromillions-choice small { color: #a86900; }
.eurodreams-choice small { color: var(--purple); }

.app-navigation { position: sticky; z-index: 15; top: 88px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 28px; padding: 6px; border: 1px solid rgba(220,226,239,.9); border-radius: 20px; background: rgba(255,255,255,.9); box-shadow: 0 12px 34px rgba(7,29,85,.09); backdrop-filter: blur(16px); }
.app-navigation button { display: flex; min-width: 0; min-height: 48px; align-items: center; justify-content: center; gap: 8px; padding: 8px 12px; border: 0; border-radius: 15px; background: transparent; color: var(--muted); font: inherit; font-size: .84rem; font-weight: 800; cursor: pointer; }
.app-navigation button.active { background: var(--navy-900); color: #fff; box-shadow: 0 6px 16px rgba(7,29,85,.2); }
.app-navigation button > span:first-child { display: inline-grid; min-width: 21px; height: 21px; place-items: center; color: var(--game-accent); font-size: 1rem; font-weight: 900; }
.app-navigation button.active > span:first-child { color: color-mix(in srgb, var(--game-accent) 70%, white); }
.app-navigation b { display: inline-grid; min-width: 18px; height: 18px; padding: 0 5px; place-items: center; border-radius: 999px; background: var(--game-soft); color: var(--game-accent-strong); font-size: .64rem; }
.mini-bars { grid-template-columns: repeat(3, 3px); align-items: end; gap: 2px; }
.mini-bars i { width: 3px; border-radius: 3px; background: currentColor; }
.mini-bars i:nth-child(1) { height: 7px; }.mini-bars i:nth-child(2) { height: 13px; }.mini-bars i:nth-child(3) { height: 18px; }

.app-status { min-height: 24px; margin: 18px 2px 0; color: var(--muted); font-size: .8rem; }
.app-status.error { padding: 11px 14px; border: 1px solid #ffcbd2; border-radius: 13px; background: #fff0f2; color: #a31229; }
.app-status.success { color: #137548; }
.app-view { padding-top: 25px; }
.view-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 24px; }
.view-heading .eyebrow { margin-bottom: 8px; }
.view-heading h2 { font-size: clamp(1.9rem, 4vw, 3rem); }
.view-heading h2 span { color: var(--game-accent-strong); }
button { -webkit-tap-highlight-color: transparent; }
.primary-button, .secondary-button, .danger-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 7px; padding: 10px 17px; border-radius: 13px; font: inherit; font-size: .82rem; font-weight: 850; cursor: pointer; transition: transform .18s ease, opacity .18s ease, background .18s ease; }
.primary-button { border: 1px solid var(--navy-900); background: var(--navy-900); color: #fff; box-shadow: 0 8px 20px rgba(7,29,85,.17); }
.secondary-button { border: 1px solid var(--line); background: #fff; color: var(--navy-900); }
.danger-button { border: 1px solid #ffd0d6; background: #fff5f6; color: #b51e32; }
.primary-button:hover, .secondary-button:hover, .danger-button:hover { transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled, .mode-picker button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.loading-card { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.loading-card span { height: 210px; border-radius: 24px; background: linear-gradient(100deg, #edf0f6 25%, #fafbfe 42%, #edf0f6 60%); background-size: 300% 100%; animation: loading 1.4s infinite; }
@keyframes loading { from { background-position: 100% 0; } to { background-position: 0 0; } }
.results-overview { display: grid; grid-template-columns: .82fr 1.18fr; gap: 18px; }
.result-panel { padding: 28px; border: 1px solid var(--line); border-radius: 26px; background: #fff; box-shadow: 0 14px 42px rgba(7,29,85,.055); }
.next-panel { position: relative; overflow: hidden; border: 0; background: linear-gradient(135deg, var(--game-accent-strong), var(--game-accent)); color: var(--game-contrast); }
.next-panel::after { position: absolute; right: -60px; bottom: -80px; width: 220px; height: 220px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; content: ""; }
.next-panel .card-kicker, .next-panel .result-date, .next-panel .jackpot-label { color: inherit; opacity: .82; }
.next-panel h3 { max-width: 370px; margin: 12px 0 4px; color: inherit; font-size: clamp(1.7rem, 4vw, 2.65rem); line-height: 1.05; }
.jackpot-label { display: block; margin-top: 40px; font-size: .64rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.jackpot-value { display: block; margin-top: 3px; font-size: clamp(1.35rem, 3vw, 2.15rem); font-weight: 900; letter-spacing: -.03em; }
.card-kicker { color: var(--game-accent-strong); font-size: .64rem; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.result-panel-header { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.result-panel h3 { margin: 8px 0 0; font-size: 1.25rem; }
.result-date { color: var(--muted); font-size: .78rem; }
.balls { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.ball { display: inline-grid; width: 45px; height: 45px; place-items: center; border: 1px solid color-mix(in srgb, var(--game-accent) 36%, white); border-radius: 50%; background: var(--game-soft); color: var(--navy-900); font-size: .95rem; font-weight: 900; box-shadow: inset 0 -5px 11px rgba(7,29,85,.06); }
.ball.bonus { border-color: transparent; background: var(--game-accent); color: var(--game-contrast); }
.bonus-group { display: flex; align-items: center; gap: 12px; margin-top: 14px; color: var(--muted); font-size: .75rem; font-weight: 750; }
.bonus-group .balls { margin: 0; }
.result-extras { display: grid; gap: 9px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.result-extras strong { color: var(--navy-900); }
.result-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.result-links a, .result-links button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--blue); font: inherit; font-size: .75rem; font-weight: 800; text-decoration: none; cursor: pointer; }
.history-section { margin-top: 38px; }
.history-section h3 { margin: 0 0 18px; font-size: 1.35rem; }
.history-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.history-card { padding: 22px; border: 1px solid var(--line); border-radius: 21px; background: #fff; }
.history-card .balls { margin-top: 15px; }
.history-card .ball { width: 37px; height: 37px; font-size: .8rem; }
.history-card h4 { margin: 4px 0 0; color: var(--navy-900); font-size: .95rem; }
.history-card details { margin-top: 15px; font-size: .76rem; }
.history-card summary { color: var(--blue); font-weight: 800; cursor: pointer; }
.payout-table { width: 100%; margin-top: 10px; border-collapse: collapse; color: var(--muted); font-size: .72rem; }
.payout-table td { padding: 6px 0; border-top: 1px solid var(--line); }
.payout-table td:last-child { text-align: right; }

.generator-layout { display: grid; grid-template-columns: .95fr 1.05fr; gap: 18px; align-items: start; }
.generated-card, .setting-card { border: 1px solid var(--line); border-radius: 25px; background: #fff; box-shadow: 0 14px 42px rgba(7,29,85,.055); }
.generated-card { position: sticky; top: 164px; min-height: 300px; padding: 30px; }
.generated-grid { display: flex; min-height: 145px; flex-direction: column; justify-content: center; }
.generated-grid.empty { align-items: center; color: var(--muted); text-align: center; }
.generated-grid .balls { margin-top: 12px; }
.generated-grid .ball { width: 53px; height: 53px; font-size: 1.05rem; }
.generated-grid .bonus-group .ball { width: 47px; height: 47px; }
.generated-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.generator-settings { display: grid; gap: 18px; }
.setting-card { padding: 26px; }
.setting-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.setting-heading h3 { margin: 0; font-size: 1.12rem; }
.setting-heading p { margin: 4px 0 0; color: var(--muted); font-size: .78rem; }
.setting-heading > span { padding: 5px 9px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .6rem; font-weight: 850; text-transform: uppercase; }
.favorite-form { margin-top: 20px; }
.favorite-form label { display: block; color: var(--muted); font-size: .72rem; font-weight: 750; }
.favorite-form > div { display: flex; gap: 9px; margin-top: 7px; }
.favorite-form input, .statistics-controls select { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--navy-900); font: inherit; }
.favorite-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 29px; margin-top: 15px; }
.favorite-list small { color: var(--muted); }
.favorite-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px 6px 11px; border: 1px solid color-mix(in srgb, var(--game-accent) 35%, white); border-radius: 999px; background: var(--game-soft); color: var(--navy-900); font-size: .75rem; font-weight: 850; }
.favorite-chip button { display: grid; width: 18px; height: 18px; padding: 0; place-items: center; border: 0; border-radius: 50%; background: rgba(7,29,85,.12); color: var(--navy-900); cursor: pointer; }
.switch-heading { align-items: center; }
.switch { position: relative; display: inline-block; flex: none; width: 48px; height: 28px; }
.switch input { width: 0; height: 0; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #cdd3df; cursor: pointer; transition: background .2s ease; }
.switch span::before { position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: white; box-shadow: 0 2px 6px rgba(7,29,85,.2); content: ""; transition: transform .2s ease; }
.switch input:checked + span { background: var(--game-accent-strong); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--game-accent) 55%, white); outline-offset: 3px; }
.mode-label { margin: 22px 0 9px; color: var(--navy-900); font-size: .76rem; font-weight: 800; }
.mode-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.mode-picker button { min-height: 48px; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--navy-900); font: inherit; font-size: .7rem; font-weight: 850; cursor: pointer; }
.mode-picker button.active { border-color: var(--game-accent); background: var(--game-soft); color: var(--game-accent-strong); }
.responsible-copy { margin: 14px 0 0; color: var(--muted); font-size: .68rem; }

.statistics-heading-row { align-items: start; }
.statistics-controls { display: flex; gap: 10px; }
.statistics-controls label { min-width: 170px; color: var(--muted); font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.statistics-controls select { display: block; margin-top: 5px; color: var(--navy-900); font-size: .78rem; font-weight: 700; text-transform: none; }
.statistics-meta { margin: -8px 0 19px; color: var(--muted); font-size: .75rem; }
.statistics-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 11px; }
.stat-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; min-height: 92px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.stat-card .ball { width: 42px; height: 42px; }
.stat-card strong { display: block; color: var(--navy-900); font-size: .79rem; }
.stat-card small { display: block; color: var(--muted); font-size: .65rem; line-height: 1.35; }
.responsible-panel { margin: 20px 0 0; padding: 17px 20px; border: 1px solid #eddca0; border-radius: 16px; background: #fffbeb; color: #6d654c; font-size: .76rem; }

.saved-grid-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.saved-card { padding: 22px; border: 1px solid var(--line); border-radius: 21px; background: #fff; }
.saved-card header { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.saved-card h3 { margin: 0; font-size: 1rem; }
.saved-card time { color: var(--muted); font-size: .68rem; }
.saved-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.empty-state { grid-column: 1 / -1; padding: 55px 26px; border: 1px dashed #cfd6e4; border-radius: 24px; background: rgba(255,255,255,.65); text-align: center; }
.empty-state strong { display: block; color: var(--navy-900); font-size: 1.1rem; }
.empty-state p { margin: 7px auto 0; color: var(--muted); font-size: .83rem; }
.webapp-notice { margin-top: 65px; margin-bottom: 0; }

@media (max-width: 980px) {
  .webapp-intro { align-items: start; flex-direction: column; }
  .freshness-card { min-width: min(100%, 330px); }
  .game-picker-grid { grid-template-columns: 1fr; }
  .game-choice em { white-space: normal; }
  .results-overview, .generator-layout { grid-template-columns: 1fr; }
  .generated-card { position: static; }
  .statistics-heading-row { flex-direction: column; align-items: stretch; }
  .statistics-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
  .webapp-header .header-cta { display: none; }
  .webapp-main { width: min(100% - 28px, 1180px); padding-top: 54px; }
  .webapp-intro h1 { font-size: clamp(2.7rem, 13vw, 4rem); }
  .game-picker { margin-top: 46px; }
  .game-choice { padding: 13px; border-radius: 18px; }
  .game-choice img { width: 52px; height: 52px; border-radius: 14px; }
  .app-navigation { top: 73px; margin-right: -7px; margin-left: -7px; overflow-x: auto; grid-template-columns: repeat(4, minmax(84px, 1fr)); border-radius: 16px; scrollbar-width: none; }
  .app-navigation::-webkit-scrollbar { display: none; }
  .app-navigation button { min-height: 51px; flex-direction: column; gap: 1px; padding: 5px; font-size: .64rem; }
  .app-navigation button > span:first-child { height: 18px; }
  .view-heading { align-items: start; }
  .view-heading .secondary-button { flex: none; }
  .loading-card, .history-grid, .saved-grid-list { grid-template-columns: 1fr; }
  .loading-card span:nth-child(n+2) { display: none; }
  .result-panel { padding: 22px; border-radius: 21px; }
  .ball { width: 40px; height: 40px; font-size: .84rem; }
  .generated-card, .setting-card { padding: 21px; border-radius: 21px; }
  .generated-grid .ball { width: 43px; height: 43px; font-size: .92rem; }
  .generated-actions { flex-direction: column; }
  .generated-actions button { width: 100%; }
  .mode-picker { grid-template-columns: 1fr; }
  .mode-picker button { min-height: 42px; }
  .statistics-controls { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .statistics-controls label { min-width: 0; }
  .statistics-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .webapp-notice { margin-right: 0; margin-left: 0; }
}

@media (max-width: 390px) {
  .statistics-controls { grid-template-columns: 1fr; }
  .statistics-grid { grid-template-columns: 1fr 1fr; }
  .app-navigation { grid-template-columns: repeat(4, 79px); }
}

@media (prefers-reduced-motion: reduce) {
  .loading-card span { animation: none; }
  .game-choice, .primary-button, .secondary-button, .danger-button { transition: none; }
}
