/* ==========================================================================
   SOLAR NEBULA PRO — UNIFIED CORE CSS (KxT + Kard + Splash)
   ========================================================================== */

/* =========================
   1. VARIABLES (ROOT)
========================= */
:root {
  /* KxT Core Base */
  --bg-deep: #050811; 
  --bg-day: radial-gradient(circle at 30% 20%, #ffffff 0%, #f2f8ff 18%, #d0e9ff 40%, #9ed0ff 65%, #6bb9ff 85%, #59a8ff 100%);
  --bg-sunset: linear-gradient(180deg, #fbcfe8 0%, #fb923c 20%, #4c1d95 60%, #111827 100%);
  --bg-night: radial-gradient(circle at 20% 0%, #0b1020 0%, #121c3b 40%, #1a237e 80%, #000000 100%);
  --bg-panel: rgba(10, 14, 24, 0.95);
  --primary: #00f5ff;
  --secondary: #ff4bff;
  --text-main: #e4ecff;
  --text-muted: #9aa4c8;
  --danger: #ff4b6b;
  --glass: blur(20px) saturate(180%);

  /* KxT Typo/Cards Extension */
  --txt-card: color-mix(in oklab, var(--bg-panel, #0e1220) 92%, black);
  --txt-bd: color-mix(in oklab, var(--ink, #e8ecf6) 16%, transparent);
  --txt-shadow: 0 6px 24px rgba(0,0,0,.25), inset 0 0 0 1px var(--txt-bd);
  --chip-bg: linear-gradient(42deg, var(--grad-a, #7effa1), var(--grad-b, #67e6ff));
  --chip-ink: #000;
  --paren-ink: color-mix(in oklab, var(--ink, #e8ecf6) 92%, white);

  /* Kard Nebula Additions */
  --bg-gradient: linear-gradient(180deg, #000, #111);
  --bg: var(--bg-gradient);
  --text: #d7d7d7;
  --neon-cyan: #00f2ff;
  --neon-purple: #bd00ff;
  --neon-gold: #ffd700;
  --neon-danger: #ff2a6d;
  --neon-success: #00ff9d;
  --font-ui: 'Montserrat', sans-serif;
  --font-code: 'JetBrains Mono', monospace;
  --glass-surface: rgba(18,18,22,0.65);
  --glass-border: rgba(255,255,255,0.06);
  --ease-overshoot: cubic-bezier(0.34, 1.3, 0.64, 1);
  --ease-smooth: cubic-bezier(0.23, 1, 0.32, 1);
}

/* =========================
   2. RESET & BASE
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  user-select: none; /* Baseado no Kard, previne seleção acidental na UI */
}

html, body {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-ui);
  overflow: hidden; /* Ajustado para 100vh fixo, conteineres internos devem rolar */
  transition: background 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
   display: flex;
      flex-direction: column;
      align-items: center;
}

/* Permite seleção de texto apenas onde necessário */
.cyber-input, input, textarea, .msg-block, pre, code, .flow-text {
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* Splash Mode Body Wrapper (Caso precise da centralização exata do splash) */
body.splash-mode {
  background: linear-gradient(to bottom, #000000, #1a1a1a);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  animation: fadeInBodyX 2s ease forwards;
}

/* =========================
   3. THEMES (SOLAR MODES)
========================= */
body.mode-day { background: var(--bg-day) !important; color: #1a1a1a !important; }
body.mode-sunset { background: var(--bg-sunset) !important; color: #fff !important; }
body.mode-night { background: var(--bg-night) !important; color: var(--text-main) !important; }

/* Day Mode UI Adaptation */
body.mode-day .msg-block.ai { background: rgba(0,0,0,0.05); color: #222; border-color: rgba(0,0,0,0.1); }
body.mode-day .glass-input { background: rgba(255,255,255,0.8); color: #000; border-color: #ccc; }
body.mode-day .btn-icon { color: #333; border-color: rgba(0,0,0,0.2); }
body.mode-day .cockpit-item, body.mode-day .deck-item { background: rgba(0,0,0,0.05); color: #000; }
body.mode-day .cockpit-input { color: #000; border-bottom-color: rgba(0,0,0,0.3); }
body.mode-day .drawer-content { background: #fff; color: #222; }
body.mode-day .sun-background { opacity: 0.5; }
body.mode-day #particles-js { opacity: 0.6; }
body.mode-day .input-dock { background: linear-gradient(to top, rgba(0,0,0,0.4) 8%, transparent); }
body.mode-day .glass-input:focus { background: white; }

/* =========================
   4. BACKGROUND & AMBIENCE
========================= */
.sky-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.sun-background { position: absolute; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fffde7 0%, #fff176 40%, #ffb300 100%); filter: blur(60px); opacity: 0; transition: opacity 2s; animation: sun-orbit 60s linear infinite; }
#particles-js { position: fixed; inset: 0; z-index: 0; opacity: 0.8; pointer-events: none; } /* KxT unificado com Splash */
#bg-fake-custom { position: fixed; inset: 0; z-index: 1;mix-blend-mode:lighten; opacity: 0.12; background-size: cover; background-position: center; pointer-events: none; }

.ambient-light { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.14; animation: float 25s infinite alternate ease-in-out; }
.blob-1 { width: 60vw; height: 60vw; background: var(--neon-cyan); top: -20%; left: -20%; }
.blob-2 { width: 50vw; height: 50vw; background: var(--neon-purple); bottom: -20%; right: -20%; animation-delay: -5s; }

/* =========================
   5. KxT CORE UI (Chat & Layout)
========================= */
.header-orb { position: fixed; top: 40px; left: 50%; transform: translateX(-50%); width: 70px; height: 70px; z-index: 15; animation: floatOrb 6s ease-in-out infinite; cursor: pointer; transition: all 0.5s ease; }
.header-orb svg { width: 100%; height: 100%; transition: fill 0.5s ease; filter: drop-shadow(0 0 10px rgba(0,245,255,0.5)); }
body.mode-day .header-orb svg { fill: #fff176; filter: drop-shadow(0 0 20px #ffb300); }
body.mode-sunset .header-orb svg { fill: #ffb74d; filter: drop-shadow(0 0 30px #e65100); }
body.mode-night .header-orb svg { fill: white; filter: drop-shadow(0 0 15px var(--primary)); }

#usernameDisplay { position: fixed; top: 120px; left: 50%; transform: translateX(-50%); z-index: 10; font-size: 0.75rem; color: var(--text-muted); opacity: 0.6; pointer-events: none; text-transform: uppercase; letter-spacing: 2px; }
#modeIndicator { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); font-size: 0.65rem; font-weight: bold; opacity: 0.5; z-index: 20; text-transform: uppercase; letter-spacing: 1px; }

.top-bar { position: fixed; top: 0; left: 0; right: 0; padding: 15px; display: flex; justify-content: space-between; z-index: 20; pointer-events: none; }
.top-grp { display: flex; gap: 10px; pointer-events: auto; }

#chat-container { position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 140px 16px 100px 16px; z-index: 5; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 16px; transition: opacity 0.4s ease; scroll-behavior: smooth; }
#chat-container.collapsed { opacity: 0; pointer-events: none; }

.msg-block { max-width: 88%; padding: 12px 16px; border-radius: 12px; position: relative; animation: slideIn 0.3s ease-out; line-height: 1.5; font-size: 0.95rem; word-wrap: break-word; }
.msg-block.user { align-self: flex-end; background: rgba(0,245,255,0.08); border-right: 2px solid var(--primary); text-align: right; }
.msg-block.ai { align-self: flex-start; background: rgba(255,255,255,0.05); border-left: 2px solid var(--secondary); }
.msg-block.system { align-self: center; font-size: 0.75rem; opacity: 0.8; text-align: center; border: 1px dashed rgba(255,255,255,0.2); background: transparent; padding: 6px 12px; font-style: italic; }

pre { position: relative; background: rgba(0,0,0,0.4); border-radius: 8px; margin: 10px 0; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); }
code { font-family: var(--font-code); font-size: 0.85rem; }
.copy-code-btn { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: var(--primary); font-size: 0.7rem; padding: 4px 8px; border-radius: 4px; cursor: pointer; z-index: 10; opacity: 0.7; transition: 0.2s; }
.copy-code-btn:hover { opacity: 1; background: var(--primary); color: #000; }

.file-msg { border-left: 3px solid var(--secondary) !important; background: rgba(255,255,255,0.05); }
.file-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; font-size: 0.8rem; }
.file-meta { font-size: 0.7rem; color: var(--text-muted); }
.msg-tools { display: flex; gap: 10px; justify-content: flex-end; margin-top: 5px; opacity: 0.5; }
.msg-block.ai .msg-tools { justify-content: flex-start; }
.tool-btn { background: none; border: none; color: inherit; padding: 0; cursor: pointer; }
.tool-btn:hover { color: var(--primary); opacity: 1; }
.tool-btn svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }
.svg-icon { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }

/* Input Dock */
.input-dock { position: fixed; bottom: 0; left: 0; right: 0; padding: 16px; background: linear-gradient(to top, var(--bg-deep) 8%, transparent); z-index: 30; display: flex; flex-direction: column; align-items: center; }
#filePreview { display: none; width: 100%; max-width: 400px; background: rgba(0,0,0,0.8); border: 1px solid var(--primary); border-radius: 12px; padding: 10px; margin-bottom: 10px; align-items: center; justify-content: space-between; backdrop-filter: blur(10px); }
#filePreview.active { display: flex; animation: slideIn 0.3s; }
.file-info { font-size: 0.8rem; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.file-actions { display: flex; gap: 10px; }
.btn-preview { background: rgba(255,255,255,0.1); border: none; color: #fff; padding: 5px 10px; border-radius: 5px; cursor: pointer; font-size: 0.7rem; }
.btn-preview.primary { background: var(--primary); color: #000; }
#field-toggle-handle { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.8rem; opacity: 0.9; cursor: pointer; padding-bottom: 12px; text-transform: lowercase; letter-spacing: 1px; transition: 0.3s; }
#field-toggle-handle:hover { color: var(--primary); transform: scale(1.02); }
.footer-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); animation: pulsex 2s infinite; }
.input-row { display: flex; width: 100%; gap: 10px; align-items: center; max-width: 800px; }
.glass-input { flex: 1; background: rgba(255,255,255,0.1); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.2); color: inherit; padding: 14px 20px; border-radius: 99px; outline: none; transition: 0.3s; }
.glass-input:focus { background: rgba(0,0,0,0.5); border-color: var(--primary); box-shadow: 0 0 15px rgba(0,245,255,0.2); }
.btn-icon { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05); color: inherit; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; backdrop-filter: blur(5px); }
.btn-icon:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); border-color: var(--primary); }
.btn-icon svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; }
.btn-primary { background: var(--primary); color: #000 !important; border: none; box-shadow: 0 0 10px rgba(0, 245, 255, 0.4); }
#btnVoice.listening { background: var(--danger); box-shadow: 0 0 15px var(--danger); animation: pulsex 1s infinite; color: white !important; }

body.field-closed .input-row { z-index: 0; opacity: 0; pointer-events: none; transform: translateY(20px); transition: opacity 0.3s ease, transform 0.3s ease, z-index 0s linear 0.3s; }
body:not(.field-closed) .input-row { opacity: 1; pointer-events: auto; transform: translateY(0); }
body.field-closed .input-dock { pointer-events: none; }
body.field-closed #field-toggle-handle { pointer-events: auto; }

/* Drawers & Cockpit */
.drawer { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px); z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.3s; display: flex; align-items: center; justify-content: center; }
.drawer.open { opacity: 1; pointer-events: auto; }
.drawer-content { width: 90%; max-width: 450px; max-height: 85vh; background: var(--bg-panel); border: 1px solid rgba(255,255,255,0.1); border-radius: 20px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.5); transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.drawer.open .drawer-content { transform: scale(1); }
.drawer-header { padding: 15px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.02); }
.drawer-header h3 { margin: 0; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }

.cockpit-grid { display: flex; flex-direction: column; gap: 15px; }
.cockpit-item { background: rgba(255,255,255,0.03); padding: 10px 15px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05); display: flex; flex-direction: column; }
.cockpit-label { font-size: 0.7rem; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 5px; }
.cockpit-input { background: transparent; border: none; color: white; font-family: var(--font-code); font-size: 1rem; outline: none; width: 100%; border-bottom: 1px dashed rgba(255,255,255,0.1); padding-bottom: 5px; transition: 0.3s; }
.cockpit-input:focus { border-bottom-color: var(--secondary); }
.control-row { display: flex; gap: 10px; margin-top: 20px; }
.btn-block { flex: 1; padding: 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05); color: inherit; cursor: pointer; font-size: 0.85rem; font-weight: 600; transition: 0.2s; }
.btn-block:hover { background: rgba(255,255,255,0.15); border-color: var(--primary); }

.deck-item { background: rgba(255,255,255,0.05); padding: 15px; border-radius: 10px; margin-bottom: 10px; border: 1px solid rgba(255,255,255,0.05); display: flex; justify-content: space-between; align-items: center; }
.deck-info h4 { margin: 0 0 5px 0; font-size: 0.9rem; }
.deck-info span { font-size: 0.7rem; opacity: 0.7; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 0.8rem; color: var(--text-muted); }
.glass-textarea { width: 100%; background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.2); color: inherit; padding: 10px; border-radius: 8px; min-height: 80px; }

/* Flow Texts & Cards (KxT Extension) */
.flow-text p { text-wrap: pretty; line-height: 1.65; letter-spacing: .01em; margin: .65rem 0; hyphens: auto; }
.flow-text .kv-head { font-weight: 800; letter-spacing: .02em; margin: 1.2rem 0 .4rem; }
.span-paren { padding: .05rem .35rem; border-radius: .55rem; border: 1px solid var(--txt-bd); color: var(--paren-ink); background: color-mix(in oklab, var(--txt-card) 86%, transparent); }
.chip, .chip-btn { display: inline-grid; place-items: center; padding: .25rem .6rem; border-radius: 999px; background: var(--chip-bg); color: var(--chip-ink); font-weight: 700; letter-spacing: .02em; box-shadow: 0 2px 10px rgba(0,0,0,.35); cursor: pointer; user-select: none; }
.chip + .chip { margin-left: .35rem; }
.q-card { background: var(--txt-card); border: 1px solid var(--txt-bd); box-shadow: var(--txt-shadow); border-radius: 14px; padding: .85rem 1rem; margin: .9rem 0; display: grid; grid-template-columns: auto 1fr; gap: .65rem; align-items: start; }
.q-card .q-ico { inline-size: 1.65rem; block-size: 1.65rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #000; background: var(--chip-bg); }
.q-card .q-body { line-height: 1.55; }
.list-card { position: relative; }
.list-card .copy-badge { position: absolute; top: .35rem; right: .35rem; font-size: .8rem; padding: .2rem .45rem; border-radius: 999px; background: color-mix(in oklab, #fff 12%, var(--txt-card)); border: 1px solid var(--txt-bd); color: var(--ink, #e8ecf6); opacity: .65; transition: .2s; user-select: none; }
.list-card:hover .copy-badge { opacity: 1; }
.raw-html-card { background: var(--txt-card); border: 1px dashed var(--txt-bd); border-radius: 14px; padding: .85rem 1rem; margin: .9rem 0; }
.raw-html-card .raw-note { color: color-mix(in oklab, var(--ink) 62%, transparent); font-size: .85em; margin-bottom: .35rem; }

/* HTML Viewer */
.html-viewer { margin-top: 10px; border: 1px solid rgba(255,255,255,0.2); border-radius: 10px; overflow: hidden; background: #000; display: flex; flex-direction: column; }
.html-viewer-bar { display: flex; background: rgba(255,255,255,0.1); padding: 8px; gap: 8px; position: sticky; top: 0; z-index: 10; }
.html-viewer-btn { background: transparent; border: none; color: var(--text-muted); padding: 6px 12px; font-size: 0.75rem; cursor: pointer; border-radius: 4px; transition: 0.2s; display: flex; align-items: center; gap: 6px; }
.html-viewer-btn.active { background: var(--primary); color: #000; font-weight: bold; }
.html-viewer-btn:hover:not(.active) { background: rgba(255,255,255,0.1); color: #fff; }
.html-viewer-content { position: relative; width: 100%; height: 450px; border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; overflow: hidden; }
.html-viewer.mobile .html-viewer-content { width: 100%; max-width: 390px; height: 844px; margin: 0 auto; background: #000; border: 12px solid #1a1a1a; border-radius: 28px; box-shadow: 0 20px 40px rgba(0,0,0,0.5); }
.html-viewer-content iframe { width: 100%; height: 100%; border: none; background: white; }
.html-viewer-code { display: none; width: 100%; height: 100%; overflow: auto; background: #1e1e1e; padding: 10px; }
.html-viewer.show-code .html-viewer-content iframe { display: none; }
.html-viewer.show-code .html-viewer-code { display: block; }
.html-viewer.fullscreen { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100vw; height: 100vh; z-index: 9999; background: #000; border-radius: 0; }
.html-viewer.fullscreen .html-viewer-content { height: calc(100vh - 48px); }
.mobile-toggle { margin-left: auto; display: flex; gap: 8px; }

/* =========================
   6. KARD FUSION UI
========================= */
#snap-zone { position: fixed; top: 0; left: 0; right: 0; height: 80px; background: linear-gradient(to bottom, rgba(0, 242, 255, 0.25), transparent); opacity: 0; pointer-events: none; transition: opacity 0.3s ease; z-index: 9000; box-shadow: 0 0 40px rgba(0, 242, 255, 0.1); }
#snap-zone.active { opacity: 1; }

.container { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; perspective: 1200px; z-index: 10; }
.fusion-card { pointer-events: auto; width: 100%; max-width: 440px; max-height: 78vh; overflow-y: auto; overflow-x: hidden; background: var(--glass-surface); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border: 1px solid var(--glass-border); border-radius: 36px; padding: 30px 25px; box-shadow: 0 40px 100px rgba(0,0,0,0.8); position: relative; opacity: 0; transform: translateY(50px) scale(0.96); display: flex; flex-direction: column; gap: 8px; transition: width 0.5s var(--ease-smooth), height 0.5s var(--ease-smooth), border-radius 0.5s var(--ease-smooth), opacity 0.4s, left 0.4s var(--ease-smooth), top 0.4s var(--ease-smooth), box-shadow 0.4s; will-change: transform, width, height, border-radius, left, top; touch-action: none; }
.fusion-card::-webkit-scrollbar { display: none; }
.fusion-card.active { opacity: 1; transform: translateY(0) scale(1); }
.fusion-card.closed { width: 260px; padding: 14px 16px; border-radius: 22px; }
.fusion-card.closed .card-body { display: none; }

/* ORB & HUD Modes */
.fusion-card.orb { position: fixed !important; width: 68px !important; height: 68px !important; padding: 0 !important; border-radius: 50% !important; align-items: center; justify-content: center; box-shadow: 0 15px 40px rgba(0,0,0,0.6), 0 0 20px rgba(0,242,255,0.2); z-index: 9999; cursor: grab; overflow: visible; }
.fusion-card.orb:active { cursor: grabbing; transform: scale(0.95); }
.fusion-card.orb .text-block, .fusion-card.orb .clock-widget, .fusion-card.orb .card-body, .fusion-card.orb .small-preview { display: none !important; }
.fusion-card.orb .card-header { margin: 0; width: 100%; height: 100%; justify-content: center; padding: 0; }
.fusion-card.orb .avatar-slot { width: 54px; height: 54px; border-radius: 50%; margin: 0; opacity: 1; pointer-events: none; }
.orb-menu-trigger { position: absolute; bottom: -30px; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.2); border-radius: 50%; display: none; align-items: center; justify-content: center; cursor: pointer; color: #fff; font-size: 12px; pointer-events: auto; backdrop-filter: blur(4px); }
.fusion-card.orb:hover .orb-menu-trigger { display: flex; }

.fusion-card.hud { position: fixed !important; top: 0 !important; left: 50% !important; transform: translateX(-50%) !important; width: 96% !important; max-width: 600px !important; height: 64px !important; padding: 0 16px !important; border-radius: 0 0 24px 24px !important; flex-direction: row; align-items: center; justify-content: space-between; box-shadow: 0 10px 40px rgba(0,0,0,0.7); z-index: 1; overflow: visible; border-top: none; opacity: 0.78; touch-action: none; }
.fusion-card.hud .card-body, .fusion-card.hud .small-preview { display: none !important; }
.fusion-card.hud .card-header { margin: 0; width: 100%; justify-content: space-between; }
.fusion-card.hud .avatar-slot { width: 40px; height: 40px; }
.fusion-card.hud .brand-dual { font-size: 1.2rem; margin: 0; }
.fusion-card.hud .greeting-row { display: none; }
.fusion-card.hud .text-block { flex: unset; }

.drag-handle { width: 60px; height: 5px; background: rgba(255,255,255,0.15); border-radius: 10px; position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: none; cursor: grab; pointer-events: none; transition: background 0.3s; }
.fusion-card.hud:active .drag-handle { background: var(--neon-cyan); width: 70px; }
.fusion-card.hud .drag-handle { display: block; }
.hud-menu-btn { display: none; background: transparent; border: none; color: rgba(255,255,255,0.6); cursor: pointer; }
.fusion-card.hud .hud-menu-btn { display: block; }

/* Fusion Card Inner Elements */
.card-header { display: flex; align-items: center; gap: 15px; margin-bottom: 18px; width: 100%; cursor: pointer; touch-action: none; }
.avatar-slot { width: 64px; height: 64px; border-radius: 18px; overflow: hidden; opacity: 0; transition: opacity 0.35s; }
.avatar-slot.shown { opacity: 1; }
.text-block { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.greeting-row { font-size: 1.5rem; line-height: 1; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.txt-thin { font-weight: 200; color: rgba(255,255,255,0.7); }
.txt-heavy { font-weight: 600; color: #fff; }
.brand-dual { font-size: 2.2rem; font-weight: 900; line-height: 0.95; text-transform: uppercase; letter-spacing: -2px; margin-top: 4px; background: linear-gradient(-45deg, #fff, var(--neon-cyan), var(--neon-purple), #fff); background-size: 300%; -webkit-background-clip: text; -webkit-text-fill-color: transparent; animation: gradientFlow 4s ease infinite; }
.clock-widget { text-align: right; }
.time-display { font-family: var(--font-code); font-size: 1rem; color: rgba(255,255,255,0.5); font-weight: 700; }
.status-led { font-size: 0.6rem; color: var(--neon-cyan); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; display: block; }

.small-preview { display: none; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.03); font-family: var(--font-code); font-size: 0.86rem; color: rgba(255,255,255,0.9); cursor: pointer; }
.small-preview .mini-avatar { width: 30px; height: 30px; border-radius: 6px; flex-shrink: 0; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; }
.small-preview .small-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 110px); }
.small-preview .ident-badge { margin-left: auto; font-weight: 700; font-size: 0.78rem; padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,0.03); color: rgba(255,255,255,0.9); border: 1px solid rgba(255,255,255,0.02); }
.fusion-card.closed:not(.orb):not(.hud) .small-preview { display: flex; }

.card-body { display: flex; flex-direction: column; gap: 12px; }
.stagger-item { opacity: 0; transform: translateY(15px); transition: opacity 0.4s ease, transform 0.4s var(--ease-overshoot); }
.content-visible .stagger-item { opacity: 1; transform: translateY(0); }
.content-visible .stagger-item:nth-child(1) { transition-delay: 0.1s; }
.content-visible .stagger-item:nth-child(2) { transition-delay: 0.18s; }
.content-visible .stagger-item:nth-child(3) { transition-delay: 0.25s; }

/* Kard Forms & Elements */
.cyber-input { width: 100%; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); border-radius: 16px; padding: 16px 50px 16px 18px; color: #fff; font-family: var(--font-code); font-size: 0.9rem; }
.activation-wrap { display: flex; flex-direction: column; gap: 8px; }
.activation-card { background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.04); padding: 12px; border-radius: 10px; overflow: hidden; transition: all 320ms var(--ease-smooth); }
.activation-pre { font-family: var(--font-code); white-space: pre-wrap; margin: 0; padding: 8px; background: rgba(0,0,0,0.12); border-radius: 8px; border: 1px dashed rgba(255,255,255,0.03); color: #fff; font-size: 0.75rem; }
.activation-hidden { max-height: 0; opacity: 0; padding: 0 12px; pointer-events: none; margin-top: 0; }
.activation-open { max-height: 567px; opacity: 1; padding: 12px; margin-top: 4px; }
.activation-toggle { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px; cursor: pointer; opacity: 0.9; transition: 0.2s; }
.activation-toggle:hover { opacity: 1; }
.trigger-btn { width: 100%; padding: 12px; border: 1px dashed rgba(255,255,255,0.1); border-radius: 12px; background: rgba(255,255,255,0.02); color: rgba(255,255,255,0.5); font-size: 0.75rem; letter-spacing: 2px; text-transform: uppercase; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 8px; transition: 0.2s; }
.trigger-btn:hover { background: rgba(255,255,255,0.04); color: #fff; border-color: rgba(255,255,255,0.3); }
.mode-btn { background: rgba(0,242,255,0.05); border-color: rgba(0,242,255,0.2); color: var(--neon-cyan); }
.mode-btn.active-mode { background: var(--neon-cyan); color: #000; box-shadow: 0 0 20px rgba(0,242,255,0.4); border-color: transparent; }

.section-title { font-size: 0.7rem; font-weight: 700; color: rgba(255,255,255,0.4); margin-bottom: 4px; text-transform: uppercase; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.form-row { display: flex; gap: 8px; }
.form-row input, .form-grid input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.08); background: #030406; color: #fff; font-family: var(--font-code); font-size: 0.85rem; }
.form-row input:focus, .form-grid input:focus { border-color: var(--neon-cyan); }
select.btn { width: 100%; padding: 8px; background: rgba(0,0,0,0.4); color: #fff; border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; }

/* Modals & Toasts (Kard & KxT) */
#nv-toast { position: fixed; bottom: 200px; left: 50%; transform: translateX(-50%) translateY(20px); background: rgba(0,0,0,0.8); color: #fff; padding: 10px 20px; border-radius: 50px; backdrop-filter: blur(10px); opacity: 0; transition: 0.4s; z-index: 9999; font-size: 0.8rem; pointer-events: none; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
#nv-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.toaster-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 99999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toaster { pointer-events: auto; background: linear-gradient(180deg, #0b1220, #071018); border: 1px solid rgba(255,255,255,0.06); padding: 10px 14px; border-radius: 10px; box-shadow: 0 18px 40px rgba(0,0,0,0.6); font-family: var(--font-ui); font-size: 0.95rem; opacity: 0; transform: translateY(8px); transition: all 260ms var(--ease-smooth); }
.toaster.show { opacity: 1; transform: translateY(0); }
.toaster.error { border-color: var(--neon-danger); color: var(--neon-danger); }
.toaster.success { border-color: var(--neon-success); color: var(--neon-success); }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.65); display: none; align-items: center; justify-content: center; z-index: 99998; backdrop-filter: blur(8px); }
.keys-card { width: 90%; max-width: 760px; background: linear-gradient(180deg, #071018, #0b1220); border: 1px solid rgba(255,255,255,0.08); padding: 20px; border-radius: 16px; color: #fff; box-shadow: 0 20px 50px rgba(0,0,0,0.8); max-height: 90vh; display: flex; flex-direction: column; }
.keys-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.key-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 6px; min-height: 100px; }
.key-item { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 10px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.02); }
.key-item.active-item { background: rgba(0, 242, 255, 0.05); border-color: rgba(0, 242, 255, 0.2); }
.small-btn { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1); padding: 6px 10px; border-radius: 8px; color: #fff; cursor: pointer; font-size: 0.75rem; text-transform: uppercase; font-weight: 600; transition: 0.2s; }
.small-btn:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); }
.small-btn.active-btn { background: var(--neon-success); color: #000; border: none; }
.danger { color: var(--neon-danger); border-color: rgba(255,42,109,0.3); }
.vault-icon { width: 50px; height: 50px; margin: 0 auto 15px; color: var(--neon-purple); background: rgba(189,0,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
#vaultModal .keys-card { max-width: 400px; text-align: center; }

/* =========================
   7. SPLASH SCREEN UI
========================= */
.logo-container { position: relative; z-index: 1; width: 300px; max-width: 80%; animation: glow 3s ease-in-out infinite alternate; padding: 20px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 1.2s ease, opacity 1.2s ease; }
.logo-container object { width: 100%; height: auto; display: block; }
.logo-container.distort { filter: url(#distort); }
.logo-container {margin-top: 18vh;}

.infodose { margin-top: 25px; font-size: 2em; color: #ccc; opacity: 0; animation: fadeInX 2s forwards 2s, pulse 4s infinite ease-in-out 4s; z-index: 1; position: relative; }
.infodose strong { font-weight: 700; color: #ffffff; }

.frase { position: absolute; bottom: 60px; font-size: 1.2em; color: #999; opacity: 0; animation: fadeIn 2s forwards 3s; z-index: 1; padding: 0 20px; width: 100%; text-align: center; }
.frase strong { font-weight: 700; color: #ffffff; }

.explosion { position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-radius: 50%; background: radial-gradient(circle, white, transparent); transform: translate(-50%, -50%); z-index: 999; opacity: 0.8; animation: explode 1s forwards ease-out; }

/* =========================
   8. KEYFRAMES & ANIMATIONS
========================= */
@keyframes sun-orbit { 0% { transform: translate(-20vw, 10vh); } 50% { transform: translate(80vw, -10vh); } 100% { transform: translate(-20vw, 10vh); } }
@keyframes floatOrb { 0%, 100% { transform: translate(-50%, 0) } 50% { transform: translate(-50%, -8px) } }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: translateY(0) } }
@keyframes float { 0% { transform: translate(0, 0) } 100% { transform: translate(40px, 60px) } }
@keyframes gradientFlow { 0% { background-position: 0% 50% } 50% { background-position: 100% 50% } 100% { background-position: 0% 50% } }
@keyframes pulsex { 50% { opacity: .4; box-shadow: 0 0 9px currentColor; } }
@keyframes glow { from { filter: drop-shadow(0 0 10px #00ffff) drop-shadow(0 0 20px #ff00ff); } to { filter: drop-shadow(0 0 25px #00ffff) drop-shadow(0 0 35px #ff00ff); } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes fadeInX { to { opacity: 1; } }
@keyframes fadeInBodyX { to { opacity: 1; } }
@keyframes fadeOutBodyX { to { opacity: 0; } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes explode { 0% { width: 0; height: 0; opacity: 0.8; } 70% { width: 600vw; height: 600vw; opacity: 1; } 100% { opacity: 0; } }

/* =========================
   9. MEDIA QUERIES
========================= */
@media (max-width: 768px) {
  .infodose { font-size: 1.5em; }
  .frase { font-size: 1em; bottom: 66px; }
  .logo-container { width: 220px; }
}
@media (max-width: 600px) {
  .keys-card { padding: 15px; }
  .form-grid { grid-template-columns: 1fr; }
}
