@font-face {
  font-family: "Rodin";
  src: url("../assets/fonts/FOT-Rodin Pro DB.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "iDroid-font";
  src: url("../assets/fonts/iDroid.otf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

/* ══════════════════════════════════════════════════════════
   VARIABILI & RESET
══════════════════════════════════════════════════════════ */
:root {
  --bg-primary: #122933;
  --bg-secondary: #0f394c;
  --ui-panel: #274e5f;
  --border: #496d7b;
  --text-secondary: #7496a1;
  --text-primary: #d3feff;
  --accent: #f7f852;
  --glow-primary:
    0 0 6px rgba(165, 188, 194, 0.35), 0 0 14px rgba(165, 188, 194, 0.12);
  --glow-accent:
    0 0 6px rgba(238, 237, 83, 0.6), 0 0 18px rgba(238, 237, 83, 0.25);
  --glow-border:
    0 0 4px rgba(73, 109, 123, 0.5), 0 0 10px rgba(73, 109, 123, 0.18);
  --glow-danger:
    0 0 6px rgba(231, 76, 60, 0.6), 0 0 16px rgba(231, 76, 60, 0.2);
  --glow-ok: 0 0 5px rgba(76, 175, 80, 0.55), 0 0 12px rgba(76, 175, 80, 0.18);
  --glow-blue:
    0 0 5px rgba(74, 144, 217, 0.55), 0 0 12px rgba(74, 144, 217, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background-color: var(--bg-secondary);
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: "Rodin", monospace;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ── Vignette laterale ── */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at center,
      transparent 55%,
      rgba(0, 0, 0, 0.55) 100%);
}

/* ══════════════════════════════════════════════════════════
   LAYOUT ROOT
══════════════════════════════════════════════════════════ */
.idroid {
  position: relative;
  height: 100vh;
  overflow: hidden;
  transform: perspective(1200px) rotateX(5deg);
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

/* ── Noise overlay globale ── */
.idroid::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  opacity: 0.028;
  animation: noise-shift 0.08s steps(1) infinite;
  mix-blend-mode: overlay;
}

/* ── Scanlines sottili ── */
.idroid::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  background: repeating-linear-gradient(to bottom,
      transparent 0px,
      transparent 2px,
      rgba(0, 0, 0, 0.07) 2px,
      rgba(0, 0, 0, 0.07) 3px);
  animation: scanline-drift 12s linear infinite;
}

#idroid_ver {
  z-index: 1;
  position: absolute;
  top: 0;
  left: 0;
  padding: 0.5rem;
}

#idroid_ver h2 {
  /* font-size: 1.2rem; */
  font-family: "iDroid-font";
  color: whitesmoke;
  margin: 0;
  font-size: 18px;
  font-weight: normal;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.5),
    0 0 20px rgba(255, 255, 255, 0.15);
}

#idroid_ver h3 {
  color: var(--accent);
}

html,
body,
#container {
  height: 100%;
  background-color: var(--bg-secondary);
}

#container {
  display: flex;
  position: relative;
  box-shadow: inset 0px 0px 40px 40px var(--bg-secondary);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#dotgrid {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-image: radial-gradient(circle,
      rgba(101, 199, 238, 0.7) 1px,
      transparent 1px);
  background-size: 15px 15px;
  box-shadow: inset 0px 0px 40px 40px var(--bg-secondary);
  opacity: 0.5;
  pointer-events: none;
}

#dotgrid::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(circle,
      rgba(101, 199, 238, 0.7) 1px,
      transparent 1px);
  background-size: 15px 15px;
  filter: blur(1px);
  z-index: 0;
}

/* ══════════════════════════════════════════════════════════
   STATIC TV CANVAS SCAN BAR
   Sostituisce #white_rectangle con un canvas animato
══════════════════════════════════════════════════════════ */
#staticScanCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  pointer-events: none;
  z-index: 99999;
  mix-blend-mode: screen;
  opacity: 0.6;
  /* animation: scanBarSlide 7s linear infinite; */
}

@keyframes scanBarSlide {
  0% {
    transform: translateY(-100%);
  }

  100% {
    transform: translateY(100vh);
  }
}

#white_rectangle {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: rgb(255, 255, 255);
  box-shadow: 0 0 70px 70px rgba(255, 255, 255, 0.8);
  opacity: 0.2;
  overflow: hidden;
  animation: slideDown 7s linear infinite;
  z-index: 9999;

  /* Stesso transform di .idroid */
  transform: perspective(1200px) rotateX(5deg);
  transform-origin: top center;
}

