:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #64706a;
  --line: #d9e1db;
  --soft: #f4f7f2;
  --surface: #ffffff;
  --field: #17633a;
  --field-dark: #0e4a2b;
  --gold: #f4b740;
  --sky: #dceefe;
  --danger: #b13b3b;
  --shadow: 0 14px 34px rgba(23, 32, 27, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  background:
    linear-gradient(180deg, rgba(220, 238, 254, 0.7), rgba(244, 247, 242, 0.95) 34rem),
    var(--soft);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

#app {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

.app-shell {
  width: 100%;
  max-width: 100%;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-x: clip;
  padding: 1rem;
}

.phone-frame {
  width: min(100%, 460px);
  max-width: 100%;
  min-height: calc(100svh - 2rem);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(23, 32, 27, 0.1);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  min-height: 68px;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.back-button,
.text-button {
  display: inline-grid;
  min-width: 42px;
  height: 42px;
  place-items: center;
  padding: 0 0.7rem;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.screen-title {
  min-width: 0;
  flex: 1;
}

.screen-title p,
.screen-title h1 {
  margin: 0;
}

.screen-title p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.screen-title h1 {
  overflow: hidden;
  font-size: 1.25rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen {
  min-width: 0;
  padding: 1rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem 0 0.8rem;
}

.section-heading > div {
  min-width: 0;
}

.section-heading h2,
.section-heading p {
  margin: 0;
}

.section-heading h2 {
  font-size: 1.08rem;
}

.section-heading p {
  color: var(--muted);
  font-size: 0.92rem;
}

.stack {
  display: grid;
  gap: 0.85rem;
}

.team-card,
.game-card,
.privacy-panel,
.hub-summary,
.scoring-panel,
.play-card,
.placeholder-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.team-card,
.game-card {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  width: 100%;
  padding: 1rem;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.game-card {
  scroll-margin-top: 86px;
}

.game-card-focus {
  border-color: rgba(244, 183, 64, 0.85);
  background: linear-gradient(180deg, #ffffff, #fff8e8);
}

.team-card:hover,
.game-card:hover,
.team-card:focus-visible,
.game-card:focus-visible {
  outline: 3px solid rgba(244, 183, 64, 0.45);
}

.team-card header,
.game-card header,
.hub-summary header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.team-card header > div,
.game-card header > div,
.hub-summary header > div {
  min-width: 0;
}

.team-card h2,
.game-card h3,
.hub-summary h2 {
  margin: 0;
  font-size: 1.05rem;
}

.team-card p,
.game-card p,
.hub-summary p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.28rem 0.56rem;
  background: var(--sky);
  color: #18425f;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-live {
  background: #ffe5e5;
  color: var(--danger);
}

.status-final {
  background: #e7efe9;
  color: var(--field-dark);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 0;
}

.meta-chip {
  border-radius: 999px;
  padding: 0.36rem 0.56rem;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.primary-button,
.secondary-button,
.quick-button {
  min-width: 0;
  min-height: 44px;
  border-radius: 8px;
  padding: 0.75rem 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  background: var(--field);
  color: #ffffff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.hub-summary {
  padding: 1rem;
  background:
    linear-gradient(135deg, rgba(23, 99, 58, 0.95), rgba(14, 74, 43, 0.92)),
    var(--field);
  color: #ffffff;
}

.hub-summary p {
  color: rgba(255, 255, 255, 0.78);
}

.hub-tabs {
  position: sticky;
  top: 68px;
  z-index: 9;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.7rem 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.tab-button {
  min-width: 0;
  min-height: 40px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}

.tab-button[aria-selected="true"] {
  background: var(--field);
  color: #ffffff;
}

.privacy-panel,
.placeholder-panel {
  padding: 0.9rem;
  background: #fbfcfb;
}

.privacy-panel strong,
.placeholder-panel strong {
  display: block;
  margin-bottom: 0.25rem;
}

.privacy-panel p,
.placeholder-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.scoreboard {
  padding: 1rem;
  border-radius: 8px;
  background: var(--field);
  color: #ffffff;
}

.score-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
}

.scoreboard p {
  margin: 0.65rem 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.score-team {
  min-width: 0;
}

.score-team-away {
  text-align: right;
}

.score-label {
  display: flex;
  align-items: center;
  gap: 0.28rem;
}

.score-label span {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.8rem;
  font-weight: 800;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.score-team-away .score-label {
  justify-content: flex-end;
}

.score-team strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 2rem;
  line-height: 1;
}

.score-divider {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 900;
}

.field-view {
  display: grid;
  gap: 0.55rem;
  border: 1px solid rgba(23, 99, 58, 0.2);
  border-radius: 8px;
  padding: 0.85rem;
  background: #f7fbf8;
}

.field-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.field-view-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-view-header span,
.field-view p {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.field-view p {
  margin: 0;
}

.field-strip {
  position: relative;
  height: 92px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(180deg, #1f7a48, #155f37);
}

.field-strip::before {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.end-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  display: grid;
  width: calc(8px + 11%);
  place-items: center;
  padding: 0.25rem 0;
  background: rgba(23, 32, 27, 0.26);
  color: rgba(255, 255, 255, 0.8);
  font-size: clamp(0.5rem, 2.3vw, 0.62rem);
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
  text-align: center;
  text-transform: uppercase;
  writing-mode: vertical-rl;
}

.end-zone-left {
  left: 0;
  transform: rotate(180deg);
}

.end-zone-right {
  right: 0;
}

.goal-line {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  width: 3px;
  background: rgba(255, 255, 255, 0.94);
  transform: translateX(-50%);
}

.goal-line-left {
  left: calc(8px + 11%);
}

.goal-line-right {
  right: calc(8px + 11%);
  transform: translateX(50%);
}

.midfield-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: rgba(244, 183, 64, 0.9);
  transform: translateX(-50%);
}

.no-run-marker {
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 0;
  border-left: 2px dashed rgba(255, 255, 255, 0.72);
  transform: translateX(-50%);
}

.football-icon {
  display: grid;
  place-items: center;
  border: 2px solid #5d2f18;
  border-radius: 50%;
  background: #9b542a;
  color: transparent;
}

.ball-marker {
  position: absolute;
  top: 50%;
  width: 28px;
  height: 20px;
  box-shadow: 0 8px 18px rgba(23, 32, 27, 0.34);
  transform: translate(-50%, -50%);
  transition: left 280ms ease;
}

.possession-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 20px;
  box-shadow: 0 2px 5px rgba(23, 32, 27, 0.25);
  transform: scale(0.62);
  transform-origin: center;
}

.possession-icon::after {
  content: none;
}

.football-icon::after {
  width: 12px;
  height: 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.8);
  content: "";
}

.scoring-panel {
  padding: 1rem;
}

.view-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem;
  background: #ffffff;
}

.scoring-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.scoring-heading h2 {
  margin: 0;
  font-size: 1.05rem;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.quick-button {
  min-height: 58px;
  background: var(--soft);
  color: var(--ink);
  text-align: left;
}

.quick-button strong {
  display: block;
}

.quick-button span {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: end;
  padding: 1rem;
  background: rgba(23, 32, 27, 0.38);
}

.play-modal {
  display: grid;
  gap: 0.9rem;
  width: min(100%, 460px);
  max-height: calc(100svh - 2rem);
  margin: 0 auto;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px 12px 8px 8px;
  padding: 1rem;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.play-modal header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.play-modal h2,
.play-modal p {
  margin: 0;
}

.play-modal p {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.form-grid {
  display: grid;
  gap: 0.8rem;
}

.form-grid label {
  display: grid;
  gap: 0.35rem;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
}

.form-grid label span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.form-grid select,
.form-grid input {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  background: #ffffff;
  color: var(--ink);
}

.management-row {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.management-row span {
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.drive-section {
  display: grid;
  gap: 0.65rem;
}

.drive-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  border-bottom: 1px solid var(--line);
  padding: 0 0.1rem 0.45rem;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.drive-summary strong,
.drive-summary small {
  display: block;
}

.drive-summary strong {
  font-size: 0.92rem;
}

.drive-summary small,
.drive-summary > span:last-child {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.play-edit-button {
  justify-self: start;
  min-height: 36px;
  margin-top: 0.4rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
}

.play-card {
  padding: 0.8rem;
}

.play-card strong {
  display: block;
}

.play-card > span {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.play-card p {
  margin: 0.22rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  padding: 1.2rem 0.8rem;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 760px) {
  .app-shell {
    padding: 2rem;
  }

  .phone-frame {
    min-height: min(860px, calc(100svh - 4rem));
  }
}
