/* Under Construction FC: placeholder kickabout (full-screen layout) */

:root {
  --panel: #191c23;
  --panel-2: #232733;
  --line: #2b303d;
  --text: #eef1f6;
  --muted: #9aa3b3;
  --hazard: #ffc61a;
  --hazard-dark: #b88a00;
  --ink: #0b0c10;
  --left: #ff8a1f;
  --right: #8f6bff;
  --display: "Arial Black", "Segoe UI Black", "Helvetica Neue", Impact, system-ui, sans-serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Roboto Mono", monospace;
  --hud: 54px;              /* height of the top bar (the pitch starts below it) */
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0b1430;
}
body {
  color: var(--text);
  font: 15px/1.5 var(--ui);
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- the whole screen is the game ---------- */
#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#safeProbe {
  position: fixed;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- top bar ---------- */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  height: calc(var(--hud) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) calc(10px + env(safe-area-inset-right)) 5px calc(14px + env(safe-area-inset-left));
  background: linear-gradient(#07090e, #0d1017);
}
.hud::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: repeating-linear-gradient(-45deg, var(--hazard) 0 12px, var(--ink) 12px 24px);
}
.brand { display: flex; flex-direction: column; justify-content: center; min-width: 0; flex: none; }
.logo {
  font: 900 19px/1 var(--display);
  letter-spacing: .01em;
  text-transform: uppercase;
  white-space: nowrap;
}
.fc {
  display: inline-block;
  margin-left: .06em;
  padding: .04em .22em;
  border-radius: .12em;
  background: var(--hazard);
  color: var(--ink);
  transform: rotate(-4deg);
}
.eyebrow {
  margin-top: 5px;
  font: 800 10px/1 var(--ui);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--hazard);
  white-space: nowrap;
}

