:root {
  --bg: #020812;
  --panel: rgba(6, 16, 30, 0.82);
  --panel-strong: rgba(8, 20, 38, 0.94);
  --border: rgba(96, 224, 214, 0.24);
  --border-bright: rgba(96, 224, 214, 0.58);
  --text: #e8f5ff;
  --muted: rgba(188, 216, 238, 0.68);
  --accent: #5ef2df;
  --gold: #ffd479;
  --danger: #ff6b7a;
  --o2: #58c7ff;
  --bat: #ffd166;
  --hull: #5ef2a8;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
}

canvas#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
}

.accent { color: var(--accent); }
.gold { color: var(--gold); }
.muted { color: var(--muted); }

/* Overlays & Title */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 35%, rgba(12, 46, 74, 0.65), rgba(2, 7, 16, 0.94));
  backdrop-filter: blur(8px);
}

.title-card {
  max-width: 640px;
  width: 100%;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 36px 34px;
  text-align: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 600;
}

.title-card h1 {
  font-size: clamp(42px, 7vw, 66px);
  letter-spacing: 0.16em;
  font-weight: 800;
  background: linear-gradient(180deg, #ffffff 0%, #86f7ea 65%, #3ba3c4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}

.tagline {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: 26px;
}

.tagline strong {
  color: var(--text);
}

.title-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.controls-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid rgba(96, 224, 214, 0.14);
  padding-top: 16px;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: rgba(94, 242, 223, 0.08);
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

/* Buttons */
.btn {
  background: rgba(94, 242, 223, 0.08);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
  font-family: inherit;
}

.btn:hover:not(:disabled) {
  background: rgba(94, 242, 223, 0.18);
  border-color: var(--border-bright);
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, rgba(56, 214, 198, 0.34), rgba(38, 138, 186, 0.38));
  border-color: var(--accent);
  color: #ffffff;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

.btn.small {
  padding: 7px 13px;
  font-size: 12.5px;
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

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

.hud-top-left {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 238px;
  pointer-events: auto;
}

.gauge-box, .bars-box {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 14px;
}

.gauge-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.gauge-row .label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.gauge-row strong {
  font-size: 20px;
}

.gauge-row.small {
  margin-top: 4px;
  font-size: 11.5px;
}

.bars-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 3px;
}

.bar-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  transition: width 0.12s linear;
}

.bar-fill.hull { background: linear-gradient(90deg, #35c988, var(--hull)); }
.bar-fill.o2 { background: linear-gradient(90deg, #2b8eff, var(--o2)); }
.bar-fill.bat { background: linear-gradient(90deg, #f4a236, var(--bat)); }

.hud-top-right {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 520px;
  pointer-events: auto;
}

.stat-pill, .hud-btn {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  text-decoration: none;
}

.hud-btn {
  cursor: pointer;
  font-family: inherit;
  transition: all 0.16s ease;
}

.hud-btn:hover {
  border-color: var(--border-bright);
  background: rgba(14, 34, 56, 0.92);
  color: var(--accent);
}

.banner {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8, 22, 40, 0.92);
  border: 1px solid var(--border-bright);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  pointer-events: none;
}

.banner.danger {
  border-color: var(--danger);
  color: #ffc5cc;
  background: rgba(68, 12, 22, 0.92);
}

.dock-prompt {
  position: fixed;
  bottom: 66px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-strong);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  pointer-events: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.hud-bottom {
  position: fixed;
  bottom: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.objective {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  color: var(--muted);
}

.mini-keys {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.mini-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.mini-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(2, 8, 18, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-card {
  width: min(740px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--panel-strong);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.72);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 22px;
}

.close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
}

.close-btn:hover {
  color: #fff;
  border-color: var(--accent);
}

.dock-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(94, 242, 223, 0.06);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 13.5px;
}

.sold-msg {
  color: var(--hull);
  font-size: 12.5px;
}

.upgrades-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.upg-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.upg-card h3 {
  font-size: 14.5px;
  color: var(--text);
  margin-bottom: 3px;
}

.upg-card p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.upg-lvl {
  font-size: 11px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid rgba(96, 224, 214, 0.14);
  padding-top: 14px;
}

.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 11px;
}

.codex-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px;
}

.codex-item.locked {
  opacity: 0.45;
  border-style: dashed;
}

.codex-item .codex-icon {
  font-size: 22px;
  margin-bottom: 6px;
}

.codex-item h3 {
  font-size: 14px;
  margin-bottom: 3px;
}

.codex-item small {
  display: block;
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 6px;
}

.codex-item p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.ending-card {
  text-align: center;
  max-width: 560px;
}

.ending-card p {
  margin: 14px 0;
  line-height: 1.65;
  font-size: 14.5px;
}

/* Radio de comunicaciones del Buque Aurora */
.radio-box {
  position: fixed;
  bottom: 58px;
  left: 16px;
  width: min(370px, calc(100vw - 32px));
  background: rgba(5, 16, 30, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(94, 242, 223, 0.4);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 11px 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.52);
  pointer-events: none;
  animation: radioIn 0.25s ease-out;
}

@keyframes radioIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.radio-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 5px;
}

.radio-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.radio-box p {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}

.codex-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.logs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.log-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 12px 14px;
}

.log-card small {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 5px;
}

.log-card p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
