@charset "utf-8";

@font-face {
  font-family: "Roboto";
  src: url("assets/ui/roboto-regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("assets/ui/roboto-medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("assets/ui/roboto-bold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #120b16;
  --ink: #fff7df;
  --muted: #c9b78a;
  --panel: rgba(38, 24, 31, 0.78);
  --panel-strong: rgba(55, 31, 37, 0.92);
  --line: rgba(255, 229, 161, 0.18);
  --red: #ff4b45;
  --teal: #21d6c7;
  --gold: #ffc857;
  --cream: #fff1c2;
  --green: #6ee06f;
  --blue: #5db7ff;
  --shadow: rgba(0, 0, 0, 0.38);
  font-family: "Roboto", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; min-height: 100%; overflow: hidden; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 75, 69, 0.23), transparent 34rem),
    radial-gradient(circle at 83% 20%, rgba(33, 214, 199, 0.18), transparent 31rem),
    linear-gradient(180deg, #1b1122 0%, #25141b 48%, #120b16 100%);
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image:
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 23px 23px;
  mask-image: radial-gradient(circle at center, black, transparent 83%);
  z-index: 5;
}

.app {
  width: min(1540px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 26px 0 28px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 16px;
}

.eyebrow, .kicker {
  margin: 0 0 8px;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 800;
}

h1, h2 { margin: 0; line-height: 1.02; }
h1 {
  max-width: 900px;
  font-size: clamp(30px, 4.6vw, 72px);
  letter-spacing: -0.06em;
  text-shadow: 0 18px 50px rgba(0,0,0,.35);
}
h2 { font-size: 24px; letter-spacing: -0.03em; }

.tap-hint {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 200, 87, .38);
  background: linear-gradient(135deg, rgba(255,200,87,.18), rgba(255,75,69,.10));
  color: var(--cream);
  border-radius: 999px;
  padding: 11px 16px;
  box-shadow: 0 14px 30px rgba(0,0,0,.28), inset 0 0 28px rgba(255, 200, 87, .08);
  transition: opacity .25s ease, transform .25s ease;
}
.tap-hint.hidden { opacity: 0; transform: translateY(-6px); pointer-events: none; }

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.hud-card, .station-overlay > div {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  column-gap: 11px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .13);
  background:
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.035)),
    linear-gradient(135deg, rgba(255,200,87,.10), rgba(33,214,199,.055));
  border-radius: 20px;
  padding: 12px 15px;
  box-shadow: 0 18px 42px var(--shadow), inset 0 1px rgba(255,255,255,.16), inset 0 -18px rgba(0,0,0,.08);
}
.hud-card img, .station-overlay img, .progress-strip img, .ui-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 7px 10px rgba(0,0,0,.32));
}
.hud-card img, .station-overlay img {
  grid-row: 1 / span 2;
}
.hud-card span, .station-overlay span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.hud-card strong, .station-overlay strong { font-size: 24px; line-height: 1; }

.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(410px, .72fr);
  gap: 14px;
  align-items: stretch;
}
.panel {
  position: relative;
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 28px;
  box-shadow: 0 32px 90px rgba(0,0,0,.35), inset 0 1px rgba(255,255,255,.08);
  overflow: hidden;
  backdrop-filter: blur(18px);
}
.panel-title {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px 14px;
  z-index: 2;
}
.panel-title.compact { padding-bottom: 10px; }

.soft-button, .upgrade-button {
  border: 1px solid rgba(255, 200, 87, .42);
  background: linear-gradient(180deg, rgba(255, 200, 87, .28), rgba(255, 75, 69, .22));
  color: var(--cream);
  border-radius: 16px;
  padding: 11px 14px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,.26), inset 0 1px rgba(255,255,255,.18);
  transition: transform .16s ease, filter .16s ease, opacity .16s ease;
}
.soft-button:hover, .upgrade-button:hover { transform: translateY(-1px); filter: brightness(1.09); }
.soft-button:active, .upgrade-button:active { transform: translateY(1px) scale(.99); }
.upgrade-button:disabled { opacity: .42; cursor: not-allowed; filter: grayscale(.5); }

