/* Medium pixel-art style: chunky pixels, limited palette, flat shapes — not photos */
:root {
  --bg-deep: #1a2030;
  --bg-mid: #243044;
  --ice: #a8d4e8;
  --ice-bright: #e8f4fc;
  --snow: #f0f4f8;
  --accent: #5cb8e0;
  --geoff: #5ce090;
  --warn: #e88840;
  --danger: #e05060;
  --panel: #141c28;
  --border: #3a5068;
  --font-ui: "Nunito", system-ui, sans-serif;
  --font-tech: "Orbitron", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: #121820;
  color: var(--snow);
  font-family: var(--font-ui);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* DOSWAPZ arcade chrome */
.arcade-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: #000;
  border-bottom: 2px solid #00aa88;
  font-family: "VT323", "Courier New", monospace;
  font-size: 20px;
  letter-spacing: 2px;
}

.arcade-bar a {
  color: #00ffcc;
  text-decoration: none;
  border: 1px solid #004433;
  padding: 4px 12px;
}

.arcade-bar a:hover {
  border-color: #00ffcc;
  background: rgba(0, 255, 204, 0.08);
}

.arcade-bar-title {
  color: #a8e0ff;
  letter-spacing: 2px;
  font-size: 18px;
  text-align: center;
}

.arcade-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.arcade-bar-btn {
  font: inherit;
  font-size: 18px;
  letter-spacing: 2px;
  color: #00ffcc;
  background: transparent;
  border: 1px solid #004433;
  padding: 4px 12px;
  cursor: pointer;
}

.arcade-bar-btn:hover {
  border-color: #00ffcc;
  background: rgba(0, 255, 204, 0.08);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 4px;
}

.howto-panel {
  max-width: 520px;
  max-height: min(88vh, 640px);
  overflow-y: auto;
  text-align: left;
}

.howto-panel h2 {
  text-align: center;
}

.howto-lead {
  text-align: center;
  margin-bottom: 12px !important;
}

.howto-block {
  margin-bottom: 12px;
  padding: 8px 10px;
  background: #0c1218;
  border: 2px solid #2a3848;
}

.howto-block h3 {
  font-family: var(--font-tech);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 6px;
}

.howto-block p {
  margin-bottom: 0 !important;
  font-size: 0.84rem !important;
  line-height: 1.45 !important;
}

.howto-list {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  font-size: 0.84rem;
  line-height: 1.5;
}

.howto-list li {
  margin: 4px 0;
}

.howto-panel .btn {
  display: block;
  width: 100%;
  margin-top: 8px;
}

.howto-side-btn {
  width: 100%;
  margin-top: 8px;
  font-size: 0.68rem !important;
  padding: 8px 10px !important;
}

.daily-strip {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  padding: 8px 12px;
  background: #0c1218;
  border: 2px solid #3a5068;
  font-family: "VT323", monospace;
  font-size: 16px;
  letter-spacing: 1px;
  color: #8ab0c8;
}

.daily-label { color: #ffd700; letter-spacing: 3px; font-size: 12px; }
.daily-seed { color: #7cffb2; letter-spacing: 2px; }

.soft-status {
  font-size: 0.82rem;
  opacity: 0.85;
  margin: 8px 0;
  color: #a8e0ff;
}

.soft-box {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #2a3848;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.soft-title {
  font-family: var(--font-tech);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.soft-box label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.72rem;
  opacity: 0.8;
}

.soft-box input {
  background: #0c1218;
  border: 1px solid #3a5068;
  color: #e8f4fc;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 0.85rem;
}

.soft-link {
  color: #7cffb2;
  font-size: 0.8rem;
  text-decoration: none;
  margin-top: 4px;
}

.soft-link:hover { text-decoration: underline; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 8px 0;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 240px;
  grid-template-rows: auto 1fr;
  gap: 12px;
  min-height: calc(100% - 48px);
}

.top-bar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border: 3px solid var(--border);
  border-radius: 0;
  box-shadow: 4px 4px 0 #0a0e14;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.brand h1 {
  font-family: var(--font-tech);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.geoff {
  color: var(--geoff);
}

.tagline {
  font-size: 0.78rem;
  opacity: 0.7;
  margin-top: 2px;
}

.hud {
  display: flex;
  gap: 12px;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
  padding: 4px 8px;
  background: #0c1218;
  border: 2px solid var(--border);
}

.hud-item .label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.6;
  font-family: var(--font-tech);
}

.hud-item span:last-child {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ice-bright);
  font-family: var(--font-tech);
}

