:root {
  --bg-primary: #000000;       /* transparent on additive display */
  --bg-surface: #0f141c;       /* visible dark UI surface */
  --bg-surface-2: #161d28;
  --text-primary: #ffffff;
  --text-secondary: #aeb6c2;
  --text-muted: #6b7480;
  --accent: #3cc9ff;
  --accent-2: #ffd24a;
  --focus-ring: #3cc9ff;
  --focus-glow: rgba(60, 201, 255, 0.45);
  --danger: #ff5c7a;
}

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

html, body { margin: 0; width: 100%; height: 100%; }

body {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Authored at a fixed 600x600; a CSS transform scales the whole box to fit the
   viewport (see fitApp() in app.js), so all layout/HUD math stays in 600-space. */
#app {
  width: 600px;
  height: 600px;
  position: relative;
  transform-origin: center center;
  flex: 0 0 auto;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.screen.hidden { display: none; }

/* ===== HOME ===== */
#home {
  align-items: center;
  justify-content: center;
  gap: 36px;
  padding: 24px;
}
.title-wrap { text-align: center; }
.title-logo {
  font-size: 58px;
  font-weight: 800;
  letter-spacing: 6px;
  background: linear-gradient(180deg, #ffe27a 0%, #ff7a3c 55%, #3cc9ff 120%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 140, 60, 0.25));
}
.title-tag {
  margin-top: 8px;
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.menu {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 300px;
}
.menu-btn {
  height: 64px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 19px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.menu-btn.primary {
  background: linear-gradient(180deg, #2aa9e0, #1f86c4);
  color: #06121a;
}
.menu-btn:focus {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 22px var(--focus-glow);
  transform: scale(1.03);
}
.menu-btn.hidden { display: none; }
.title-hint { font-size: 13px; color: var(--text-muted); text-align: center; }
.title-best { font-size: 14px; color: var(--accent-2); text-align: center; font-weight: 600; min-height: 18px; }

/* ===== GAME ===== */
#game { background: var(--bg-primary); }
#canvas { width: 600px; height: 600px; display: block; }

/* ===== HEADER (how-to) ===== */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--bg-surface);
  flex-shrink: 0;
}
.header h1 { font-size: 22px; font-weight: 700; }
.back-btn {
  background: transparent;
  color: var(--text-primary);
  font-size: 22px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
}
.back-btn:focus {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 18px var(--focus-glow);
}

/* ===== HOW-TO CONTENT ===== */
.content {
  flex: 1;
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.help-card {
  background: var(--bg-surface);
  border-radius: 14px;
  padding: 14px 16px;
}
.help-h {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}
.help-card p { font-size: 14px; line-height: 1.5; color: var(--text-secondary); }
.help-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.help-list li { font-size: 14px; line-height: 1.45; color: var(--text-secondary); }
.help-list b { color: var(--text-primary); }

/* Industrial field console — static surfaces, strong focus, no blur filters. */
:root { --bg-surface:#101d26; --bg-surface-2:#1c303b; --text-secondary:#bdcbd1; --text-muted:#96aab5; --accent:#8bd9e8; --accent-2:#f4cf91; --focus-ring:#f4cf91; --focus-glow:rgba(244,207,145,.2); }
#home { padding:28px 40px 22px; gap:14px; align-items:stretch; justify-content:flex-start; background:linear-gradient(140deg,#111d24,#000 72%); }
.home-kicker { font-size:11px; font-weight:700; letter-spacing:2.4px; color:#a3b8c2; border-top:2px solid #e6bc78; padding-top:14px; }
.title-wrap { text-align:left; }
.title-logo { font-size:51px; letter-spacing:3px; line-height:1.05; background:none; color:#f5e7cf; filter:none; }
.title-tag { margin-top:8px; font-size:12px; letter-spacing:1.7px; color:#bbccd2; }
#home-art { width:520px; height:180px; border:1px solid #40525b; border-radius:10px; margin:1px 0; object-fit:contain; }
.menu { width:100%; gap:9px; }
.menu-btn { position:relative; height:46px; padding:0 18px; text-align:left; border:1px solid #3e515b; border-radius:8px; font-size:16px; background:#13232c; transition:background .12s,border-color .12s; }
.menu-btn::after { content:'›'; float:right; font-size:24px; color:#e9c68b; }
.menu-btn.primary { background:#e9c68b; color:#17232a; }
.menu-btn.primary::after { color:#17232a; }
.menu-btn:focus { border:2px solid #f4cf91; background:#243944; box-shadow:none; transform:none; color:#fff0d7; }
.title-best { min-height:0; font-size:13px; text-align:left; }
.title-best:empty { display:none; }
.title-hint { font-size:12px; line-height:1.6; text-align:left; color:#a9bec8; margin-top:auto; }
.help-card { border:1px solid #344952; border-radius:9px; }
.header { border-bottom:1px solid #4b6067; }