#white_rectangle::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    repeating-radial-gradient(#002f5570 0 0.0002%, #0093a770 0 0.0002%) 50% 0/250px 2500px,
    repeating-conic-gradient(#002f5570 0 0.0001%, #0093a770 0 0.0002%) 60% 60%/250px 2500px;
  background-blend-mode: difference;
  animation: b 0.2s infinite alternate;
  z-index: 9999;
  opacity: 0.3;
  /* Stesso transform di .idroid */
  transform: perspective(1200px) rotateX(5deg);
  transform-origin: top center;
}

/* ══════════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════════ */
.tabs-container {
  width: 90%;
  margin: 40px auto;
  position: relative;
}

.tabs-wrapper {
  position: relative;
  display: inline-flex;
  justify-content: center;
  width: 100%;
  z-index: 20;
  height: 35px;
}

.tabs-wrapper::before,
.tabs-wrapper::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  pointer-events: none;
  z-index: 21;
}

.tabs-wrapper::before {
  left: 0;
}

.tabs-wrapper::after {
  right: 0;
}

.tabs-container input[type="radio"] {
  display: none;
}

.tabs-container .tab {
  display: inline-block;
  width: 25%;
  text-align: center;
  padding: 5px 0;
  border: 2px solid var(--border);
  border-bottom: none;
  margin-right: -6px;
  background: transparent;
  cursor: pointer;
  font-family: "iDroid-font", monospace;
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  position: relative;
  top: 6px;
  transition: all 0.15s ease;
  z-index: 21;
  color: whitesmoke;
  margin-right: 5px;
}

.tabs-wrapper .tab:last-of-type {
  margin-right: 0;
}

#tab1:checked+label,
#tab2:checked+label,
#tab3:checked+label {
  top: 0;
  background: linear-gradient(to bottom, var(--border), var(--bg-secondary));
  /* più opaco per coprire la linea */
  border-bottom: 2px solid var(--glow-secondary);
  border-right-color: var(--glow-primary);
  border-left-color: var(--glow-primary);
  box-shadow: 0 -3px 0 0 whitesmoke, 0 0 12px rgba(255, 255, 255, 0.12), inset 0 0 20px rgba(255, 255, 255, 0.03);
  z-index: 23;
  margin-bottom: -2px;
  /* si sovrappone esattamente alla linea */
  padding-bottom: 0;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6), 0 0 20px rgba(255, 255, 255, 0.2);
}

.tab-panels {
  height: 75vh;
  border-top: none;
  background: transparent;
  font-family: "Rodin", monospace;
  overflow: hidden;
  margin-top: -2px;
  padding-top: 20px;
  z-index: 10;
}

.tab-panels::before {
  content: "";
  position: absolute;
  top: 35px;
  left: 0;
  right: 0;
  height: 15px;
  border-left: 2px solid var(--text-primary);
  border-right: 2px solid var(--text-primary);
  pointer-events: none;
  z-index: 20;
}

input[type=radio]:not(:checked)~.tab {
    scale: 0.96;
    margin-bottom: 5px;
}

.tab-panel {
  height: 100%;
  width: 100%;
  overflow-y: auto;
  display: none;
  flex-direction: row;
}

#panel-mission {
  display: flex;
}

.tab label {
  position: relative;
}

.tab label::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 6px;
  /* accorcia lato sinistro */
  right: 6px;
  /* accorcia lato destro */
  border-bottom: 2px solid transparent;
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
}

/* attivo */
#tab1:checked+label::before,
#tab2:checked+label::before,
#tab3:checked+label::before {
  border-bottom: 2px solid var(--glow-primary);
  border-left-color: var(--glow-primary);
  border-right-color: var(--glow-primary);
}


/* ══════════════════════════════════════════════════════════
   UTILITY
══════════════════════════════════════════════════════════ */
.iDroid-font {
  font-family: "iDroid-font", monospace;
  letter-spacing: 0.05em;
  text-shadow:
    0 0 5px rgba(165, 188, 194, 0.3),
    0 0 12px rgba(165, 188, 194, 0.1);
}

/* ══════════════════════════════════════════════════════════
   MOTHER BASE — DRILL-DOWN (stessa struttura di Missions)
══════════════════════════════════════════════════════════ */
#panel-mission {
  position: relative;
  overflow: hidden;
  flex-direction: column;
}

#mb-menu {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 8px 0;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  pointer-events: auto;
}

#panel-mission.is-drilling #mb-menu {
  opacity: 0.1;
  transform: translateY(30px);
  pointer-events: none;
}

#mb-subpanels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mb-subpanel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  pointer-events: none;
}

.mb-subpanel.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ══════════════════════════════════════════════════════════
   MOTHER BASE — CONTENT AREA
══════════════════════════════════════════════════════════ */
.mb-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.mb-section {
  display: none;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

.mb-section.active {
  display: flex;
}

#mb-tapes {
  flex-direction: row;
}

