* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0d1526;
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* the canvas takes every finger itself: no scrolling, no zooming */
canvas { display: block; touch-action: none; }

#fade {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background: #000;
  transition: opacity 0.25s;
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.label {
  font-size: 12px;
  letter-spacing: 2.5px;
  font-weight: 700;
}

#board {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(10, 16, 34, 0.85);
  backdrop-filter: blur(4px);
  font-weight: 800;
}

#board .side {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  min-width: 104px;
  font-size: 15px;
  letter-spacing: 1px;
}

#sideA { justify-content: flex-start; }
#sideB { justify-content: flex-end; }
#board .pts { font-size: 26px; font-variant-numeric: tabular-nums; }
#board .side.ball .abbr::after { content: " 🏈"; font-size: 12px; }

#board .mid { padding: 4px 14px; text-align: center; background: rgba(255, 255, 255, 0.08); }
#quarter { font-size: 11px; letter-spacing: 2px; opacity: 0.8; }
#clock { font-size: 22px; color: #ffe58a; font-variant-numeric: tabular-nums; }

#down {
  grid-column: 1 / 4;
  padding: 4px 10px 5px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 1.5px;
  background: rgba(255, 216, 74, 0.92);
  color: #2b2200;
}

#down:empty { display: none; }

/* top left; on rigottigames.com it sits just under the arcade's back button */
#pauseBtn {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
}

.arcade #pauseBtn { top: max(52px, calc(env(safe-area-inset-top) + 42px)); }

.pill {
  pointer-events: auto;
  cursor: pointer;
  font: inherit;
  border-radius: 999px;
  touch-action: manipulation;
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: rgba(10, 16, 34, 0.6);
  color: #fff;
  font-size: 12px;
  letter-spacing: 2px;
  padding: 8px 12px;
  min-height: 44px;
  backdrop-filter: blur(4px);
}

#soundBtn[aria-pressed="true"] { background: rgba(255, 255, 255, 0.92); color: #10203f; }

/* bottom right, out of the way of the throw */
#soundBtn {
  position: absolute;
  z-index: 2;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
}

/* two players: player 2's stick lives down there, so it goes to the top right */
.two #soundBtn {
  bottom: auto;
  top: max(16px, env(safe-area-inset-top));
}

#msg {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: 90%;
  text-align: center;
  font-size: 46px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.45), 0 0 24px rgba(0, 0, 0, 0.5);
}

#msg small { display: block; font-size: 18px; letter-spacing: 2px; margin-top: 4px; }
#msg.gold { color: #ffd94a; }
#msg.bad { color: #ff8a80; }

/* the throw buttons over the receivers' heads */
.throwTag {
  position: absolute;
  left: 0;
  top: 0;
  width: 46px;
  height: 46px;
  margin: -46px 0 0 -23px;
  border-radius: 50%;
  border: 3px solid #fff;
  color: #fff;
  font: inherit;
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  touch-action: none;
  cursor: pointer;
}

.throwTag { z-index: 3; }
.throwTag.wait { opacity: 0.55; pointer-events: none; }
.throwTag small { position: absolute; right: -6px; bottom: -6px; font-size: 10px; background: #10203f; border-radius: 6px; padding: 1px 4px; }
@media (hover: none) { .throwTag small { display: none; } }

#hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px));
  width: max-content;
  max-width: calc(100% - 340px);
  padding: 9px 20px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 999px;
  background: rgba(10, 16, 34, 0.8);
  backdrop-filter: blur(4px);
}

#hint:empty { display: none; }

#fourth {
  position: absolute;
  left: 50%;
  bottom: max(70px, calc(env(safe-area-inset-bottom) + 60px));
  transform: translateX(-50%);
  text-align: center;
  pointer-events: auto;
}

#fourth .row { display: flex; gap: 10px; margin-top: 6px; }

#fourth button {
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1.5px;
  background: #fff;
  color: #10203f;
  box-shadow: 0 5px 0 #8f9bc0;
  touch-action: manipulation;
}