#hud-diff {
  font-size: 0.7rem !important;
  letter-spacing: 0.04em;
  color: var(--geoff);
}

#hud-diff[data-diff="MEDIUM"],
#hud-diff[data-diff="MEDIUMp"] {
  color: #e8c060;
}

#hud-diff[data-diff="HARD"],
#hud-diff[data-diff="HARDp"] {
  color: var(--danger);
}

.stage-wrap {
  position: relative;
  overflow: hidden;
  border: 3px solid var(--border);
  box-shadow: 4px 4px 0 #0a0e14;
  background: #0c1218;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 120px);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #1a2838;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 18, 0.88);
  z-index: 5;
  padding: 16px;
}

.overlay.hidden {
  display: none;
}

.panel {
  max-width: 460px;
  width: 100%;
  background: #1a2434;
  border: 3px solid var(--border);
  border-radius: 0;
  padding: 24px 22px;
  text-align: center;
  box-shadow: 5px 5px 0 #0a0e14;
}

.panel.hidden {
  display: none;
}

.snowman-hero {
  display: block;
  width: 72px;
  height: 112px;
  margin: 0 auto 10px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  animation: bob 2.4s steps(4) infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.panel h2 {
  font-family: var(--font-tech);
  font-size: 1.2rem;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}

.panel p {
  font-size: 0.92rem;
  line-height: 1.5;
  opacity: 0.9;
  margin-bottom: 14px;
}

.controls {
  list-style: none;
  text-align: left;
  margin: 0 auto 12px;
  max-width: 320px;
  font-size: 0.88rem;
}

.controls li {
  margin: 5px 0;
}

.tip {
  font-size: 0.8rem;
  opacity: 0.75;
  margin-bottom: 14px;
  line-height: 1.4;
}

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 1px 6px;
  margin: 0 2px;
  border-radius: 0;
  border: 2px solid var(--border);
  background: #0c1218;
  font-family: var(--font-tech);
  font-size: 0.72rem;
  text-align: center;
}

.btn {
  display: inline-block;
  font-family: var(--font-tech);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 12px 20px;
  border-radius: 0;
  border: 2px solid #0a0e14;
  cursor: pointer;
  margin: 4px;
  box-shadow: 3px 3px 0 #0a0e14;
  text-transform: uppercase;
}

.btn:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 #0a0e14;
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.btn.primary {
  background: var(--accent);
  color: #0a1018;
}

.btn.ghost {
  background: transparent;
  color: var(--ice);
  border: 2px solid var(--border);
}

.component-big {
  font-size: 2.8rem;
  margin: 8px 0 16px;
}

.win-panel {
  max-width: 500px;
}

.win-sub {
  color: var(--geoff);
}

.geoff-boot {
  background: #060c10;
  border: 2px solid #2a5040;
  padding: 12px 14px;
  text-align: left;
  margin-bottom: 14px;
  max-height: 160px;
  overflow: hidden;
}

#boot-log {
  font-family: "Courier New", Consolas, monospace;
  font-size: 0.78rem;
  color: var(--geoff);
  line-height: 1.45;
  white-space: pre-wrap;
  min-height: 4em;
}

.win-score {
  font-weight: 800;
}

.geoff-panel {
  background: var(--panel);
  border: 3px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 4px 4px 0 #0a0e14;
}

.geoff-panel h3 {
  font-family: var(--font-tech);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.geoff-status {
  font-size: 0.78rem;
  opacity: 0.85;
}

.component-list {
  list-style: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.component-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 7px;
  background: #0c1218;
  border: 2px solid transparent;
  font-size: 0.8rem;
}

.component-list li.got {
  border-color: #2a6048;
  background: #0c2018;
}

.component-list li .icon {
  font-size: 1rem;
  width: 1.3em;
  text-align: center;
}

.component-list li .name {
  flex: 1;
}

.component-list li .badge {
  font-family: var(--font-tech);
  font-size: 0.52rem;
  letter-spacing: 0.05em;
  opacity: 0.5;
}

.component-list li.got .badge {
  color: var(--geoff);
  opacity: 1;
}

.geoff-machine {
  margin-top: auto;
  border: 2px solid var(--border);
  padding: 10px;
  background: #0c1218;
}

.rack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 8px;
}