#mb-staff,
#mb-resources,
#mb-development,
#mb-fobs {
  flex-direction: column;
  overflow-y: auto;
  padding: 0 24px 24px;
}

/* .mb-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  background: rgba(18, 41, 51, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1;
}

.mb-panel-title {
  font-size: 0.85rem;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.12em;
  text-shadow: var(--glow-primary);
} */

.mb-panel-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mb-filter-label {
  font-size: 0.6rem;
  color: var(--text-secondary);
  margin-right: 6px;
}

.mb-filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: "Rodin", monospace;
  font-size: 0.65rem;
  padding: 3px 10px;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: all 0.15s;
}

.mb-filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  text-shadow: var(--glow-primary);
  box-shadow: 0 0 6px rgba(73, 109, 123, 0.2);
}

.mb-filter-btn.active {
  background: var(--ui-panel);
  color: var(--text-primary);
  border-color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════
   TAPES COLUMNS
══════════════════════════════════════════════════════════ */
.column {
  height: 80%;
  width: 50%;
}

#column_2 {
  margin-left: 100px;
}

.column_tapes {
  overflow-y: scroll;
  height: 70%;
  overflow-x: hidden;
}

.top_column {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.btn_settings {
  display: flex;
}

.default_heading {
  margin: 0;
  color: var(--text-secondary);
}

#main_tablist,
#main_tabpanel,
#media_box {
  font-family: "Rodin", monospace;
  color: var(--text-primary);
}

#main_tabpanel {
  padding-bottom: 20px;
}

#main_tabpanel h1 {
  font-size: 1.5rem;
  margin: 0;
}

#main_tabpanel p {
  margin: 0;
}

.tape_tab {
  border: 0;
  width: 50px;
  height: 50px;
  background-color: transparent;
  color: var(--text-secondary);
  font-size: 1.1rem;
  opacity: 0.6;
  transition:
    opacity 0.15s,
    background-color 0.15s;
  font-family: "Rodin", monospace;
}

.tape_tab:hover {
  opacity: 1;
  color: var(--text-primary);
}

.tape_tab[aria-selected="true"] {
  background-color: var(--ui-panel);
  opacity: 0.9;
  color: var(--text-primary);
}

.active_playing {
  display: inline !important;
}

.keyboard_key {
  font-size: 0.8rem;
  color: var(--accent);
  text-shadow: var(--glow-accent);
}

#media_box_headings {
  display: flex;
  justify-content: space-between;
}

#media_box_headings h2,
#media_box_headings h3 {
  display: inline-block;
  margin: 0;
  font-size: 1.1rem;
}

#tapes_playing {
  background-color: rgba(15, 57, 76, 0.4);
}

#current_tape {
  font-size: 1.2rem;
  background-color: #b2f5fd;
  padding: 0 5px;
}

#current_tape h2 {
  font-size: 1rem;
  color: var(--bg-primary);
  margin: 0;
}

#current_sub_tape h2 {
  font-size: 1rem;
  color: white;
  margin: 0;
  padding-left: 5px;
}

#progress_container {
  display: flex;
  justify-content: space-between;
}

#progress {
  background-color: var(--border);
  width: 100%;
  height: 15px;
  margin: 10px;
}

#progress_bar_container {
  width: 85%;
  overflow: hidden;
}

#progress_current {
  background-color: #b2f5fd;
  height: 15px;
  width: 0%;
}

#current_progress {
  margin: 5px;
  margin-left: 35px;
  width: 50px;
  color: var(--text-primary);
}

#progress_audio {
  margin: 10px;
  color: var(--text-secondary);
}

#current_time,
#current_now,
#current_length,
.inner-rectangle p,
.stats_section p {
  font-family: "iDroid-font", monospace;
  letter-spacing: 0.05em;
}

#current_time {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  /* margin-right: 0; */
}

#clock-hours,
#clock-mins {
  display: inline-block;
  width: 2ch;
  /* larghezza fissa — 2 caratteri */
  text-align: center;
  line-height: 1;
}

#clock-colon {
  display: inline-block;
  width: 0.6ch;
  /* larghezza fissa per il separatore */
  text-align: center;
  line-height: 1;
  vertical-align: baseline;
}

#media_controls {
  display: flex;
  justify-content: end;
  margin: 20px;
}

.media_control_btn {
  border: 3px solid transparent;
  background-color: transparent;
  color: var(--text-secondary);
  font-size: 1.3rem;
  margin: 0 10px;
  transition:
    color 0.15s,
    border 0.15s;
}

.media_control_btn:hover {
  color: var(--text-primary);
  text-shadow: var(--glow-primary);
}

