* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; background: #05070f; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: #e8eefc; user-select: none; touch-action: none;
}
#app { position: fixed; inset: 0; }
#game { display: block; width: 100%; height: 100%; outline: none; }
#ui { position: absolute; inset: 0; pointer-events: none; }
#ui .clickable, #ui button, #ui input { pointer-events: auto; }

/* ---------- HUD ---------- */
.hud-top { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.hud-card {
  background: rgba(10,16,32,.72); border: 1px solid rgba(120,160,255,.25); border-radius: 12px;
  padding: 8px 12px; font-size: 13px; line-height: 1.35; backdrop-filter: blur(6px); max-width: 60vw;
}
.hud-card b { color: #7fd0ff; }
.objective { border-left: 3px solid #38e08a; }
.stats { text-align: right; min-width: 130px; }
.stats .money { color: #ffd166; font-weight: 700; }
.crosshair {
  position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 0 6px rgba(0,0,0,.9);
}
.crosshair.hidden { display: none; }
.hint-bottom { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 12px; color: #9fb0d8; background: rgba(8,12,24,.6); padding: 5px 12px; border-radius: 20px; white-space: nowrap; }
.prompt {
  position: absolute; left: 50%; top: 58%; transform: translateX(-50%);
  background: rgba(6,10,22,.85); border: 1px solid #38e08a; color: #d9ffe9;
  padding: 8px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; white-space: nowrap;
}
.toasts { position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; width: 90%; }
.toast { background: rgba(12,20,40,.92); border: 1px solid rgba(120,160,255,.35); padding: 8px 14px; border-radius: 10px; font-size: 13px; animation: pop .25s ease; max-width: 92%; text-align: center; }
.toast.good { border-color: #38e08a; }
.toast.bad { border-color: #ff5d6c; }
@keyframes pop { from { transform: translateY(10px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---------- Overlay / Menu ---------- */
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 30%, rgba(16,28,60,.55), rgba(3,5,12,.92)); text-align: center; padding: 20px; }
.overlay.hidden { display: none; }
.game-title { font-size: clamp(26px, 7vw, 54px); font-weight: 800; letter-spacing: 1px; margin: 0 0 6px; background: linear-gradient(90deg,#7fd0ff,#38e08a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.game-sub { color: #9fb0d8; font-size: clamp(12px, 3.4vw, 16px); margin-bottom: 22px; max-width: 620px; }
.btn {
  background: linear-gradient(180deg,#2b6bff,#1c46b8); border: none; color: #fff; font-size: 15px; font-weight: 700;
  padding: 12px 22px; border-radius: 12px; cursor: pointer; margin: 5px; min-width: 170px; box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.btn:hover { filter: brightness(1.12); }
.btn.ghost { background: rgba(255,255,255,.08); border: 1px solid rgba(160,190,255,.35); }
.btn.green { background: linear-gradient(180deg,#2fce7d,#16a05a); }
.btn.gold { background: linear-gradient(180deg,#f0b429,#c98a06); color: #241a00; }
.btn.red { background: linear-gradient(180deg,#f4586b,#b82438); }
.btn.small { min-width: 0; padding: 8px 14px; font-size: 13px; }

/* ---------- Panels (dialog / exam / computer) ---------- */
.panel-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(2,4,10,.62); padding: 14px; overflow-y: auto; }
.panel-wrap.bottom { align-items: flex-end; background: linear-gradient(to top, rgba(2,4,10,.88), rgba(2,4,10,.25)); padding-bottom: 4vh; }
.panel {
  width: min(760px, 96vw); max-height: 92vh; overflow-y: auto; background: #0d1428;
  border: 1px solid rgba(120,160,255,.3); border-radius: 16px; padding: 18px 20px; text-align: left;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.panel h2 { margin: 0 0 4px; font-size: 20px; color: #7fd0ff; }
.panel h3 { margin: 16px 0 6px; font-size: 15px; color: #b9c8ec; }
.panel p { margin: 6px 0; font-size: 14px; line-height: 1.5; color: #cfdaf5; }
.panel .muted { color: #8fa0c6; font-size: 12.5px; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.q-text { font-size: clamp(17px, 4.6vw, 23px); font-weight: 700; margin: 14px 0 4px; line-height: 1.35; }
.q-visual { font-size: 34px; letter-spacing: 6px; margin: 6px 0; }
.opts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.opt {
  text-align: left; background: rgba(255,255,255,.06); border: 1px solid rgba(150,180,255,.3);
  color: #e8eefc; padding: 12px 14px; border-radius: 10px; font-size: 15px; cursor: pointer;
}
.opt:hover { background: rgba(120,160,255,.18); }
.opt.correct { background: rgba(56,224,138,.28); border-color: #38e08a; }
.opt.wrong { background: rgba(255,93,108,.28); border-color: #ff5d6c; }
.progress-bar { height: 8px; background: rgba(255,255,255,.1); border-radius: 8px; overflow: hidden; margin-top: 10px; }
.progress-bar > div { height: 100%; background: linear-gradient(90deg,#2b6bff,#38e08a); width: 0%; transition: width .3s; }
.timer { float: right; color: #ffd166; font-variant-numeric: tabular-nums; }
.uni-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid rgba(150,180,255,.22); border-radius: 10px; margin-bottom: 6px; background: rgba(255,255,255,.04); }
.uni-row .info { flex: 1; font-size: 13px; }
.uni-row .info small { color: #8fa0c6; }
.uni-row .pick { font-weight: 800; color: #ffd166; min-width: 22px; text-align: center; }
.uni-row.full { opacity: .55; }
.badge { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 6px; background: rgba(127,208,255,.15); color: #9fd8ff; margin-left: 6px; }
.badge.green { background: rgba(56,224,138,.18); color: #8ff0bb; }
.badge.red { background: rgba(255,93,108,.18); color: #ffb3ba; }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th, table.list td { text-align: left; padding: 7px 6px; border-bottom: 1px solid rgba(150,180,255,.15); }
table.list th { color: #8fa0c6; font-weight: 600; }

/* computer OS */
.pc-frame { width: min(900px, 97vw); height: min(640px, 92vh); background: #08101f; border: 1px solid rgba(120,160,255,.35); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.7); }
.pc-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #101a33; border-bottom: 1px solid rgba(120,160,255,.25); }
.pc-bar .dot { width: 11px; height: 11px; border-radius: 50%; }
.pc-bar .title { flex: 1; text-align: center; font-size: 13px; color: #9fb0d8; }
.pc-body { flex: 1; display: flex; min-height: 0; }
.pc-icons { width: 160px; background: #0c1526; border-right: 1px solid rgba(120,160,255,.18); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.pc-app { background: rgba(255,255,255,.05); border: 1px solid rgba(150,180,255,.2); color: #dfe8ff; border-radius: 10px; padding: 10px 8px; font-size: 12.5px; cursor: pointer; text-align: center; }
.pc-app:hover { background: rgba(120,160,255,.18); }
.pc-app.active { border-color: #38e08a; background: rgba(56,224,138,.14); }
.pc-screen { flex: 1; padding: 14px 16px; overflow-y: auto; }
.pc-screen h2 { margin: 0 0 8px; font-size: 17px; color: #7fd0ff; }
.pc-screen h3 { margin: 14px 0 4px; font-size: 14px; color: #b9c8ec; }
.mail { border-left: 3px solid #7fd0ff; padding: 6px 10px; margin-bottom: 8px; background: rgba(255,255,255,.04); border-radius: 0 8px 8px 0; font-size: 13px; }
.mail.unread { border-left-color: #ffd166; }

/* ---------- Mobile controls ---------- */
.touch-only { display: none; }
body.touch .touch-only { display: block; }
body.touch .hint-bottom { display: none; }
#joystick { position: absolute; left: 18px; bottom: 18px; width: 130px; height: 130px; border-radius: 50%; background: rgba(10,18,36,.45); border: 2px solid rgba(160,190,255,.35); }
#joystick .stick { position: absolute; left: 35px; top: 35px; width: 60px; height: 60px; border-radius: 50%; background: rgba(190,215,255,.5); }
#actionBtn {
  position: absolute; right: 20px; bottom: 26px; width: 96px; height: 96px; border-radius: 50%;
  background: rgba(56,224,138,.25); border: 2px solid #38e08a; color: #eafff2; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.15;
}
#actionBtn:active { background: rgba(56,224,138,.5); }
#runBtn { position: absolute; right: 128px; bottom: 40px; width: 62px; height: 62px; border-radius: 50%; background: rgba(255,209,102,.22); border: 2px solid #ffd166; color: #fff3d0; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
#menuBtn { position: absolute; right: 14px; top: 12px; width: 40px; height: 40px; border-radius: 10px; background: rgba(10,18,36,.7); border: 1px solid rgba(150,180,255,.35); color: #dfe8ff; font-size: 17px; display: flex; align-items: center; justify-content: center; }
.scroll-note { font-size: 11.5px; color: #7d8db3; }
