/* =========================================================================
   2Moonz Space 2026 — Modern UI Overrides (Tailwind-compatible)
   Minimal override layer: only things Tailwind can't do.
   jQuery UI, Magnific Popup, legacy compat fixes, Lucide icon styles.
   ========================================================================= */

/* === Reset layer (Tailwind CDN handles most resets, but we keep these for compat) === */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font-family); line-height: 1.55; background: var(--bg) var(--bg-gradient); min-height: 100vh; color: var(--text); }
img { max-width: 100%; height: auto; }
a { color: var(--text-link); text-decoration: none; }
a:hover { color: var(--text-link-hover); text-decoration: underline; }

/* === Tooltip === */
#tooltip { position: fixed; background: var(--panel-solid); border: 1px solid var(--panel-border-strong); border-radius: 8px; padding: 10px 14px; box-shadow: var(--panel-shadow); max-width: min(320px, calc(100vw - 16px)); z-index: var(--z-tooltip); font-size: var(--font-size-sm); color: var(--text-strong); box-sizing: border-box; }
#tooltip table { width: 100% !important; max-width: none !important; border-collapse: collapse; }
#tooltip table th, #tooltip table td { word-break: break-word; }
#tooltip img { max-width: 100%; height: auto; }
#tooltip.tooltip_sticky_div { animation: tooltipIn 0.14s ease-out; transform-origin: top center; }

