@import url('data:text/css,');

:root {
  --ink: #f5f7ed;
  --muted: #9cab9e;
  --lime: #c9ff3d;
  --lime-dark: #172d13;
  --pitch: #0f5d35;
  --panel: #0b1710;
  --line: rgba(232, 255, 223, 0.14);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #061008; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(52, 113, 51, 0.22), transparent 31rem),
    radial-gradient(circle at 90% 80%, rgba(119, 150, 38, 0.10), transparent 28rem),
    #061008;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.25'/%3E%3C/svg%3E");
}

button { font: inherit; }

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 26px 24px 28px;
}

.masthead {
  display: grid;
  grid-template-columns: 50px 1fr 44px;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 48px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(201, 255, 61, 0.38);
  border-radius: 50%;
  background: rgba(201, 255, 61, 0.08);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  content: "";
  position: absolute;
  width: 22px;
  height: 2px;
  background: var(--lime);
  transform: rotate(60deg);
}

.brand-mark::after { transform: rotate(-60deg); }
.brand-mark span { transform: rotate(0); }

.eyebrow {
  margin: 0 0 2px;
  color: var(--lime);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.27em;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 4.2vw, 31px);
  line-height: 1;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

h1 em { color: var(--lime); font-style: normal; }

.icon-button {
  width: 44px;
  height: 44px;
  cursor: pointer;
  color: var(--lime);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 21px;
  transition: 160ms ease;
}

.icon-button:hover { border-color: var(--lime); transform: translateY(-1px); }
.icon-button.is-muted { color: var(--muted); }

.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 74px;
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: rgba(10, 24, 15, 0.94);
}

.score-cell { display: flex; flex-direction: column; }
.score-cell--right { align-items: flex-end; }
.score-label { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.score-cell strong { margin-top: -2px; font: 900 29px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.08em; }
.score-cell:first-child strong { color: var(--lime); }

.match-clock {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  color: #cbd4cc;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 99px;
  background: rgba(255,255,255,.035);
  font-size: 9px;
  letter-spacing: .11em;
}

.match-clock span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #98a09a;
  box-shadow: 0 0 0 3px rgba(152,160,154,.12);
}

.match-clock.is-live span { background: var(--lime); box-shadow: 0 0 0 3px rgba(201,255,61,.13), 0 0 9px var(--lime); }

.game-card {
  border: 1px solid var(--line);
  border-radius: 0 0 24px 24px;
  background: rgba(10, 24, 15, 0.94);
  box-shadow: 0 30px 90px rgba(0,0,0,.38);
  overflow: hidden;
}

.field-wrap {
  position: relative;
  margin: 0 12px;
  border: 1px solid rgba(234, 255, 223, 0.22);
  border-radius: 6px;
  background: #0f6338;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  touch-action: none;
}

.level-chip {
  position: absolute;
  top: 11px;
  right: 11px;
  padding: 6px 9px;
  color: rgba(255,255,255,.72);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 7px;
  background: rgba(4, 22, 12, .74);
  backdrop-filter: blur(6px);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .12em;
}

.level-chip b { color: var(--lime); font-size: 11px; }

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  background: linear-gradient(rgba(5, 23, 13, .78), rgba(5, 21, 12, .91));
  backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.game-overlay.is-visible { opacity: 1; pointer-events: auto; }

.overlay-badge {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 17px;
  border: 1px solid rgba(201,255,61,.45);
  border-radius: 50%;
  background: rgba(201,255,61,.09);
  box-shadow: 0 0 30px rgba(201,255,61,.08);
  font-size: 27px;
}

.overlay-kicker { margin: 0 0 8px; color: var(--lime); font-size: 9px; font-weight: 900; letter-spacing: .25em; }
.game-overlay h2 { margin: 0; font-size: clamp(29px, 6.5vw, 49px); line-height: .98; letter-spacing: -.05em; text-transform: uppercase; }
.game-overlay > p:not(.overlay-kicker) { margin: 15px 0 23px; color: #b7c3b9; font-size: clamp(12px, 2.5vw, 15px); line-height: 1.55; }

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 26px;
  padding: 13px 14px 13px 20px;
  cursor: pointer;
  color: #10210d;
  border: 0;
  border-radius: 9px;
  background: var(--lime);
  box-shadow: 0 10px 35px rgba(201,255,61,.13);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
  transition: 160ms ease;
}

.primary-button:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(201,255,61,.22); }
.primary-button i { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 6px; background: rgba(16,33,13,.12); font-size: 17px; font-style: normal; }

.desktop-hint {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 18px 19px;
  color: #76857a;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

kbd {
  min-width: 20px;
  display: inline-flex;
  justify-content: center;
  margin-right: 2px;
  padding: 3px 5px;
  color: #bdc8be;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 4px;
  background: rgba(255,255,255,.04);
  font: inherit;
}

.mobile-controls { display: none; }

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding-top: 20px;
  color: #516057;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .2em;
}

.footer-ball { color: var(--lime); font-size: 7px; }

@media (max-width: 620px), (pointer: coarse) {
  .app-shell { padding: 18px 12px 24px; }
  .masthead { grid-template-columns: 42px 1fr 42px; margin-bottom: 15px; }
  .brand-mark, .icon-button { width: 42px; height: 42px; }
  .scoreboard { min-height: 66px; padding: 8px 14px; border-radius: 18px 18px 0 0; }
  .score-cell strong { font-size: 25px; }
  .match-clock { padding: 6px 8px; }
  .field-wrap { margin: 0 7px; }
  .desktop-hint { display: none; }
  .mobile-controls {
    display: grid;
    grid-template-columns: repeat(3, 54px) 1fr 54px;
    grid-template-rows: repeat(2, 48px);
    justify-content: center;
    gap: 7px;
    padding: 14px;
  }
  .control, .pause-button {
    color: var(--ink);
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 12px;
    background: rgba(255,255,255,.055);
    font-size: 20px;
    font-weight: 900;
    touch-action: manipulation;
  }
  .control:active, .pause-button:active { color: #10210d; background: var(--lime); transform: scale(.95); }
  .control--up { grid-column: 2; grid-row: 1; }
  .control--left { grid-column: 1; grid-row: 2; }
  .control--down { grid-column: 2; grid-row: 2; }
  .control--right { grid-column: 3; grid-row: 2; }
  .pause-button { grid-column: 5; grid-row: 1 / 3; }
  footer { padding-top: 15px; }
}

@media (max-height: 740px) and (orientation: landscape) {
  .app-shell { width: min(100%, 560px); padding-top: 10px; }
  .masthead { margin-bottom: 9px; }
  .scoreboard { min-height: 55px; }
  .mobile-controls, footer { display: none; }
}

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