#fourth button[data-four="go"] { background: #ffd94a; color: #4a3200; box-shadow: 0 5px 0 #b98a10; }
#fourth button:disabled { opacity: 0.4; cursor: default; }

/* ---------- sticks and buttons ---------- */

/* the bottom-left (and for player 2, bottom-right) part of the screen:
   hold anywhere in it to run. Taps up the field still throw. */
.zone {
  position: absolute;
  bottom: 0;
  width: 45%;
  height: 55%;
  pointer-events: auto;
  touch-action: none;
}

#stick1 { left: 0; }
#stick2 { right: 0; }

.stick {
  position: absolute;
  bottom: max(26px, calc(env(safe-area-inset-bottom) + 16px));
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
  opacity: 0.6;
}

.stick.held { opacity: 1; }

#stick1 .stick { left: max(26px, calc(env(safe-area-inset-left) + 16px)); }
#stick2 .stick { right: max(26px, calc(env(safe-area-inset-right) + 16px)); }

/* buttons sit on top of the zones */
.act, #fourth { z-index: 2; }

.stick .knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  margin: -29px 0 0 -29px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  pointer-events: none;
}

#stick1 .knob { background: rgba(255, 216, 74, 0.9); }
#stick2 .knob { background: rgba(110, 220, 255, 0.9); }

.stick span {
  position: absolute;
  top: -22px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  opacity: 0.7;
  pointer-events: none;
}

.act {
  position: absolute;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #ffd94a;
  color: #4a3200;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.5px;
  pointer-events: auto;
  touch-action: none;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
}

/* one player: the button sits middle right */
#act1 { right: max(34px, calc(env(safe-area-inset-right) + 24px)); top: 50%; transform: translateY(-50%); }

/* two players: each button sits above that player's stick */
.two #act1, .two #act2 {
  top: auto;
  transform: none;
  width: 92px;
  height: 92px;
  font-size: 13px;
  bottom: max(186px, calc(env(safe-area-inset-bottom) + 176px));
}

.two #act1 { right: auto; left: max(46px, calc(env(safe-area-inset-left) + 36px)); }
.two #act2 { right: max(46px, calc(env(safe-area-inset-right) + 36px)); background: #6edcff; color: #003040; }

.act:disabled {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.5) !important;
  box-shadow: none;
  cursor: default;
}

/* ---------- the menu card ---------- */

.card {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(64px, env(safe-area-inset-top)) 20px 28px;
  text-align: center;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 30%, rgba(30, 70, 140, 0.88), rgba(6, 10, 26, 0.96));
  backdrop-filter: blur(3px);
}

.card > * { flex-shrink: 0; }
.card .top { margin: auto 0 0; }
.card .bottom { margin: 0 0 auto; }

.card h1 {
  margin: 0;
  font-size: 64px;
  letter-spacing: 4px;
  line-height: 1.05;
  color: #ffd94a;
  text-shadow: 0 5px 0 #0b1a44;
}

.card h2 {
  margin: 0 0 6px;
  font-size: 34px;
  letter-spacing: 3px;
  color: #ffd94a;
}

.card .tag { margin: 10px 0 20px; font-size: 19px; letter-spacing: 1px; }
.card .note { max-width: 520px; margin: 0 auto 20px; font-size: 15px; line-height: 1.6; opacity: 0.92; }
.card .note:empty { display: none; }

.card .keys { list-style: none; margin: 0 0 18px; padding: 0; font-size: 14px; line-height: 2; }
.card .keys b {
  display: inline-block;
  padding: 1px 8px;
  margin: 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 5px;
  font-size: 12px;
  letter-spacing: 1px;
}

/* show the keys that match what you're holding */
.forTouch { display: none; }
@media (hover: none) {
  .forTouch { display: block; }
  .forKeys { display: none; }
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 8px;
}

button.big {
  cursor: pointer;
  border: none;
  background: #ffd94a;
  color: #4a3200;
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 2.5px;
  padding: 15px 28px;
  border-radius: 999px;
  box-shadow: 0 6px 0 #b98a10;
  touch-action: manipulation;
}