.media_control_btn:focus,
.control_btn:focus {
  border: 3px solid #6c7a7e !important;
}

.media_control_btn.disabled {
  opacity: 0.3;
  pointer-events: none;
}

button.topic_tape {
  border: none;
  background-color: transparent;
  border-radius: 0;
  display: flex;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  width: 100%;
  text-align: left;
  padding: 5px 0;
  font-size: 1.1rem;
  margin-left: 5px;
  justify-content: space-between;
  transition:
    background-color 0.15s,
    color 0.15s;
  font-family: "Rodin", monospace;
}

button.topic_tape:hover {
  background-color: var(--ui-panel);
  color: var(--text-primary);
}

button.topic_tape:focus {
  background-color: var(--bg-secondary);
  outline: 1px solid var(--accent);
}

button.active_topic {
  background-color: var(--bg-secondary);
  color: white;
}

.disabled_control {
  opacity: 0.5;
}

.disabled_control span {
  color: var(--text-secondary) !important;
}

.control_btn {
  background-color: rgba(39, 78, 95, 0.5);
  border: 3px solid transparent;
  padding: 7px;
  width: 200px;
  color: var(--text-primary);
  font-size: 1rem;
  text-align: left;
  align-self: end;
  margin: 3px;
  font-family: "Rodin", monospace;
}

/* ══════════════════════════════════════════════════════════
   STAFF
══════════════════════════════════════════════════════════ */
.staff-layout {
  display: flex;
  gap: 20px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.staff-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
}

