/* =========================================================
   TARKOV OPTIMIZER — Estética táctica inspirada en EFT
   ========================================================= */

:root {
  --bg: #0a0a08;
  --bg-panel: #14140f;
  --bg-panel-2: #1c1b15;
  --line: #3d3b33;
  --line-soft: #2a2922;
  --tan: #9a8866;
  --tan-bright: #c8b895;
  --bone: #c7c5b3;
  --dim: #7a776a;
  --ok: #86a44a;
  --warn: #c9a13b;
  --bad: #b04a3a;
  --font-hud: 'Rajdhani', 'Segoe UI', sans-serif;
  --font-mono: 'Share Tech Mono', 'Consolas', monospace;
}

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

html { scrollbar-color: var(--line) var(--bg); }

body {
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(154,136,102,0.06), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(80,90,70,0.05), transparent 60%);
  color: var(--bone);
  font-family: var(--font-hud);
  min-height: 100vh;
  overflow-x: hidden;
  letter-spacing: 0.04em;
}

::selection { background: rgba(154,136,102,0.45); color: #fff; }

.hidden { display: none !important; }

/* =========================================================
   EFECTOS AMBIENTALES
   ========================================================= */
.fx-vignette, .fx-scanlines, .fx-noise, .fx-fog {
  position: fixed; inset: 0; pointer-events: none;
}
.fx-vignette {
  z-index: 6;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
}
.fx-scanlines {
  z-index: 5; opacity: 0.3;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.16) 0 1px, transparent 1px 3px);
}
/* grano estático: textura sin repintados (los saltos con steps() hacían
   parpadear toda la pantalla) */
.fx-noise {
  z-index: 4; opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
}
.fx-fog { z-index: 1; }
.fx-fog i {
  position: absolute; border-radius: 50%; filter: blur(70px); display: block;
}
.fog-a {
  width: 55vw; height: 55vw; left: -15vw; top: -20vh;
  background: radial-gradient(circle, rgba(154,136,102,0.06), transparent 65%);
}
.fog-b {
  width: 60vw; height: 60vw; right: -20vw; bottom: -25vh;
  background: radial-gradient(circle, rgba(90,100,80,0.06), transparent 65%);
}

/* =========================================================
   PANTALLA DE ARRANQUE
   ========================================================= */
.boot {
  position: fixed; inset: 0; z-index: 100;
  background: #060605;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(.7,0,.3,1);
}
.boot.out { opacity: 0; transform: scale(1.04); pointer-events: none; }
.boot-inner { width: min(680px, 88vw); }
.boot-logo {
  font-size: clamp(26px, 4.4vw, 44px); font-weight: 700; letter-spacing: 0.22em;
  color: var(--bone); text-shadow: 0 0 24px rgba(199,197,179,0.25);
  border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 26px;
  animation: bootLogo 1.1s cubic-bezier(.2,.8,.2,1) both;
}
.boot-logo span {
  display: block; font-size: 0.34em; letter-spacing: 0.52em; color: var(--tan);
  margin-top: 6px; font-weight: 600;
}
@keyframes bootLogo {
  from { opacity: 0; transform: translateY(18px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}
.boot-terminal {
  font-family: var(--font-mono); font-size: 13px; color: var(--tan-bright);
  min-height: 128px; line-height: 1.85; white-space: pre-wrap;
}
.boot-terminal .ok { color: var(--ok); }
.boot-progress {
  height: 4px; background: var(--line-soft); margin-top: 18px; overflow: hidden;
}
.boot-progress i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--tan), var(--tan-bright));
  box-shadow: 0 0 12px rgba(200,184,149,0.6);
  transition: width 0.35s ease;
}
.boot-skip {
  margin-top: 22px; font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.3em; color: var(--dim); text-align: center;
  opacity: 0; animation: blink 1.2s steps(2) infinite;
}
.boot-skip.show { opacity: 1; }
@keyframes blink { 50% { opacity: 0.25; } }

/* =========================================================
   ESTRUCTURA / HUD
   ========================================================= */
