/* ==========================================================================
   GNS SENTINELA — ARK: Survival Evolved theme
   Jungle-night background, Tek-cyan HUD panels with corner brackets,
   obelisk colors for status (green ally · red enemy · torch-amber unknown).
   Class names are shared with app.js / extras.js — rename only together.
   ========================================================================== */

:root {
  --bg-color: #060c0b;
  --bg-secondary: #0b1412;
  --surface: rgba(12, 22, 20, 0.88);
  --surface-2: #12201d;
  --surface-3: #1a2c28;
  --card-bg: rgba(12, 22, 20, 0.88);
  --card-border: rgba(94, 234, 212, 0.13);
  --card-hover-border: rgba(94, 234, 212, 0.45);

  /* Tek cyan */
  --color-primary: #5eead4;
  --color-primary-soft: rgba(94, 234, 212, 0.1);
  /* obelisks / torch */
  --color-success: #4ade80;
  --color-danger: #f05252;
  --color-warning: #f6c453;
  --color-info: #60a5fa;

  --text-main: #e4f1ed;
  --text-muted: #8ea9a2;
  --text-dim: #5b7570;

  --font-heading: 'Cinzel', Georgia, serif;
  --font-mono: 'Rajdhani', 'Inter', sans-serif;
  --font-hud: 'Rajdhani', 'Inter', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  --shadow-glow: 0 0 24px rgba(94, 234, 212, 0.12);
  --shadow-danger-glow: 0 0 0 1px rgba(240, 82, 82, 0.5), 0 0 26px rgba(240, 82, 82, 0.15);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --transition: all 0.18s ease;

  /* ARK HUD corner brackets (used as extra background layers on panels) */
  --hud-c: rgba(94, 234, 212, 0.55);
  --hud-size: 12px;
  --hud-corners:
    linear-gradient(var(--hud-c), var(--hud-c)) top left / var(--hud-size) 2px no-repeat,
    linear-gradient(var(--hud-c), var(--hud-c)) top left / 2px var(--hud-size) no-repeat,
    linear-gradient(var(--hud-c), var(--hud-c)) top right / var(--hud-size) 2px no-repeat,
    linear-gradient(var(--hud-c), var(--hud-c)) top right / 2px var(--hud-size) no-repeat,
    linear-gradient(var(--hud-c), var(--hud-c)) bottom left / var(--hud-size) 2px no-repeat,
    linear-gradient(var(--hud-c), var(--hud-c)) bottom left / 2px var(--hud-size) no-repeat,
    linear-gradient(var(--hud-c), var(--hud-c)) bottom right / var(--hud-size) 2px no-repeat,
    linear-gradient(var(--hud-c), var(--hud-c)) bottom right / 2px var(--hud-size) no-repeat;
  --panel-sheen: linear-gradient(180deg, rgba(94, 234, 212, 0.045), transparent 38%);
  --bevel: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Background: jungle night + Tek hex pattern + island ridge */
body.dark-theme {
  background:
    radial-gradient(900px 520px at 0% 0%, rgba(94, 234, 212, 0.09), transparent 60%),
    radial-gradient(800px 600px at 100% 100%, rgba(74, 222, 128, 0.06), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cpath d='M28 66L0 50V16L28 0l28 16v34L28 66v34' fill='none' stroke='%235eead4' stroke-opacity='0.06'/%3E%3Cpath d='M28 0v34L0 50v34l28 16 28-16V50L28 34' fill='none' stroke='%235eead4' stroke-opacity='0.035'/%3E%3C/svg%3E"),
    var(--bg-color);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.dark-theme::before {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 240px;
  pointer-events: none;
  z-index: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 240' preserveAspectRatio='none'%3E%3Cpath d='M0 240V160l90-34 80 18 100-66 80 46 80-26 100-64 90 70 100-22 80 38 100-64 80 52 100-22 80 42 100-66 80 48 120-24v152z' fill='%235eead4' fill-opacity='0.05'/%3E%3Cpath d='M0 240v-48l120-22 80 16 100-36 100 30 100-22 120 30 100-28 120 22 100-28 100 24 120-20 100 26 100-22 80 16v82z' fill='%2303100c' fill-opacity='0.9'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
}

::selection { background: rgba(94, 234, 212, 0.3); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border: 2px solid var(--bg-color); }
::-webkit-scrollbar-thumb:hover { background: #24403a; }

/* The old full-screen red flash is disabled (kept only so the element stays hidden) */
.alarm-flash-overlay { display: none !important; }

/* ==========================================================================
   Layout: sidebar navigation + content
   ========================================================================== */
.app-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  grid-template-areas:
    "nav header"
    "nav metrics"
    "nav main";
  column-gap: 26px;
  max-width: 1640px;
  margin: 0 auto;
  padding: 24px;
}

.navbar { grid-area: header; }
.metrics-grid { grid-area: metrics; }
.tab-navigation { grid-area: nav; }
.content-area { grid-area: main; min-width: 0; }

/* Shared HUD panel look */
.navbar,
.tab-navigation,
.metric-card,
.glass-card,
.server-card,
.timer-card {
  background: var(--hud-corners), var(--panel-sheen), var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(3px);
}

/* Header */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 22px;
  margin-bottom: 18px;
  --hud-size: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Radar emblem */
.radar-sweep-icon {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(94, 234, 212, 0.55);
  background:
    radial-gradient(circle, transparent 38%, rgba(94, 234, 212, 0.18) 39%, transparent 41%),
    radial-gradient(circle, rgba(94, 234, 212, 0.18), rgba(94, 234, 212, 0.02) 70%);
  box-shadow: 0 0 18px rgba(94, 234, 212, 0.25), inset 0 0 12px rgba(94, 234, 212, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.radar-dot {
  width: 6px;
  height: 6px;
  background: var(--color-primary);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--color-primary);
}
.radar-line {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), transparent);
  transform-origin: left center;
  animation: radarRotate 3s infinite linear;
}
@keyframes radarRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--color-primary);
  text-shadow: 0 0 18px rgba(94, 234, 212, 0.35);
  line-height: 1.1;
}
.brand-text h1 span { color: #fff; text-shadow: none; }

.brand-text .subtext {
  font-family: var(--font-hud);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Buttons — beveled like the in-game menus
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  font-family: var(--font-hud);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  line-height: 1.15;
  border-radius: 0;
  border: 1px solid transparent;
  clip-path: var(--bevel);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn .icon { font-size: 1rem; }

.btn-primary {
  background: linear-gradient(180deg, #7ff3e2, #3fcfba);
  color: #04201b;
}

.btn-success {
  background: linear-gradient(180deg, #6ee79a, #34c46b);
  color: #052312;
}

.btn-warning,
.btn-danger {
  background: linear-gradient(180deg, #f87171, #dc3e3e);
  color: #fff;
}

.btn-secondary {
  background: linear-gradient(180deg, rgba(94, 234, 212, 0.12), rgba(94, 234, 212, 0.05));
  color: var(--text-main);
  border-color: rgba(94, 234, 212, 0.28);
}
.btn-secondary:hover { border-color: rgba(94, 234, 212, 0.55); }

.btn-audio {
  background: rgba(74, 222, 128, 0.12);
  color: var(--color-success);
  border-color: rgba(74, 222, 128, 0.4);
}
.btn-audio.muted {
  background: rgba(240, 82, 82, 0.12);
  color: var(--color-danger);
  border-color: rgba(240, 82, 82, 0.4);
}

.btn-danger-outline {
  background: rgba(240, 82, 82, 0.06);
  color: var(--color-danger);
  border-color: rgba(240, 82, 82, 0.45);
}
.btn-danger-outline:hover { background: rgba(240, 82, 82, 0.15); }

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Metrics
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.metric-card {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}
.metric-card:hover { border-color: var(--card-hover-border); box-shadow: var(--shadow-glow); }

.metric-icon {
  font-size: 1.35rem;
  width: 46px;
  height: 46px;
  background: var(--color-primary-soft);
  border: 1px solid rgba(94, 234, 212, 0.3);
  clip-path: var(--bevel);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.metric-value {
  font-family: var(--font-hud);
  font-size: 1.9rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.05;
}
.metric-value.warning-text { color: var(--color-warning); }
.metric-value.status-online-text {
  color: var(--color-success);
  font-size: 1.15rem;
  letter-spacing: 1px;
}

.metric-label {
  font-family: var(--font-hud);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ==========================================================================
   Sidebar navigation (the tabs)
   ========================================================================== */
.tab-navigation {
  position: sticky;
  top: 24px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 10px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.tab-navigation::before {
  content: '◆ MENU DA TRIBO';
  font-family: var(--font-hud);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 2px;
  color: var(--color-primary);
  padding: 0 12px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--card-border);
}

/* Block (not flex) so the label and its "(count)" flow as one line of text */
.tab-btn {
  display: block;
  position: relative;
  width: 100%;
  min-height: 48px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  padding: 13px 12px 13px 54px;
  font-family: var(--font-hud);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.tab-btn .tab-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--card-border);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  font-size: 0.95rem;
}
.tab-btn:hover {
  color: var(--text-main);
  background: rgba(94, 234, 212, 0.05);
}
.tab-btn.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(94, 234, 212, 0.16), rgba(94, 234, 212, 0.02));
  border-left-color: var(--color-primary);
  text-shadow: 0 0 12px rgba(94, 234, 212, 0.35);
}
.tab-btn.active .tab-icon {
  background: rgba(94, 234, 212, 0.25);
  border-color: rgba(94, 234, 212, 0.6);
}

.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: fadeIn 0.22s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Sections & cards
   ========================================================================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

/* Section titles get a small obelisk marker */
.section-header h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #fff;
}
.section-header h2::before {
  content: '';
  width: 10px;
  height: 22px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--color-primary), rgba(94, 234, 212, 0.25));
  clip-path: polygon(50% 0, 100% 28%, 100% 100%, 0 100%, 0 28%);
  filter: drop-shadow(0 0 6px rgba(94, 234, 212, 0.6));
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 4px;
}

.glass-card {
  padding: 20px;
  margin-bottom: 18px;
}

.glass-card h3,
.card h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

h4 {
  font-family: var(--font-hud);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--color-primary);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 1px 6px;
}