button.big.plain { background: #fff; color: #10203f; box-shadow: 0 6px 0 #8f9bc0; }
button.big:disabled { opacity: 0.5; cursor: default; }
button.big small { display: block; font-size: 10px; letter-spacing: 1.5px; font-weight: 700; }

.points { font-size: 16px; margin: 0 0 12px; }
.points b { color: #8ff08f; font-size: 20px; }

/* team picker */
.teams {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  width: min(100%, 980px);
  margin: 6px 0 14px;
}

.confName {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  text-align: left;
  font-size: 13px;
  letter-spacing: 3px;
  opacity: 0.8;
}

.team {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border: 3px solid var(--c2);
  border-radius: 14px;
  background: var(--c1);
  color: #fff;
  font: inherit;
  text-align: left;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  touch-action: manipulation;
}

.team .city { font-size: 12px; letter-spacing: 1px; opacity: 0.9; }
.team .nm { font-size: 18px; font-weight: 800; letter-spacing: 1px; }
.team .ovr { font-size: 11px; letter-spacing: 1.5px; opacity: 0.9; }
.team:disabled { opacity: 0.3; cursor: default; }

/* lists: careers, your players, the shop, standings */
.list {
  width: min(100%, 560px);
  margin: 6px 0 14px;
  border-radius: 18px;
  background: #f1f4ff;
  color: #10203f;
  padding: 10px;
  text-align: left;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
}

.list .row + .row { border-top: 1px solid #d8def5; }
.list .row.me { background: #fff3c4; }
.row .icon { font-size: 26px; width: 36px; text-align: center; }
.row .about { flex: 1; min-width: 0; }
.row .name { font-weight: 800; letter-spacing: 0.5px; font-size: 15px; }
.row .what { font-size: 12px; line-height: 1.4; opacity: 0.75; }
.row .num { font-weight: 800; font-size: 18px; min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.row .chip { width: 18px; height: 18px; border-radius: 5px; border: 2px solid; flex-shrink: 0; }

.row button {
  border: none;
  border-radius: 999px;
  padding: 9px 12px;
  min-width: 84px;
  background: #3cb043;
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 4px 0 #237a29;
  cursor: pointer;
  touch-action: manipulation;
}

.row button:disabled { background: #b9bdd0; box-shadow: 0 4px 0 #9094a8; cursor: default; }
.row button.del { min-width: 0; background: #d8dcf5; color: #10203f; box-shadow: none; }

.segs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 6px 0 18px; }
.segs button {
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 10px 16px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  touch-action: manipulation;
}

.segs button.on { background: #ffd94a; border-color: #ffd94a; color: #4a3200; }

.next {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 16px;
  padding: 12px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 16px;
}

.next .vs { font-size: 13px; letter-spacing: 2px; opacity: 0.7; }
.next b { font-size: 20px; }
.trophies { font-size: 26px; letter-spacing: 4px; margin: 0 0 6px; }

/* narrow screens: the scoreboard drops below the buttons and the trophy pill */
@media (max-width: 760px) {
  #board { top: max(116px, calc(env(safe-area-inset-top) + 106px)); }
}

@media (max-width: 700px), (max-height: 560px) {
  .card { padding-top: max(52px, env(safe-area-inset-top)); }
  .card h1 { font-size: 40px; }
  .card h2 { font-size: 26px; }
  .card .tag { font-size: 15px; margin: 6px 0 12px; }
  .card .note { font-size: 13px; margin-bottom: 12px; }
  button.big { font-size: 14px; padding: 12px 18px; }
  #msg { font-size: 30px; }
  #msg small { font-size: 14px; }
  #board .side { min-width: 80px; padding: 4px 8px; font-size: 12px; }
  #board .pts { font-size: 20px; }
  #clock { font-size: 17px; }
  #hint { font-size: 12px; max-width: calc(100% - 300px); }
  .stick { width: 112px; height: 112px; }
  .act { width: 88px; height: 88px; font-size: 13px; }
  #fourth button { padding: 10px 12px; font-size: 12px; }
}