.app {
  position: relative; z-index: 3;
  opacity: 0; transition: opacity 1.3s ease;
  max-width: 1340px; margin: 0 auto; padding: 22px clamp(14px, 3vw, 40px) 30px;
  display: flex; flex-direction: column; min-height: 100vh;
}
.app.ready { opacity: 1; }

.hud-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding-bottom: 14px; border-bottom: 1px solid var(--line);
  margin-bottom: 26px; gap: 16px; flex-wrap: wrap;
}
.logo-main {
  font-size: clamp(20px, 3vw, 30px); font-weight: 700; letter-spacing: 0.24em;
  color: var(--bone); text-shadow: 0 0 18px rgba(199,197,179,0.2);
}
.logo-sub {
  font-size: 11px; letter-spacing: 0.5em; color: var(--tan); font-weight: 600; margin-top: 2px;
}
.hud-right { display: flex; align-items: baseline; gap: 22px; font-family: var(--font-mono); }
.hud-clock { font-size: 20px; color: var(--tan-bright); letter-spacing: 0.15em; }
.hud-meta { font-size: 11px; color: var(--dim); letter-spacing: 0.2em; }
.hud-sound {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em;
  background: none; border: 1px solid var(--line); color: var(--dim);
  padding: 5px 12px; cursor: pointer; transition: all 0.25s ease;
}
.hud-sound:hover { border-color: var(--tan); color: var(--bone); }
.hud-sound span { color: var(--tan-bright); }
.hud-guide { text-decoration: none; color: var(--tan); align-self: center; }
.hud-guide:hover { box-shadow: 0 0 14px rgba(154,136,102,0.2); }

/* selector de idioma */
.lang-switch { display: flex; gap: 4px; align-self: center; }
.lang-btn {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em;
  background: none; border: 1px solid var(--line); color: var(--dim);
  padding: 4px 6px; cursor: pointer; transition: all 0.2s ease;
}
.lang-btn:hover { border-color: var(--tan); color: var(--bone); }
.lang-btn.active { border-color: var(--tan); color: #12110d; background: var(--tan); font-weight: 700; }

.layout {
  display: grid; grid-template-columns: minmax(340px, 430px) 1fr;
  gap: 26px; align-items: start; flex: 1;
}

/* =========================================================
   PANELES
   ========================================================= */
.panel {
  position: relative;
  background: linear-gradient(165deg, rgba(30,29,23,0.94), rgba(17,16,12,0.97));
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.03);
}
/* esquinas tácticas */
.panel::before, .panel::after {
  content: ""; position: absolute; width: 16px; height: 16px; pointer-events: none;
  border-color: var(--tan); border-style: solid; opacity: 0.85;
}
.panel::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.panel::after  { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.reveal { opacity: 0; transform: translateY(26px); }
.reveal.in {
  animation: panelIn 1.1s cubic-bezier(.16,.75,.25,1) both;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(26px); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: none; }
}

.panel-head {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  background: linear-gradient(90deg, rgba(154,136,102,0.14), rgba(154,136,102,0.03) 60%, transparent);
  border-bottom: 1px solid rgba(154,136,102,0.35);
}
.panel-head h2 {
  font-size: 15px; font-weight: 700; letter-spacing: 0.34em; color: var(--bone); flex: 1;
}
.p-num {
  font-family: var(--font-mono); font-size: 13px; color: var(--tan);
  border: 1px solid rgba(154,136,102,0.5); padding: 2px 8px;
}
.p-tag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.3em;
  color: var(--dim); border-left: 1px solid var(--line); padding-left: 12px;
}
.panel-body { padding: 20px 18px 22px; }

/* =========================================================
   FORMULARIO
   ========================================================= */