.staff-list-header {
  display: grid;
  grid-template-columns: 2fr 1fr 0.6fr 1.2fr 0.8fr;
  padding: 6px 12px;
  background: rgba(39, 78, 95, 0.5);
  font-size: 0.6rem;
  color: var(--text-secondary);
  letter-spacing: 0.12em;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.staff-row {
  display: grid;
  grid-template-columns: 2fr 1fr 0.6fr 1.2fr 0.8fr;
  padding: 9px 12px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(73, 109, 123, 0.3);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
  align-items: center;
}

.staff-row:hover {
  background: rgba(39, 78, 95, 0.25);
  color: var(--text-primary);
}

.staff-row.active {
  background: rgba(39, 78, 95, 0.45);
  color: var(--text-primary);
  border-left: 2px solid var(--accent);
  box-shadow:
    inset 2px 0 0 var(--accent),
    0 0 8px rgba(238, 237, 83, 0.08);
}

.staff-icon {
  margin-right: 6px;
  opacity: 0.6;
}

.staff-rank {
  font-size: 0.85rem;
}

.staff-skill {
  font-size: 0.65rem;
  letter-spacing: 0.05em;
}

.status-ok {
  color: #4caf50;
  text-shadow: var(--glow-ok);
}

.status-warn {
  color: var(--accent);
}

.status-err {
  color: #e74c3c;
  text-shadow: var(--glow-danger);
}

.staff-detail {
  width: 260px;
  border: 1px solid var(--border);
  background: rgba(10, 34, 48, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.staff-detail-header {
  display: flex;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.staff-portrait {
  width: 56px;
  height: 56px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--border);
  background: var(--ui-panel);
  flex-shrink: 0;
}

.staff-detail-name {
  font-size: 0.8rem;
  margin: 0 0 4px;
  color: var(--text-primary);
  text-shadow: var(--glow-primary);
}

.staff-detail-rank {
  font-size: 1.2rem;
  color: var(--accent);
  line-height: 1;
  text-shadow: var(--glow-accent);
}

.staff-detail-unit {
  font-size: 0.6rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.staff-detail-stats {
  padding: 14px 16px;
  flex: 1;
}

.detail-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.ds-label {
  font-size: 0.6rem;
  color: var(--text-secondary);
  width: 72px;
  flex-shrink: 0;
  letter-spacing: 0.08em;
}

.ds-bar {
  flex: 1;
  height: 4px;
  background: var(--ui-panel);
}

.ds-fill {
  height: 100%;
  background: var(--border);
  box-shadow: 0 0 5px rgba(73, 109, 123, 0.5);
}

.accent-fill {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(238, 237, 83, 0.5);
}

.ds-val {
  font-size: 0.75rem;
  color: var(--text-secondary);
  width: 24px;
  text-align: right;
}

.accent-val {
  color: var(--accent);
  text-shadow: var(--glow-accent);
}

.staff-detail-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.sdf-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.65rem;
}

.sdf-label {
  color: var(--text-secondary);
}

.sdf-val {
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════
   RESOURCES
══════════════════════════════════════════════════════════ */
.resources-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

.res-category {
  border: 1px solid var(--border);
  padding: 16px;
  background: rgba(10, 34, 48, 0.3);
}

.res-cat-title {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin: 0 0 14px;
  letter-spacing: 0.1em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.res-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.res-name {
  font-size: 0.62rem;
  color: var(--text-secondary);
  width: 120px;
  flex-shrink: 0;
}

.res-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--ui-panel);
}

.res-bar-fill {
  height: 100%;
  background: var(--border);
  box-shadow: 0 0 5px rgba(73, 109, 123, 0.5);
}

.res-warn {
  background: #e74c3c !important;
  box-shadow: 0 0 6px rgba(231, 76, 60, 0.5);
}

.res-val {
  font-size: 0.72rem;
  color: var(--text-primary);
  width: 44px;
  text-align: right;
}

.res-warn-text {
  color: #e74c3c;
  text-shadow: var(--glow-danger);
}

.res-gmp {
  display: flex;
  flex-direction: column;
}

.gmp-display {
  font-size: 1.5rem;
  color: var(--accent);
  margin: 12px 0 4px;
  letter-spacing: 0.05em;
  text-shadow: var(--glow-accent);
}

.gmp-sub {
  font-size: 0.6rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.gmp-breakdown {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.gmp-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.gmp-row .iDroid-font {
  color: #4caf50;
}

.gmp-expense .iDroid-font {
  color: #e74c3c;
  text-shadow: var(--glow-danger);
}

/* ══════════════════════════════════════════════════════════
   DEVELOPMENT
══════════════════════════════════════════════════════════ */
.dev-layout {
  display: flex;
  gap: 20px;
  flex: 1;
}

.dev-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dev-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  background: rgba(10, 34, 48, 0.25);
  transition: background 0.15s;
  cursor: pointer;
}

.dev-item:hover {
  background: rgba(39, 78, 95, 0.25);
}

.dev-item.dev-new {
  border-left-color: var(--accent);
}

.dev-item.dev-progress {
  border-left-color: #4a90d9;
}

.dev-item.dev-complete {
  border-left-color: #4caf50;
  opacity: 0.7;
}

.dev-icon {
  width: 28px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 1rem;
}

.dev-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dev-name {
  font-size: 0.75rem;
  color: var(--text-primary);
  text-shadow: var(--glow-primary);
}

.dev-cat {
  font-size: 0.6rem;
  color: var(--text-secondary);
}

.dev-status-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 130px;
}

.dev-status {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}

.dev-status.new {
  color: var(--accent);
  text-shadow: var(--glow-accent);
}

.dev-status.in-prog {
  color: #4a90d9;
  text-shadow: var(--glow-blue);
}

.dev-status.complete {
  color: #4caf50;
  text-shadow: var(--glow-ok);
}

.dev-prog-bar {
  width: 120px;
  height: 3px;
  background: var(--ui-panel);
}

.dev-prog-fill {
  height: 100%;
  background: #4a90d9;
  box-shadow: 0 0 6px rgba(74, 144, 217, 0.5);
}

.dev-detail-panel {
  width: 220px;
  border: 1px solid var(--border);
  background: rgba(10, 34, 48, 0.45);
  backdrop-filter: blur(2px);
  padding: 16px;
}

.dev-detail-title {
  font-size: 0.65rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.platform-levels {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plat-label {
  font-size: 0.6rem;
  color: var(--text-secondary);
  width: 72px;
  flex-shrink: 0;
}

.plat-lv {
  font-size: 0.65rem;
  color: var(--accent);
  width: 32px;
  flex-shrink: 0;
}

.plat-bar {
  flex: 1;
  height: 3px;
  background: var(--ui-panel);
}

.plat-fill {
  height: 100%;
  background: var(--border);
  box-shadow: 0 0 5px rgba(73, 109, 123, 0.5);
}

/* ══════════════════════════════════════════════════════════
   FOB
══════════════════════════════════════════════════════════ */
.fob-layout {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.fob-card {
  border: 1px solid var(--border);
  padding: 16px;
  background: rgba(10, 34, 48, 0.3);
  min-width: 220px;
  flex: 1;
  transition: border-color 0.15s;
}

.fob-main {
  border-color: var(--text-secondary);
  box-shadow:
    0 0 8px rgba(73, 109, 123, 0.25),
    inset 0 0 20px rgba(73, 109, 123, 0.04);
}

.fob-alert {
  border-color: #e74c3c;
  animation: fob-pulse 2s ease-in-out infinite;
  box-shadow:
    0 0 12px rgba(231, 76, 60, 0.3),
    inset 0 0 20px rgba(231, 76, 60, 0.05);
}

.fob-card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.fob-type {
  font-size: 0.6rem;
  color: var(--text-secondary);
  letter-spacing: 0.12em;
}

.fob-name {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 14px;
  text-shadow: var(--glow-primary);
}

.fob-status {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}

.fob-secure {
  color: #4caf50;
  text-shadow: var(--glow-ok);
}

.fob-danger {
  color: #e74c3c;
  animation: blink-badge 1s step-end infinite;
  text-shadow: var(--glow-danger);
}

.fob-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.fob-stat-label {
  font-size: 0.6rem;
  color: var(--text-secondary);
  width: 100px;
}

.fob-bar {
  flex: 1;
  height: 3px;
  background: var(--ui-panel);
}

.fob-fill {
  height: 100%;
  background: var(--border);
  box-shadow: 0 0 5px rgba(73, 109, 123, 0.5);
}

.fob-fill-danger {
  background: #e74c3c;
  box-shadow: 0 0 6px rgba(231, 76, 60, 0.5);
}

.fob-num {
  font-size: 0.75rem;
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════
   MISSIONS PANEL — menu icone
══════════════════════════════════════════════════════════ */
.menu-item {
  list-style: none;
  display: flex;
  align-items: center;
  margin-bottom: 18px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: 0.15s;
  position: relative;
  width: 35%;
}

.menu-item div {
  align-items: flex-start;
}

.menu-item-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  width: 60px;
  flex-shrink: 0;
}

/* Icona principale — in primo piano */
.menu-item-icon {
  font-size: 4em;
  color: var(--border);
  position: relative;
  z-index: 2;
  transition:
    font-size 0.15s,
    color 0.15s,
    text-shadow 0.15s;
  display: block;
  line-height: 1;
  opacity: 60%;
}

.menu-item-icon-img {
  width: 1em;
  height: 1em;
  font-size: 4em;
  /* eredita la dimensione dal parent */
  object-fit: contain;
  /* per il colore SVG monocromatico usa filter */
  filter: invert(60%) sepia(20%) saturate(400%) hue-rotate(160deg) brightness(90%);
}

.menu-item:hover .menu-item-icon-img {
  filter: invert(85%) sepia(20%) saturate(300%) hue-rotate(160deg) brightness(110%);
}

.menu-item-icon-ghost {
  font-size: 4em;
  color: var(--border);
  opacity: 0.22;
  position: absolute;
  left: 2px;
  top: 4px;
  z-index: 1;
  pointer-events: none;
  transition:
    font-size 0.15s,
    color 0.15s,
    left 0.15s,
    top 0.15s;
  /* aggiunto left e top */
  display: block;
  line-height: 1;
}

.menu-item:hover .menu-item-icon-wrap {
  padding-right: 15px;
}

.menu-item:hover .menu-item-icon,
.menu-item:hover .menu-item-icon-img {
  font-size: 5em;
  color: var(--text-primary);
}

.menu-item:hover .menu-item-icon-ghost {
  font-size: 5em;
  /* scala insieme */
  color: var(--text-primary);
  left: -10px !important;
  /* mantieni offset fisso */
  top: 4px !important;
}

.menu-item.active .menu-item-icon {
  text-shadow: var(--glow-primary);
}

/* Badge neutro — notifica standard */
.menu-item-badge {
  position: absolute;
  top: -6px;
  left: -20px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  background: var(--text-primary);
  color: var(--bg-primary);
  font-family: "iDroid-font", monospace;
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: none;
  box-shadow: 0 0 4px rgba(73, 109, 123, 0.3);
  z-index: 10;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid var(--border);
}

/* Badge urgente — notifica critica, giallo accent */
.menu-item-badge-urgent {
  position: absolute;
  top: -6px;
  left: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  background: var(--accent);
  color: var(--bg-primary);
  font-family: "iDroid-font", monospace;
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: none;
  box-shadow: var(--glow-accent);
  z-index: 10;
  line-height: 1;
  border-radius: 50%;
}

.menu-item-badge.badge-dot,
.menu-item-badge-urgent.badge-dot {
  min-width: 10px;
  height: 10px;
  padding: 0;
}

.menu-item-title {
  font-size: 20px;
  margin: 0;
  color: var(--text-primary);
  text-shadow: var(--glow-primary);
}

.menu-item:hover .menu-item-title {
  font-size: 30px;
}

.menu-item-subtitle {
  margin: 0;
  line-height: 1.4;
  display: none;
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: none;
}

.menu-item:hover .menu-item-subtitle {
  display: block;
  font-size: medium;
}

/* ══════════════════════════════════════════════════════════
   HUD BOTTOM
══════════════════════════════════════════════════════════ */
#dialogueBox {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 400px;
  max-width: 90vw;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 12px;
  color: var(--text-primary);
  font-family: "Rodin", monospace;
  z-index: 9000;
  box-shadow:
    0 0 20px rgba(0, 0, 0, 0.7),
    0 0 10px var(--glow-primary);
}

#box_settings {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}

.stats_settings {
  width: auto;
  min-width: 250px;
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.containero {
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.blue-rectangle {
  width: 100%;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.top-row,
.bottom-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.top-row .inner-rectangle {
  height: 30px;
}

.inner-rectangle {
  flex: 1;
  background-color: rgba(150, 198, 218, 0.35);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  box-shadow: var(--glow-border);
}

.bottom-row .inner-rectangle {
  height: 60px;
}

.stats_section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.stats_section p {
  padding: 10px;
  width: auto;
  font-size: large;
}

.stats_section {
  margin: 5px;
}

/* bottom-row stacked variant */
.bottom-row .inner-rectangle--stacked {
  flex-direction: column;
  align-items: stretch;
  height: auto;
  padding: 0;
  gap: 0;
}

/* riga superiore: label a sinistra, valore a destra */
.stats_section--split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 4px 10px;
  height: 30px;
}

/* riga inferiore: tutto allineato a destra, sfondo più scuro */
.stats_section--right {

  align-items: center;
  width: 90%;
  padding: 4px 10px;
  gap: 10px;
  margin: 10px;
  height: 20px;

}

.stats_section--dark {
  background-color: rgba(9, 26, 33, 0.55);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: right;
}

.stats_section--dark p {
  font-size: 16px;
}

/* ══════════════════════════════════════════════════════════
   KEYFRAMES
══════════════════════════════════════════════════════════ */
@keyframes blink-badge {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

@keyframes fob-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
  }

  50% {
    box-shadow: 0 0 8px 2px rgba(231, 76, 60, 0.3);
  }
}

@keyframes map-pulse {
  0% {
    opacity: 0.6;
    r: 12;
  }

  100% {
    opacity: 0;
    r: 28;
  }
}

@keyframes slideDown {
  0% {
    transform: translateY(-110vh);
  }

  100% {
    transform: translateY(110vh);
  }
}

@keyframes noise-shift {
  0% {
    background-position: 0 0;
  }

  10% {
    background-position: -12px 8px;
  }

  20% {
    background-position: 6px -14px;
  }

  30% {
    background-position: -20px 4px;
  }

  40% {
    background-position: 14px -6px;
  }

  50% {
    background-position: -8px 18px;
  }

  60% {
    background-position: 20px -10px;
  }

  70% {
    background-position: -4px -18px;
  }

  80% {
    background-position: 16px 12px;
  }

  90% {
    background-position: -18px -4px;
  }

  100% {
    background-position: 10px 16px;
  }
}

@keyframes scanline-drift {
  from {
    background-position: 0 0;
  }

  to {
    background-position: 0 100vh;
  }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media only screen and (max-height: 670px) {
  #dialogueBox h2.current_text {
    background-color: var(--bg-secondary);
    margin: 0 50px;
  }
}

/* ── Filtro colore iDROID sui tile OSM ── */
#idroid-map .leaflet-tile {
  filter:
    /* grayscale(1) */
    hue-rotate(155deg) saturate(0.55) brightness(0.38) contrast(1.2);
}

/* ── Rimuovi UI Leaflet di default ── */
#idroid-map .leaflet-control-zoom {
  display: none;
}

#idroid-map .leaflet-control-attribution {
  background: rgba(10, 25, 33, 0.75) !important;
  color: #496d7b !important;
  font-size: 0.48rem !important;
  font-family: monospace !important;
  border-radius: 0 !important;
  border: none !important;
}

#idroid-map .leaflet-control-attribution a {
  color: #7496a1 !important;
}

/* ── Marker posizione utente ── */
.idroid-marker-pulse {
  width: 14px;
  height: 14px;
  background: #eeed53;
  border: 2px solid rgba(238, 237, 83, 0.5);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(238, 237, 83, 0.6);
  animation: idroid-gps-pulse 2s ease-out infinite;
  position: relative;
}

@keyframes idroid-gps-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(238, 237, 83, 0.6);
  }

  70% {
    box-shadow: 0 0 0 16px rgba(238, 237, 83, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(238, 237, 83, 0);
  }
}

/* ══════════════════════════════════════════════════════════
   MISSIONS PANEL — DRILL-DOWN NAVIGATION
══════════════════════════════════════════════════════════ */

#panel-missions {
  position: relative;
  overflow: hidden;
  flex-direction: column;
}