/* ==========================================================================
   Breeding
   ========================================================================== */
.species-pills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.species-pill-card {
  background: linear-gradient(180deg, rgba(94, 234, 212, 0.05), transparent 50%), var(--surface-2);
  border: 1px solid var(--card-border);
  border-left: 3px solid rgba(94, 234, 212, 0.5);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.88rem;
}
.species-pill-card > div:first-child { flex: 1 1 100%; }
.species-pill-card strong { color: var(--color-primary); font-family: var(--font-hud); font-size: 1.02rem; }

.timers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.timer-card {
  padding: 20px;
  position: relative;
  transition: var(--transition);
}
.timer-card.alarm-triggered {
  --hud-c: rgba(240, 82, 82, 0.8);
  border-color: rgba(240, 82, 82, 0.6);
  box-shadow: var(--shadow-danger-glow);
}

.timer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.timer-title {
  font-family: var(--font-hud);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.timer-badge-mode {
  font-family: var(--font-hud);
  font-size: 0.76rem;
  padding: 3px 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}
.timer-badge-mode.incubation {
  background: rgba(246, 196, 83, 0.16);
  color: var(--color-warning);
}
.timer-badge-mode.maturation {
  background: rgba(74, 222, 128, 0.16);
  color: var(--color-success);
}

.timer-progress-wrap { margin: 14px 0; }

/* Progress bars look like the in-game torpor/food bars */
.timer-progress-bar-bg {
  width: 100%;
  height: 12px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(94, 234, 212, 0.25);
  overflow: hidden;
}

.timer-progress-bar-fill {
  height: 100%;
  background:
    repeating-linear-gradient(90deg, transparent 0 10px, rgba(0, 0, 0, 0.18) 10px 12px),
    linear-gradient(90deg, #3fcfba, var(--color-success));
  width: 0%;
  transition: width 1s linear;
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.4);
}
.timer-progress-bar-fill.complete {
  background: repeating-linear-gradient(90deg, transparent 0 10px, rgba(0, 0, 0, 0.18) 10px 12px), var(--color-danger);
  box-shadow: 0 0 10px rgba(240, 82, 82, 0.5);
}

.timer-stats-flex {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--font-hud);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.timer-actions-trio {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
}
.timer-actions-trio .btn {
  padding: 8px 6px;
  font-size: 0.8rem;
  justify-content: center;
}

/* ==========================================================================
   Radar: server cards
   ========================================================================== */
.servers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.server-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.server-card:hover { border-color: var(--card-hover-border); box-shadow: var(--shadow-glow); }

.server-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 12px;
}

