/* ===== Audit Quest 3D: Busy Season ===== */

:root {
  --bg: #1a1a2e;
  --panel: rgba(20, 20, 40, 0.92);
  --card: #f8f6f0;
  --text: #e0e0e0;
  --text-dark: #1a1a2e;
  --accent: #e9c46a;
  --accent-dark: #c4973a;
  --green: #2a9d8f;
  --red: #e76f51;
  --blue: #457b9d;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code', 'Consolas', 'Courier New', monospace;
  --radius: 10px;
}

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

body {
  font-family: var(--font);
  background: #000;
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

#gameContainer {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #000;
  overflow: hidden;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hidden { display: none !important; }

/* ── Room Label ───────────────────────────────────── */
.room-label {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent);
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.room-label.visible { opacity: 1; }

/* ── Camera Mode ──────────────────────────────────── */
.cam-mode {
  position: absolute;
  bottom: 12px;
  left: 12px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.4);
  padding: 4px 10px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 15;
  transition: opacity 0.3s;
}

.speech-toggle {
  position: absolute;
  bottom: 12px;
  left: 280px;
  font-size: 1.2rem;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(233,196,106,0.4);
  color: #e9c46a;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  z-index: 15;
  transition: background 0.2s, opacity 0.2s;
}
.speech-toggle:hover { background: rgba(233,196,106,0.2); }
.speech-toggle.muted { opacity: 0.5; }

/* ── HUD ───────────────────────────────────────────── */
.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(10,10,25,0.8) 0%, rgba(10,10,25,0) 100%);
  pointer-events: none;
  z-index: 10;
}
.hud-left { display: flex; gap: 24px; align-items: flex-start; }
.hud-item { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.hud-icon { font-size: 1.1rem; }
.hud-label { opacity: 0.6; font-size: 0.75rem; }
.hud-value { font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem; color: var(--accent); }
.hud-value.danger { color: var(--red); animation: pulse 0.5s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

.evidence-bar { width: 90px; height: 8px; background: rgba(255,255,255,0.15); border-radius: 4px; overflow: hidden; }
.evidence-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); border-radius: 4px; transition: width 0.4s ease; width: 0%; }
.evidence-fill.winning { background: linear-gradient(90deg, var(--green), var(--accent)); }

.hud-streak { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; color: var(--green); background: rgba(42,157,143,0.2); padding: 1px 5px; border-radius: 3px; }

.hud-right { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.hud-tasks { display: flex; flex-direction: column; gap: 2px; font-size: 0.75rem; }
.hud-task { display: flex; align-items: center; gap: 5px; opacity: 0.7; padding: 3px 10px; border-radius: 4px; background: rgba(255,255,255,0.05); }
.hud-task.done { opacity: 0.5; text-decoration: line-through; }
.hud-task.done .task-check { color: var(--green); }
.hud-task.active { opacity: 1; background: rgba(233,196,106,0.15); border: 1px solid rgba(233,196,106,0.3); }
.task-check { font-size: 0.85rem; }

/* ── Interaction Prompt ─────────────────────────────── */
.interact-prompt {
  position: absolute;
  bottom: 80px; left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid rgba(233,196,106,0.4);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: promptBounce 1.5s ease-in-out infinite;
  z-index: 20;
  pointer-events: none;
}
@keyframes promptBounce {
  0%,100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-5px); }
}

kbd {
  display: inline-block;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dark);
  background: var(--accent);
  border-radius: 4px;
  border-bottom: 2px solid var(--accent-dark);
}

/* ── Dialog Box ─────────────────────────────────────── */
.dialog-box {
  position: absolute;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 600px;
  background: var(--panel);
  border: 2px solid rgba(233,196,106,0.4);
  border-radius: var(--radius);
  padding: 16px 20px;
  z-index: 25;
}
.dialog-speaker { font-weight: 700; color: var(--accent); font-size: 0.85rem; margin-bottom: 6px; }
.dialog-text { font-size: 0.9rem; line-height: 1.5; }
.dialog-hint { font-size: 0.7rem; opacity: 0.4; margin-top: 8px; text-align: right; }