/* ── Layer A: menu lista ── */
#missions-menu {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 8px 0;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  pointer-events: auto;
}

/* Menu esce verso il basso quando si fa drill-down */
#panel-missions.is-drilling #missions-menu {
  opacity: 0.1;
  transform: translateY(30px);
  pointer-events: none;
}

/* ── Layer B: wrapper sottopannelli ── */
#missions-subpanels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Singolo sottopannello — nascosto di default */
.missions-subpanel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  pointer-events: none;
}

/* Sottopannello attivo */
.missions-subpanel.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Header del sottopannello (back + titolo) ── */
.subpanel-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(18, 41, 51, 0.6);
}

.subpanel-back-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: "Rodin", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.subpanel-back-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: rgba(73, 109, 123, 0.15);
  text-shadow: var(--glow-primary);
}

.subpanel-title {
  font-size: 0.8rem;
  color: var(--text-primary);
  letter-spacing: 0.12em;
  text-shadow: var(--glow-primary);
}

/* ── Body del sottopannello ── */
.subpanel-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  /* tapes usa row (due colonne) */
}

/* Placeholder per sottopannelli non ancora implementati */
.subpanel-placeholder {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0.3;
}

.subpanel-placeholder i {
  font-size: 3rem;
  color: var(--border);
}

.subpanel-placeholder p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
  letter-spacing: 0.1em;
}

