/* Circle Football – only what's specific to this game.
   Header, difficulty and buttons come from /css/style.css. */

.cf-layout {
  gap: 16px;
}

/* ---------- Score + clock ---------- */

.cf-hud {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-display);
  font-weight: 700;
}

.cf-team {
  font-size: 15px;
  color: var(--text-muted);
}

.cf-team.is-mine {
  color: var(--accent);
}

.cf-score {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 30px;
}

.cf-dash {
  color: var(--text-faint);
}

.cf-clock {
  min-width: 56px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 15px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---------- Pitch ---------- */

/* Wide screens get a big pitch; phones fill the width */
.cf-stage {
  position: relative;
  width: min(100%, 900px);
}

.cf-pitch {
  width: 100%;
}

.cf-canvas {
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  touch-action: none; /* the joystick handles touches, not page scrolling */
}

/* End of match */
.cf-result {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius);
  background: var(--overlay);
  text-align: center;
}

.cf-result p {
  margin: 0;
}

.cf-result-score {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
}

.cf-result .btn {
  margin-top: 10px;
}

/* ---------- Keys hint ---------- */

.cf-keys {
  text-align: center;
}

kbd {
  display: inline-block;
  min-width: 22px;
  margin: 0 1px;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
}

/* On touch screens the keys hint is replaced by the controls */
@media (pointer: coarse) {
  .cf-keys {
    display: none;
  }
}

/* ---------- Touch controls ---------- */

/* The holder sits in a centred column, so it needs its own width */
.cf-touch-holder {
  width: min(100%, 900px);
}

.cf-touch-holder:empty {
  display: none;
}

/* Only on phones held upright */
.cf-rotate {
  display: none;
  text-align: center;
}

@media (pointer: coarse) and (orientation: portrait) {
  .cf-rotate {
    display: block;
  }
}

.cf-touch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 8px;
  user-select: none;
  -webkit-user-select: none;
}

.cf-stick {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  touch-action: none;
}

.cf-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.85;
}

.cf-kick {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 0;
  background: var(--accent-fill);
  color: var(--accent-text);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  touch-action: none;
}

.cf-kick.is-down {
  transform: scale(0.94);
  filter: brightness(0.92);
}

/* ---------- Online: waiting notes ---------- */

.cf-note {
  min-height: 21px;
  margin: 0;
  text-align: center;
}

.cf-note[data-tone="warn"] {
  color: var(--warn);
}

/* Sideways phone: pitch and controls side by side would be too
   cramped, so keep the controls under the pitch but smaller */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .cf-stick {
    width: 96px;
    height: 96px;
  }
  .cf-kick {
    width: 80px;
    height: 80px;
  }
}

/* ---------- Online: picking teams ---------- */

.cf-teams,
.cf-match {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.cf-teams-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.cf-teams > p {
  margin: 0;
}

.cf-team-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: min(100%, 560px);
}

.cf-team-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

/* Your team's column is outlined in green */
.cf-team-col.is-mine {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.cf-team-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.cf-team-col ul {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cf-team-col li {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cf-team-col li.is-empty {
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-faint);
  font-weight: 500;
}

.cf-team-col li.is-away {
  color: var(--text-faint);
}

.cf-watchers {
  min-height: 21px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 420px) {
  .cf-team-col {
    padding: 12px;
  }
}
@media (orientation: landscape) and (max-height: 540px) {
  :root { --land-side: 236px; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .cf-stage { width: min(900px, var(--play-w), calc(var(--play-h) * 1.94)); }
  .cf-rotate, .cf-keys { display: none; }
}
/* With friends, phone held sideways */
@media (orientation: landscape) and (max-height: 540px) {
  .cf-match {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "hud hud hud" "stick stage kick" "note note note";
    align-items: center;
    justify-items: center;
    gap: 6px 10px;
    width: 100%;
  }
  .cf-match > .cf-hud { grid-area: hud; }
  .cf-match > .cf-stage { grid-area: stage; width: min(900px, calc(100vw - 300px), calc((var(--play-h) - 44px) * 1.94)); }
  .cf-match > .cf-note { grid-area: note; }
  .cf-match .cf-touch-holder,
  .cf-match .cf-touch { display: contents; }
  .cf-match .cf-stick { grid-area: stick; }
  .cf-match .cf-kick { grid-area: kick; }
}