.server-title-box h3 {
  font-family: var(--font-hud);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 4px;
}

.server-map-badge {
  display: inline-block;
  font-family: var(--font-hud);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border: 1px solid rgba(94, 234, 212, 0.25);
  padding: 1px 8px;
}

.status-pill {
  font-family: var(--font-hud);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}
.status-pill.online {
  background: rgba(74, 222, 128, 0.15);
  color: var(--color-success);
}
.status-pill.offline {
  background: rgba(240, 82, 82, 0.15);
  color: var(--color-danger);
}

.server-details-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  padding: 9px 14px;
  margin-bottom: 14px;
  font-family: var(--font-hud);
  font-weight: 600;
  font-size: 0.95rem;
}

.player-roster-title {
  font-family: var(--font-hud);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.player-list-scroll {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 4px;
}

.player-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  padding: 7px 12px;
  border-left: 3px solid var(--text-dim);
  font-size: 0.88rem;
}
.player-item.friendly { border-left-color: var(--color-success); background: rgba(74, 222, 128, 0.05); }
.player-item.enemy {
  border-left-color: var(--color-danger);
  background: rgba(240, 82, 82, 0.08);
}
.player-item.unknown { border-left-color: var(--color-warning); }

.player-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.tag-badge {
  font-family: var(--font-hud);
  font-size: 0.74rem;
  padding: 1px 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.tag-badge.friendly { background: rgba(74, 222, 128, 0.16); color: var(--color-success); }
.tag-badge.enemy { background: rgba(240, 82, 82, 0.18); color: var(--color-danger); }
.tag-badge.unknown { background: rgba(246, 196, 83, 0.15); color: var(--color-warning); }

.server-actions-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
}