/* En táctil: evita el menú de "guardar imagen" al tocar iconos/tooltips */
[data-tooltip], [data-tooltip-content], .resv2__icon {
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	user-select: none;
	touch-action: manipulation;
}
@keyframes tooltipIn { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 380px) { #tooltip { font-size: 11px; padding: 8px 10px; border-radius: 7px; } }

/* === App shell layout (used by PHP templates) === */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.app-body { display: flex; flex: 1; position: relative; }
.app-content { flex: 1; padding: var(--content-padding); width: 100%; max-width: var(--content-max); margin: 0 auto; }

/* === Bottom navigation (visible on ALL screen sizes) === */
.bottomnav { padding-bottom: env(safe-area-inset-bottom, 4px); box-shadow: 0 -6px 20px rgba(0,0,0,0.25); }
.bottomnav a, .bottomnav button { text-decoration: none; background: transparent; border: 0; cursor: pointer; font: inherit; min-height: 56px; }
.bottomnav a:hover, .bottomnav button:hover { text-decoration: none; }
.bottomnav [data-lucide], .bottomnav svg { flex-shrink: 0; }
.bottomnav span { font-size: 10px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bottomnav a, .bottomnav button { min-width: 0; }

/* === "More" slide-up panel === */
.more-overlay { position: fixed; inset: 0; z-index: var(--z-drawer); background: rgba(0,0,0,0.6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.more-panel {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: calc(var(--z-drawer) + 1);
	max-height: 82vh; overflow-y: auto;
	background: var(--panel-solid);
	border-top: 1px solid var(--panel-border-strong);
	border-radius: 18px 18px 0 0;
	box-shadow: 0 -16px 50px rgba(0,0,0,0.5);
}
.more-tile {
	display: flex; flex-direction: column; align-items: center; gap: 6px;
	padding: 10px 6px; border-radius: 12px; text-align: center;
	color: var(--text-muted); background: var(--input-bg); border: 1px solid var(--panel-border);
	text-decoration: none; transition: all var(--transition-fast); min-height: 72px;
}
.more-tile:hover { background: var(--panel-hover); color: var(--accent-hover); border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.more-tile [data-lucide], .more-tile svg { width: 22px; height: 22px; }
.more-tile span { font-size: 10px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* === Planet / colonies switcher panel (drops from topnav) === */
/* [5.6.3] Enfoque New-Star: dropdown compacto anclado bajo el botón del planeta
   activo (no panel a ancho completo), esquinas redondeadas y deslizamiento corto.
   position:absolute (el backdrop-filter del nav rompe el fixed; nav sticky = ancla). */
.planet-panel {
	position: absolute; top: calc(100% + 6px); left: 10px;
	width: min(400px, calc(100vw - 20px));
	max-height: min(60vh, 480px); overflow: hidden;
	display: flex; flex-direction: column;
	background: var(--panel-solid);
	border: 1px solid var(--panel-border-strong);
	border-radius: 14px;
	box-shadow: 0 18px 50px rgba(0,0,0,0.55);
}
.planet-panel__inner {
	margin: 0 auto;
	width: 100%;
	max-width: 420px;
	padding: 12px 14px 14px;
	display: flex; flex-direction: column;
	min-height: 0;
	flex: 1 1 auto;
	overflow: hidden;
}
.planet-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; flex: 1 1 auto; padding: 2px 4px 6px 2px; overscroll-behavior: contain; }
.planet-list::-webkit-scrollbar { width: 6px; }
.planet-list::-webkit-scrollbar-thumb { background: var(--panel-border-strong); border-radius: 999px; }
.planet-list::-webkit-scrollbar-track { background: transparent; }
.planet-row {
	display: flex; align-items: center; gap: 12px; min-height: 48px;
	padding: 6px 10px; border-radius: 12px;
	background: var(--input-bg); border: 1px solid var(--panel-border);
	text-decoration: none; transition: all var(--transition-fast);
}
.planet-row:hover { background: var(--panel-hover); border-color: var(--accent); text-decoration: none; }
.planet-row--active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
/* [5.6.3] Luna como sub-entrada agrupada bajo su planeta (estilo New-Star) */
.planet-row--moon { margin: -3px 0 0 16px; min-height: 40px; border-top-left-radius: 6px; border-left: 2px solid var(--panel-border-strong); background: rgba(10, 14, 28, 0.5); }
.planet-row--moon .planet-row__img-wrap { width: 26px; height: 26px; }
.planet-row--moon .planet-row__img { width: 26px; height: 26px; }
.planet-row--moon .planet-row__name { font-size: 12px; color: var(--text-muted); }
.planet-row--moon .planet-row__coords { font-size: 9px; }
.planet-row--moon:hover { border-color: var(--accent); border-left-color: var(--accent); }
.planet-row--moon .planet-row__moon { color: var(--accent-hover); }
.planet-row__img-wrap { position: relative; flex-shrink: 0; width: 34px; height: 34px; }
.planet-row__img { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--panel-border-strong); object-fit: cover; }
.planet-row__moon { position: absolute; right: -5px; bottom: -4px; width: 13px; height: 13px; color: var(--text-muted); background: var(--panel-solid); border-radius: 50%; }
.planet-row__info { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.planet-row__name { font-size: 13px; font-weight: 700; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.planet-row__coords { font-size: 10px; font-family: ui-monospace, monospace; color: var(--text-muted); }
.planet-row__chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; flex-shrink: 1; }
.p-chip {
	display: inline-flex; align-items: center; gap: 3px;
	padding: 2px 7px; border-radius: 999px;
	font-size: 10px; font-weight: 700; line-height: 1.4; white-space: nowrap;
	border: 1px solid var(--panel-border-strong); background: var(--panel-solid); color: var(--text-muted);
}
.p-chip--attack { color: var(--danger-strong); border-color: rgba(239,93,110,0.45); background: rgba(239,93,110,0.10); }
.p-chip--spy { color: var(--accent-hover); border-color: rgba(58,142,230,0.40); background: rgba(58,142,230,0.10); }
.p-chip--missile { color: #ff8a50; border-color: rgba(255,138,80,0.45); background: rgba(255,138,80,0.10); }
.p-chip--build { color: var(--success-strong, #7bd88f); border-color: rgba(125,211,124,0.35); background: rgba(125,211,124,0.10); }
@media (max-width: 480px) {
	.planet-row { gap: 8px; padding: 6px 8px; }
	.planet-row__chips { flex-wrap: nowrap; overflow: hidden; }
}

/* === Stat cards (reusable) === */
.stat-card {
	display: flex; align-items: center; gap: 10px;
	padding: 12px 14px; border-radius: var(--panel-radius);
	background: var(--panel); border: 1px solid var(--panel-border);
	box-shadow: var(--panel-shadow);
}
.stat-card__icon { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; background: var(--input-bg); flex-shrink: 0; }
.stat-card__label { font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.stat-card__value { font-size: 18px; font-weight: 800; color: var(--text-strong); line-height: 1.2; }
.stat-card__unit { display: block; font-size: 10px; font-weight: 500; color: var(--text-muted); }

/* === Universe stats block === */
.us-dl { margin: 0; display: flex; flex-direction: column; }
.us-row {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 8px 2px; border-bottom: 1px solid var(--panel-border);
}
.us-row:last-child { border-bottom: none; }
.us-row dt { font-size: 13px; color: var(--text-muted); margin: 0; flex-shrink: 0; }
.us-row dd { font-size: 13px; color: var(--text); margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.us-row--player { display: flex; align-items: center; gap: 10px; }
.us-rank {
	display: inline-flex; align-items: center; justify-content: center;
	width: 20px; height: 20px; flex-shrink: 0; border-radius: 6px;
	background: var(--input-bg); border: 1px solid var(--panel-border);
	font-size: 11px; font-weight: 800; color: var(--text-muted); font-family: var(--font-mono);
}
.us-number { color: var(--success); font-weight: 700; }
.us-online { color: var(--info); font-weight: 700; }
.us-highlight { color: var(--gold); font-weight: 700; }
.us-unit { font-size: 11px; color: var(--text-muted); }

/* === Panels / cards === */
.panel {
        background: var(--panel);
        -webkit-backdrop-filter: var(--panel-blur);
        backdrop-filter: var(--panel-blur);
        border: 1px solid var(--panel-border);
        border-radius: var(--panel-radius);
        box-shadow: var(--panel-shadow);
        padding: 18px;
        margin: 14px 0;
}

/* === Buttons === */
.btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 9px 18px;
        background: var(--panel-solid);
        color: var(--text);
        border: 1px solid var(--panel-border-strong);
        border-radius: 8px;
        cursor: pointer;
        font-family: inherit;
        font-size: var(--font-size-sm);
        font-weight: 600;
        text-decoration: none;
        line-height: 1.4;
        min-height: var(--touch-target);
        transition: all var(--transition-fast);
}
.btn:hover { background: var(--panel-hover); color: var(--text-strong); text-decoration: none; transform: translateY(-1px); }
.btn--primary { background: var(--accent-gradient); color: #fff; border: 0; }
.btn--primary:hover { background: var(--accent-gradient-hover); color: #fff; }
.btn--danger { color: var(--danger-strong); border-color: var(--danger-strong); }
.btn--danger:hover { background: var(--danger-strong); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--panel-hover); }
.btn--block { width: 100%; }

/* === Forms === */
input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea {
        background: var(--input-bg);
        color: var(--input-text);
        border: 1px solid var(--input-border);
        border-radius: 8px;
        padding: 10px 12px;
        font: inherit;
        font-size: var(--font-size);
        width: 100%;
        transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
input:focus, select:focus, textarea:focus {
        outline: 0;
        border-color: var(--accent);
        box-shadow: var(--input-focus-glow);
}

/* === Modernized tables === */
table {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        margin: 14px 0;
        font-size: var(--font-size-sm);
        background: transparent;
}
table table { margin: 0; }
td, th { padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--panel-border); background: transparent; color: var(--text); }
th { background: var(--panel-solid); color: var(--text-strong); font-weight: 700; text-transform: uppercase; font-size: var(--font-size-xs); letter-spacing: 0.06em; border-bottom: 2px solid var(--panel-border-strong); }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--panel-hover); }
.transparent, #header td, .tip td, .tip th, .raportMessage td { background: transparent !important; border: 0 !important; }
img { border: 0; }
table table, img { border: 0; }

/* Legacy classes */
.table519, .table569 { min-width: 0 !important; width: 100% !important; max-width: var(--content-max); }

/* Responsive: no table may force horizontal page overflow (inline fixed widths like 760px still get capped). */
#content table { min-width: 0; max-width: 100%; }
#content > table, #content form > table { width: 100%; max-width: 100%; }

/* === Content === */
#content { padding: var(--content-padding); max-width: var(--content-max); margin: 0 auto; }
.full #content > table, .full form > table { width: 100%; max-width: 100%; }

/* === Page headings === */
h1, h2, h3 { color: var(--text-strong); }
h1 { font-size: var(--font-size-xl); margin: 0 0 12px; }
h2 { font-size: var(--font-size-lg); }
h3 { font-size: 16px; }

/* === Status colors === */
.admin { color: var(--rank-admin); }
.mod { color: var(--rank-mod); }
.ops { color: var(--rank-ops); }
.messages_body .admin, .messages_body .mod, .messages_body .ops { font-weight: 700; }
.res_max { color: var(--text-muted); }
.res_current, .res_current_max { color: var(--text-strong); font-weight: 700; }
.attack, .federation, .error { color: var(--danger-strong); }
.allymember, .colony, .deploy, .harvest, .transport, .success { color: var(--success); }
.warning { color: var(--warning); }
.notice { color: var(--gold); }
.galaxy-alliance-member { color: var(--rank-ally); }
.galaxy-alliance-friend { color: var(--rank-friend); }
.galaxy-alliance-enemy { color: var(--danger-strong); }
.galaxy-short-noob { color: var(--rank-noob); }
.galaxy-short-strong { color: var(--rank-strong); }
.destroy, .hold, .espionage, .missile, .return, .raportWin, .raportLose { font-weight: 600; }
.raportWin { color: var(--success); }
.raportLose { color: var(--danger-strong); }

/* Build buttons */
.build_submit, .build_form { display: inline-block; }
.build_submit {
        background: transparent; border: 1px solid var(--accent); color: var(--accent-hover);
        padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit; font-size: var(--font-size-sm); font-weight: 600;
        transition: all var(--transition-fast);
}
.build_submit:hover { background: var(--accent); color: #fff; text-decoration: none; }
.onlist { color: var(--text-muted); }

/* === Infobox === */
.infobox { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--text-strong); padding: 12px 16px; border-radius: 8px; margin: 10px 0; text-align: center; font-weight: 600; }
.globalWarning { background: var(--accent-soft); border: 1px solid var(--warning); color: var(--text-strong); margin: 0 0 12px; padding: 10px; border-radius: 8px; text-align: center; }

/* === jQuery UI overrides === */
.ui-widget, .ui-widget td { font-family: inherit; font-size: var(--font-size-sm); }
.ui-widget-header, .ui-widget-content { background: var(--panel-solid) !important; color: var(--text-strong) !important; border-color: var(--panel-border-strong) !important; }
.ui-state-default, .ui-state-hover { border-radius: 6px !important; border: 1px solid var(--panel-border-strong) !important; background: var(--panel-solid) !important; }
.ui-state-hover { background: var(--panel-hover) !important; }
.ui-tabs-nav { padding: 0; border-bottom: 1px solid var(--panel-border); }
.ui-tabs { border: 1px solid var(--panel-border); background: transparent; }
.ui-autocomplete { background: var(--panel-solid); border: 1px solid var(--panel-border-strong); border-radius: 8px; box-shadow: var(--panel-shadow); }
.ui-autocomplete-category { font-weight: 700; padding: 6px 12px; }
.ui-autocomplete-item { cursor: pointer; padding: 8px 12px; }
.ui-autocomplete-item:hover { background: var(--panel-hover); }
.ui-progressbar { height: 8px !important; background: var(--input-bg) !important; }
.ui-progressbar-value { background: var(--accent-gradient) !important; }

/* === Spy raport === */
.spyRaportContainerHead { background: var(--panel-solid); color: var(--text-strong); border-radius: 8px 8px 0 0; }
.spyRaportContainerRow { border-top: 1px solid var(--panel-border); }
.spyRaportFooter { text-align: center; padding-top: 12px; }

/* === Login card === */
.login-card, section.panel { background: var(--panel); -webkit-backdrop-filter: var(--panel-blur); backdrop-filter: var(--panel-blur); border: 1px solid var(--panel-border); border-radius: var(--panel-radius); box-shadow: var(--panel-shadow); padding: 28px 32px; margin: 20px auto; max-width: 480px; }
.login-card h1 { margin: 0 0 16px; color: var(--text-strong); font-size: var(--font-size-lg); text-align: center; }
.small { color: var(--text-muted); font-size: var(--font-size-sm); }

/* Footer */
footer { text-align: center; padding: 24px; color: var(--text-muted); font-size: var(--font-size-sm); }
footer a { color: var(--text-link); }

/* === Lucide icon styles === */
[data-lucide] { display: inline-block; vertical-align: middle; }
.sidebar [data-lucide] { flex-shrink: 0; }
.bottomnav [data-lucide] { flex-shrink: 0; }

/* === Install === */
body > table { max-width: 960px; margin: 0 auto; }
body > table th[colspan] { background: var(--accent-gradient); color: #fff; padding: 16px; border-radius: 8px 8px 0 0; text-align: center; }

/* === Misc === */
.tip { display: none; padding: 12px; position: absolute; z-index: var(--z-tooltip); max-width: 320px; background: var(--panel-solid); border: 1px solid var(--panel-border-strong); border-radius: 8px; box-shadow: var(--panel-shadow); }
.textForBlind { position: absolute; left: -10000px; }

/* === Mobile tweaks === */
@media (max-width: 768px) {
        .panel, .login-card, section.panel { padding: 16px; margin: 10px 0; }
        #content { padding: 10px; }
        .app-content { padding: 10px; padding-bottom: 80px; }
        .topnav { padding: 6px 8px; }
        .res { padding: 3px 6px; }
        .res__icon { width: 16px; height: 16px; }
        table { font-size: 11px; }
        td, th { padding: 6px 8px; }
        th { font-size: 10px; }
        h1 { font-size: var(--font-size-lg); }
}

/* === Print === */
@media print { .topnav, .bottomnav, .more-panel, .more-overlay, footer { display: none; } }

/* =========================================================================
   Modern message cards (error / success / info) — used by error.default.tpl
   ========================================================================= */
.msg-card { border-width: 1px; }
.msg-card--error { border-color: var(--danger); }
.msg-card--success { border-color: var(--success); }
.msg-card--info { border-color: var(--info); }
.msg-card__icon { background: var(--accent-soft); color: var(--info); }
.msg-card--error .msg-card__icon { background: rgba(239, 93, 110, 0.15); color: var(--danger-strong); }
.msg-card--success .msg-card__icon { background: rgba(67, 211, 158, 0.15); color: var(--success-strong); }
.msg-card--info .msg-card__icon { background: var(--accent-soft); color: var(--info); }
.msg-card__btn { background: var(--accent-gradient); color: #fff; border: 0; }
.msg-card__btn:hover { background: var(--accent-gradient-hover); color: #fff; text-decoration: none; transform: translateY(-1px); }
.msg-card--error .msg-card__btn { background: var(--danger-strong); }
.msg-card--error .msg-card__btn:hover { background: var(--danger); }
.msg-card--success .msg-card__btn { background: var(--success); }
.msg-card--success .msg-card__btn:hover { background: var(--success-strong); }

/* =========================================================================
   Modern toastr (balloon) overrides — cosmic theme, slide-in animation
   ========================================================================= */
#toast-container { z-index: var(--z-toast); }
#toast-container.toast-top-right { top: 72px; }
#toast-container > div {
	width: min(360px, calc(100vw - 24px));
	margin: 0 0 10px;
	padding: 14px 18px 14px 50px;
	border-radius: 12px;
	border: 0;
	color: #fff !important;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
	opacity: 1 !important;
	filter: none !important;
	font-size: var(--font-size-sm);
	font-weight: 500;
	animation: ab-toast-in 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
#toast-container > div:hover { box-shadow: 0 14px 38px rgba(0, 0, 0, 0.55); opacity: 1 !important; }
#toast-container > .toast-success { background-color: #1ea97c !important; }
#toast-container > .toast-error   { background-color: #e23b4d !important; }
#toast-container > .toast-warning { background-color: #e0941b !important; }
#toast-container > .toast-info    { background-color: #2f86d6 !important; }
.toast-title { color: #fff !important; font-weight: 700; font-size: var(--font-size-sm); }
.toast-message { color: #fff !important; -ms-word-wrap: break-word; word-wrap: break-word; }
.toast-close-button { color: #fff !important; text-shadow: none !important; opacity: 0.75; font-size: 18px; }
.toast-close-button:hover { color: #fff !important; opacity: 1; }
@keyframes ab-toast-in { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === Fancybox 3 (replaces the legacy Magnific / native moonz modals) ===
   Themed to match the cosmic design: dark panel, rounded, backdrop blur. */
.fancybox-container { z-index: var(--z-modal); }
.fancybox-bg { background: rgba(4, 7, 16, 0.82); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.fancybox-is-open .fancybox-bg { opacity: 1; }
.fancybox-content {
	background: var(--panel-solid);
	color: var(--text);
	border: 1px solid var(--panel-border-strong);
	border-radius: 16px;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}
.fancybox-content iframe { background: transparent; border-radius: 0; border: 0; }
.fancybox-slide--iframe .fancybox-content {
	border: 0;
	border-radius: 16px;
	overflow: hidden;
	background: var(--panel-solid);
}
.fancybox-close-small {
	color: var(--text-strong);
	width: 32px; height: 32px;
	background: var(--panel-solid);
	border: 1px solid var(--panel-border-strong);
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	transition: background 0.15s, color 0.15s;
}
.fancybox-close-small:hover { background: var(--danger); color: #fff; }
.fancybox-button { background: var(--panel-hover); color: var(--text-strong); }
.fancybox-button:hover:not([disabled]) { color: #fff; background: var(--accent); }
.fancybox-button--arrow_right, .fancybox-button--arrow_left { border-radius: 50%; }
.fancybox-infobar, .fancybox-caption { color: var(--text-muted); }

/* === Fancybox confirm dialog === */
.fancybox-confirm-wrap .fancybox-content {
	max-width: min(480px, calc(100vw - 32px));
	padding: 24px;
	border-radius: 16px;
}
/* [5.6.7] inline-flex (no flex): fancybox añade su clase .fancybox-content a este
   mismo elemento en los modales html, y el centrado de fancybox 3 usa inline-block +
   vertical-align; con display:flex el bloque caía bajo el ghost :before (esquina
   inferior izquierda). inline-flex conserva el layout interno y se centra. */
.fancybox-confirm { display: inline-flex; vertical-align: middle; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.fancybox-confirm__icon {
	width: 52px; height: 52px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: var(--danger-soft, rgba(239, 68, 68, 0.12)); color: var(--danger, #ef4444);
}
.fancybox-confirm__icon svg { width: 26px; height: 26px; }
.fancybox-confirm__text { margin: 0; font-size: var(--font-size-base, 14px); color: var(--text); line-height: 1.55; }
.fancybox-confirm__actions { display: flex; gap: 10px; justify-content: center; }
.fancybox-confirm__actions .btn { min-width: 96px; }

/* =========================================================================
   Galaxy orbital view (2D / 3D)
   ========================================================================= */
.galaxy-stage {
	/* [Ola 8a A-PC] tokens locales del stage: tinte de anillo por tipo
	   (planeta = var(--accent), escombros = var(--warning), luna = violeta propio) */
	--gxy-moon: #a78bfa;
	position: relative;
	width: min(520px, 100%);
	aspect-ratio: 1/1;
	margin: 0 auto;
	border-radius: 50%;
	border: 1px solid var(--panel-border);
	background:
		radial-gradient(circle at 50% 50%, rgba(58,142,230,0.10) 0%, transparent 55%),
		radial-gradient(ellipse at 28% 22%, rgba(125,77,219,0.12) 0%, transparent 50%),
		radial-gradient(ellipse at 72% 80%, rgba(64,171,255,0.10) 0%, transparent 50%),
		rgba(6,10,22,0.55);
	box-shadow: inset 0 0 90px rgba(0,0,0,0.6), 0 10px 34px rgba(0,0,0,0.35);
	/* visible: el submenú del planeta debe poder salir del círculo sin cortarse */
	overflow: visible;
}
/* [Ola 8a A-PC] Campo estelar sutil detras de los slots (opacidad 0.15):
   puntos radial-gradient en tile; los slots (z-index 1+) mandan sobre el fondo. */
.galaxy-stage::before {
	content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit;
	pointer-events: none; opacity: 0.15;
	background-image:
		radial-gradient(1px 1px at 24px 32px, rgba(255,255,255,0.9) 50%, transparent 51%),
		radial-gradient(1px 1px at 104px 88px, rgba(255,255,255,0.7) 50%, transparent 51%),
		radial-gradient(1.5px 1.5px at 188px 148px, rgba(255,255,255,0.85) 50%, transparent 51%),
		radial-gradient(1px 1px at 66px 178px, rgba(255,255,255,0.6) 50%, transparent 51%),
		radial-gradient(1px 1px at 214px 50px, rgba(255,255,255,0.75) 50%, transparent 51%);
	background-size: 240px 200px;
}
[data-theme="light"] .galaxy-stage { --gxy-moon: #7c5cd6; }
.galaxy-map { position: relative; z-index: 10; }
.galaxy-nebula { position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
	background: radial-gradient(circle at 50% 50%, transparent 34%, rgba(58,142,230,0.06) 60%, rgba(58,142,230,0.12) 78%, transparent 86%); }
.galaxy-ring { position: absolute; box-sizing: border-box; border-radius: 50%; pointer-events: none;
	border: 1px dashed rgba(140,160,220,0.24); }
.galaxy-star {
	position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
	width: 62px; height: 62px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: radial-gradient(circle, #fff7e0 0%, #ffd37a 28%, #ffb74d 48%, rgba(255,157,46,0.25) 62%, transparent 72%);
	animation: galaxy-star-pulse 3.2s ease-in-out infinite;
	z-index: 2;
}
.galaxy-star span { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .06em; color: rgba(60,25,0,0.85); }
@keyframes galaxy-star-pulse {
	0%, 100% { box-shadow: 0 0 30px 8px rgba(255,170,60,0.30), 0 0 70px 24px rgba(255,170,60,0.10); }
	50%      { box-shadow: 0 0 42px 14px rgba(255,190,80,0.42), 0 0 92px 36px rgba(255,170,60,0.16); }
}
.galaxy-slot {
	position: absolute; transform: translate(-50%, -50%);
	display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
	width: 60px; padding: 5px 4px 3px; border-radius: 12px;
	background: linear-gradient(160deg, rgba(24,30,52,0.94), rgba(10,14,28,0.94));
	border: 1px solid var(--panel-border-strong);
	box-shadow: 0 4px 14px rgba(0,0,0,0.45);
	color: var(--text); text-decoration: none; cursor: pointer;
	transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
	z-index: 1;
}
.galaxy-slot:hover { z-index: 6; border-color: var(--accent); box-shadow: 0 0 20px rgba(58,142,230,0.45); }
.galaxy-slot:hover .galaxy-slot-planet { scale: 1.12; }
.galaxy-slot .galaxy-slot-planet { transition: scale var(--transition-fast); }
.galaxy-slot .galaxy-slot-num {
	position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
	font-family: var(--font-mono); font-size: var(--font-size-2xs); font-weight: 700; line-height: 14px;
	padding: 0 5px; border-radius: 999px; color: var(--text-muted);
	background: var(--panel-solid); border: 1px solid var(--panel-border);
}
/* [Ola 8a A-PC] miniatura 26px -> 40px con anillo tintado (planeta = acento;
   luna y escombros llevan su propio anillo en .galaxy-badge) */
.galaxy-slot .galaxy-slot-planet { position: relative; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; display: block; perspective: 120px;
	box-shadow: 0 0 0 1.5px var(--accent), 0 0 10px rgba(58,142,230,0.35); }
.galaxy-slot .galaxy-slot-planet img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 50%; animation: galaxy-planet-tilt 7s ease-in-out infinite; will-change: transform; }
.galaxy-slot .galaxy-slot-planet .galaxy-planet-shine, .galaxy-planet-shine { position: absolute; inset: -30% -100%; background: linear-gradient(100deg, transparent 42%, rgba(255,255,255,0.65) 50%, transparent 58%); mix-blend-mode: screen; pointer-events: none; animation: galaxy-shine 7s ease-in-out infinite; }
/* [5.7.2] Overview: planeta del hero con el mismo efecto 3D + brillo que la galaxia */
.overview-planet { position: relative; display: block; border-radius: 50%; overflow: hidden; perspective: 500px; }
.overview-planet img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; animation: galaxy-planet-tilt 7s ease-in-out infinite; will-change: transform; }
@keyframes galaxy-planet-tilt {
	0%, 100% { transform: rotateY(-18deg); }
	50%      { transform: rotateY(18deg); }
}
@keyframes galaxy-shine {
	from { transform: translateX(-45%); }
	to   { transform: translateX(45%); }
}
.galaxy-slot .galaxy-slot-name { max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-size-2xs); line-height: 1.15; color: var(--text); }
.galaxy-slot .galaxy-slot-badges { display: inline-flex; align-items: center; gap: 4px; min-height: 20px; }
/* [Ola 8a] badges luna/escombros 14px -> 18px con anillo tintado por tipo
   (luna = violeta --gxy-moon, escombros = ambar var(--warning)) */
.galaxy-slot .galaxy-badge { width: 18px; height: 18px; border-radius: 50%; filter: brightness(1.2); }
.galaxy-slot .galaxy-badge.is-moon { box-shadow: 0 0 0 1.5px var(--gxy-moon), 0 0 8px rgba(167,139,250,0.45); }
.galaxy-slot .galaxy-badge.is-debris { box-shadow: 0 0 0 1.5px var(--warning), 0 0 8px rgba(255,183,77,0.45); }
.galaxy-slot .galaxy-badge-act { width: 12px; height: 12px; color: var(--success); }
.galaxy-slot.is-own { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(58,142,230,0.28), 0 4px 14px rgba(0,0,0,0.45); }
.galaxy-slot.is-destroyed { border-color: rgba(239,93,110,0.7); background: linear-gradient(160deg, rgba(60,12,20,0.92), rgba(20,6,10,0.92)); }
.galaxy-slot.is-destroyed .galaxy-slot-icon { color: var(--danger-strong); }
.galaxy-slot.is-empty { width: 44px; height: 44px; border-style: dashed; background: rgba(12,16,30,0.55); justify-content: center; }
.galaxy-slot.is-empty:hover { border-color: var(--text-link); }
.galaxy-slot.is-empty .galaxy-slot-num { top: auto; }
.galaxy-slot.is-empty .galaxy-slot-icon { color: var(--text-muted); }
.galaxy-slot.is-outer { flex-direction: row; width: auto; gap: 6px; padding: 8px 14px; border-radius: 999px; border-style: dashed; color: var(--text-link); font-size: 11px; font-weight: 600; }
.galaxy-slot.is-outer:hover { border-color: var(--accent); color: var(--accent-hover); }
.galaxy-slot.is-status-strong  { box-shadow: 0 0 0 2px rgba(255,138,138,0.38), 0 4px 14px rgba(0,0,0,0.45); }
.galaxy-slot.is-status-noob    { box-shadow: 0 0 0 2px rgba(200,224,160,0.32), 0 4px 14px rgba(0,0,0,0.45); }
.galaxy-slot.is-status-vacation{ box-shadow: 0 0 0 2px rgba(255,216,102,0.32), 0 4px 14px rgba(0,0,0,0.45); }
.galaxy-slot.is-status-banned  { box-shadow: 0 0 0 2px rgba(121,134,166,0.38), 0 4px 14px rgba(0,0,0,0.45); opacity: .72; }
.galaxy-slot.is-status-inactive{ opacity: .72; }
.galaxy-slot.is-selected { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255,200,72,0.35), 0 0 22px rgba(255,200,72,0.28); z-index: 5; }
.galaxy-slot.is-menu-open { z-index: 20; border-color: var(--accent); }

/* [Ola 8a A-PC] Panel de seleccion: retrato 96px con glow de atmosfera
   (reusa el patron .galaxy-planet-shine del stage) */
.galaxy-sd-planet {
	position: relative; flex: none;
	width: 96px; height: 96px; border-radius: 50%; overflow: hidden;
	background: var(--panel-solid); perspective: 200px;
	box-shadow: 0 0 0 1.5px var(--accent), 0 0 24px rgba(58,142,230,0.35);
}
.galaxy-sd-planet img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* [Ola 8a A-PC] Escombros: metal/cristal como chips con icono de moneda
   (los iconos vienen del tpl; las monedas nuevas las genera otra ola) */
.galaxy-res-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.galaxy-res-chip {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 3px 9px 3px 5px; border-radius: 999px;
	background: var(--input-bg); border: 1px solid var(--panel-border);
	font-size: var(--font-size-sm); font-weight: 600;
}
.galaxy-res-chip img { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.galaxy-res-chip-name { color: var(--text-muted); font-size: var(--font-size-2xs); font-weight: 600; }

/* === Submenú del planeta (solo clic): un único menú, siempre debajo === */
.galaxy-submenu {
	position: absolute; top: 0; left: 0;
	transform: translateX(-50%);
	display: flex; flex-direction: column; gap: 2px;
	min-width: 150px; max-width: 210px; padding: 5px;
	border-radius: 10px;
	background: var(--panel-solid);
	border: 1px solid var(--panel-border-strong);
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
	z-index: 30;
}
.galaxy-submenu-group {
	display: flex; flex-direction: column; gap: 2px;
	margin-top: 4px; padding-top: 4px;
	border-top: 1px solid var(--panel-border-strong);
}
.galaxy-submenu-title {
	display: flex; align-items: center; gap: 8px;
	padding: 2px 8px 4px; font-size: 10px; font-weight: 700;
	text-transform: uppercase; letter-spacing: .06em;
	color: var(--text-muted);
}
.galaxy-submenu-title svg { width: 12px; height: 12px; flex: none; }
.galaxy-submenu-item {
	display: flex; align-items: center; gap: 8px;
	min-height: 36px; padding: 6px 8px; border-radius: 7px;
	font-size: 11.5px; font-weight: 600; line-height: 1.2;
	color: var(--text); white-space: nowrap;
	background: transparent; border: 1px solid transparent;
	transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.galaxy-submenu-item svg { width: 13px; height: 13px; flex: none; }
.galaxy-submenu-item:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.galaxy-submenu-item.is-danger { color: var(--danger-strong); }
.galaxy-submenu-item.is-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
/* [P1-4 auditoria] Los items JS-only del submenu son <button type="button"> reales
   (activables con Enter y Espacio, anunciados como boton). main.css heredado da a
   <button> font verdana 10px y margin:2px: se neutraliza para que el boton se vea
   identico al <a> que sustituye. */
button.galaxy-submenu-item {
	font-family: inherit;
	margin: 0;
	cursor: pointer;
	text-align: left;
}

/* [Ola 8a A-MOVIL] <=640px: targets >=44px, thumbs 36px y popover -> bottom-sheet.
   El sheet sigue el patron .more-panel del juego (anclado abajo, scroll interno,
   cierre por tap fuera con el @click.outside ya presente en el tpl; desktop
   conserva el popover posicionado por Alpine). OJO: .galaxy-map pierde su
   backdrop-blur aqui porque backdrop-filter crea containing-block y romperia
   el position:fixed del sheet; left/top inline de Alpine se neutralizan. */
@media (max-width: 640px) {
	.galaxy-map { backdrop-filter: none; -webkit-backdrop-filter: none; }
	.galaxy-stage { width: 100%; }
	.galaxy-slot { width: 58px; min-height: 44px; padding: 6px 3px 3px; }
	.galaxy-slot.is-empty { width: 44px; height: 44px; }
	.galaxy-slot .galaxy-slot-planet { width: 36px; height: 36px; }
	.galaxy-slot .galaxy-slot-name { max-width: 50px; }
	.galaxy-star { width: 48px; height: 48px; }
	.galaxy-submenu {
		position: fixed; left: 0 !important; right: 0; top: auto !important; bottom: 0;
		transform: none;
		width: auto; min-width: 0; max-width: none;
		max-height: 85vh;
		max-height: 85dvh;
		overflow-y: auto; overscroll-behavior: contain;
		border-radius: 18px 18px 0 0;
		border-left: 0; border-right: 0; border-bottom: 0;
		padding: 8px 14px calc(14px + env(safe-area-inset-bottom));
		box-shadow: 0 -16px 50px rgba(0,0,0,0.5);
		z-index: var(--z-drawer);
	}
	.galaxy-submenu::before {
		content: ""; flex: none; align-self: center;
		width: 40px; height: 4px; margin: 2px auto 8px;
		border-radius: 999px; background: var(--panel-border-strong);
	}
	.galaxy-submenu-group { margin-top: 8px; padding-top: 8px; }
	.galaxy-submenu-title { padding: 4px 8px 6px; }
	.galaxy-submenu-item { min-height: 44px; padding: 8px 10px; font-size: 13px; white-space: normal; }
	.galaxy-submenu-item svg { width: 16px; height: 16px; }
	#galaxy_form { gap: 10px; }
	#galaxy_form .flex.items-center { gap: 8px; }
	#galaxy_form button[type="submit"] { min-height: 44px; min-width: 44px; }
}

.hover\:bg-\[var\(--danger\)\]:hover { background: var(--danger); }
.hover\:text-white:hover { color: #fff; }
/* [P1-3 auditoria] Utilidades ausentes del build estatico de tailwind.css: los 4
   botones de acento (confirmar mensajes, escribir, atacar del espionaje) se quedaban
   SIN fondo y con el color de texto heredado (~2.4:1) porque el build es anterior a
   esas clases en las plantillas. Patron MIGRACION.md: sin build runtime, las
   utilidades que faltan se anaden aqui. */
.bg-\[var\(--accent\)\] { background-color: var(--accent); }
.text-\[var\(--accent-contrast\)\] { color: var(--accent-contrast); }
.hover\:bg-\[var\(--accent-hover\)\]:hover { background-color: var(--accent-hover); }
.border-\[var\(--gold\)\] { border-color: var(--gold); }
.border-l-\[var\(--accent\)\] { border-left-color: var(--accent); }
.bg-\[var\(--panel-nav\)\] { background-color: var(--panel-nav); }
.bg-\[var\(--success-strong\)\] { background-color: var(--success-strong); }
.bg-\[var\(--accent-hover\)\] { background-color: var(--accent-hover); }
.text-\[var\(--accent\)\] { color: var(--accent); }
.text-\[var\(--text-link-hover\)\] { color: var(--text-link-hover); }
.hover\:bg-\[var\(--accent\)\]:hover { background-color: var(--accent); }
.hover\:text-\[var\(--text\)\]:hover { color: var(--text); }
.hover\:text-\[var\(--gold\)\]:hover { color: var(--gold); }
.hover\:text-\[var\(--text-link\)\]:hover { color: var(--text-link); }
.hover\:text-\[var\(--warning\)\]:hover { color: var(--warning); }
.hover\:border-\[var\(--gold\)\]:hover { border-color: var(--gold); }
.hover\:border-\[var\(--warning\)\]:hover { border-color: var(--warning); }
.hover\:border-\[var\(--danger\)\]:hover { border-color: var(--danger); }
.hover\:border-\[var\(--danger-strong\)\]:hover { border-color: var(--danger-strong); }
.hover\:border-\[var\(--accent-hover\)\]:hover { border-color: var(--accent-hover); }
.focus\:border-\[var\(--danger\)\]:focus { border-color: var(--danger); }
/* [P1-3 auditoria] lg:pb de layout.full.tpl: sin ella el contenido completo
   conservaba pb-24 (96px) en escritorio en vez de volver al padding base. */
@media (min-width: 1024px) {
	.lg\:pb-\[var\(--content-padding\)\] { padding-bottom: var(--content-padding); }
}

/* =========================================================================
   [5.8.0] Barra de recursos v2 (.resv2) — chips con micro-barra de capacidad,
   colapsables (botón + memoria), números tabulares y modo compacto automático.
   ========================================================================= */
.topnav__resources { min-width: 0; }
/* [5.8.0] override del legado (flex-basis:100% + wrap apilaban la barra en móvil) */
.topnav__resources { flex-wrap: nowrap !important; flex: 1 1 auto !important; flex-basis: 0% !important; min-width: 0 !important; }
/* chips: encogen de verdad (contenido recortable) */
.resv2 { min-width: 0 !important; }
.resv2 {
	position: relative; display: flex; align-items: center; gap: 6px;
	min-width: 0; flex: 0 1 auto; overflow: hidden;
	padding: 4px 8px 6px; border-radius: 10px;
	background: var(--input-bg); border: 1px solid var(--panel-border);
}
.resv2 + .resv2 { margin-left: 2px; }
.resv2__icon { width: 24px; height: 24px; flex-shrink: 0; object-fit: contain; }
.resv2__body { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.resv2__value {
	font-size: clamp(10px, 2.6vw, 13px);
	font-variant-numeric: tabular-nums;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	max-width: 96px;
}
.resv2__max { font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* micro-barra de capacidad */
.resv2__bar {
	position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
	background: rgba(120, 140, 200, 0.15);
}
.resv2-bar-fill { height: 100%; width: 0; border-radius: 0 2px 2px 0; background: var(--accent-gradient); transition: width 0.8s linear; }
/* estados de llenado */
.resv2[data-fill="warn"] { border-color: var(--warning); }
.resv2[data-fill="warn"] .resv2-bar-fill { background: var(--warning); }
.resv2[data-fill="full"] .resv2-bar-fill { background: var(--success); }
.resv2 .res_current_warn { color: var(--warning); }
.resv2 .res_current_max { color: var(--success-strong); }
/* energía: balance (sin barra) con color según signo */
.resv2--energy .resv2__value.max { color: var(--danger-strong); }
/* MO: destacada en dorado */
.resv2--dm { border-color: rgba(255, 200, 72, 0.35); }
.resv2--dm .resv2__value { color: var(--gold); }

/* Botón de colapso: iconos según estado */
#resbarToggle .resbar-toggle-closed { display: none; }
html.resbar-collapsed #resbarToggle .resbar-toggle-open { display: none; }
html.resbar-collapsed #resbarToggle .resbar-toggle-closed { display: block; }

/* --- Modo compacto (colapsado o pantallas estrechas) --- */
html.resbar-collapsed .resv2 { padding: 4px 6px; gap: 4px; }
html.resbar-collapsed .resv2__max, html.resbar-collapsed .resv2__bar { display: none; }
html.resbar-collapsed .resv2__value { max-width: 58px; font-size: 11px; }

/* Auto-compacto en pantallas estrechas (salvo expansión manual reciente) */
@media (max-width: 640px) {
	.resv2 { padding: 4px; gap: 0; flex: 0 0 auto; }
	.resv2__icon { width: 31px; height: 31px; max-width: none; }
	.topnav__resources { overflow-x: auto; overflow-y: hidden; }
	/* colapsado = solo icono: oculta cuerpo (valor+max) y barra */
	html.resbar-collapsed .resv2__body,
	html.resbar-collapsed .resv2__bar { display: none; }
	/* expandido = muestra todo */
	html:not(.resbar-collapsed) .resv2__body { display: flex; }
	html:not(.resbar-collapsed) .resv2__bar { display: block; }
	html:not(.resbar-collapsed) .resv2__max { display: block; font-size: 9px; }
	html:not(.resbar-collapsed) .resv2__value { max-width: 70px; font-size: 11px; }
}
@media (max-width: 380px) {
	.resv2 { padding: 3px 5px; }
	.resv2__value { max-width: 52px; }
}

/* [5.6.1] Gradientes como imagen de fondo: el build estático de Tailwind generó
   `background-color: var(--*-gradient)` (inválido: un gradient no es un color),
   dejando estos botones sin fondo. Se redefine con background-image. */
.bg-\[var\(--accent-gradient\)\] { background-image: var(--accent-gradient); }
.hover\:bg-\[var\(--accent-gradient-hover\)\]:hover { background-image: var(--accent-gradient-hover); }
.bg-\[var\(--gold-gradient\)\] { background-image: var(--gold-gradient); }

/* [ola 6 P3-4/P4-5] Utilidades tokenizadas ausentes del build estatico (mismo
   patron que los overrides de gradiente de arriba): paso tipografico minimo
   para chips/badges/slots y texto sobre fondos dorados (--gold-contrast). */
.text-2xs { font-size: var(--font-size-2xs); line-height: 1.35; }
.text-gold-contrast { color: var(--gold-contrast); }

/* [5.6.9] Utilidades responsive ausentes del build estático de Tailwind
   (selects con width:100% global se comían la fila en desktop) */
@media (min-width: 640px) {
	.sm\:w-auto { width: auto; }
	.sm\:max-w-\[200px\] { max-width: 200px; }
}

/* === Sección admin de Bots (acoplada al estilo del juego) === */
.bot-wrap {
	max-width: 1100px; margin: 0 auto;
	/* El admin no define las variables de tema del juego; las fijamos aquí
	   para que la sección de bots mantenga el mismo look que el juego. */
	--panel: rgba(22, 28, 48, 0.92);
	--panel-border: rgba(120, 140, 200, 0.18);
	--panel-border-strong: rgba(140, 160, 220, 0.35);
	--input-bg: rgba(8, 12, 26, 0.6);
	--text: #d8dcea;
	--text-muted: #7986a6;
	--accent: #3a8ee6;
	--danger: #ef5d6e;
	--panel-radius: 12px;
}
.bot-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.bot-nav button, .bot-btn {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 8px 14px; border-radius: 8px; font-size: 13px; cursor: pointer;
	border: 1px solid var(--panel-border); background: var(--input-bg); color: var(--text);
	transition: border-color .15s, opacity .15s;
}
.bot-nav button:hover, .bot-btn:hover { border-color: var(--accent); }
.bot-btn--primary { background: var(--accent); color: #fff; border-color: transparent; }
.bot-btn--primary:hover { opacity: .9; }
.bot-btn--danger { background: var(--danger); color: #fff; border-color: transparent; }
.bot-btn--danger:hover { opacity: .9; }

.bot-section-title { font-size: 20px; font-weight: 600; color: var(--text); margin: 0 0 12px; }
.bot-intro { font-size: 13px; color: var(--text-muted); margin: 0 0 16px; line-height: 1.5; }

.bot-card {
	background: var(--panel); border: 1px solid var(--panel-border);
	border-radius: var(--panel-radius); padding: 16px; margin-bottom: 16px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}
.bot-card > h3 { margin: 0 0 12px; font-size: 16px; font-weight: 600; color: var(--text); }

.bot-field { margin-bottom: 12px; max-width: 360px; }
.bot-field > label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.bot-field input[type=number], .bot-field input[type=text], .bot-field select {
	width: 100%; padding: 8px 10px; border-radius: 6px; font-size: 14px;
	border: 1px solid var(--panel-border); background: var(--input-bg); color: var(--text);
}
.bot-field input:focus, .bot-field select:focus { outline: none; border-color: var(--accent); }
.bot-help { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.bot-table { width: 100%; border-collapse: collapse; margin: 8px 0 4px; font-size: 13px; }
.bot-table th, .bot-table td { padding: 6px 10px; border: 1px solid var(--panel-border); text-align: left; color: var(--text); }
.bot-table thead th { background: var(--input-bg); font-weight: 600; }
.bot-table tbody tr:nth-child(odd) td { background: rgba(255, 255, 255, .02); }
#bottable { width: 100%; border-collapse: collapse; font-size: 12px; }
#bottable th, #bottable td { padding: 5px 8px; border: 1px solid var(--panel-border); text-align: left; color: var(--text); }
#bottable thead th { background: var(--input-bg); cursor: pointer; position: sticky; top: 0; }
#bottable tbody tr:nth-child(odd) td { background: rgba(255, 255, 255, .02); }
.bot-note { font-size: 12px; color: var(--text-muted); margin: 8px 0; line-height: 1.4; }
hr.bot-sep { border: 0; border-top: 1px solid var(--panel-border); margin: 16px 0; }
.bot-select { padding: 8px 10px; border-radius: 6px; font-size: 14px; border: 1px solid var(--panel-border); background: var(--input-bg); color: var(--text); margin-top: 4px; }
.bot-inline { width: 110px; padding: 8px 10px; border-radius: 6px; font-size: 14px; border: 1px solid var(--panel-border); background: var(--input-bg); color: var(--text); margin-right: 6px; }
.bot-inline-label { font-size: 13px; color: var(--text-muted); margin: 0 4px 0 10px; }
.bot-factor { width: 90px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--panel-border); background: var(--input-bg); color: var(--text); }
#bottable input[type=number] { width: 56px; padding: 3px 5px; border-radius: 5px; border: 1px solid var(--panel-border); background: var(--input-bg); color: var(--text); }

/* =========================================================================
   [6.3.1] Badge de raza en el hero del overview (arriba-derecha).
   Clase propia: las utilidades tailwind (z-10, backdrop-blur-md, right-4...)
   no existen en el build estatico y el badge quedaba bajo los overlays.
   ========================================================================= */
.race-badge {
	position: absolute;
	top: 16px; right: 16px;
	z-index: 30;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: 9999px;
	border: 1px solid var(--gold);
	background: rgba(10, 14, 30, 0.85);
	color: var(--gold);
	font-size: 12px;
	font-weight: 700;
	text-decoration: none;
	backdrop-filter: blur(8px);
	transition: transform .15s ease, border-color .15s ease, filter .15s ease;
}
.race-badge:hover { transform: scale(1.05); filter: brightness(1.15); text-decoration: none; }
.race-badge img { width: 16px; height: 16px; border-radius: 9999px; object-fit: cover; }
.race-badge svg { width: 14px; height: 14px; flex-shrink: 0; }
.race-badge--empty { border-style: dashed; border-color: var(--warning); background: rgba(10, 14, 30, 0.85); color: var(--warning); }

/* === [6.6.1] Alarma de ataque entrante === */
.attack-alarm-overlay { position: fixed; inset: 0; pointer-events: none; z-index: var(--z-alarm); box-shadow: inset 0 0 140px 30px rgba(200, 16, 16, .55); animation: attackPulse 2.2s ease-in-out infinite; }
@keyframes attackPulse { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }
.attack-alarm-bar { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: calc(var(--z-alarm) + 1); display: flex; align-items: center; gap: .5rem; margin-top: 8px; padding: .45rem .9rem; border-radius: 9999px; background: rgba(140, 8, 8, .92); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em; box-shadow: 0 4px 18px rgba(200, 16, 16, .45); pointer-events: none; white-space: nowrap; }
.attack-alarm-icon { font-size: 14px; line-height: 1; animation: attackIconBlink 1s steps(2, start) infinite; }
@keyframes attackIconBlink { 50% { opacity: .25; } }
@media (max-width: 640px) { .attack-alarm-bar { font-size: 11px; padding: .35rem .6rem; max-width: 94vw; white-space: normal; text-align: center; } }
/* === [6.6.1] Variante espionaje (naranja, mas suave) === */
.attack-alarm-overlay--spy { box-shadow: inset 0 0 120px 25px rgba(255, 140, 0, .40); animation: attackPulse 3.2s ease-in-out infinite; }
.attack-alarm-bar--spy { background: rgba(150, 80, 0, .92); box-shadow: 0 4px 18px rgba(255, 140, 0, .35); }

/* === [6.6.1] line-clamp-3 (no venia en el build de Tailwind) + descripcion info centrada === */
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.info-desc-text { text-align: center; }

/* === [7.1] Recursos del topnav SIEMPRE visibles en movil: propia fila
   scrollable con formato compacto. Especificidad mayor que las utilidades
   de Tailwind (min-w-0/flex-1/flex) que aplastaban la barra a 0. === */
@media (max-width: 900px) {
	nav.topnav .topnav__inner { flex-wrap: wrap !important; }
	nav.topnav .topnav__resources { order: 10 !important; flex: 0 0 100% !important; min-width: 100% !important; overflow-x: auto; scrollbar-width: none; }
	nav.topnav .topnav__resources::-webkit-scrollbar { display: none; }
	nav.topnav .topnav__resources .resv2 { min-width: 72px; }
	nav.topnav .topnav__resources .resv2__max { display: none; }
}

/* === [Ola 8.1] Galaxia movil: wrapper en bloque (el span inline generaba
   huecos) y buscador compacto en una sola fila (GALAXIA/SISTEMA/Mostrar). === */
#galaxy_table_wrapper { display: block; }
@media (max-width: 640px) {
	#galaxy_form { flex-wrap: wrap; row-gap: 0.45rem; justify-content: center; }
	#galaxy_form input[name="galaxy"],
	#galaxy_form input[name="system"] { width: 3.5rem; padding-top: 0.4rem; padding-bottom: 0.4rem; }
	#galaxy_form button[type="submit"] { min-width: 0; }
	#galaxy_form > button[type="submit"] { flex: 1 1 100%; min-height: 38px; padding: 0.45rem 0.75rem; }
	#galaxy_form .text-2xs { display: none; }
}

/* === [Ola 8.2] Galaxia movil: la orbita se colapsa y se presenta una LISTA
   por posicion (misma info, sin solapes). El bottom-sheet de opciones sigue
   funcionando: su contenedor (.galaxy-stage) NO se oculta, solo se aplana. === */
@media (max-width: 640px) {
	.galaxy-stage {
		aspect-ratio: auto;
		height: auto;
		border-radius: 20px;
		padding: 10px;
		min-height: 0;
	}
	.galaxy-ring, .galaxy-star, .galaxy-slot, .galaxy-nebula, .galaxy-slot-num,
	.galaxy-stage::before { display: none !important; }
	.galaxy-star { display: none !important; }
}
.gml { display: none; }
@media (max-width: 640px) {
	.gml { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
	.gml-row {
		display: flex; align-items: center; gap: 10px;
		min-height: 52px; padding: 6px 10px;
		border: 1px solid var(--panel-border); border-radius: 12px;
		background: var(--panel-solid); cursor: pointer;
		transition: border-color var(--transition-fast);
	}
	.gml-row:active { border-color: var(--accent); }
	.gml-row--empty { opacity: 0.65; }
	.gml-row img.gml-thumb, .gml-thumb { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
	.gml-num { font-weight: 700; font-size: var(--font-size-sm); color: var(--text-strong); min-width: 20px; text-align: center; }
	.gml-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 600; }
	.gml-badges { display: flex; align-items: center; gap: 4px; }
	.gml-badges img { width: 16px; height: 16px; }
	.gml-chev { color: var(--text-muted); flex-shrink: 0; }
}

/* === [Ola 8.3] Recursos mÃ³viles: swipe con el dedo + pista visual.
   Chips compactos, momentum tÃ¡ctil, flecha/difuminado en el borde derecho
   que desaparece al llegar al final (clase is-scroll-end vÃ­a topnav.js). === */
@media (max-width: 900px) {
	.topnav__resources {
		touch-action: pan-x;
		-webkit-overflow-scrolling: touch;
		padding-right: 26px;
		user-select: none;
	}
	.topnav__resources .resv2 { min-width: 88px; padding: 3px 8px; gap: 6px; }
	.topnav__resources .resv2__value { font-size: 12px; white-space: nowrap; }
	.topnav__resources::after {
		content: "â€º";
		position: absolute;
		right: 0; top: 50%;
		transform: translateY(-50%);
		height: 100%;
		display: flex; align-items: center;
		padding: 0 4px 0 16px;
		font-size: 15px; font-weight: 700;
		color: var(--text-muted);
		background: linear-gradient(90deg, transparent, var(--panel-nav) 55%);
		pointer-events: none;
		transition: opacity var(--transition-fast);
		opacity: 0;
	}
	/* la flecha solo aparece cuando la fila desborda de verdad */
	.topnav__resources.is-scrollable::after { opacity: 1; }
	.topnav__resources.is-scrollable.is-scroll-end::after { opacity: 0; }
}

/* === [Ola 8.3] PC: cursor de arrastre en la fila de recursos === */
@media (min-width: 641px) {
	#resourceWrapper { cursor: grab; }
	#resourceWrapper.is-dragging { cursor: grabbing; user-select: none; }
	#resourceWrapper.is-dragging * { pointer-events: none; }
}

/* === [8.6] Badge de raza en mÃ³vil: entra en el flujo de la ficha === */
/* position:absolute (flotado sobre la ficha) pisa al chip del hÃ©roe activo y al menÃº â‹¯ a 375px */
@media (max-width: 640px) {
	.race-badge,
	.race-badge--empty {
		position: static;
	}
}
