@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #050817;
  --panel: rgba(13, 18, 45, .78);
  --panel-strong: #101636;
  --line: rgba(255, 255, 255, .09);
  --muted: #8891aa;
  --text: #f6f7fb;
  --blue: #315cff;
  --cyan: #2dd4ff;
  --lime: #d8ff52;
  --shadow: 0 28px 90px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(35, 72, 199, .34), transparent 34rem),
    linear-gradient(180deg, #050819 0%, #060a19 58%, #040612 100%);
  font-family: Inter, system-ui, sans-serif;
  overflow-x: hidden;
}

button, select { font: inherit; }
button { color: inherit; }
.ambient { position: fixed; border-radius: 50%; filter: blur(100px); pointer-events: none; opacity: .22; z-index: -1; }
.ambient-one { width: 34rem; height: 34rem; background: #234cff; top: 20rem; left: -20rem; }
.ambient-two { width: 25rem; height: 25rem; background: #5f2dff; right: -13rem; top: 58rem; }

.topbar {
  width: min(1320px, calc(100% - 48px));
  height: 82px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; font: 700 16px/1 'Barlow Condensed', sans-serif; letter-spacing: .14em; }
.brand-ball { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; color: var(--lime); font-size: 20px; box-shadow: inset 0 0 16px rgba(216,255,82,.16); }
.season { color: var(--muted); font: 600 12px/1 Inter, sans-serif; letter-spacing: .13em; }

main { width: min(1320px, calc(100% - 48px)); margin: 0 auto; }
.hero { padding: 78px 0 56px; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; color: #aab1c6; font: 600 12px/1 Inter, sans-serif; letter-spacing: .22em; }
.eyebrow span { width: 34px; height: 2px; background: var(--lime); }
h1 { margin: 0; max-width: 860px; font: 800 clamp(58px, 8vw, 118px)/.82 'Barlow Condensed', sans-serif; letter-spacing: -.035em; text-transform: uppercase; }
h1 em { color: #aeb9dc; -webkit-text-stroke: 0; font-style: normal; }
.actions { margin-top: 36px; display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; }
.team-select-wrap { width: 300px; min-width: 286px; padding: 8px 12px; position: relative; display: grid; gap: 3px; background: rgba(255,255,255,.055); border: 1px solid var(--line); border-radius: 10px; }
.team-select-caption { color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.team-select-button { width: 100%; padding: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #fff; background: transparent; border: 0; cursor: pointer; font-weight: 650; text-align: left; }
#selectedTeam, .team-menu-option { display: flex; align-items: center; gap: 8px; }
.select-chevron { color: var(--muted); font-size: 16px; transition: transform .18s ease; }
.team-select-button[aria-expanded="true"] .select-chevron { transform: rotate(180deg); }
.team-menu { width: 100%; max-height: min(60vh, 460px); padding: 8px; position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; overflow-y: auto; border: 1px solid rgba(255,255,255,.14); border-radius: 12px; background: #111831; box-shadow: 0 20px 60px rgba(0,0,0,.48); }
.team-menu-group > span { display: block; padding: 10px 8px 6px; color: var(--muted); font-size: 9px; letter-spacing: .12em; }
.team-menu-option { width: 100%; padding: 9px 8px; color: #e9ecf5; border: 0; border-radius: 7px; background: transparent; cursor: pointer; font-size: 12px; text-align: left; }
.team-menu-option:hover, .team-menu-option.active { color: #fff; background: rgba(49,92,255,.2); }
.country-flag { flex: 0 0 auto; display: inline-block; vertical-align: -.1em; font-size: 1.05em; line-height: 1; }
.button { min-height: 58px; padding: 0 22px; display: inline-flex; align-items: center; justify-content: center; gap: 28px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 700; transition: transform .2s ease, filter .2s ease, background .2s ease; }
.button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.button:active { transform: translateY(0); }
.button-primary { color: #071020; background: var(--lime); }
.button-primary b { font-size: 20px; }
.button-secondary { background: rgba(45,92,255,.16); border-color: rgba(80,119,255,.48); }

.panel { margin-bottom: 28px; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, rgba(17,23,54,.88), rgba(8,12,31,.9)); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.section-heading { min-height: 42px; margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; }
.section-heading > div { display: flex; align-items: baseline; gap: 13px; }
.section-index { color: var(--lime); font: 700 11px/1 Inter, sans-serif; }
h2 { margin: 0; font: 700 27px/1 'Barlow Condensed', sans-serif; letter-spacing: .03em; text-transform: uppercase; }
.result-actions { display: flex; align-items: center; gap: 18px; }
.text-button { padding: 8px 0; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; }
.text-button:hover { color: #fff; }
.text-button:disabled { color: #4d556b; cursor: not-allowed; }
#shareResult:not(:disabled) { color: var(--lime); }
.team-count { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; letter-spacing: .12em; }

.result-root { min-height: 250px; }
.empty-result { height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); }
.empty-result strong { margin-top: 16px; color: #d5d9e4; font: 600 18px/1 'Barlow Condensed', sans-serif; letter-spacing: .08em; }
.empty-result small { margin-top: 8px; font-size: 11px; }
.empty-orbit { width: 62px; height: 62px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; position: relative; }
.empty-orbit::before, .empty-orbit::after { content: ''; position: absolute; border: 1px solid rgba(49,92,255,.42); border-radius: 50%; transform: rotate(48deg); }
.empty-orbit::before { width: 74px; height: 28px; }
.empty-orbit::after { width: 28px; height: 74px; }
.empty-orbit span { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 18px var(--lime); }

.single-head { padding: 4px 4px 26px; display: flex; align-items: center; gap: 16px; }
.single-head .crest { width: 60px; height: 60px; }
.single-head small { color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.single-head h3 { margin: 4px 0 0; display: flex; align-items: center; gap: 9px; font: 700 28px/1 'Barlow Condensed', sans-serif; }
.draw-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.draw-pot { padding: 14px; background: rgba(3,7,23,.42); border: 1px solid var(--line); border-radius: 12px; }
.draw-pot-title { margin-bottom: 10px; display: flex; justify-content: space-between; color: var(--muted); font: 700 11px/1 Inter, sans-serif; letter-spacing: .1em; }
.opponent { padding: 12px 10px; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; border-top: 1px solid rgba(255,255,255,.065); }
.opponent:first-of-type { border-top: 0; }
.opponent .crest { width: 32px; height: 32px; }
.opponent strong { min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; font-size: 12px; }
.venue { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 5px; color: var(--cyan); background: rgba(45,212,255,.1); font: 700 10px/1 Inter, sans-serif; }
.venue.away { color: #b9c0d2; background: rgba(255,255,255,.07); }

.pots-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.pot { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: rgba(3,7,23,.38); }
.pot-title { height: 46px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; background: linear-gradient(90deg, rgba(49,92,255,.62), rgba(49,92,255,.16)); font: 700 14px/1 'Barlow Condensed', sans-serif; letter-spacing: .08em; }
.team-row { width: 100%; min-height: 54px; padding: 7px 12px; display: grid; grid-template-columns: 34px minmax(0,1fr); align-items: center; gap: 10px; color: #e9ecf5; text-align: left; border: 0; border-bottom: 1px solid rgba(255,255,255,.055); background: transparent; cursor: pointer; transition: background .18s ease, color .18s ease; }
.team-row:last-child { border-bottom: 0; }
.team-row:hover, .team-row.active { color: #fff; background: rgba(49,92,255,.16); }
.team-row.active { box-shadow: inset 2px 0 var(--lime); }
.team-row > span:first-child { width: 34px; height: 34px; display: grid; place-items: center; overflow: hidden; }
.team-row .crest { width: 30px; height: 30px; }
.team-row strong { min-width: 0; display: flex; align-items: center; gap: 7px; overflow: hidden; white-space: nowrap; font-size: 11px; font-weight: 600; }
.team-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crest { display: block; flex: 0 0 auto; max-width: 100%; object-fit: contain; filter: drop-shadow(0 4px 7px rgba(0,0,0,.25)); }
.crest-fallback { display: none; align-items: center; justify-content: center; border-radius: 50%; color: #fff; background: #263052; font: 700 10px/1 Inter, sans-serif; }

.all-toolbar { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.all-toolbar strong { color: var(--lime); }
.all-results { display: grid; gap: 8px; }
.schedule-row { min-width: 0; padding: 10px 12px; display: grid; grid-template-columns: minmax(180px, .9fr) 3fr; align-items: center; gap: 18px; border: 1px solid rgba(255,255,255,.065); border-radius: 10px; background: rgba(3,7,23,.35); }
.schedule-team { min-width: 0; display: flex; align-items: center; gap: 10px; }
.schedule-team .crest { width: 32px; height: 32px; }
.schedule-team > span:last-child { min-width: 0; display: flex; align-items: center; gap: 7px; overflow: hidden; white-space: nowrap; font-size: 12px; font-weight: 700; }
.schedule-opponents { min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.mini-opponent { min-width: 0; height: 40px; padding: 4px 7px; display: flex; align-items: center; gap: 6px; border-radius: 6px; background: rgba(255,255,255,.052); }
.mini-opponent .crest { width: 22px; height: 22px; }
.mini-opponent > span:nth-child(2) { min-width: 0; display: flex; align-items: center; gap: 5px; overflow: hidden; white-space: nowrap; color: #cbd0dd; font-size: 10px; }
.mini-opponent b { margin-left: auto; color: var(--cyan); font-size: 8px; }
.mini-opponent b.away { color: #8f98ad; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 20; padding: 11px 16px; transform: translate(-50%, 20px); opacity: 0; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: #171d35; color: #fff; font-size: 12px; transition: .22s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.is-drawing .result-root { opacity: .45; filter: blur(2px); }

.share-dialog { width: min(560px, calc(100% - 28px)); max-height: calc(100dvh - 32px); padding: 16px; color: var(--text); border: 1px solid rgba(255,255,255,.14); border-radius: 16px; background: #0d132d; box-shadow: var(--shadow); }
.share-dialog::backdrop { background: rgba(1,3,12,.78); backdrop-filter: blur(8px); }
.share-dialog-head { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.share-dialog-head strong { font-size: 15px; }
.share-dialog-head button { width: 34px; height: 34px; color: var(--muted); background: rgba(255,255,255,.06); border: 0; border-radius: 50%; cursor: pointer; font-size: 24px; line-height: 1; }
.share-dialog img { width: 100%; max-height: calc(100dvh - 170px); display: block; object-fit: contain; border-radius: 10px; background: #070b1b; }
.share-dialog-actions { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-dialog-actions .button { min-height: 48px; }

footer { width: min(1320px, calc(100% - 48px)); margin: 42px auto 0; padding: 24px 0 38px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: #555f78; font-size: 9px; letter-spacing: .13em; }

@media (max-width: 1050px) {
  .pots-grid, .draw-grid { grid-template-columns: repeat(2, 1fr); }
  .schedule-row { grid-template-columns: 1fr; gap: 8px; }
}
@media (max-width: 700px) {
  html { -webkit-text-size-adjust: 100%; }
  .topbar, main, footer { width: calc(100% - 24px); }
  .topbar { height: 62px; }
  .brand { font-size: 14px; letter-spacing: .08em; }
  .season { display: none; }
  .hero { padding: 40px 0 32px; }
  h1 { font-size: clamp(46px, 15vw, 68px); line-height: .9; }
  .actions { margin-top: 26px; display: grid; gap: 10px; }
  .team-select-wrap { width: 100%; min-width: 0; min-height: 56px; }
  .team-menu { max-height: 55vh; }
  .button { width: 100%; min-height: 52px; touch-action: manipulation; }
  .panel { margin-bottom: 18px; padding: 17px 12px; border-radius: 14px; }
  .section-heading { min-height: 36px; margin-bottom: 16px; }
  h2 { font-size: 23px; }
  .result-root { min-height: 220px; }
  .empty-result { height: 220px; text-align: center; }
  .single-head { padding: 2px 4px 18px; }
  .single-head .crest { width: 48px; height: 48px; }
  .single-head h3 { font-size: 24px; }
  .draw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .draw-pot { min-width: 0; padding: 10px 8px; }
  .draw-pot-title { font-size: 9px; letter-spacing: .04em; }
  .opponent { padding: 10px 4px; grid-template-columns: 28px minmax(0, 1fr) 22px; gap: 6px; }
  .opponent .crest { width: 26px; height: 26px; }
  .opponent strong { font-size: 11px; }
  .venue { width: 22px; height: 22px; }
  .pots-grid { display: flex; grid-template-columns: none; gap: 10px; margin: 0 -12px; padding: 0 12px 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
  .pots-grid::-webkit-scrollbar { display: none; }
  .pot { flex: 0 0 min(86vw, 330px); scroll-snap-align: start; }
  .team-row { min-height: 52px; touch-action: manipulation; }
  .schedule-row { padding: 10px; gap: 10px; }
  .schedule-team .crest { width: 36px; height: 36px; }
  .schedule-team span { font-size: 14px; }
  .schedule-opponents { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .mini-opponent { height: 42px; padding: 5px 7px; }
  .mini-opponent .crest { width: 26px; height: 26px; }
  .mini-opponent span { font-size: 10px; }
  footer { margin-top: 26px; display: grid; gap: 8px; line-height: 1.6; }
}