/* ==========================================================================
   Allies / enemies
   ========================================================================== */
.whitelist-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-family: var(--font-hud);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(94, 234, 212, 0.2);
  border-radius: 0;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.92rem;
  transition: var(--transition);
}
textarea { resize: vertical; min-height: 90px; }
select option { background: var(--bg-secondary); }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary), 0 0 14px rgba(94, 234, 212, 0.25);
}

input[type="range"] { width: 100%; accent-color: var(--color-primary); }
input[type="checkbox"] { accent-color: var(--color-primary); }

.help-text {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
  display: block;
}

.full-width {
  width: 100%;
  justify-content: center;
}

/* ==========================================================================
   Tables
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: rgba(94, 234, 212, 0.07);
  padding: 10px 14px;
  font-family: var(--font-hud);
  font-size: 0.8rem;
  color: var(--color-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(94, 234, 212, 0.25);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--card-border);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: rgba(94, 234, 212, 0.04); }

/* ==========================================================================
   Settings / alerts grid
   ========================================================================== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
  align-items: start;
}
.settings-grid > .card { margin-bottom: 0; }

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 7, 0.78);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  --hud-size: 18px;
  background: var(--hud-corners), var(--panel-sheen), #0c1715;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(94, 234, 212, 0.08);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--card-border);
}
.modal-header h3 { margin-bottom: 0; }

.modal-close {
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}
.modal-close:hover { color: #fff; border-color: var(--color-primary); }

.modal-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--card-border);
}

.modal-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 12px;
  font-family: var(--font-hud);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}
.modal-tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.modal-tab-content { display: none; }
.modal-tab-content.active { display: block; }

.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.search-result-item {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 24px;
}

/* History pagination (the history has no size limit) */
.history-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px 0;
  color: var(--text-muted);
  flex-wrap: wrap;
  font-family: var(--font-hud);
  font-weight: 600;
}
.history-pager button[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   Bot features on the dashboard (extras.js)
   ========================================================================== */
.muted { color: var(--text-muted); }
.x-small { font-size: 0.82rem; }

.x-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.x-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 0;
  transition: var(--transition);
}
.x-card:hover { border-color: var(--card-hover-border); box-shadow: var(--shadow-glow); }