.field { margin-bottom: 16px; position: relative; }
.field label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.3em;
  color: var(--tan); margin-bottom: 6px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.field.error .tselect-trigger {
  border-color: var(--bad);
  box-shadow: 0 0 0 1px rgba(176,74,58,0.4), 0 0 18px rgba(176,74,58,0.25);
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---- select táctico ---- */
.tselect { position: relative; }
.tselect-trigger {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: rgba(10,10,8,0.65); border: 1px solid var(--line);
  color: var(--bone); font-family: var(--font-hud); font-size: 15px; font-weight: 600;
  letter-spacing: 0.06em; padding: 10px 12px; cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}
.tselect-trigger:hover, .tselect.open .tselect-trigger {
  border-color: var(--tan);
  box-shadow: 0 0 14px rgba(154,136,102,0.18), inset 0 0 12px rgba(154,136,102,0.05);
  background: rgba(20,19,14,0.85);
}
.tselect-value.placeholder { color: var(--dim); font-weight: 500; }
.tselect-arrow { color: var(--tan); transition: transform 0.3s ease; font-size: 12px; }
.tselect.open .tselect-arrow { transform: rotate(180deg); }

.tselect-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: rgba(12,12,9,0.98); border: 1px solid var(--tan);
  box-shadow: 0 22px 44px rgba(0,0,0,0.7), 0 0 24px rgba(154,136,102,0.12);
  opacity: 0; transform: translateY(-8px) scaleY(0.96); transform-origin: top;
  pointer-events: none; transition: opacity 0.32s ease, transform 0.32s cubic-bezier(.2,.8,.3,1);
}
.tselect.open .tselect-menu { opacity: 1; transform: none; pointer-events: auto; }
.tselect-search {
  width: 100%; background: rgba(154,136,102,0.08); border: none;
  border-bottom: 1px solid var(--line); color: var(--bone);
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.1em;
  padding: 9px 12px; outline: none;
}
.tselect-search::placeholder { color: var(--dim); }
.tselect-list { max-height: 250px; overflow-y: auto; }
.tselect-list::-webkit-scrollbar { width: 8px; }
.tselect-list::-webkit-scrollbar-thumb { background: var(--line); }
.tselect-list::-webkit-scrollbar-track { background: transparent; }
.tsel-group {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.28em;
  color: var(--tan); padding: 8px 12px 4px; text-transform: uppercase;
  border-top: 1px solid var(--line-soft); background: rgba(154,136,102,0.05);
  position: sticky; top: 0; backdrop-filter: blur(4px);
}
.tsel-opt {
  padding: 8px 14px; font-size: 14px; font-weight: 500; cursor: pointer;
  color: var(--bone); display: flex; justify-content: space-between; gap: 10px;
  transition: background 0.15s, padding-left 0.15s;
  border-left: 2px solid transparent;
}
.tsel-opt:hover {
  background: rgba(154,136,102,0.16); border-left-color: var(--tan); padding-left: 18px;
}
.tsel-opt.selected { background: rgba(154,136,102,0.22); border-left-color: var(--tan-bright); }
.tsel-opt small { color: var(--dim); font-family: var(--font-mono); font-size: 11px; }

/* ---- segmentado prioridad ---- */
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.segmented button {
  background: rgba(10,10,8,0.65); border: 1px solid var(--line); color: var(--dim);
  font-family: var(--font-hud); font-weight: 700; font-size: 13px; letter-spacing: 0.12em;
  padding: 9px 4px 7px; cursor: pointer; transition: all 0.25s ease;
  display: flex; flex-direction: column; gap: 1px; align-items: center;
}
.segmented button small {
  font-size: 8px; letter-spacing: 0.28em; font-weight: 600; color: var(--dim);
}
.segmented button:hover { border-color: var(--tan); color: var(--bone); }
.segmented button.active {
  border-color: var(--tan); color: #12110d;
  background: linear-gradient(180deg, var(--tan-bright), var(--tan));
  box-shadow: 0 0 18px rgba(154,136,102,0.35);
}
.segmented button.active small { color: rgba(18,17,13,0.7); }

