/* style.css — Encoro IT web client dark theme */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap');

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

:root {
  --bg: #0a0a0a;
  --bg-panel: #111111;
  --bg-input: #1a1a1a;
  --border: #2a2a2a;
  --border-focus: #00cc66;
  --text: #cccccc;
  --text-dim: #666666;
  --text-bright: #ffffff;
  --accent: #00cc66;
  --accent-dim: #009944;
  --accent-cyan: #00cccc;
  --accent-yellow: #cccc00;
  --danger: #cc3333;
  --mono: 'JetBrains Mono', 'DejaVu Sans Mono', 'Consolas', 'Courier New', monospace;
  --sidebar-w: 300px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  overflow: hidden;
}

/* ===== LANDING PAGE ===== */

.landing-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.ascii-logo {
  color: var(--accent);
  font-size: 10px;
  line-height: 1.15;
  white-space: pre;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 8px rgba(0, 204, 102, 0.3);
  user-select: none;
}

.subtitle {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 2.5rem;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.login-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 2rem 2.5rem;
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-box label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.login-box input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-bright);
  font-family: var(--mono);
  font-size: 14px;
  padding: 0.6rem 0.8rem;
  outline: none;
  transition: border-color 0.2s;
}

.login-box input:focus {
  border-color: var(--border-focus);
}

.login-box input::placeholder {
  color: #444;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.btn-launch {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 14px;
  padding: 0.7rem 1rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 3px;
  transition: all 0.2s;
  margin-top: 0.5rem;
}

.btn-launch:hover {
  background: var(--accent);
  color: var(--bg);
}

.btn-launch:active {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

.login-error {
  color: var(--danger);
  font-size: 11px;
  min-height: 1.2em;
  text-align: center;
}

.version-tag {
  position: fixed;
  bottom: 1rem;
  right: 1.5rem;
  color: #333;
  font-size: 10px;
}

/* ===== GAME PAGE ===== */

.game-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
}

#gameCanvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% - var(--sidebar-w));
  height: 100%;
  image-rendering: pixelated;
}

/* ===== HUD CONTAINER ===== */

.hud-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  font-family: var(--mono);
  font-size: 12px;
}

.hud-container > * {
  pointer-events: auto;
}

/* ===== RIGHT SIDEBAR (matches terminal 42-char sidebar) ===== */

.hud-sidebar {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--sidebar-w);
  height: 100%;
  background: rgba(8, 8, 8, 0.95);
  border-left: 1px solid #222;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  overflow: hidden;
}

/* --- Status section (top of sidebar) --- */
.hud-status {
  padding: 8px 10px;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

.hud-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 17px;
  white-space: nowrap;
}

.hud-status-label {
  font-size: 11px;
  color: var(--text-dim);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.hud-bar-wrap {
  flex: 1;
  height: 10px;
  background: #1a1a1a;
  border: 1px solid #333;
  position: relative;
  overflow: hidden;
}

.hud-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  transition: width 0.15s ease-out;
}