.build {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}
.build-label {
  font: 800 10px/1.1 var(--ui);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.build-bar {
  flex: none;
  width: clamp(60px, 11vw, 150px);
  height: 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #0b0d11;
  overflow: hidden;
}
.build-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(-45deg, var(--hazard) 0 8px, #d9a400 8px 16px);
  animation: stripes 1.2s linear infinite;
}
@keyframes stripes { to { background-position: 22.63px 0; } }
.build strong { flex: none; font: 800 14px/1 var(--mono); color: var(--hazard); }
.status {
  min-width: 0;
  max-width: 36ch;
  margin-left: 6px;
  font: 12px/1.3 var(--mono);
  color: #c8d0dc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity .3s;
}
.status::before { content: "> "; color: var(--hazard); }
.status.fade { opacity: 0; }

.hud-actions { display: flex; gap: 6px; margin-left: auto; flex: none; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.help { font: 900 17px/1 var(--display); color: var(--hazard); }
.icon-btn:hover:not(:disabled) { border-color: var(--hazard); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn:focus-visible, .seg button:focus-visible, .cta:focus-visible, .ghost:focus-visible, .close-x:focus-visible {
  outline: 2px solid var(--hazard);
  outline-offset: 2px;
}

/* ---------- overlays (menu, pause, full time) ---------- */
.overlay {
  position: absolute;
  top: var(--hud-h, var(--hud));
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  padding: 14px;
  overflow: auto;
  background: rgba(8, 10, 14, .45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  font-size: 15px;
  font-size: clamp(11px, calc(.55vw + .6vh + 4px), 16px);
  user-select: text;
  -webkit-user-select: text;
}
.card {
  width: min(100%, 33em);
  margin: auto;
  padding: 1.3em 1.5em 1.2em;
  border: 1px solid var(--line);
  border-radius: 1em;
  background: rgba(25, 28, 35, .95);
  box-shadow: 0 1.4em 4em rgba(0, 0, 0, .55);
  text-align: center;
}
.card-kicker {
  margin: 0 0 .4em;
  font: 800 .78em/1 var(--ui);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--hazard);
}
.card h2 { margin: 0 0 .5em; font: 900 1.8em/1.05 var(--display); text-transform: uppercase; }
.card-note { margin: .8em 0 0; font-size: .92em; color: var(--muted); }
.fixture { margin: 0 0 .5em; font-weight: 800; }
.fixture .l { color: var(--left); }
.fixture .r { color: var(--right); }
.fixture i { margin: 0 .45em; font-style: normal; font-size: .85em; color: var(--muted); }
.tagline { max-width: 28em; margin: 0 auto .9em; font-size: .9em; color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; justify-content: center; gap: .45em; margin: 0 0 .7em; }
.seg button {
  padding: .6em 1.1em;
  border: 1px solid var(--line);
  border-radius: .6em;
  background: var(--panel-2);
  font-weight: 800;
  cursor: pointer;
}
.seg button:hover { border-color: var(--hazard); }
.seg button.on { background: var(--hazard); border-color: var(--hazard); color: var(--ink); }
.seg-small button { padding: .4em .9em; font-size: .9em; }
.cta, .ghost {
  padding: .65em 1.6em;
  border-radius: .6em;
  font: 900 1.1em/1 var(--display);
  text-transform: uppercase;
  cursor: pointer;
}
.cta {
  margin-top: .2em;
  border: 0;
  background: var(--hazard);
  color: var(--ink);
  box-shadow: 0 .25em 0 var(--hazard-dark);
}
.cta:hover { filter: brightness(1.06); }
.cta:active { transform: translateY(.15em); box-shadow: 0 .1em 0 var(--hazard-dark); }
.ghost { border: 1px solid var(--line); background: var(--panel-2); font-size: .95em; }
.ghost:hover { border-color: var(--hazard); }
.btn-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .6em; margin-top: 1em; }

.ft-score { display: flex; justify-content: center; align-items: center; gap: .7em; font-weight: 800; }
.ft-score .l { color: var(--left); }
.ft-score .r { color: var(--right); }
.ft-score b { font: 900 2em/1 var(--mono); color: var(--text); }
.ft-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5em; margin: 1em 0 0; }
.ft-stats div { padding: .5em; border-radius: .6em; background: var(--panel-2); }
.ft-stats dt { font: 800 .7em/1.2 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ft-stats dd { margin: .2em 0 0; font: 800 1em var(--mono); }

/* ---------- how-to-play pop-up ---------- */
.help-pop {
  top: 0;
  z-index: 40;
  background: rgba(6, 8, 12, .68);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.help-card { position: relative; width: min(100%, 48em); padding: 1.3em 1.6em 1em; text-align: left; }
.help-card > .card-kicker, .help-card > h2 { text-align: center; }
.help-card h3 {
  margin: 1em 0 .5em;
  font: 800 .75em/1 var(--ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--hazard);
}
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.8em; }
.help-grid h3 { margin-top: .4em; }
.close-x {
  position: absolute;
  top: .55em;
  right: .55em;
  display: grid;
  place-items: center;
  width: 2em;
  height: 2em;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-2);
  font: 700 1.25em/1 var(--ui);
  cursor: pointer;
}
.close-x:hover { border-color: var(--hazard); color: var(--hazard); }
.keys { display: grid; gap: .45em; margin: 0; padding: 0; list-style: none; }
.keys li { display: flex; justify-content: space-between; align-items: center; gap: .8em; font-size: .9em; }
.keys li > span:first-child { color: var(--muted); }
.keys .l { color: var(--left) !important; font-weight: 700; }
.keys .r { color: var(--right) !important; font-weight: 700; }
kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: .05em .4em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: .35em;
  background: var(--panel-2);
  font: 700 .85em/1.5 var(--mono);
  text-align: center;
  color: var(--text);
}
.note { margin: .9em 0 0; font-size: .88em; color: var(--muted); }
.note b { color: var(--text); }
kbd.tk { min-width: 2.3em; padding: .15em .45em; font: 900 .9em/1.4 var(--display); }
kbd.tk.kick { border-color: var(--hazard); color: var(--hazard); font-size: .72em; letter-spacing: .04em; }
.note.tip { margin-top: .45em; }
.ball-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5em, 1fr));
  gap: .5em 1em;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ball-list li { display: flex; align-items: center; gap: .6em; font-size: .86em; line-height: 1.3; color: var(--muted); }