/* ---- botones ---- */
.btn {
  position: relative; overflow: hidden;
  background: transparent; border: 1px solid var(--tan); color: var(--bone);
  font-family: var(--font-hud); font-weight: 700; font-size: 14px; letter-spacing: 0.28em;
  padding: 12px 20px; cursor: pointer; transition: all 0.3s ease;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
.btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%;
  left: -60%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(200,184,149,0.22), transparent);
  transition: left 0.55s ease;
}
.btn:hover { background: rgba(154,136,102,0.16); box-shadow: 0 0 22px rgba(154,136,102,0.3); color: #fff; }
.btn:hover::after { left: 130%; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: wait; }
.btn-analyze { width: 100%; margin-top: 6px; font-size: 15px; padding: 14px 20px; }
.btn-icon { color: var(--tan-bright); margin-right: 6px; }
.btn-ghost { border-color: var(--line); color: var(--dim); }
.btn-ghost:hover { border-color: var(--tan); color: var(--bone); }

.config-status {
  margin-top: 14px; font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.18em; color: var(--dim); text-align: center; min-height: 16px;
  transition: color 0.3s;
}
.config-status.err { color: var(--bad); animation: blink 0.7s steps(2) 3; }
.config-status.ok { color: var(--ok); }

/* =========================================================
   RESULTADOS · ESTADO INACTIVO (RADAR)
   ========================================================= */
.results-idle {
  padding: 70px 30px; text-align: center; color: var(--dim);
}
.results-idle p { letter-spacing: 0.3em; font-weight: 700; font-size: 14px; color: var(--bone); }
.results-idle p.dim {
  color: var(--dim); font-weight: 500; font-size: 12px; letter-spacing: 0.12em; margin-top: 8px;
}
/* --- MONITOR DE DIAGNÓSTICO (pulsómetro de hospital) --- */
/* --- TÍTULO DE ESPERA (solo texto) --- */
.idle-title {
  font-size: 22px; font-weight: 700; letter-spacing: 0.36em;
  color: var(--tan-bright); margin-bottom: 18px;
  text-shadow: 0 0 18px rgba(200,184,149,0.25);
}

/* =========================================================
   RESULTADOS · ANALIZANDO
   ========================================================= */
.results-analyzing { padding: 60px 40px; }
.an-terminal {
  font-family: var(--font-mono); font-size: 13px; color: var(--tan-bright);
  min-height: 150px; line-height: 2;
}
.an-terminal .ok { color: var(--ok); }
.an-progress { height: 4px; background: var(--line-soft); margin-top: 18px; overflow: hidden; }
.an-progress i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--tan), var(--tan-bright));
  box-shadow: 0 0 12px rgba(200,184,149,0.6);
  transition: width 0.4s ease;
}

/* =========================================================
   RESULTADOS · CONTENIDO
   ========================================================= */
.results-content { padding: 22px 20px 26px; }