.hud-hp-fill { background: #00cc44; }
.hud-stam-fill { background: #cc8800; }
.hud-xp-fill { background: #4488cc; }

@keyframes lowHpPulse {
  0%, 100% { box-shadow: 0 0 4px 1px rgba(255,30,30,0.3); }
  50% { box-shadow: 0 0 10px 4px rgba(255,30,30,0.7); }
}
@keyframes goldFlash {
  0% { color: #fff; text-shadow: 0 0 8px rgba(255,220,50,0.8); }
  100% { color: #cc0; text-shadow: none; }
}

.hud-bar-text {
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 9px;
  color: var(--text-bright);
  line-height: 12px;
  text-shadow: 0 0 3px #000, 0 0 3px #000;
}

.hud-name-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.hud-name {
  font-size: 13px;
  color: var(--accent-cyan);
  font-weight: bold;
}

.hud-level {
  font-size: 11px;
  color: var(--text-dim);
}

.hud-loc {
  font-size: 10px;
  color: #888;
  margin-bottom: 4px;
}

.hud-gold-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3px;
}

.hud-gold {
  font-size: 12px;
  color: var(--accent-yellow);
}

.hud-sprint {
  font-size: 10px;
  color: var(--accent-yellow);
  font-weight: bold;
  letter-spacing: 1px;
}

/* --- Equipment section --- */
.hud-equip {
  padding: 6px 10px;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
  font-size: 11px;
}

.hud-equip-row {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 16px;
  white-space: nowrap;
  overflow: hidden;
}

.hud-equip-key {
  color: var(--text-dim);
  width: 42px;
  flex-shrink: 0;
  text-align: right;
  white-space: pre;
}

.hud-equip-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-equip-name.ready { color: var(--accent); }
.hud-equip-name.on-cd { color: #884400; }
.hud-equip-name.empty { color: #333; }
.hud-equip-name.equipped { color: var(--text); }
.hud-equip-name.no-equip { color: #444; font-style: italic; }

/* --- Compass section --- */
.hud-compass {
  padding: 4px 10px;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
  font-size: 11px;
  min-height: 20px;
}

.hud-compass-row {
  display: flex;
  gap: 6px;
  align-items: center;
  height: 15px;
}

.hud-compass-arrow {
  font-weight: bold;
  width: 14px;
  text-align: center;
}

.hud-compass-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Status effects --- */
.hud-effects {
  padding: 4px 10px;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  min-height: 0;
}

.hud-effects:empty {
  display: none;
}

.hud-effect-tag {
  font-size: 9px;
  padding: 1px 5px;
  letter-spacing: 1px;
}

/* --- Log section --- */
.hud-log-section {
  flex: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-bottom: 1px solid #222;
}

.hud-log-header {
  display: flex;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

.hud-log-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: #555;
  font-family: var(--mono);
  font-size: 9px;
  padding: 3px 0;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: color 0.15s;
}

.hud-log-tab:hover { color: #888; }
.hud-log-tab.active { color: var(--accent); border-bottom: 1px solid var(--accent); }

.hud-log-content {
  flex: 1;
  overflow-y: auto;
  padding: 3px 6px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
  min-height: 0;
}

.hud-log-content::-webkit-scrollbar { width: 4px; }
.hud-log-content::-webkit-scrollbar-track { background: transparent; }
.hud-log-content::-webkit-scrollbar-thumb { background: #333; }

.hud-log-line {
  font-size: 10px;
  line-height: 1.3;
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- Chat section (bottom of sidebar) --- */
.hud-chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 80px;
}

.hud-chat-title {
  font-size: 10px;
  color: var(--accent);
  padding: 3px 10px;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
  letter-spacing: 1px;
}

.hud-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 3px 6px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
  min-height: 0;
}

.hud-chat-messages::-webkit-scrollbar { width: 4px; }
.hud-chat-messages::-webkit-scrollbar-track { background: transparent; }
.hud-chat-messages::-webkit-scrollbar-thumb { background: #333; }

.hud-chat-msg {
  font-size: 10px;
  line-height: 1.3;
  color: #aaa;
}

.hud-chat-input-wrap {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  border-top: 1px solid #333;
  flex-shrink: 0;
  background: #0d0d0d;
}

.hud-chat-input-wrap.hidden { display: none; }

.hud-chat-prompt {
  color: var(--accent);
  font-size: 11px;
  margin-right: 4px;
  flex-shrink: 0;
}

.hud-chat-input {
  flex: 1;
  background: #111;
  border: 1px solid #333;
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  outline: none;
}

.hud-chat-input:focus {
  border-color: var(--accent);
}

/* ===== FULLSCREEN PROMPT ===== */

.fs-prompt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  gap: 1.5rem;
}

.fs-prompt-text {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 2px;
}

.fs-prompt-btn {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 18px;
  padding: 1rem 2.5rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 3px;
  transition: all 0.2s;
}

.fs-prompt-btn:hover {
  background: var(--accent);
  color: #000;
}

/* ===== HELP OVERLAY ===== */

.controls-overlay {
  position: absolute;
  top: 50%;
  left: calc((100% - var(--sidebar-w)) / 2);
  transform: translate(-50%, -50%);
  background: rgba(10, 10, 10, 0.95);
  border: 1px solid #444;
  padding: 1.5rem 2rem;
  z-index: 50;
  font-size: 12px;
  color: var(--text-dim);
  max-width: 440px;
  line-height: 1.7;
  display: none;
}

.controls-overlay.visible { display: block; }

.controls-overlay h3 {
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 0.8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.controls-overlay .key {
  color: var(--text-bright);
  display: inline-block;
  min-width: 30px;
  text-align: center;
}

.controls-overlay .sep {
  border-top: 1px solid #222;
  margin: 6px 0;
}

/* ===== DEMO BANNER ===== */

.demo-banner {
  position: absolute;
  bottom: 50px;
  left: calc((100% - var(--sidebar-w)) / 2);
  transform: translateX(-50%);
  color: #444;
  font-size: 11px;
  text-align: center;
  z-index: 20;
  pointer-events: none;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ===== OVERLAY PANELS (inventory, shop, party, tickets, help) ===== */

.hud-overlay {
  position: absolute;
  top: 50%;
  left: calc((100% - var(--sidebar-w)) / 2);
  transform: translate(-50%, -50%);
  background: rgba(8, 8, 8, 0.95);
  border: 1px solid #333;
  padding: 12px 16px;
  z-index: 50;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  width: 805px;
  height: 520px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
}

.ov-title {
  color: var(--accent);
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 6px;
  border-bottom: 1px solid #333;
  padding-bottom: 4px;
}

.ov-equipped {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 10px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid #222;
  font-size: 10px;
}

.eq-slot {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.eq-filled { color: var(--text); }
.eq-empty { color: #444; }

.ov-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.ov-tab {
  font-size: 10px;
  color: #555;
  cursor: pointer;
  padding: 2px 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid transparent;
}

.ov-tab-active {
  color: var(--accent);
  border-color: var(--accent);
}

.ov-hint {
  font-size: 10px;
  color: #444;
  margin-bottom: 6px;
}

.ov-mats {
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}

.ov-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.ov-row {
  display: flex;
  gap: 8px;
  padding: 2px 4px;
  align-items: center;
  white-space: nowrap;
}

.ov-row.ov-sel {
  background: rgba(0, 204, 102, 0.15);
  border-left: 2px solid var(--accent);
}

.ov-row.ov-empty {
  color: #555;
  font-style: italic;
}

.ov-name {
  flex: 1;
  min-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ov-stat { width: 155px; color: #888; text-align: right; }
.ov-slot { width: 85px; color: #666; flex-shrink: 0; }
.ov-set { width: 140px; color: #5bc; overflow: hidden; text-overflow: ellipsis; }
.ov-price { width: 70px; color: var(--accent-yellow); text-align: right; }
.ov-qty { width: 40px; color: #888; text-align: right; }

/* ===== TICKET OVERLAY (wider) ===== */
.hud-ticket-overlay {
  width: 900px;
  height: 520px;
}
.hud-party-overlay, .hud-biome-overlay, .hud-help-overlay {
  width: auto;
  height: auto;
  min-width: 400px;
  max-width: 720px;
  max-height: 85vh;
}
.hud-score-overlay {
  width: auto;
  height: auto;
  min-width: 520px;
  max-width: 720px;
  max-height: 85vh;
}
.hud-ticket-overlay .ov-list { overflow-x: hidden; overflow-y: auto; flex: 1; min-height: 0; }
.hud-ticket-overlay .ov-row { overflow: hidden; flex-shrink: 0; }
.hud-ticket-overlay .ov-name { flex: 1; min-width: 300px; }
.hud-ticket-overlay .ov-stat { width: 55px; text-align: center; flex-shrink: 0; }
.hud-ticket-overlay .ov-slot { width: 120px; flex-shrink: 0; }
.hud-ticket-overlay .ov-set { width: 140px; flex-shrink: 0; }
.hud-ticket-overlay .ov-qty { width: 90px; flex-shrink: 0; }
.ov-colheader {
  display: flex;
  gap: 8px;
  padding: 2px 4px;
  color: #555;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid #333;
  margin-bottom: 2px;
}

/* ===== PARTY HUD BAR (persistent) ===== */
.hud-party-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(8, 8, 8, 0.85);
  border: 1px solid #333;
  padding: 6px 10px;
  z-index: 40;
  font-family: var(--mono);
  font-size: 11px;
  color: #ccc;
  pointer-events: none;
  min-width: 140px;
  max-width: 200px;
}
.party-hud-title {
  color: #0c6;
  font-size: 10px;
  font-weight: bold;
  margin-bottom: 4px;
  letter-spacing: 1px;
}
.party-hud-member {
  margin-bottom: 4px;
}
.party-hud-name {
  color: #0ff;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.party-hud-bar {
  width: 100%;
  height: 4px;
  background: #222;
  margin: 2px 0;
  border-radius: 2px;
  overflow: hidden;
}
.party-hud-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}
.party-hud-hp {
  color: #888;
  font-size: 9px;
}

/* ===== NOTIFICATION BANNER ===== */
.hud-notify {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 40, 60, 0.95);
  border: 2px solid #0cc;
  padding: 12px 24px;
  z-index: 80;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: bold;
  color: #0ff;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(0, 200, 200, 0.5);
  animation: notifyPulse 2s ease-in-out infinite;
}
@keyframes notifyPulse {
  0%, 100% { border-color: #0cc; box-shadow: 0 0 10px rgba(0,200,200,0.3); }
  50% { border-color: #0ff; box-shadow: 0 0 20px rgba(0,255,255,0.5); }
}

/* ===== FORKLIFT BANNER ===== */
.hud-forklift-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 25, 0, 0.92);
  border: 2px solid #cc0;
  padding: 8px 18px;
  z-index: 75;
  font-family: var(--mono);
  font-size: 13px;
  color: #ff0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
  text-shadow: 0 0 6px rgba(200, 200, 0, 0.4);
}
.hud-forklift-banner.hidden { display: none; }
.hud-forklift-banner .fk-icon {
  font-size: 18px;
  font-weight: bold;
  color: #ff0;
}
.hud-forklift-banner .fk-label {
  font-weight: bold;
  color: #ff0;
}
.hud-forklift-banner .fk-bar-wrap {
  display: inline-block;
  width: 100px;
  height: 12px;
  background: #333;
  border: 1px solid #555;
  border-radius: 2px;
  overflow: hidden;
}
.hud-forklift-banner .fk-bar-fill {
  height: 100%;
  transition: width 0.2s;
}
.fk-bar-fill.fk-hp-ok { background: #cc0; }
.fk-bar-fill.fk-hp-warn { background: #d80; }
.fk-bar-fill.fk-hp-crit { background: #c00; }
.hud-forklift-banner .fk-hp-text {
  font-size: 11px;
  color: #cc0;
}
.hud-forklift-banner .fk-hint {
  font-size: 11px;
  color: #888;
}
.hud-forklift-banner.fk-critical {
  border-color: #c00;
  animation: fkCritPulse 0.5s ease-in-out infinite;
}
.hud-forklift-banner.fk-critical .fk-hint {
  color: #f44;
  font-weight: bold;
}
@keyframes fkCritPulse {
  0%, 100% { border-color: #c00; box-shadow: 0 0 8px rgba(200,0,0,0.4); }
  50% { border-color: #f44; box-shadow: 0 0 16px rgba(255,60,60,0.6); }
}

/* ===== LOOK MODE OVERLAY ===== */
.hud-look-overlay {
  position: absolute;
  bottom: 30px;
  left: 10px;
  background: rgba(8, 8, 8, 0.92);
  border: 1px solid #444;
  padding: 6px 10px;
  z-index: 55;
  font-family: var(--mono);
  font-size: 12px;
  color: #888;
  pointer-events: none;
  min-width: 250px;
  max-width: 400px;
}

/* ===== SCANLINE OVERLAY (aesthetic) ===== */

.scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% - var(--sidebar-w));
  height: 100%;
  pointer-events: none;
  z-index: 5;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* Hazard popup (tunnel entry) */
.hud-hazard-popup {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid #ff8800;
  padding: 8px 16px;
  font-family: 'DejaVu Sans Mono', monospace;
  font-size: 12px;
  color: #ccc;
  z-index: 200;
  min-width: 320px;
  pointer-events: none;
}
.hud-hazard-popup .hazard-title {
  color: #ff8800;
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 6px;
}
.hud-hazard-popup .hazard-row { margin: 2px 0; }
.hud-hazard-popup .hazard-ch { font-weight: bold; }
.hud-hazard-popup .hazard-desc { color: #888; }
