:root {
  --bg: #090d16;
  --card: rgba(12, 16, 27, .86);
  --card-strong: rgba(19, 25, 40, .94);
  --text: #f7f8ff;
  --muted: #aeb7cc;
  --accent: #7c5cff;
  --accent-2: #00d4ff;
  --danger: #ff4e62;
  --gold: #ffd166;
  --border: rgba(255,255,255,.14);
}
* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,.70), rgba(0,0,0,.24));
  pointer-events: none;
}
.app-shell { position: relative; z-index: 1; width: min(1180px, calc(100% - 24px)); margin: 0 auto; padding: 28px 0; }
.card { width: min(820px,100%); margin: 24px auto; padding: 28px; border: 1px solid var(--border); border-radius: 28px; background: var(--card); backdrop-filter: blur(14px); box-shadow: 0 24px 80px rgba(0,0,0,.42); text-align: center; }
.top-row { display:flex; justify-content:flex-end; align-items:center; gap:12px; margin-bottom:12px; }
.feedback-link { color: var(--accent-2); text-decoration:none; font-weight:700; }
.feedback-link:hover { text-decoration: underline; }
.game-logo { width: 140px; height: 140px; object-fit: cover; border-radius: 28px; box-shadow: 0 18px 40px rgba(0,0,0,.35); }
.eyebrow { margin: 18px 0 8px; color: var(--accent-2); text-transform: uppercase; letter-spacing: .18em; font-size: 12px; font-weight: 800; }
h1,h2,h3,p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(44px,8vw,82px); line-height: .95; }
h2 { font-size: clamp(30px,5vw,46px); }
h3 { margin-bottom: 14px; }
.muted { color: var(--muted); }
.small-text { font-size: 14px; }
.menu-actions { display: grid; gap: 12px; width: min(420px,100%); margin: 22px auto; }
.inline-actions { display:flex; justify-content:center; gap:12px; flex-wrap:wrap; }
button, select, .button-link { font: inherit; }
button, .button-link { border: 1px solid var(--border); border-radius: 16px; padding: 13px 18px; background: rgba(255,255,255,.08); color: var(--text); cursor: pointer; transition: transform .16s ease, background .16s ease, border-color .16s ease; text-decoration:none; display:inline-block; }
button:hover, .button-link:hover { transform: translateY(-2px); background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.28); }
button:disabled { opacity:.45; cursor:not-allowed; transform:none; }
.primary-button { border-color: transparent; background: linear-gradient(135deg,var(--accent),var(--accent-2)); color: white; font-weight: 800; }
.primary-button:hover { background: linear-gradient(135deg,#9279ff,#26dcff); }
.small-button { padding: 8px 12px; border-radius: 12px; }
.stats-grid { display:grid; grid-template-columns: repeat(3,1fr); gap:12px; margin-top:20px; }
.stat-box { padding:16px; border:1px solid var(--border); border-radius:18px; background: rgba(255,255,255,.07); }
.stat-box span { display:block; color: var(--muted); font-size:13px; }
.stat-box strong { display:block; margin-top:4px; font-size:30px; }
.message { margin-top:16px; padding:14px; border-radius:16px; background: rgba(255,255,255,.08); }
.danger { background: rgba(255,78,98,.22); border:1px solid rgba(255,78,98,.36); }
.feedback-prompt { border: 1px solid rgba(0,212,255,.28); }
.achievement-toast { position: fixed; right:20px; bottom:20px; z-index:30; padding:14px 18px; border-radius:18px; color:#201600; background:var(--gold); box-shadow:0 12px 40px rgba(0,0,0,.35); font-weight:800; }
.settings-section { margin:18px 0; padding:18px; border:1px solid var(--border); border-radius:20px; background:rgba(255,255,255,.06); text-align:left; }
.setting-row { display:grid; grid-template-columns: 1fr auto auto auto auto; align-items:center; gap:10px; margin:10px 0; }
.two-columns { display:grid; grid-template-columns: 1fr 1fr; gap:14px; }
.two-columns label, .toggle-row { display:grid; grid-template-columns: 1fr auto; align-items:center; gap:12px; }
select { width:100%; padding:12px; border-radius:14px; border:1px solid var(--border); background:rgba(255,255,255,.1); color:var(--text); }
option { background:#111827; }
.background-preview { display:grid; grid-template-columns: repeat(auto-fit,minmax(130px,1fr)); gap:12px; }
.background-option { min-height:94px; padding:8px; display:grid; gap:8px; align-items:center; justify-items:center; }
.background-option img, .theme-swatch { width:100%; height:58px; object-fit:cover; border-radius:12px; display:block; }
.background-option.active { border-color: var(--accent-2); box-shadow:0 0 0 2px rgba(0,212,255,.22) inset; }
.skin-list { display:grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap:14px; margin-top:18px; }
.skin-card { display:grid; gap:10px; padding:14px; border:1px solid var(--border); border-radius:18px; background:rgba(255,255,255,.06); }
.skin-preview { width:46px; height:46px; margin:0 auto; border-radius:12px; box-shadow:0 8px 20px rgba(0,0,0,.28); }
#game-container { width:100%; }
.game-panel { position:relative; width:min(100%, 980px); margin:0 auto; border:1px solid var(--border); border-radius:24px; overflow:hidden; background:rgba(0,0,0,.42); box-shadow:0 24px 80px rgba(0,0,0,.45); }
#gameCanvas { width:100%; aspect-ratio: 3 / 2; display:block; background:rgba(2,6,23,.45); }
#hud { position:absolute; top:12px; left:12px; display:flex; gap:10px; flex-wrap:wrap; }
#hud div, #powerup-bar span { padding:8px 10px; border:1px solid var(--border); border-radius:999px; background:rgba(8,13,24,.72); backdrop-filter: blur(8px); }
#powerup-bar { position:absolute; top:12px; right:86px; display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; max-width:50%; }
.pause-game { position:absolute; right:12px; top:12px; padding:8px 12px; border-radius:999px; }
.warning-message { position:absolute; left:50%; bottom:22px; transform:translateX(-50%); width:min(620px, calc(100% - 24px)); padding:12px 14px; border-radius:16px; background:rgba(255,78,98,.22); border:1px solid rgba(255,78,98,.45); text-align:center; font-weight:700; }
.overlay, .tutorial-overlay { position:absolute; inset:0; display:grid; place-items:center; padding:28px; background:rgba(4,7,16,.78); backdrop-filter: blur(9px); text-align:center; }
.tutorial-overlay { align-items:center; justify-items:center; }
.tutorial-card { width:min(720px, calc(100% - 24px)); display:grid; gap:12px; justify-items:center; padding:28px; border:1px solid var(--border); border-radius:24px; background:rgba(10,15,27,.88); box-shadow:0 24px 70px rgba(0,0,0,.45); text-align:center; }
.tutorial-overlay p { max-width:650px; margin:0 auto; font-size:19px; line-height:1.45; color:var(--muted); text-align:center; }
.step-count { width:max-content; margin:0 auto; padding:6px 10px; border-radius:999px; color:var(--accent-2); background:rgba(0,212,255,.12); border:1px solid rgba(0,212,255,.22); font-weight:800; }
.countdown-overlay { position:absolute; inset:0; display:grid; place-items:center; font-size:90px; font-weight:900; color:white; background:rgba(4,7,16,.46); text-shadow:0 14px 42px rgba(0,0,0,.6); }
.modal-backdrop { position:fixed; inset:0; z-index:50; background:rgba(0,0,0,.72); display:grid; place-items:center; padding:20px; }
.modal-card { width:min(520px,100%); }
@media (max-width: 720px) {
  .card { padding:20px; border-radius:22px; }
  .stats-grid, .two-columns { grid-template-columns:1fr; }
  .setting-row { grid-template-columns:1fr; text-align:center; }
  #hud { font-size:13px; }
  #powerup-bar { top:58px; right:12px; max-width:calc(100% - 24px); }
  h1 { font-size:48px; }
  .game-logo { width:110px; height:110px; }
}

/* V6 refinements */
#main-menu h1 { line-height: 1.08; margin-bottom: 18px; }
#menu-subtitle { margin-top: 8px; }
.beta-notice { margin: 14px auto 0; max-width: 720px; background: rgba(255, 209, 102, .13); border: 1px solid rgba(255, 209, 102, .30); color: #ffe6a3; }
.setting-help { display: block; grid-column: 1 / -1; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.two-columns label { align-content: start; }
.toggle-row { grid-template-columns: 1fr auto; }
.toggle-row .setting-help { padding-right: 20px; }
.tutorial-overlay { place-items: start center; padding-top: 18px; background: linear-gradient(180deg, rgba(4,7,16,.38), rgba(4,7,16,0)); backdrop-filter: none; pointer-events: none; }
.tutorial-card { width: min(760px, calc(100% - 24px)); padding: 16px 18px; gap: 8px; pointer-events: auto; background: rgba(10,15,27,.82); }
.tutorial-card h2 { font-size: clamp(22px, 3.4vw, 34px); margin-bottom: 2px; }
.tutorial-overlay p { font-size: 16px; line-height: 1.38; }
.tutorial-card .inline-actions { margin-top: 4px; }
.tutorial-card button { padding: 9px 14px; }
.step-count { font-size: 13px; padding: 4px 9px; }
@media (max-width: 720px) {
  #main-menu h1 { margin-bottom: 14px; }
  .tutorial-overlay { padding-top: 8px; }
  .tutorial-card { padding: 12px; }
}

/* V7 refinements */
.top-row { justify-content: space-between; }
.beta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 209, 102, .35);
  background: rgba(255, 209, 102, .14);
  color: #ffe6a3;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
}
#beta-notice {
  max-width: 780px;
  line-height: 1.45;
}
#main-menu h1 {
  line-height: 1.12;
  margin-bottom: 24px;
}
#menu-subtitle {
  margin-top: 0;
}
.tutorial-overlay {
  place-items: center;
  padding: 28px;
  background: rgba(4,7,16,.78);
  backdrop-filter: blur(9px);
  pointer-events: auto;
}
.tutorial-card {
  width: min(760px, calc(100% - 24px));
  padding: 28px;
  gap: 12px;
  background: rgba(10,15,27,.92);
}
.tutorial-card h2 {
  font-size: clamp(30px, 5vw, 46px);
}
.tutorial-overlay p {
  font-size: 19px;
  line-height: 1.45;
}
@media (max-width: 720px) {
  .top-row { align-items: flex-start; gap: 10px; }
  .feedback-link { text-align: right; }
  #main-menu h1 { margin-bottom: 18px; }
  .tutorial-overlay { padding: 16px; }
  .tutorial-card { padding: 20px; }
}