.slot {
  height: 20px;
  background: #1a2030;
  border: 2px dashed #2a3848;
}

.slot.filled {
  border-style: solid;
  border-color: #2a8060;
  background: #1a4030;
}

.screen {
  height: 32px;
  background: #060c10;
  border: 2px solid #1a3028;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-tech);
  font-size: 0.65rem;
  color: #3a5048;
  letter-spacing: 0.1em;
}

.screen.online {
  color: var(--geoff);
  border-color: #2a6048;
  animation: pulse 1.2s steps(2) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Touch controls — hidden on desktop, shown on coarse pointers / narrow screens */
.touch {
  display: none;
  grid-column: 1 / -1;
  gap: 10px;
  align-items: stretch;
  justify-content: space-between;
  padding: 6px 4px 10px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.touch-left,
.touch-right {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.touch button {
  min-width: 56px;
  min-height: 52px;
  padding: 10px 14px;
  font-family: var(--font-tech);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ice-bright);
  background: #1a2838;
  border: 2px solid var(--border);
  border-radius: 0;
  box-shadow: 3px 3px 0 #0a0e14;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.touch button:active,
.touch button.is-down {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #0a0e14;
  background: #2a4058;
  border-color: var(--accent);
}

.touch button[data-k="jump"] {
  min-width: 72px;
  background: #1a3848;
  color: var(--accent);
}

.touch button[data-k="shoot"] {
  min-width: 56px;
  background: #3a2820;
  color: var(--warn);
  border-color: #684830;
}

@media (max-width: 900px) {
  #app {
    grid-template-columns: 1fr;
    padding: 8px;
    gap: 8px;
    min-height: auto;
  }

  .arcade-bar {
    padding: 6px 10px;
    font-size: 16px;
  }

  .arcade-bar-title {
    font-size: 14px;
    letter-spacing: 1px;
  }

  .arcade-bar a,
  .arcade-bar-btn {
    padding: 6px 10px;
    min-height: 40px;
  }

  .daily-strip {
    padding: 6px 8px;
    font-size: 14px;
  }

  .top-bar {
    padding: 6px 8px;
  }

  .hud {
    gap: 6px;
    width: 100%;
    justify-content: space-between;
  }

  .hud-item {
    min-width: 0;
    flex: 1;
    padding: 4px 4px;
  }

  .hud-item span:last-child {
    font-size: 0.9rem;
  }

  .stage-wrap {
    max-height: none;
    aspect-ratio: 16 / 9;
  }

  .touch {
    display: flex;
  }

  .geoff-panel {
    order: 3;
    padding: 10px;
  }

  .component-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }

  .component-list li {
    font-size: 0.72rem;
    padding: 5px 6px;
  }

  .geoff-machine {
    display: none;
  }

  .panel {
    padding: 16px 14px;
    max-width: 100%;
  }

  .panel h2 {
    font-size: 1rem;
  }

  .panel p {
    font-size: 0.85rem;
    margin-bottom: 10px;
  }

  .btn {
    padding: 12px 16px;
    min-height: 44px;
    font-size: 0.7rem;
  }

  .soft-box input {
    font-size: 16px; /* prevent iOS zoom */
    min-height: 44px;
  }
}

@media (max-width: 420px) {
  .arcade-bar-title {
    display: none;
  }

  .touch button {
    min-width: 48px;
    min-height: 48px;
    padding: 8px 10px;
    font-size: 0.75rem;
  }

  .touch button[data-k="jump"] {
    min-width: 64px;
  }
}

/* Coarse pointer (phones/tablets) even when wide */
@media (hover: none) and (pointer: coarse) {
  .touch {
    display: flex;
  }

  .btn {
    min-height: 44px;
  }

  .soft-box input {
    font-size: 16px;
  }
}