.x-card-title {
  font-family: var(--font-hud);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--card-border);
}

.x-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  padding: 3px 0;
}
.x-row.enemy { color: #fca5a5; }
.x-num { white-space: nowrap; font-family: var(--font-hud); font-weight: 600; font-size: 0.9rem; color: var(--text-muted); }
.x-num strong { color: var(--text-main); }
.x-alias { color: var(--color-primary); font-weight: 600; }

.x-bar {
  display: block;
  height: 5px;
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
  margin-bottom: 5px;
}
.x-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #3fcfba, var(--color-primary)); box-shadow: 0 0 8px rgba(94, 234, 212, 0.5); }
.x-bar.green > span { background: var(--color-success); }

.x-pill { font-family: var(--font-hud); font-size: 0.78rem; font-weight: 700; padding: 1px 8px; white-space: nowrap; }
.x-pill.home { background: rgba(74, 222, 128, 0.15); color: var(--color-success); }
.x-pill.visitor { background: rgba(246, 196, 83, 0.16); color: var(--color-warning); }

.player-link { cursor: pointer; text-decoration: underline dotted rgba(94, 234, 212, 0.4); text-underline-offset: 3px; }
.player-link:hover { color: var(--color-primary); text-decoration-color: var(--color-primary); }

.x-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.x-inline input[type="text"] { flex: 1; min-width: 160px; width: auto; }
.x-checks label { display: flex; align-items: center; gap: 8px; margin: 6px 0; color: var(--text-main); }
.x-btn-sm { padding: 4px 10px; font-size: 0.78rem; }

.x-modal-wide { max-width: 780px; width: 95%; max-height: 90vh; overflow-y: auto; }
.x-modal-wide h4 { margin: 16px 0 6px; }

.x-qr { width: 260px; max-width: 100%; background: #fff; padding: 10px; margin: 10px 0; }

.x-switch-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-main); font-size: 0.9rem; }
.x-switch { position: relative; display: inline-block; width: 38px; height: 20px; flex-shrink: 0; }
.x-switch input { opacity: 0; width: 0; height: 0; }
.x-switch span { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(94, 234, 212, 0.3); transition: var(--transition); cursor: pointer; }
.x-switch span::before { content: ''; position: absolute; width: 12px; height: 12px; left: 3px; top: 3px; background: var(--text-muted); transition: var(--transition); }
.x-switch input:checked + span { background: rgba(74, 222, 128, 0.25); border-color: var(--color-success); }
.x-switch input:checked + span::before { transform: translateX(18px); background: var(--color-success); box-shadow: 0 0 8px var(--color-success); }

#xToast { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.x-toast {
  background: var(--hud-corners), #0c1715;
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--color-success);
  color: var(--text-main);
  padding: 11px 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  max-width: 380px;
  font-size: 0.88rem;
  animation: fadeIn 0.2s ease;
}
.x-toast.error { border-left-color: var(--color-danger); }

/* Alerts tab: the DM table needs the full width */
#xDmCard { grid-column: 1 / -1; }
#xDmCard .data-table td { padding: 8px 14px; }