.subpanel-placeholder span {
  font-size: 0.6rem;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
}

/* ══════════════════════════════════════════════════════════
   FOOTER LEFT — back button
══════════════════════════════════════════════════════════ */
#footer-left {
  position: fixed;
  bottom: 20px;
  left: 50px;
  z-index: 9000;

  /* nascosto di default */
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

body.is-drilling-missions #footer-left {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Il back btn riusa .inner-rectangle — solo override cursore e hover */
#footer-back-btn {
  cursor: pointer;
  min-width: 120px;
  height: 30px;
  transition:
    background-color 0.15s,
    color 0.15s,
    box-shadow 0.15s;
}

#footer-back-btn:hover {
  background-color: rgba(73, 109, 123, 0.6);
  color: var(--text-primary);
  box-shadow:
    var(--glow-border),
    0 0 12px rgba(73, 109, 123, 0.3);
}

#footer-back-btn:hover p,
#footer-back-btn:hover i {
  text-shadow: var(--glow-primary);
}

/* Rimuovi la vecchia regola .footer-back-btn standalone */
.footer-back-btn {}

/* Visibile solo quando il panel missions è in drilling */
#panel-missions.is-drilling~#footer-left .footer-back-btn,
body.is-drilling-missions #footer-left .footer-back-btn {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ══════════════════════════════════════════════════════════
   BREADCRUMB sotto idroid_ver
