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

:root {
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #f87171;
  --blue: #7dd3fc;
  --panel-bg: rgba(6, 10, 16, 0.92);
  --mono: "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

html, body { width: 100%; height: 100%; overflow: hidden; background: #05070c; }
body { font-family: var(--mono); color: #cbd5e1; }

#game, #game canvas { position: absolute; inset: 0; display: block; }

.hidden { display: none !important; }

kbd {
  background: #1e293b; border: 1px solid #334155; border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 6px; font-family: var(--mono); font-size: 0.9em; color: #e2e8f0;
}
code { color: var(--blue); }

/* ---------- full-screen overlays ---------- */
#title-screen, #pause-screen, #end-screen {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(8,14,24,0.88) 0%, rgba(2,4,8,0.97) 100%);
  cursor: pointer;
}

.title-box {
  max-width: 620px; padding: 40px 48px; text-align: center;
  border: 1px solid #1e3a5f; border-radius: 10px; background: var(--panel-bg);
  box-shadow: 0 0 60px rgba(56, 130, 200, 0.15), inset 0 0 40px rgba(0,0,0,0.5);
}
.title-box h1 {
  font-size: 42px; letter-spacing: 10px; color: var(--green);
  text-shadow: 0 0 18px rgba(74, 222, 128, 0.5); margin-bottom: 6px;
}
.title-box h2 { color: var(--blue); letter-spacing: 4px; }
.title-box .subtitle { color: #64748b; margin-bottom: 18px; letter-spacing: 2px; }
.title-box p { margin: 10px 0; line-height: 1.55; font-size: 14px; }
.title-box .hint { color: #64748b; font-size: 12.5px; }
.title-box pre { text-align: left; font-size: 12.5px; color: #94a3b8; margin: 14px 0; white-space: pre-wrap; }

.controls-table { margin: 16px auto; font-size: 13px; border-collapse: collapse; }
.controls-table td { padding: 4px 12px; text-align: left; }

.start-button {
  margin-top: 22px; padding: 12px; border: 1px solid var(--green); border-radius: 6px;
  color: var(--green); letter-spacing: 4px; font-weight: bold;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { background: rgba(74, 222, 128, 0.12); } }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; }

#crosshair {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: rgba(203, 213, 225, 0.7); font-size: 18px; text-shadow: 0 0 4px #000;
}

#hud-topleft {
  position: absolute; top: 16px; left: 16px;
  background: var(--panel-bg); border: 1px solid #1e293b; border-radius: 6px; padding: 10px 16px;
}
#hud-clock { font-size: 22px; color: var(--blue); letter-spacing: 2px; }
#hud-tickets { font-size: 12px; color: #64748b; margin-top: 3px; }
#hud-tickets.has-open { color: var(--amber); }

#hud-topright {
  position: absolute; top: 16px; right: 16px; font-size: 12px; color: #475569;
  background: var(--panel-bg); border: 1px solid #1e293b; border-radius: 6px; padding: 8px 12px;
}

#hud-prompt {
  position: absolute; bottom: 18%; left: 50%; transform: translateX(-50%);
  background: var(--panel-bg); border: 1px solid #334155; border-radius: 6px;
  padding: 10px 18px; text-align: center; font-size: 14px; line-height: 1.7;
}
#hud-prompt .alert { color: var(--red); animation: blink 0.8s step-start infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* ---------- toasts ---------- */
#toasts {
  position: absolute; bottom: 20px; right: 20px; z-index: 30;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: 380px;
}
.toast {
  background: var(--panel-bg); border-left: 3px solid #475569; border-radius: 4px;
  padding: 10px 14px; opacity: 0; transform: translateX(30px); transition: all 0.35s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast.crit { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
.toast.ok { border-left-color: var(--green); }
.toast-head { font-size: 11px; color: #64748b; letter-spacing: 1px; margin-bottom: 3px; }
.toast.crit .toast-head { color: var(--red); }
.toast.warn .toast-head { color: var(--amber); }
.toast.ok .toast-head { color: var(--green); }
.toast-body { font-size: 13px; line-height: 1.4; }

/* ---------- tickets panel ---------- */
#tickets-panel {
  position: absolute; top: 8%; left: 50%; transform: translateX(-50%);
  width: min(680px, 92vw); max-height: 84vh; z-index: 25;
  background: var(--panel-bg); border: 1px solid #1e3a5f; border-radius: 8px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 10px 60px rgba(0,0,0,0.7);
}
.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid #1e293b;
  color: var(--blue); letter-spacing: 2px; font-size: 13px;
}
.panel-close { color: #475569; font-size: 11px; letter-spacing: 0; }
#tickets-list { overflow-y: auto; padding: 12px 18px; }

.tickets-section { color: #475569; font-size: 11px; letter-spacing: 2px; margin: 12px 0 6px; }
.ticket {
  border: 1px solid #1e293b; border-radius: 6px; padding: 12px 14px; margin-bottom: 10px;
  background: rgba(15, 23, 42, 0.5);
}
.ticket.sev-critical.live { border-left: 3px solid var(--red); }
.ticket.sev-high.live { border-left: 3px solid var(--amber); }
.ticket.sev-medium.live { border-left: 3px solid var(--blue); }
.ticket.done { opacity: 0.55; border-left: 3px solid var(--green); }
.ticket-top { display: flex; gap: 12px; font-size: 11px; margin-bottom: 6px; }
.ticket-id { color: var(--blue); }
.ticket-sev { color: #64748b; flex: 1; }
.ticket-host { color: var(--amber); }
.ticket-title { font-size: 14px; color: #e2e8f0; margin-bottom: 6px; }
.ticket-body { font-size: 12.5px; color: #94a3b8; line-height: 1.5; white-space: pre-line; }

/* ---------- terminal ---------- */
#terminal {
  position: absolute; top: 5%; left: 50%; transform: translateX(-50%);
  width: min(940px, 96vw); height: 86vh; z-index: 35;
  background: rgba(3, 8, 5, 0.97); border: 1px solid #14532d; border-radius: 8px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 0 80px rgba(34, 197, 94, 0.12), 0 10px 60px rgba(0,0,0,0.8);
}
#term-titlebar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; background: #0a1410; border-bottom: 1px solid #14532d;
  color: #4ade80; font-size: 12px; letter-spacing: 1px;
}
#term-scroll { flex: 1; overflow-y: auto; padding: 12px 16px; }
#term-output { font-size: 13.5px; line-height: 1.45; }
.term-line { white-space: pre-wrap; word-break: break-all; color: #86efac; }
.term-line.echo { color: #d9f99d; }
.term-line.err { color: #fca5a5; }
.term-line.dim { color: #3f6212; }

#term-inputrow { display: flex; align-items: baseline; }
#term-prompt { color: #d9f99d; font-size: 13.5px; white-space: pre; }
#term-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #d9f99d; font-family: var(--mono); font-size: 13.5px; caret-color: #4ade80;
}

/* scanline flourish on the terminal */
#terminal::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.13) 0 1px, transparent 1px 3px);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e3a2f; border-radius: 4px; }