/* Grid/flex children may shrink below their content width (prevents horizontal overflow on phones) */
.metric-card,
.server-card,
.timer-card,
.x-card,
.server-title-box,
.server-card-header > *,
.player-name-wrap { min-width: 0; }
.metric-label,
.server-title-box h3 { overflow-wrap: anywhere; }
.server-card-header > .status-pill { flex-shrink: 0; min-width: max-content; }

/* ==========================================================================
   Responsive: the sidebar becomes a scrollable strip on small screens
   ========================================================================== */
@media (max-width: 980px) {
  .app-container {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "header"
      "metrics"
      "nav"
      "main";
    padding: 14px;
  }
  .tab-navigation {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    max-height: none;
    margin-bottom: 18px;
    padding: 8px;
  }
  .tab-navigation::before { display: none; }
  .tab-btn { width: auto; white-space: nowrap; flex-shrink: 0; min-height: 46px; padding: 12px 14px 12px 50px; border-left: none; border-bottom: 3px solid transparent; }
  .tab-btn.active { border-bottom-color: var(--color-primary); }
  .whitelist-layout { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .servers-grid,
  .timers-grid,
  .settings-grid,
  .x-grid,
  .species-pills-grid { grid-template-columns: 1fr; }
  .navbar { padding: 14px; }
  .brand-text .subtext { display: none; }
}

/* ==========================================================================
   Entry animation: "GNS SENTINELA"
   ========================================================================== */
body.splashing { overflow: hidden; }

#splash {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background:
    radial-gradient(600px 400px at 50% 40%, rgba(94, 234, 212, 0.12), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cpath d='M28 66L0 50V16L28 0l28 16v34L28 66v34' fill='none' stroke='%235eead4' stroke-opacity='0.06'/%3E%3C/svg%3E"),
    var(--bg-color);
  transition: opacity 0.6s ease, transform 0.6s ease, visibility 0.6s;
}
#splash.done {
  opacity: 0;
  transform: scale(1.04);
  visibility: hidden;
}

/* Radar */
.splash-radar {
  position: relative;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 1px solid rgba(94, 234, 212, 0.55);
  background: radial-gradient(circle, rgba(94, 234, 212, 0.08), transparent 70%);
  box-shadow: 0 0 40px rgba(94, 234, 212, 0.15);
  margin-bottom: 10px;
  overflow: hidden;
  animation: splashPop 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
.splash-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(94, 234, 212, 0.2);
  inset: 25px;
}
.splash-ring.r2 { inset: 50px; }
.splash-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(94, 234, 212, 0.6), rgba(94, 234, 212, 0) 70deg, transparent 360deg);
  animation: splashSpin 1.6s linear infinite;
}
.splash-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 14px var(--color-primary);
}
.splash-blip {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 10px var(--color-success);
  opacity: 0;
  animation: splashBlip 1.6s ease-out infinite;
}
.splash-blip.b1 { top: 28%; left: 64%; animation-delay: 0.25s; }
.splash-blip.b2 { top: 66%; left: 30%; animation-delay: 0.85s; background: var(--color-danger); box-shadow: 0 0 10px var(--color-danger); }
.splash-blip.b3 { top: 40%; left: 22%; animation-delay: 1.2s; }

/* Title */
.splash-gns {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 9vw, 5.4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.14em;
  color: var(--color-primary);
  text-shadow: 0 0 34px rgba(94, 234, 212, 0.45);
  animation: splashRise 1.1s 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.splash-word {
  display: flex;
  gap: 0.2em;
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 3.4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #fff;
}
.splash-word span {
  display: inline-block;
  opacity: 0;
  animation: splashLetter 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(1.1s + var(--i) * 0.16s);
}

/* Progress */
.splash-bar {
  width: min(260px, 60vw);
  height: 4px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(94, 234, 212, 0.25);
  overflow: hidden;
  margin-top: 12px;
}
.splash-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #3fcfba, var(--color-success));
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.6);
  animation: splashLoad 3.6s 0.3s ease-in-out forwards;
}
.splash-status {
  font-family: var(--font-hud);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  animation: splashBlink 1.2s ease-in-out infinite;
}