/* ── Overlays ───────────────────────────────────────── */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 10, 25, 0.88);
  z-index: 50;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

/* ── Title Screen ───────────────────────────────────── */
.title-content { text-align: center; animation: slideUp 0.6s ease; }
@keyframes slideUp { from{transform:translateY(30px);opacity:0} to{transform:translateY(0);opacity:1} }

.title-logo { font-size: 4rem; color: var(--accent); margin-bottom: 10px; text-shadow: 0 0 40px rgba(233,196,106,0.4); animation: logoGlow 3s ease-in-out infinite; }
@keyframes logoGlow { 0%,100% { text-shadow: 0 0 40px rgba(233,196,106,0.3); } 50% { text-shadow: 0 0 80px rgba(233,196,106,0.6); } }

.title-name { font-size: 2.8rem; font-weight: 900; letter-spacing: 6px; color: var(--accent); }
.title-3d { font-size: 1.4rem; color: var(--green); vertical-align: super; letter-spacing: 2px; }
.title-sub { font-size: 1.3rem; font-weight: 300; opacity: 0.7; letter-spacing: 8px; margin-bottom: 20px; }
.title-desc { max-width: 440px; margin: 0 auto 20px; font-size: 0.9rem; line-height: 1.6; opacity: 0.7; }
.title-controls { display: flex; justify-content: center; gap: 24px; margin-bottom: 28px; font-size: 0.8rem; opacity: 0.6; }
.title-footer { font-size: 0.75rem; opacity: 0.35; margin-top: 16px; }

/* ── Difficulty ────────────────────────────────────── */
.difficulty-group { display: flex; justify-content: center; gap: 10px; margin-bottom: 24px; }
.diff-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 18px; background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.1); border-radius: 8px; color: var(--text); cursor: pointer; transition: all 0.2s; min-width: 120px; }
.diff-btn:hover { background: rgba(233,196,106,0.1); border-color: rgba(233,196,106,0.3); }
.diff-btn.active { background: rgba(233,196,106,0.15); border-color: var(--accent); box-shadow: 0 0 12px rgba(233,196,106,0.2); }
.diff-label { font-weight: 700; font-size: 0.95rem; }
.diff-btn.active .diff-label { color: var(--accent); }
.diff-desc { font-size: 0.7rem; opacity: 0.5; }

/* ── Buttons ────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 22px; border: none; border-radius: 8px; font-family: var(--font); font-size: 0.9rem; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--text-dark); border-bottom: 3px solid var(--accent-dark); }
.btn-primary:hover { background: #f0d080; }
.btn-large { padding: 14px 40px; font-size: 1.05rem; letter-spacing: 2px; }
.btn-approve { background: var(--green); color: white; border-bottom: 3px solid #1f7a6e; }
.btn-approve:hover { background: #32b8a8; }
.btn-flag { background: var(--red); color: white; border-bottom: 3px solid #c45a3d; }
.btn-flag:hover { background: #f08070; }

/* ── End Screens ────────────────────────────────────── */
.end-content { text-align: center; animation: slideUp 0.5s ease; }
.end-icon { font-size: 4rem; margin-bottom: 10px; }
.end-content h1 { font-size: 2rem; margin-bottom: 10px; }
.end-stats { font-family: var(--font-mono); font-size: 0.95rem; color: var(--accent); margin-bottom: 8px; }
.end-sub { opacity: 0.6; margin-bottom: 24px; font-size: 0.9rem; }