.tier-row {
  display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center;
  padding-bottom: 20px; margin-bottom: 8px; border-bottom: 1px solid var(--line-soft);
}
.tier-badge {
  position: relative; text-align: center; padding: 16px 26px 14px;
  border: 2px solid var(--tan); min-width: 190px;
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px), 0 14px);
  background: linear-gradient(160deg, rgba(154,136,102,0.14), rgba(154,136,102,0.03));
  opacity: 0;
}
.tier-badge.stamp { animation: stamp 0.85s cubic-bezier(.2,1.25,.4,1) 0.15s both; }
@keyframes stamp {
  0% { opacity: 0; transform: scale(2.1) rotate(-7deg); filter: blur(5px); }
  60% { opacity: 1; transform: scale(0.94) rotate(1deg); filter: none; }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.t-label { display: block; font-size: 9px; letter-spacing: 0.42em; color: var(--tan); font-weight: 700; }
.t-roman {
  display: block; font-size: 46px; font-weight: 700; line-height: 1.1;
  color: var(--tan-bright); text-shadow: 0 0 22px rgba(200,184,149,0.4);
}
.t-name { display: block; font-size: 12px; letter-spacing: 0.3em; font-weight: 700; color: var(--bone); }

.gauges { display: flex; gap: 30px; justify-content: space-around; flex-wrap: wrap; }
.gauge { text-align: center; width: 170px; }
.gauge svg { width: 100%; overflow: visible; }
.g-track { fill: none; stroke: var(--line-soft); stroke-width: 7; stroke-linecap: butt; }
.g-fill {
  fill: none; stroke: var(--tan); stroke-width: 7; stroke-linecap: butt;
  stroke-dasharray: 164; stroke-dashoffset: 164;
  filter: drop-shadow(0 0 6px rgba(154,136,102,0.5));
  transition: stroke-dashoffset 2s cubic-bezier(.3,.75,.25,1), stroke 0.8s;
}
.g-num {
  font-size: 34px; font-weight: 700; color: var(--bone); margin-top: -46px;
  text-shadow: 0 0 16px rgba(199,197,179,0.3); font-family: var(--font-hud);
}
.g-label { font-size: 10px; letter-spacing: 0.24em; color: var(--tan); font-weight: 700; margin-top: 12px; }
.g-range { font-family: var(--font-mono); font-size: 12px; color: var(--dim); margin-top: 2px; }

/* ---- lista de ajustes ---- */
.settings-list { margin-top: 6px; }
.settings-section {
  font-size: 11px; font-weight: 700; letter-spacing: 0.4em; color: var(--tan);
  padding: 16px 4px 8px; display: flex; align-items: center; gap: 12px;
}
.settings-section::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(154,136,102,0.4), transparent); }

.setting-row {
  display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(120px, 0.9fr) 110px 1.6fr;
  gap: 14px; align-items: center;
  padding: 8px 10px; border-bottom: 1px solid rgba(61,59,51,0.4);
  opacity: 0; transform: translateX(-18px);
  animation: rowIn 0.7s cubic-bezier(.2,.75,.3,1) both;
  animation-delay: var(--d, 0s);
  transition: background 0.2s;
}
.setting-row:hover { background: rgba(154,136,102,0.07); }
@keyframes rowIn { to { opacity: 1; transform: none; } }
.s-name { font-size: 13px; font-weight: 700; letter-spacing: 0.1em; color: var(--bone); }
.s-value { font-size: 14px; font-weight: 700; color: var(--tan-bright); letter-spacing: 0.05em; }
.s-bar { height: 5px; background: var(--line-soft); overflow: hidden; }
.s-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--tan), var(--tan-bright));
  box-shadow: 0 0 8px rgba(154,136,102,0.5);
  transition: width 1.5s cubic-bezier(.3,.75,.25,1);
  transition-delay: var(--d, 0s);
}
.s-note { font-family: var(--font-mono); font-size: 11px; color: var(--dim); line-height: 1.5; }

/* ---- notas ---- */
.notes { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.note {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6;
  padding: 9px 14px; border-left: 3px solid var(--warn);
  background: rgba(201,161,59,0.07); color: var(--bone);
  opacity: 0; animation: rowIn 0.5s ease both; animation-delay: var(--d, 0s);
}
.note.bad { border-left-color: var(--bad); background: rgba(176,74,58,0.08); }
.note.ok { border-left-color: var(--ok); background: rgba(134,164,74,0.07); }

.actions { display: flex; gap: 14px; margin-top: 24px; flex-wrap: wrap; }
.actions .btn { flex: 1; min-width: 200px; }

/* =========================================================
   PIE
   ========================================================= */
.hud-footer {
  margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; color: var(--dim);
}
.hud-footer a {
  color: var(--tan); text-decoration: none;
  transition: color 0.25s, text-shadow 0.25s;
}
.hud-footer a:hover { color: var(--tan-bright); text-shadow: 0 0 10px rgba(200,184,149,0.5); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1020px) {
  .layout { grid-template-columns: 1fr; }
  .tier-row { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .setting-row { grid-template-columns: 1fr 1fr; }
  .s-bar { display: none; }
  .s-note { grid-column: 1 / -1; margin-top: -2px; }
}
@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .hud-right { gap: 12px; }
  .gauges { gap: 10px; }
}

/* =========================================================
   ACCESIBILIDAD
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}