@keyframes splashSpin { to { transform: rotate(360deg); } }
@keyframes splashPop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
@keyframes splashRise { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes splashLetter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes splashLoad { from { width: 0; } to { width: 100%; } }
@keyframes splashBlink { 50% { opacity: 0.4; } }
@keyframes splashBlip {
  0%, 15% { opacity: 0; transform: scale(0.4); }
  25% { opacity: 1; transform: scale(1.2); }
  70%, 100% { opacity: 0; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  #splash *, #splash { animation: none !important; }
  .splash-word span { opacity: 1; }
  .splash-bar span { width: 100%; }
}

/* 🔊 Watched-player speaker next to names */
.x-watch {
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  margin-left: 4px;
  padding: 1px 3px;
  opacity: 0.45;
  vertical-align: middle;
}
.x-watch:hover { opacity: 1; border-color: var(--border-color, rgba(94, 234, 212, 0.35)); }
.x-watch.on { opacity: 1; border-color: rgba(94, 234, 212, 0.6); background: rgba(94, 234, 212, 0.12); }

/* History filters: search, event type, map and date range on one wrapping row */
.history-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.history-controls .search-input { flex: 1 1 220px; width: auto; }
.history-controls select { width: auto; flex: 0 1 auto; max-width: 260px; }
.history-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.history-date input[type="date"] {
  padding: 9px 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(94, 234, 212, 0.2);
  border-radius: 0;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color-scheme: dark;
}
.history-date input[type="date"]:focus {
  outline: none;
  border-color: var(--color-primary);
}
@media (max-width: 640px) {
  .history-controls > * { flex: 1 1 100%; max-width: none; }
  .history-date input[type="date"] { flex: 1; }
}

/* Spots: name + lat/long boxes + add button on one row */
.spot-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.spot-form .form-group { margin: 0; }
.spot-name { flex: 1 1 260px; }
.spot-map { flex: 0 1 200px; }
.spot-coord { flex: 0 0 110px; }
.spot-command { flex: 2 1 320px; }
.spot-notes { flex: 1 1 240px; }
.spot-filter { margin-bottom: 12px; }
.spot-filter select { width: auto; min-width: 220px; }
.spot-notes-text { margin-top: 2px; white-space: normal; }
.spot-pending-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  white-space: nowrap;
}
.spot-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #f5c451;
  border: 1px solid rgba(245, 196, 81, 0.45);
  background: rgba(245, 196, 81, 0.1);
}
tr.spot-pending td { background: rgba(245, 196, 81, 0.04); }
.spot-badge-info { color: var(--color-primary); border-color: rgba(94, 234, 212, 0.4); background: rgba(94, 234, 212, 0.08); }
.spot-visit-cell { white-space: nowrap; font-size: 0.88rem; }
.spot-visit-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 12px 0 4px;
}
.spot-visit-form .form-group { margin: 0; flex: 1 1 180px; }
.spot-visit-form .spot-visit-note { flex: 2 1 240px; }
.spot-visit-form input[type="date"] {
  width: 100%;
  padding: 9px 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(94, 234, 212, 0.2);
  border-radius: 0;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.92rem;
  color-scheme: dark;
}
.spot-visit-form .btn { height: 42px; }
@media (max-width: 640px) {
  .spot-visit-form .form-group, .spot-visit-form .btn { flex: 1 1 100%; justify-content: center; }
}
.spot-coord input { text-align: center; font-size: 1.05rem; letter-spacing: 1px; }
.spot-add { height: 42px; }
#tab-spots .glass-card + .glass-card { margin-top: 16px; }
.spot-actions { text-align: right; white-space: nowrap; }
.spot-actions .btn + .btn { margin-left: 6px; }
@media (max-width: 640px) {
  .spot-coord { flex: 1 1 calc(50% - 6px); }
  .spot-map, .spot-command, .spot-notes { flex: 1 1 100%; }
  .spot-filter select { width: 100%; }
  .spot-add { flex: 1 1 100%; justify-content: center; }
}
.spot-visit-note-text { margin-top: 2px; white-space: normal; max-width: 260px; color: var(--text-muted); }