.station-panel { min-height: 690px; }
#stationCanvas {
  display: block;
  width: 100%;
  height: calc(100% - 82px);
  min-height: 600px;
}
.station-overlay {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  pointer-events: none;
}
.station-overlay > div { padding: 11px 13px; background: rgba(28, 18, 23, .78); }
.station-overlay strong { font-size: 18px; }

.match-panel {
  padding-bottom: 14px;
  background:
    radial-gradient(circle at 80% 0%, rgba(33, 214, 199, .12), transparent 17rem),
    linear-gradient(180deg, rgba(54,32,38,.94), rgba(26,16,23,.9));
}
.moves {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(33,214,199,.18), rgba(33,214,199,.05));
  border: 1px solid rgba(33,214,199,.34);
}
.moves span { color: var(--muted); font-size: 11px; line-height: 1; }
.moves strong { font-size: 24px; line-height: .9; }

.goals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  padding: 0 16px 12px;
}
.goal {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  background: rgba(255,255,255,.055);
}
.goal .label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.goal .label .ui-icon { width: 22px; height: 22px; }
.goal strong { display: block; margin-top: 6px; font-size: 18px; }
.goal.done { border-color: rgba(110,224,111,.55); background: rgba(110,224,111,.12); }

.board-wrap { padding: 0 16px; }
.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 7px;
  padding: 10px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.025)),
    repeating-linear-gradient(45deg, rgba(255,255,255,.018), rgba(255,255,255,.018) 8px, transparent 8px, transparent 18px);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: inset 0 0 28px rgba(0,0,0,.30);
  touch-action: manipulation;
}
.cell {
  aspect-ratio: 1;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  position: relative;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.92);
  font-weight: 900;
  font-size: clamp(17px, 2.5vw, 25px);
  text-shadow: 0 2px 8px rgba(0,0,0,.28);
  box-shadow: 0 10px 20px rgba(0,0,0,.28), inset 0 2px rgba(255,255,255,.30), inset 0 -9px rgba(0,0,0,.14);
  transform: translateZ(0);
  transition: transform .16s cubic-bezier(.2,.9,.25,1.25), filter .16s ease, opacity .16s ease;
}
.cell::before {
  content: "";
  position: absolute;
  inset: 14% 18% auto;
  height: 18%;
  border-radius: 999px;
  background: rgba(255,255,255,.36);
  filter: blur(.2px);
}
.cell .ui-icon {
  position: relative;
  z-index: 1;
  width: 66%;
  height: 66%;
  filter: drop-shadow(0 8px 9px rgba(0,0,0,.32));
}
.cell:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.08); }
.cell.selected { outline: 3px solid var(--cream); outline-offset: 2px; transform: scale(1.08); z-index: 2; }
.cell.pop { animation: pop .28s ease forwards; }
.cell.bad { animation: shake .24s ease; }
.cell[data-tile="fuel"] { background: linear-gradient(145deg, #fa4148, #982834); }
.cell[data-tile="snack"] { background: linear-gradient(145deg, #ffc857, #bd7520); }
.cell[data-tile="coffee"] { background: linear-gradient(145deg, #9b6338, #4d2a22); }
.cell[data-tile="parts"] { background: linear-gradient(145deg, #67b8ff, #2261a2); }
.cell[data-tile="soap"] { background: linear-gradient(145deg, #25d7c5, #137f83); }
.cell[data-tile="neon"] { background: linear-gradient(145deg, #fa6fff, #7b38e6); }

@keyframes pop { 0% { transform: scale(1); opacity: 1; } 45% { transform: scale(1.24) rotate(5deg); } 100% { transform: scale(.2); opacity: 0; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-6px); } 60% { transform: translateX(5px); } }

.board-tip {
  min-height: 36px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin: 11px 18px 12px;
}
.board-tip.win { color: var(--green); }
.board-tip.warn { color: var(--gold); }

.inventory, .upgrades, .offers {
  display: grid;
  gap: 9px;
  padding: 0 16px;
}
.inventory { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 12px; }
.offers { margin-top: 12px; }
.progress-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 16px 12px;
}
.progress-strip div {
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  border: 1px solid rgba(33, 214, 199, .24);
  border-radius: 15px;
  padding: 8px 9px;
  background: linear-gradient(180deg, rgba(33, 214, 199, .10), rgba(33, 214, 199, .035));
}
.progress-strip img { grid-row: 1 / span 2; width: 28px; height: 28px; }
.progress-strip span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  margin-bottom: 2px;
}
.progress-strip strong { font-size: 16px; line-height: 1; }
.inv-item, .upgrade-card, .offer-card {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.055);
  border-radius: 16px;
  padding: 10px;
}
.offer-card.ad { border-color: rgba(33, 214, 199, .28); background: rgba(33, 214, 199, .07); }
.offer-card.pack { border-color: rgba(255, 200, 87, .30); background: rgba(255, 200, 87, .07); }
.offer-card.pass { border-color: rgba(250, 111, 255, .30); background: rgba(250, 111, 255, .07); }
.inv-item span { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.inv-item span .ui-icon { width: 24px; height: 24px; }
.inv-item strong { font-size: 19px; }
.inv-pill { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; box-shadow: 0 0 16px currentColor; }
.upgrade-card, .offer-card { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 10px; }
.upgrade-card h3, .offer-card h3 { margin: 0 0 4px; font-size: 15px; }
.upgrade-card p, .offer-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.3; }
.upgrade-button { padding: 9px 11px; border-radius: 13px; white-space: nowrap; }

.float-text {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  color: var(--cream);
  font-weight: 900;
  text-shadow: 0 4px 16px rgba(0,0,0,.55);
  animation: floatUp 1s ease forwards;
}
@keyframes floatUp { from { transform: translate(-50%, 0) scale(.95); opacity: 0; } 18% { opacity: 1; } to { transform: translate(-50%, -54px) scale(1.05); opacity: 0; } }
.mobile-bar {
  display: none;
}
.offer-modal[hidden] { display: none; }
.offer-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
}
.offer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(20, 15, 24, .72);
  backdrop-filter: blur(5px);
}
.offer-popup {
  position: relative;
  width: min(560px, calc(100vw - 24px));
  border: 4px solid #f8bd36;
  border-radius: 34px;
  padding: 80px 18px 20px;
  background: linear-gradient(180deg, #ffb548, #f07832 72%, #c85029);
  box-shadow: 0 28px 70px rgba(0,0,0,.45), inset 0 3px rgba(255,255,255,.45);
  color: #fff8d8;
  text-align: center;
}
.offer-gifts {
  position: absolute;
  left: 50%;
  top: -45px;
  display: flex;
  gap: 7px;
  transform: translateX(-50%);
}
.offer-gifts img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  filter: drop-shadow(0 12px 12px rgba(0,0,0,.32));
}
.offer-awning {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 45px;
  height: 30px;
  border-radius: 0 0 18px 18px;
  background: repeating-linear-gradient(90deg, #f44733 0 34px, #fff0d2 34px 68px);
  box-shadow: 0 8px 18px rgba(0,0,0,.25);
}
.offer-close {
  position: absolute;
  right: -10px;
  top: -10px;
  z-index: 2;
  width: 54px;
  height: 54px;
  border: 4px solid #ffe38a;
  border-radius: 50%;
  background: linear-gradient(180deg, #ff6659, #be251e);
  color: #fff;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px #7b1d19;
  box-shadow: 0 10px 18px rgba(0,0,0,.28);
}
.offer-popup h2 {
  margin: 0 auto 10px;
  width: min(420px, 100%);
  border: 3px solid #ffdc67;
  border-radius: 22px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #bf2437, #8e1d2b);
  color: #fff8d8;
  font-size: 28px;
  text-shadow: 0 3px #61202a;
}
.offer-popup p {
  margin: 0 8px 14px;
  color: #fff4c8;
  font-weight: 800;
  text-shadow: 0 2px rgba(80,35,25,.45);
}
.offer-rewards {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.offer-reward {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 14px;
  border: 3px solid #ffaa2d;
  border-radius: 18px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #fff8d9, #ffd57a);
  color: #8c3524;
  box-shadow: inset 0 2px rgba(255,255,255,.8), 0 8px 16px rgba(0,0,0,.18);
  text-align: left;
}
.offer-reward .ui-icon {
  width: 66px;
  height: 66px;
}
.offer-reward strong {
  font-size: 22px;
  color: #8c3524;
}
.offer-primary {
  width: min(330px, 100%);
  min-height: 68px;
  border: 4px solid #baf15a;
  border-radius: 999px;
  background: linear-gradient(180deg, #8af23c, #25a90e);
  color: #fff;
  font-size: 28px;
  font-weight: 950;
  text-shadow: 0 3px #166812;
  box-shadow: 0 14px 25px rgba(0,0,0,.30), 0 0 24px rgba(125,255,61,.5), inset 0 4px rgba(255,255,255,.48);
}


@media (max-width: 1180px) {
  .game-shell { grid-template-columns: 1fr; }
  .station-panel { min-height: 560px; }
  #stationCanvas { min-height: 480px; }
}
@media (max-width: 720px) {
  html, body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
  }
  body { background-attachment: fixed; }
  .app {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    width: min(100vw - 10px, 1540px);
    height: 100dvh;
    padding: 5px 0 calc(70px + env(safe-area-inset-bottom));
    overflow: hidden;
  }
  .hero,
  .hud {
    display: none;
  }
  .game-shell {
    display: grid;
    grid-template-rows: minmax(255px, 42dvh) minmax(0, 1fr);
    gap: 6px;
    min-height: 0;
    overflow: hidden;
  }
  .station-panel {
    min-height: 0;
    height: auto;
    margin: 0;
  }
  #stationCanvas {
    height: calc(100% - 54px);
    min-height: 0;
  }
  .match-panel {
    min-height: 0;
    height: auto;
    overflow: hidden;
    padding-bottom: 6px;
  }
  .panel { border-radius: 22px; }
  .panel-title { padding: 10px 12px 8px; min-height: 52px; }
  h2 { font-size: 18px; }
  .kicker { font-size: 10px; margin-bottom: 4px; }
  .moves {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }
  .moves strong { font-size: 19px; }
  .goals {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    padding: 0 8px 6px;
  }
  .goal {
    border-radius: 13px;
    padding: 6px;
  }
  .goal .label { font-size: 9px; gap: 3px; }
  .goal .label .ui-icon { width: 18px; height: 18px; }
  .goal strong { font-size: 13px; margin-top: 3px; }
  .board-wrap { padding: 0 8px; }
  .board {
    gap: 4px;
    padding: 6px;
    border-radius: 18px;
  }
  .cell {
    border-radius: 11px;
    box-shadow: 0 5px 10px rgba(0,0,0,.28), inset 0 2px rgba(255,255,255,.30), inset 0 -6px rgba(0,0,0,.14);
  }
  .board-tip,
  .progress-strip,
  .inventory,
  .upgrades,
  .offers {
    display: none;
  }
  .station-overlay {
    left: 8px;
    right: 8px;
    bottom: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }
  .station-overlay > div {
    grid-template-columns: 22px 1fr;
    column-gap: 5px;
    border-radius: 13px;
    padding: 7px 6px;
  }
  .station-overlay img {
    width: 20px;
    height: 20px;
  }
  .station-overlay span { font-size: 9px; }
  .station-overlay strong { font-size: 13px; }
  .soft-button {
    min-height: 40px;
    padding: 8px 11px;
    border-radius: 14px;
  }
  .mobile-bar {
    position: fixed;
    z-index: 20;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, 1fr) minmax(76px, auto);
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(255, 229, 161, .22);
    border-radius: 22px;
    background: rgba(22, 13, 19, .88);
    box-shadow: 0 18px 50px rgba(0,0,0,.45), inset 0 1px rgba(255,255,255,.09);
    backdrop-filter: blur(18px);
  }
  .mobile-bar button,
  .mobile-bar span {
    min-height: 44px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 15px;
    background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.035));
    color: var(--cream);
    font-weight: 900;
    font-size: 12px;
  }
  .mobile-bar button:active { transform: translateY(1px) scale(.98); }
  .mobile-bar span {
    display: grid;
    place-items: center;
    color: var(--gold);
  }
}
