:root {
  --ink: #17202a;
  --accent: #4bc1a0;
  --accent-dark: #2f8f75;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(23, 32, 42, 0.12);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #bfd8ea;
  color: var(--ink);
  font-family: 'Noto Sans', sans-serif;
}

#view {
  display: block;
  height: 100%;
  touch-action: none;
  width: 100%;
}

.panel {
  backdrop-filter: blur(6px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(23, 32, 42, 0.12);
  position: fixed;
}

.title-panel {
  left: 16px;
  max-width: 420px;
  padding: 0.8rem 1rem;
  top: 16px;
}

.title-panel h1 {
  font-family: 'Google Sans', sans-serif;
  font-size: 1.35rem;
  margin: 0.15rem 0 0.35rem;
}

.title-panel p {
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 0;
}

.slide {
  min-height: 5.6rem;
  transition: opacity 0.35s ease;
}

.slide.is-fading { opacity: 0; }

.slide h2 {
  color: var(--accent-dark);
  font-family: 'Google Sans', sans-serif;
  font-size: 0.95rem;
  margin: 0 0 0.2rem;
}

.slide-dots {
  display: flex;
  gap: 6px;
  margin-top: 0.45rem;
}

.slide-dots button {
  background: rgba(23, 32, 42, 0.18);
  border: 0;
  border-radius: 3px;
  flex: none;
  height: 6px;
  overflow: hidden;
  padding: 0;
  position: relative;
  width: 22px;
}

.slide-dots button[aria-selected='true'] { background: rgba(75, 193, 160, 0.3); }

.slide-dots button[aria-selected='true']::after {
  animation: slide-progress var(--slide-ms, 6000ms) linear forwards;
  background: var(--accent);
  content: '';
  inset: 0;
  position: absolute;
  transform-origin: left;
}

.title-panel:hover .slide-dots button[aria-selected='true']::after { animation-play-state: paused; }

@keyframes slide-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.back {
  color: var(--accent-dark);
  font-size: 0.85rem;
  text-decoration: none;
}

.back:hover { text-decoration: underline; }

.links {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.links .back { margin-right: 0.3rem; }

.link-pill {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  font-size: 0.78rem;
  gap: 0.3rem;
  padding: 0.1rem 0.6rem;
  text-decoration: none;
}

.link-pill svg { height: 0.85rem; width: 0.85rem; }
a.link-pill:hover { border-color: var(--accent); color: var(--accent-dark); }
.link-pill.is-soon { color: #77808a; cursor: default; }

.hud {
  padding: 0.7rem 0.9rem;
  right: 16px;
  top: 16px;
  width: 280px;
}

.hud dl {
  display: grid;
  font-size: 0.85rem;
  gap: 0.25rem 0.75rem;
  grid-template-columns: auto 1fr;
  margin: 0;
}

.hud dt { color: #55606b; }

.hud dd {
  font-family: 'Google Sans', sans-serif;
  font-variant-numeric: tabular-nums;
  margin: 0;
  text-align: right;
}

#hud-vis[data-state='on'] { color: var(--accent-dark); }
#hud-vis[data-state='off'] { color: #c0392b; }

.buttons {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  flex: 1;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.4rem;
}

button:hover { border-color: var(--accent); }
button[aria-pressed='false'] { color: #77808a; }
/* On/off toggles: filled when on, plain when off. */
button[aria-pressed='true']:not(.challenge-btn) { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
button[aria-pressed='false']:not(.challenge-btn) { background: #fff; }
button:disabled { cursor: default; opacity: 0.45; }
#btn-aim:disabled { visibility: hidden; } /* a challenge decides aim assist */

kbd {
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.75rem;
  margin-right: 2px;
  padding: 0 0.3rem;
}

.help {
  bottom: 16px;
  left: 16px;
  padding: 0.75rem 0.9rem 0.8rem;
  width: 290px;
}

.help-title {
  color: #55606b;
  font-family: 'Google Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  margin: 0 0 0.45rem;
}

.keys {
  align-items: center;
  display: grid;
  font-size: 0.8rem;
  gap: 0.32rem 0.7rem;
  grid-template-columns: auto 1fr;
  margin: 0;
}

.keys dt {
  align-items: center;
  display: flex;
  gap: 3px;
  justify-content: flex-end;
}

.keys dd { color: #2b3640; margin: 0; }

.keys .hold {
  color: #77808a;
  font-size: 0.7rem;
  margin-right: 2px;
}

.keys .mouse {
  color: #77808a;
  font-size: 0.72rem;
}

.keys kbd {
  min-width: 1.45rem;
  text-align: center;
}

.keys kbd.wide { min-width: 3rem; }

.pad-note {
  border-top: 1px solid var(--line);
  color: #55606b;
  font-size: 0.74rem;
  margin: 0.55rem 0 0;
  padding-top: 0.45rem;
}

.challenge-box {
  border-top: 1px solid var(--line);
  margin-top: 0.65rem;
  padding-top: 0.55rem;
}

.challenge-label {
  color: #55606b;
  font-family: 'Google Sans', sans-serif;
  font-size: 0.78rem;
  margin: 0 0 0.4rem;
}

.challenge-row {
  display: grid;
  gap: 0.4rem;
  grid-template-columns: 1fr 1fr;
}

.challenge-btn {
  background: #750014;
  border-color: #750014;
  color: #fff;
  display: flex;
  flex-direction: column;
  font-weight: 600;
  gap: 0.1rem;
  padding: 0.4rem 0.3rem;
}

.challenge-btn span {
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.85;
}

.challenge-btn kbd {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.55);
  color: inherit;
  font-size: 0.62rem;
  padding: 0 0.2rem;
}

.challenge-btn[data-mode='easy'] { background: var(--accent-dark); border-color: var(--accent-dark); }
.challenge-btn[data-mode^='slalom'] { background: #c45a10; border-color: #c45a10; }
.challenge-btn[data-mode='freekick'] { background: #1d4f7a; border-color: #1d4f7a; }
.challenge-wide { width: 100%; }
.challenge-row + .challenge-label, .challenge-wide + .challenge-label { margin-top: 0.55rem; }
.challenge-btn:hover { filter: brightness(1.12); }
.challenge-btn:disabled { cursor: default; filter: none; opacity: 0.45; }
.challenge-btn[aria-pressed='false'] { color: #fff; } /* not the gray of an off toggle */
.challenge-btn[aria-pressed='true'] { background: #fff; color: #750014; }
.challenge-btn[aria-pressed='true'] kbd { border-color: rgba(117, 0, 20, 0.4); }

#ch-mode {
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  opacity: 0.75;
}

.challenge-hud {
  align-items: baseline;
  background: rgba(23, 32, 42, 0.82);
  border-radius: 10px;
  color: #fff;
  display: flex;
  font-family: 'Google Sans', sans-serif;
  gap: 0.9rem;
  left: 50%;
  padding: 0.35rem 1rem;
  position: fixed;
  top: 16px;
  transform: translateX(-50%);
}

.challenge-hud[hidden] { display: none; }

#ch-time {
  font-size: 1.9rem;
  font-variant-numeric: tabular-nums;
  min-width: 3.6ch;
  text-align: right;
}

#ch-time.is-low { color: #ff8a8a; }

#ch-goals { font-size: 1rem; opacity: 0.9; }

.inset {
  aspect-ratio: 1;
  border: 2px solid #fff;
  border-radius: 6px;
  bottom: 16px;
  box-shadow: 0 4px 18px rgba(23, 32, 42, 0.25);
  margin: 0;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  right: 16px;
  width: min(240px, 34vw);
}

.inset figcaption {
  background: rgba(23, 32, 42, 0.65);
  bottom: 0;
  color: #fff;
  font-size: 0.72rem;
  left: 0;
  padding: 0.2rem 0.45rem;
  position: absolute;
  right: 0;
}

.inset-box {
  border: 2px solid #3be26b;
  position: absolute;
}

.banner {
  background: var(--panel);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(23, 32, 42, 0.18);
  font-family: 'Google Sans', sans-serif;
  font-size: 2rem;
  left: 50%;
  padding: 0.6rem 1.4rem;
  position: fixed;
  top: 38%;
  transform: translate(-50%, -50%);
}

.loading {
  align-items: center;
  background: #e9f1f6;
  display: flex;
  flex-direction: column;
  inset: 0;
  justify-content: center;
  position: fixed;
  text-align: center;
}

.loading[hidden] { display: none; }

.loading p { margin: 0.35rem 1rem; }

#loading-status {
  font-family: 'Google Sans', sans-serif;
  font-size: 1.05rem;
}

.loading-note {
  color: #55606b;
  font-size: 0.85rem;
}

.loading.is-error .spinner { display: none; }
.loading.is-error #loading-status { color: #c0392b; }

.spinner {
  animation: spin 0.9s linear infinite;
  border: 4px solid rgba(75, 193, 160, 0.25);
  border-radius: 50%;
  border-top-color: var(--accent);
  height: 42px;
  margin-bottom: 0.8rem;
  width: 42px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.stick {
  background: rgba(255, 255, 255, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  bottom: 24px;
  height: 120px;
  left: 24px;
  position: fixed;
  touch-action: none;
  width: 120px;
}

.stick > div {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  height: 48px;
  left: 36px;
  position: absolute;
  top: 36px;
  width: 48px;
}

[hidden] { display: none !important; }


.banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.banner-sub {
  color: #55606b;
  font-size: 0.95rem;
}

.banner.is-goal {
  animation: goal-pop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) both;
  background: #750014;
  color: #fff;
  padding: 0.7rem 2.2rem;
}

.banner.is-goal .banner-main {
  font-size: 3.2rem;
  letter-spacing: 0.04em;
  line-height: 1;
}

.banner.is-goal .banner-sub { color: rgba(255, 255, 255, 0.85); }

@keyframes goal-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.skills {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 0.4rem;
}

.skill-chip {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  user-select: none;
  border-radius: 5px;
  color: #55606b;
  font-size: 0.72rem;
  padding: 0.3rem 0;
}

/* Skills that cannot be used right now are hidden; their slots stay, so nothing jumps. */
.skill-chip.is-off { visibility: hidden; }
.keys .is-off { opacity: 0.3; }
.keys dt, .keys dd { transition: opacity 0.15s; }
.skill-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.skill-chip.is-target {
  animation: chip-pulse 0.3s ease-in-out infinite alternate;
  border-color: var(--accent);
  color: var(--accent-dark);
}

@keyframes chip-pulse { to { background: rgba(75, 193, 160, 0.25); } }

.strike-track {
  background: rgba(23, 32, 42, 0.08);
  border-radius: 2px;
  height: 3px;
  margin-bottom: 0.55rem;
  overflow: hidden;
}

#strike-bar {
  background: #750014;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
}


.hint {
  background: rgba(23, 32, 42, 0.78);
  margin-top: 64px;
  border-radius: 6px;
  color: #fff;
  font-size: 0.85rem;
  left: 50%;
  padding: 0.35rem 0.8rem;
  position: fixed;
  top: 16px;
  transform: translateX(-50%);
}

.power {
  bottom: 120px;
  left: 50%;
  pointer-events: none;
  position: fixed;
  text-align: center;
  transform: translateX(-50%);
  width: min(360px, 70vw);
}

.power-track {
  background: rgba(255, 255, 255, 0.75);
  border: 2px solid #fff;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(23, 32, 42, 0.25);
  height: 16px;
  overflow: hidden;
}

#power-fill {
  background: linear-gradient(90deg, #f0c419, #e1814c 60%, #750014);
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
}

.power[data-skill='passing'] #power-fill { background: linear-gradient(90deg, #a7e3d2, #4bc1a0 60%, #2f8f75); }

#power-label {
  color: #fff;
  font-family: 'Google Sans', sans-serif;
  font-size: 0.95rem;
  margin: 0.35rem 0 0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* Tablets: the panels fill the top corners, so the challenge clock and hints
   sit below them instead of between them. */
@media (max-width: 1100px) {
  .challenge-hud { top: var(--below-panels, 272px); }
  .hint { margin-top: 72px; top: var(--below-panels, 272px); }
}

/* Phones: a slim title bar, the skill/button card under it, and the challenge
   card above the stick. Stats and the rotating slides are dropped. */
@media (max-width: 720px) {
  .title-panel { max-width: none; padding: 0.5rem 0.8rem; right: 16px; }
  .title-panel h1 { font-size: 1.05rem; margin: 0.2rem 0 0; }
  .title-panel .slide, .title-panel .slide-dots { display: none; }
  .hud { left: 16px; padding: 0.5rem 0.6rem; top: 100px; width: auto; }
  .hud dl { display: none; }
  .hud .buttons { margin-top: 0.3rem; }
  .help { width: auto; }
  .help .keys, .help .help-title, .help .pad-note { display: none; }
  .help .challenge-box { border-top: 0; margin-top: 0; padding-top: 0; }
  .challenge-hud, .hint { --below-panels: 226px; }
  .power { bottom: auto; top: 46%; }
}

@media (pointer: coarse) {
  .help { bottom: 160px; width: auto; }
  .help .keys, .help .help-title, .help .pad-note { display: none; }
  .help .challenge-box { border-top: 0; margin-top: 0; padding-top: 0; }
  .challenge-btn kbd, .buttons kbd { display: none; }
}

/* ----------------------------------------------------------------- touch --
   Phones and tablets get a game layout: menu and reset top left, goals and the
   onboard view top right, the stick bottom left, skill buttons bottom right. */
.rotate { display: none; }

.tap-play {
  align-items: center;
  background: #750014;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.25);
  color: #fff;
  display: inline-flex;
  flex: none;
  font-family: 'Google Sans', sans-serif;
  font-size: 1.3rem;
  gap: 0.6rem;
  margin-top: 1rem;
  padding: 0.8rem 1.8rem 0.8rem 1.4rem;
}
.tap-play svg { height: 1.3rem; width: 1.3rem; }
.tap-play[hidden] { display: none; }

body.is-touch { touch-action: none; -webkit-user-select: none; user-select: none; }
body.is-touch .title-panel,
body.is-touch .help,
body.is-touch .hud .skills,
body.is-touch .hud .strike-track { display: none; }

/* Goals only, as a small pill in the top-left bar. */
body.is-touch .hud {
  align-items: center;
  display: flex;
  padding: 0.3rem 0.7rem;
  position: static;
  width: auto;
}
body.is-touch .hud dl { display: flex; font-size: 0.85rem; gap: 0.4rem; }
body.is-touch .hud dt:not(:nth-of-type(5)),
body.is-touch .hud dd:not(:nth-of-type(5)) { display: none; }

/* Onboard view top left, under Menu and Reset; it shrinks to stay above the stick
   (52 px above it, 140 px stick + 20 + 16 px below). */
body.is-touch .inset {
  bottom: auto;
  left: calc(12px + env(safe-area-inset-left));
  right: auto;
  top: calc(52px + env(safe-area-inset-top));
  width: max(64px, min(150px, 30vh, calc(100vh - 228px - env(safe-area-inset-top) - env(safe-area-inset-bottom))));
}
body.is-touch .inset figcaption { display: none; }

.touch-bar {
  display: flex;
  gap: 8px;
  left: calc(12px + env(safe-area-inset-left));
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
}
.touch-bar button {
  align-items: center;
  backdrop-filter: blur(6px);
  background: var(--panel);
  display: inline-flex;
  flex: none;
  font-size: 0.85rem;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
}
.touch-bar svg { height: 0.95rem; width: 0.95rem; }

body.is-touch .stick {
  background: rgba(255, 255, 255, 0.25);
  bottom: calc(20px + env(safe-area-inset-bottom));
  height: 140px;
  left: calc(28px + env(safe-area-inset-left));
  width: 140px;
}
body.is-touch .stick > div { height: 56px; left: 40px; top: 40px; }
.stick.is-sprint { border-color: #f0c419; box-shadow: 0 0 0 4px rgba(240, 196, 25, 0.35); }

/* Skill buttons: Shoot is the big one, the rest arc around it. */
.touch-pad {
  bottom: calc(14px + env(safe-area-inset-bottom));
  height: 160px;
  position: fixed;
  right: calc(14px + env(safe-area-inset-right));
  touch-action: none;
  width: 240px;
}
.tbtn {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  backdrop-filter: blur(4px);
  background: rgba(255, 255, 255, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(23, 32, 42, 0.25);
  color: var(--ink);
  font-family: 'Google Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  height: 54px;
  padding: 0;
  position: absolute;
  touch-action: none;
  user-select: none;
  width: 54px;
}
.tbtn-shoot { background: #750014; border-color: #fff; bottom: 6px; color: #fff; font-size: 1rem; height: 82px; right: 6px; width: 82px; }
.tbtn-pass { background: var(--accent-dark); border-color: #fff; bottom: 10px; color: #fff; font-size: 0.9rem; height: 64px; right: 104px; width: 64px; }
.tbtn-receive { bottom: 26px; right: 182px; }
.tbtn-dribble { bottom: 102px; right: 20px; }
.tbtn-walk { bottom: 90px; right: 94px; height: 46px; width: 46px; font-size: 0.72rem; }
.tbtn.is-active { box-shadow: 0 0 0 4px rgba(75, 193, 160, 0.85), 0 3px 10px rgba(23, 32, 42, 0.25); }
.tbtn-receive.is-active, .tbtn-dribble.is-active, .tbtn-walk.is-active { background: var(--accent); border-color: #fff; color: #fff; }
.tbtn.is-target { animation: chip-pulse 0.3s ease-in-out infinite alternate; }
.tbtn { transition: opacity 0.15s, transform 0.15s; }
.tbtn.is-off { opacity: 0; pointer-events: none; transform: scale(0.85); }
.tbtn:active { filter: brightness(0.9); transform: scale(0.95); }

/* Messages sit in the middle band, clear of the corners. */
body.is-touch .challenge-hud { top: calc(10px + env(safe-area-inset-top)); }
body.is-touch .hint { margin-top: 0; top: calc(64px + env(safe-area-inset-top)); max-width: min(56vw, 480px); text-align: center; }
/* In a challenge the clock shows the goals: the bar's goal count steps aside. */
body.is-touch.in-challenge #touch-bar .hud { display: none; }
/* Free kick: the robot stands still, so the stick has nothing to do. */
body.is-touch.is-freekick #stick { display: none; }
body.is-touch .power { bottom: auto; top: 30%; width: min(300px, 40vw); }
body.is-touch .banner { font-size: 1.5rem; top: 42%; }

/* Menu: links, challenges, and settings. */
.menu {
  align-items: center;
  background: rgba(23, 32, 42, 0.45);
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 20;
}
.menu-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(23, 32, 42, 0.3);
  max-height: calc(100% - 24px);
  max-width: min(560px, calc(100% - 24px));
  overflow-y: auto;
  padding: 0.8rem 1rem 1rem;
  width: 100%;
}
.menu-head { align-items: center; display: flex; justify-content: space-between; }
.menu-head h2 { font-family: 'Google Sans', sans-serif; font-size: 1.15rem; margin: 0; }
.menu-head button { flex: none; font-size: 1.4rem; line-height: 1; padding: 0.1rem 0.6rem; }
.menu-note { color: #55606b; font-size: 0.82rem; margin: 0.35rem 0 0.6rem; }
.menu .links { margin: 0.5rem 0 0.2rem; }
.menu .challenge-box { border-top: 0; margin-top: 0; padding-top: 0; }
#menu .challenge-btn kbd, #menu .buttons kbd, body.is-touch #challenges kbd { display: none; }
.menu .buttons, .menu-buttons { display: flex; gap: 0.4rem; margin-top: 0.6rem; }
.menu-buttons[hidden], #btn-fullscreen[hidden] { display: none; }

@media (pointer: coarse) and (orientation: portrait) {
  .rotate {
    align-items: center;
    background: #17202a;
    color: #fff;
    display: flex;
    flex-direction: column;
    font-family: 'Google Sans', sans-serif;
    font-size: 1.1rem;
    gap: 0.8rem;
    inset: 0;
    justify-content: center;
    position: fixed;
    text-align: center;
    z-index: 30;
  }
  .rotate svg { animation: rotate-hint 2s ease-in-out infinite; height: 72px; width: 72px; }
  /* Until the tap to play, the loading card stays usable in portrait. */
  body:has(#loading:not([hidden])) .rotate { display: none; }
}
@keyframes rotate-hint { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { .rotate svg { animation: none; } }

/* Short landscape phones: shrink the controls a little. */
@media (pointer: coarse) and (max-height: 380px) {
  body.is-touch .stick { height: 120px; width: 120px; }
  body.is-touch .stick > div { height: 48px; left: 34px; top: 34px; }
  .touch-pad { transform: scale(0.88); transform-origin: bottom right; }
  body.is-touch .inset { width: max(64px, min(120px, 28vh, calc(100vh - 204px - env(safe-area-inset-top) - env(safe-area-inset-bottom)))); }
}

/* Dribble button cue when the ball is in reach while walking. */
.tbtn.is-cue { animation: tbtn-cue 0.7s ease-in-out infinite alternate; border-color: var(--accent); }
@keyframes tbtn-cue { to { box-shadow: 0 0 0 7px rgba(75, 193, 160, 0.55); } }
@media (prefers-reduced-motion: reduce) { .tbtn.is-cue { animation: none; box-shadow: 0 0 0 5px rgba(75, 193, 160, 0.55); } }

/* Player card (the loading card once the demo is ready) */
.player-form {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 340px;
  width: calc(100% - 32px);
}
.player-form[hidden] { display: none; }
.player-title { font-family: 'Google Sans', sans-serif; font-size: 1.15rem; margin: 0.2rem 0 0; }
.player-fields { display: grid; gap: 0.6rem; grid-template-columns: 1fr 5.5rem; width: 100%; }
.player-fields label { color: #55606b; display: flex; flex-direction: column; font-size: 0.8rem; gap: 0.2rem; text-align: left; }
.player-fields input {
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-family: 'Google Sans', sans-serif;
  font-size: 1.1rem;
  padding: 0.45rem 0.6rem;
  text-transform: uppercase;
  width: 100%;
}
.player-fields input:focus { border-color: var(--accent); outline: 2px solid rgba(75, 193, 160, 0.35); }
.player-save { align-items: center; color: #55606b; display: flex; font-size: 0.8rem; gap: 0.4rem; text-align: left; }
.player-save[hidden] { display: none; }
.player-form .tap-play { margin-top: 0.3rem; }
.player-skip { background: none; border: 0; color: #55606b; flex: none; font-size: 0.85rem; text-decoration: underline; }
.player-skip:hover { color: var(--ink); }
button.player-pill { background: rgba(75, 193, 160, 0.14); border-color: rgba(47, 143, 117, 0.35); color: var(--accent-dark); cursor: pointer; flex: none; font-weight: 700; }

/* Leaderboard */
.board-btn { margin-top: 0.55rem; width: 100%; }
.board-btn[hidden] { display: none; }
.board-card { max-width: min(680px, calc(100% - 24px)); }
.challenges-card { max-width: min(420px, calc(100% - 24px)); }
.challenges-card .challenge-label { margin-top: 0.7rem; }
.challenge-open { background: #750014; border-color: #750014; }
.board-lists { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0.4rem; }
.board-lists h3 { font-family: 'Google Sans', sans-serif; font-size: 0.95rem; margin: 0 0 0.3rem; }
.board-lists ol { font-size: 0.82rem; margin: 0; padding-left: 1.3rem; }
.board-lists li { padding: 0.12rem 0; }
.board-lists li > span:last-child { color: #55606b; float: right; font-variant-numeric: tabular-nums; }
.board-lists li.is-me { color: var(--accent-dark); font-weight: 700; }
.board-lists li.is-empty { color: #77808a; list-style: none; margin-left: -1.3rem; }
@media (max-width: 560px) { .board-lists { grid-template-columns: 1fr; } }

/* Short landscape phones: the player card fits without scrolling. */
@media (max-height: 420px) {
  .loading { justify-content: flex-start; overflow-y: auto; padding: 12px 0; }
  .player-form { gap: 0.4rem; }
}

/* Robot view: the onboard camera fills the screen. Its real image is the
   central square; the sides are dimmed. */
.fov {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  pointer-events: none;
  position: fixed;
}
.fov[hidden] { display: none; }
.fov-square {
  aspect-ratio: 1;
  box-shadow: 0 0 0 100vmax rgba(10, 16, 22, 0.38);
  height: min(100vh, 100vw);
  outline: 1px solid rgba(255, 255, 255, 0.35);
  position: relative;
}

/* The corner view is a button: tap or click to swap views. */
.inset { cursor: pointer; pointer-events: auto; touch-action: none; }
.inset-swap {
  align-items: center;
  background: rgba(23, 32, 42, 0.6);
  border-radius: 50%;
  color: #fff;
  display: flex;
  height: 24px;
  justify-content: center;
  position: absolute;
  right: 5px;
  top: 5px;
  width: 24px;
}
.inset-swap svg { height: 14px; width: 14px; }
.inset:hover .inset-swap { background: var(--accent-dark); }

/* What the keys / stick control right now */
.mode-line {
  color: #2b3640;
  font-size: 0.78rem;
  margin: -0.15rem 0 0.45rem;
}
.mode-line[data-mode='locomotion'] { color: #c45a10; }
.stick-label {
  color: #fff;
  font-family: 'Google Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  left: 50%;
  pointer-events: none;
  position: absolute;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  top: -1.4rem;
  transform: translateX(-50%);
  white-space: nowrap;
}
.tbtn-walk { line-height: 1.05; }
body.is-touch .mode-line { display: none; }

/* Button guide in the phone menu */
.menu-guide {
  display: grid;
  font-size: 0.8rem;
  gap: 0.3rem 0.7rem;
  grid-template-columns: max-content 1fr;
  margin: 0.4rem 0 0.7rem;
}
.menu-guide dt { align-items: center; display: flex; font-weight: 700; gap: 0.3rem; white-space: nowrap; }
.menu-guide dd { color: #55606b; margin: 0; }
.g-dot { border: 1.5px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); display: inline-block; height: 0.8rem; width: 0.8rem; }
.g-stick { background: rgba(255, 255, 255, 0.6); box-shadow: 0 0 0 1px #9aa4ad; }
.g-dribble, .g-walk, .g-receive { background: #eef1ee; box-shadow: 0 0 0 1px #9aa4ad; }
.g-shoot { background: #750014; }
.g-pass { background: var(--accent-dark); }
.g-view { background: #3a6b3a; border-radius: 3px; }

/* Desktop: keep the top right clear (that's usually where the goal is). The
   status panel sits on the right, just above the onboard view. */
@media (min-width: 721px) and (pointer: fine), (min-width: 721px) and (pointer: none) {
  .hud { bottom: calc(28px + min(240px, 34vw)); top: auto; }
}

/* Narrow phones: the challenge clock drops below the top-left bar. */
@media (pointer: coarse) and (max-width: 660px) {
  body.is-touch .challenge-hud { top: calc(52px + env(safe-area-inset-top)); }
  body.is-touch .hint { top: calc(104px + env(safe-area-inset-top)); }
}

/* Share card after a finished challenge (public site) */
.share {
  backdrop-filter: blur(6px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 6px 24px rgba(23, 32, 42, 0.2);
  left: 50%;
  max-width: min(520px, calc(100vw - 32px));
  padding: 0.55rem 0.7rem 0.65rem;
  position: fixed;
  transform: translateX(-50%);
  z-index: 15;
}
.share[hidden] { display: none; }
.share-head { align-items: center; display: flex; justify-content: space-between; }
.share-head p { font-family: 'Google Sans', sans-serif; font-weight: 700; margin: 0; }
.share-head button { flex: none; font-size: 1.1rem; line-height: 1; padding: 0.05rem 0.5rem; }
.share-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
.share-row button, .share-link {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  flex: none;
  font-size: 0.82rem;
  padding: 0.3rem 0.8rem;
  text-decoration: none;
}
.share-link:hover, .share-row button:hover { border-color: var(--accent); }
#share-native { background: #750014; border-color: #750014; color: #fff; }
.share-note { color: #55606b; font-size: 0.78rem; margin: 0.4rem 0 0; }
/* Phones: between the stick and the skill buttons. */
body.is-touch .share { bottom: calc(10px + env(safe-area-inset-bottom)); max-width: min(380px, calc(100vw - 440px)); min-width: 260px; }