.ball-list b { display: block; color: var(--text); }
.ball-list small { font-size: 1em; }
.ball-ico { flex: none; width: 3.2em; height: 3.2em; }
.fine { margin: .8em 0 0; font-size: .78em; color: #6f7788; }
.tap-hint {
  margin: 1em 0 0;
  font: 700 .8em/1.3 var(--ui);
  letter-spacing: .04em;
  text-align: center;
  color: var(--hazard);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- touch pads ---------- */
/* Each pad has 10px of invisible padding: a thumb that lands just off a
   button still presses it (game.js adds a little more slack on top). */
.pad, .rotate-hint { display: none; }
.pad {
  position: absolute;
  z-index: 10;
  bottom: calc(2px + env(safe-area-inset-bottom));
  padding: 10px;
  gap: 10px;
  align-items: flex-end;
  touch-action: none;
  -webkit-touch-callout: none;
}
#padL { left: calc(2px + env(safe-area-inset-left)); }
#padR { right: calc(2px + env(safe-area-inset-right)); }
body.touch .pad { display: flex; }
body.touch .pad.grid2 { display: grid; grid-template-columns: repeat(2, 56px); gap: 8px; }
.tbtn {
  width: 60px;
  height: 60px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, .22);
  border-radius: 18px;
  background: rgba(12, 14, 20, .55);
  font: 900 22px/1 var(--display);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none; /* the pad itself tracks every finger */
  transition: transform .06s, background-color .06s;
}
.grid2 .tbtn { width: 56px; height: 56px; }
.tbtn.kick { border-color: var(--hazard); background: rgba(255, 198, 26, .2); font-size: 14px; letter-spacing: .04em; }
.tbtn.down { background: var(--hazard); color: var(--ink); transform: scale(.92); }

.rotate-hint {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: calc(var(--world-bottom, 60%) + 16px);
  transform: translateX(-50%);
  align-items: center;
  gap: .55em;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: .55em 1.1em .55em .8em;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 99px;
  background: rgba(8, 10, 14, .6);
  font: 700 13px/1.25 var(--ui);
  text-align: left;
  color: #eaf6ea;
  cursor: pointer;
  touch-action: manipulation;
}
.rotate-hint svg { flex: none; width: 26px; height: 26px; color: var(--hazard); animation: tilt 2.4s ease-in-out infinite; }
.rotate-hint:disabled { cursor: default; opacity: 1; }
@keyframes tilt { 0%, 30% { transform: rotate(0); } 55%, 80% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (orientation: portrait) {
  body.touch .rotate-hint { display: flex; }
}
/* no double-tap zoom on buttons and menus */
.hud, .overlay { touch-action: manipulation; }
body.touch #app { -webkit-touch-callout: none; }

/* ---------- smaller screens ---------- */
@media (max-width: 900px), (max-height: 600px) {
  :root { --hud: 42px; }
  .hud { gap: 12px; }
  .logo { font-size: 14px; }
  .eyebrow, .status { display: none; }
  .icon-btn { width: 32px; height: 30px; }
  .icon-btn svg { width: 16px; height: 16px; }
  .icon-btn.help { font-size: 15px; }
}
@media (max-width: 600px) {
  .hud { gap: 8px; padding-left: calc(10px + env(safe-area-inset-left)); padding-right: calc(8px + env(safe-area-inset-right)); }
  .logo { max-width: 12em; font-size: 10px; line-height: 1.1; white-space: normal; }
  .build-label { display: none; }
  .build { gap: 6px; }
  .build-bar { width: 48px; }
  .build strong { font-size: 12px; }
  .hud-actions { gap: 4px; }
  .icon-btn { width: 30px; height: 28px; }
  .help-grid { grid-template-columns: 1fr; }
  .keys li { flex-wrap: wrap; }
}

/* short screens (phones on their side): squeeze the how-to-play card */
@media (max-height: 500px) {
  .help-pop { padding: 8px; }
  .help-card { padding: .8em 1.3em .7em; }
  .help-card > .card-kicker, .help-card .fine { display: none; }
  .help-card h2 { margin-bottom: .2em; font-size: 1.5em; }
  .help-card h3 { margin: .6em 0 .35em; }
  .help-card .keys { gap: .2em; }
  .help-card .note { margin-top: .5em; }
  .ball-list { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .3em; }
  .ball-list li { flex-direction: column; gap: .2em; text-align: center; }
  .ball-list small { display: none; }
  .ball-ico { width: 2.6em; height: 2.6em; }
  .tap-hint { margin-top: .6em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