══════════════════════════════════════════════════════════ */
.idroid-breadcrumb {
  font-size: 1.2rem;
  /* uguale a h2 in #idroid_ver */
  font-family: "iDroid-font";
  letter-spacing: 0.08em;
  margin: 0;
  color: var(--accent);
  text-shadow: var(--glow-accent);

  /* nascosto di default */
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition:
    opacity 0.2s ease,
    max-height 0.25s ease;
}

.idroid-breadcrumb.is-visible {
  opacity: 1;
  max-height: 2rem;
}

/* ══════════════════════════════════════════════════════════
   BADGE — scala con hover su menu-item
══════════════════════════════════════════════════════════ */
.menu-item-badge {
  transition:
    font-size 0.15s ease,
    min-width 0.15s ease,
    height 0.15s ease,
    top 0.15s ease,
    left 0.15s ease;
}

.menu-item:hover .menu-item-badge {
  font-size: 1.2rem;
  min-width: 28px;
  height: 28px;
  top: -10px;
  left: -10px;
}

#idroid-map-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

#idroid-map .leaflet-tile-pane {
  filter: url(#idroid-color-matrix);
}

#idroid-map .leaflet-control-zoom {
  display: none;
}

#idroid-map .leaflet-control-attribution {
  background: rgba(10, 25, 33, 0.75) !important;
  color: #496d7b !important;
  font-size: 0.48rem !important;
  font-family: monospace !important;
  border-radius: 0 !important;
}

#idroid-map .leaflet-control-attribution a {
  color: #7496a1 !important;
}

.leaflet-container {
  background: none !important;
}

.idroid-marker-pulse {
  width: 12px;
  height: 12px;
  background: #eeed53;
  border: 2px solid rgba(238, 237, 83, 0.4);
  border-radius: 50%;
  animation: idroid-gps-pulse 2s ease-out infinite;
}

@keyframes idroid-gps-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(238, 237, 83, 0.7);
  }

  70% {
    box-shadow: 0 0 0 14px rgba(238, 237, 83, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(238, 237, 83, 0);
  }
}

#staticBgCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9997;
  /* sotto scanlines (9998) e noise overlay (9999) */
  mix-blend-mode: screen;
  opacity: 0.018;
}