.report-card { display: flex; align-items: center; gap: 20px; background: rgba(255,255,255,0.06); border: 1px solid rgba(233,196,106,0.2); border-radius: 12px; padding: 20px 28px; margin: 16px auto 12px; max-width: 380px; }
.report-grade { font-family: var(--font-mono); font-size: 3.5rem; font-weight: 900; line-height: 1; min-width: 60px; text-align: center; }
.grade-A { color: #2ecc71; text-shadow: 0 0 20px rgba(46,204,113,0.4); }
.grade-B { color: #27ae60; }
.grade-C { color: var(--accent); }
.grade-D { color: #e67e22; }
.grade-E { color: var(--red); }
.grade-F { color: #c0392b; }
.report-details { flex: 1; text-align: left; }
.report-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 0.85rem; }
.report-label { opacity: 0.6; }
.report-value { font-family: var(--font-mono); font-weight: 600; color: var(--accent); }
.report-comment { font-style: italic; opacity: 0.7; font-size: 0.85rem; margin-bottom: 20px; max-width: 400px; margin-left: auto; margin-right: auto; }

.high-scores { margin-top: 16px; max-width: 340px; margin-left: auto; margin-right: auto; }
.hs-title { font-size: 0.85rem; opacity: 0.5; margin-bottom: 8px; }
.hs-row { display: flex; gap: 8px; align-items: center; font-size: 0.75rem; padding: 4px 8px; border-radius: 4px; background: rgba(255,255,255,0.04); margin-bottom: 3px; }
.hs-rank { opacity: 0.4; width: 24px; font-family: var(--font-mono); }
.hs-grade { font-weight: 800; width: 20px; color: var(--accent); }
.hs-score { font-family: var(--font-mono); flex: 1; color: var(--accent); }
.hs-diff { opacity: 0.5; }
.hs-date { opacity: 0.3; font-family: var(--font-mono); font-size: 0.7rem; }

/* ── Pause ─────────────────────────────────────────── */
.pause-content { text-align: center; animation: slideUp 0.3s ease; }
.pause-content h1 { font-size: 2.5rem; color: var(--accent); margin-bottom: 24px; letter-spacing: 8px; }

/* ── Modals / Mini-games ────────────────────────────── */
.modal { background: var(--panel); border: 2px solid rgba(233,196,106,0.3); border-radius: var(--radius); padding: 24px; width: 480px; max-width: 90%; animation: slideUp 0.3s ease; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.modal-header h2 { font-size: 1.1rem; }
.modal-progress { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); opacity: 0.8; }
.modal-actions { display: flex; gap: 12px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
.modal-feedback { margin-top: 14px; padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; line-height: 1.4; animation: fadeIn 0.2s ease; }
.modal-feedback.correct { background: rgba(42,157,143,0.2); border: 1px solid rgba(42,157,143,0.4); color: #7dd8cc; }
.modal-feedback.wrong { background: rgba(231,111,81,0.2); border: 1px solid rgba(231,111,81,0.4); color: #f0a090; }

/* ── Invoice ───────────────────────────────────────── */
.invoice-card { background: var(--card); color: var(--text-dark); border-radius: 8px; padding: 18px; border: 1px solid #ddd; }
.invoice-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #eee; font-size: 0.88rem; }
.invoice-row.desc { flex-direction: column; gap: 4px; border-bottom: none; padding-top: 8px; }
.invoice-label { font-weight: 600; color: #666; font-size: 0.8rem; }
.invoice-amount { font-weight: 800; font-size: 1.05rem; }

/* ── Inventory ─────────────────────────────────────── */
#inventoryCanvas { width: 100%; border-radius: 8px; background: #f0ece4; border: 1px solid rgba(255,255,255,0.1); }
.count-question { font-size: 0.95rem; font-weight: 600; margin: 12px 0 8px; text-align: center; }
.count-input-row { display: flex; gap: 10px; justify-content: center; align-items: center; }
.count-input { width: 80px; padding: 8px 12px; font-family: var(--font-mono); font-size: 1.2rem; font-weight: 700; text-align: center; border: 2px solid rgba(233,196,106,0.4); border-radius: 8px; background: rgba(255,255,255,0.08); color: var(--text); outline: none; }
.count-input:focus { border-color: var(--accent); }

/* ── Interview ─────────────────────────────────────── */
.interview-scene { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 4px; }
.ceo-avatar { font-size: 2.5rem; background: rgba(255,255,255,0.08); border-radius: 50%; width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ceo-bubble { background: rgba(255,255,255,0.06); border-radius: 12px; padding: 14px 18px; font-size: 0.9rem; line-height: 1.5; font-style: italic; position: relative; flex: 1; }
.ceo-bubble::before { content: ""; position: absolute; left: -8px; top: 18px; border: 6px solid transparent; border-right-color: rgba(255,255,255,0.06); }
