/* Worldie — summery, cheerful arcade football. Self-contained (no arcade.css). */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root { --grass: #3fb24d; --sky: #7ec8ff; --sun: #ffd54d; --coral: #ff5d8f; --ink: #0b2033; }
html, body { height: 100%; overflow: hidden; background: #0b2033;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #fff; user-select: none; -webkit-user-select: none; touch-action: none; }
body { display: flex; flex-direction: column; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---- top bar ---- */
#top { flex: none; height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: linear-gradient(180deg, #0e2a1c, #0b2033); border-bottom: 1px solid #ffffff22; z-index: 20; }
#top .back { color: #cfe9ff; text-decoration: none; font-weight: 700; font-size: 15px; }
#top .back .lbl { opacity: .8; }
#top .tname { font-weight: 800; letter-spacing: .01em; font-size: 18px; }
#top .tname b { color: var(--sun); } #top .tname i { font-style: normal; }
#top .tools { margin-left: auto; display: flex; gap: 6px; }
#top .tools button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid #ffffff2e;
  background: #ffffff14; color: #fff; font-size: 16px; }
#top .tools button:hover { background: #ffffff28; }

/* ---- stage ---- */
#stage { position: relative; flex: 1; min-height: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---- overlay screens ---- */
#overlay { position: absolute; inset: 0; z-index: 15; display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 15%, #0b203399 0%, #0b2033cc 75%); overflow: auto; padding: 18px; }
.scr { width: min(560px, 94%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.scr.wide { width: min(760px, 96%); }
.logo { font-size: clamp(46px, 12vw, 88px); font-weight: 900; letter-spacing: -.02em; line-height: .95;
  background: linear-gradient(180deg, #fff, var(--sun)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo span { -webkit-text-fill-color: initial; }
.sub { color: #bfe0ff; font-size: 15px; margin-top: -6px; }
.hint { color: #9fc4dd; font-size: 12.5px; max-width: 44ch; line-height: 1.5; }
.wbtn { background: #ffffff18; border: 1px solid #ffffff33; color: #fff; font-weight: 700; font-size: 16px;
  padding: 12px 20px; border-radius: 12px; transition: transform .1s, background .15s; }
.wbtn:hover { background: #ffffff2b; transform: translateY(-1px); }
.wbtn.big { background: linear-gradient(180deg, var(--coral), #e0447a); border-color: #ff8fb2; font-size: 19px; padding: 14px 30px; box-shadow: 0 6px 20px #ff5d8f44; }
.wbtn.big:disabled { background: #ffffff14; border-color: #ffffff22; color: #ffffff66; box-shadow: none; cursor: default; transform: none; }
.row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.career { display: flex; gap: 22px; margin-top: 4px; }
.career div { display: flex; flex-direction: column; }
.career b { font-size: 24px; color: var(--sun); } .career span { font-size: 11px; color: #9fc4dd; text-transform: uppercase; letter-spacing: .06em; }

/* country select */
.scr h2 { font-size: 24px; }
.wsearch { width: 100%; max-width: 420px; padding: 11px 15px; border-radius: 11px; border: 1px solid #ffffff33;
  background: #0b2033; color: #fff; font-size: 16px; }
.wsearch::placeholder { color: #7fa6c0; }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; width: 100%;
  max-height: 46vh; overflow-y: auto; padding: 4px; }
.ccard { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; text-align: left;
  background: #ffffff12; border: 1px solid #ffffff22; color: #fff; font-size: 13.5px; }
.ccard:hover { background: #ffffff22; }
.ccard.on { background: var(--coral); border-color: #ff8fb2; }
.ccard .cn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* stylised flag chip */
.flg { display: inline-flex; width: 26px; height: 17px; border-radius: 3px; overflow: hidden; flex: none; border: 1px solid #0003; }
.flg i { flex: 1; }
.muf .flg, .nextopp .flg, .wname .flg { width: 34px; height: 22px; vertical-align: middle; margin-right: 6px; }

/* bracket / matchup */
.cuptitle { font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--sun); font-weight: 800; }
.roundname { font-size: 28px; font-weight: 900; }
.matchup { display: flex; align-items: center; gap: 14px; justify-content: center; margin: 6px 0; }
.mu { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 96px; }
.mu.you b { color: var(--sun); } .mu em { font-style: normal; font-size: 10px; letter-spacing: .1em; color: var(--coral); font-weight: 800; }
.mu b { font-size: 15px; } .muf { display: inline-flex; }
.muvs { font-weight: 800; color: #9fc4dd; }
.others { background: #ffffff10; border: 1px solid #ffffff1e; border-radius: 12px; padding: 10px 14px; font-size: 13px; color: #cfe3f2; }
.others .ol { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #7fa6c0; margin-bottom: 4px; }
.others .rr { font-variant-numeric: tabular-nums; }

/* results */
.big-res { font-size: clamp(34px, 8vw, 56px); font-weight: 900; }
.big-res.win { color: var(--sun); } .big-res.lose { color: #ff8fb2; }
.scoreline { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.nextopp { color: #cfe3f2; font-size: 15px; }
.trophy { font-size: 76px; filter: drop-shadow(0 6px 14px #ffd54d66); }
.wname { font-size: 20px; font-weight: 800; }

/* ---- touch controls ---- */
#touch { position: absolute; inset: 0; z-index: 12; pointer-events: none; }
#stick { position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: 22px; width: 120px; height: 120px;
  border-radius: 50%; background: #ffffff1c; border: 2px solid #ffffff33; pointer-events: auto; }
#knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  background: #ffffff44; border: 2px solid #ffffff77; }
.tbtns { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: 20px; display: flex; align-items: flex-end; gap: 12px; pointer-events: none; }
.tb { pointer-events: auto; border-radius: 50%; border: 2px solid #ffffff55; color: #fff; font-size: 26px; display: grid; place-items: center; }
.tb.shoot { width: 78px; height: 78px; background: #ff5d8fcc; border-color: #ff8fb2; }
.tb.pass { width: 66px; height: 66px; background: #4dd2ffbb; }
.tb.sprint { width: 52px; height: 52px; font-size: 24px; background: #ffd54dbb; color: #3a2a00; margin-bottom: 6px; }
.tb:active { transform: scale(.92); }

@media (max-width: 480px) {
  #stick { width: 104px; height: 104px; } #knob { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
  .tb.shoot { width: 68px; height: 68px; } .tb.pass { width: 58px; height: 58px; }
}
