/* GLOBAL RESET & FONTS */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  -webkit-text-size-adjust: 100%;
}

button {
  all: unset;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

body {
    background-color: #050505;
    background-image: 
        radial-gradient(circle at top right, rgba(30, 30, 40, 0.8), transparent 40%),
        radial-gradient(circle at bottom left, rgba(20, 20, 25, 0.8), transparent 40%),
        repeating-linear-gradient(45deg, rgba(255,255,255,0.015) 0, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 10px);
    color: #ffffff;
    font-family: 'Inter', sans-serif;

    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    touch-action: pan-y;
}

:root {
  --gold: #D4AF37;
  --gold-glow: rgba(212, 175, 55, 0.6);
  --error: #ff4a4a;
  --success: #4ade80;
  --panel-bg: rgba(15, 15, 15, 0.5);
  --panel-border: rgba(255, 255, 255, 0.05);
}

/* CONTAINER */
.container {
  padding: 15px;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 90px;
}

/* HEADER EXACT */
.top-center-header {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin-top: env(safe-area-inset-top, 20px); margin-bottom: 25px;
}
.top-center-header img { width: 25px; margin-bottom: 5px; opacity: 0.9; }
.top-center-header span { color: #fff; font-size: 14px; font-weight: 700; letter-spacing: 2px; }

.title-row-exact { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; padding: 0 5px; }
.title-row-exact h2 { color: #fff; font-size: 16px; font-weight: 700; text-shadow: 0 0 10px rgba(255,255,255,0.2); }
.badge-exact { color: #fff; text-align: center; font-size: 10px; font-weight: 700; line-height: 1.2; text-shadow: 0 0 5px rgba(255,255,255,0.5); }

/* MIRROR BOX */
.mirror-box {
  background: #080808;
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 20px;
  aspect-ratio: 16/10;
  position: relative;
  margin-bottom: 15px;
  box-shadow: 0 0 15px rgba(212,175,55,0.1);
  overflow: hidden;
}
canvas { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0 10px var(--gold)); }
.mirror-time-top { position: absolute; top: 12px; left: 15px; color: #aaa; font-size: 10px; font-weight: 700; z-index: 10; }
.mirror-time-bottom { position: absolute; bottom: 12px; right: 15px; color: #aaa; font-size: 10px; font-weight: 700; z-index: 10; }

.ocr-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85); display: none; justify-content: center; align-items: center;
  color: var(--gold); font-size: 18px; font-weight: 700; letter-spacing: 4px; z-index: 50;
  animation: pulseComputing 1.5s infinite;
}
@keyframes pulseComputing { 0% { opacity: 0.5; } 50% { opacity: 1; text-shadow: 0 0 10px var(--gold); } 100% { opacity: 0.5; } }

/* BUTTONS EXACT */
button { appearance: none; -webkit-appearance: none; outline: none; border: none; }
.action-grid { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 15px; }
.action-btn {
  flex: 1; min-height: 50px; background: #fff; border-radius: 30px;
  display: flex; align-items: center; justify-content: center; padding: 5px 10px;
  color: #000; font-family: 'Inter', sans-serif; font-size: 8px; font-weight: 700; text-align: left;
  gap: 8px; cursor: pointer; letter-spacing: 0px; line-height: 1.1; 
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
  border: 1px solid;
}
.action-btn i { font-size: 16px; }
.action-btn span { display: block; }
.icon-group { display:flex; justify-content:center; align-items:center; width:20px; height:20px; border-radius:50%; border:1px solid #ccc; }

.action-btn.red { border-color: rgba(255,100,100,0.5); box-shadow: 0 0 10px rgba(255,100,100,0.3); }
.action-btn.red span { color: #555; }
.action-btn.grey { border-color: #aaa; box-shadow: 0 0 10px rgba(200,200,200,0.2); }
.action-btn.grey span { color: #555; }
.action-btn.yellow { border-color: rgba(212,175,55,0.5); box-shadow: 0 0 10px rgba(212,175,55,0.3); }
.action-btn.yellow span { color: #555; }

.action-btn:active { transform: scale(0.95); }

/* CONNECTIONS PANEL */
#connPanel .btn { border-radius: 8px; font-weight: 600; padding: 8px; font-size: 10px; cursor: pointer; border:none; color:#fff; }
.btn-neon { background: rgba(0,0,0,0.6); border: 1px solid var(--gold); color: var(--gold); }
.btn-green { background: rgba(0,0,0,0.6); border: 1px solid var(--success); color: var(--success); }
.btn-red { background: rgba(0,0,0,0.6); border: 1px solid var(--error); color: var(--error); }

/* STATUS PANEL EXACT */
.status-panel {
  display: flex; justify-content: space-between;
  margin-top: 5px; margin-bottom: 20px;
}
.s-col { flex: 1; }
.s-center { text-align: left; }
.s-label { color: #fff; font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.s-val { color: #ddd; font-size: 11px; font-weight: 600; }
.s-val span:not([id]) { color: #888; font-weight: 400; }
.text-green { color: #4ade80 !important; }
.text-green i { font-size: 8px; vertical-align: middle; margin-right: 2px; text-shadow: 0 0 5px #4ade80;}
.blink { animation: blink 1.5s infinite; }
@keyframes blink { 0% { opacity: 1; } 50% { opacity: 0.3; } 100% { opacity: 1; } }

/* TERMINAL LOG */
.terminal-log {
  flex: 1;
  background: #050505;
  border: 1px solid #222;
  border-radius: 12px;
  padding: 10px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  min-height: 60px;
  max-height: 80px;
}
.log-entry { margin-bottom: 4px; padding-bottom: 4px; border-bottom: 1px solid #111; color: #aaa;}
.log-entry.success { color: var(--success); text-shadow: 0 0 4px rgba(74,222,128,0.4); }
.log-entry.error { color: var(--error); }
.log-entry.warning { color: var(--gold); }

/* BOTTOM NAV */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; width: 100%;
  background: rgba(10,10,10,0.95);
  border-top: 1px solid #222;
  display: flex; justify-content: space-around;
  padding: 12px 0 20px 0;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  backdrop-filter: blur(10px);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #666; font-size: 8px; font-weight: 600; letter-spacing: 0.5px;
}
.nav-item i { font-size: 18px; margin-bottom: 2px;}
.nav-item.active { color: var(--gold); }
.nav-item.active i { filter: drop-shadow(0 0 5px var(--gold)); }


/* MODALS */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px);
  display: none; justify-content: center; align-items: center; z-index: 200; padding: 20px;
}
.modal-content {
  background: #111; border: 1px solid var(--gold); border-radius: 16px; padding: 30px;
  width: 100%; max-width: 350px; text-align: center; box-shadow: 0 0 30px rgba(0,0,0,0.8);
}
.modal-content h2 { font-size: 16px; color: #fff; margin-bottom: 20px; letter-spacing: 1px; }

/* ADMIN */
.license-display {
  background: #000; border: 1px dashed #444; border-radius: 8px; padding: 15px; font-family: monospace;
  font-size: 16px; color: var(--gold); margin-bottom: 20px; letter-spacing: 2px;
}
.btn-yellow { background: var(--gold); border: none; color: #000; padding: 12px; border-radius: 8px; font-weight: 700; width: 100%; margin-bottom: 10px; cursor: pointer;}
.modal-actions .btn { width: 100%; padding: 12px; border-radius: 8px; font-weight: 600; margin-bottom: 10px; cursor: pointer; border:none; color:#fff; background:var(--gold);}
.modal-actions #btnCloseModal { background: #444; }

/* ACTIVATION SCREEN */
.activation-card { max-width: 400px; padding: 40px 30px; }
.input-group { margin-bottom: 25px; }
.input-group input {
  width: 100%; background: rgba(0,0,0,0.4); border: 1px solid rgba(212,175,55,0.3); border-radius: 12px;
  padding: 15px; color: #fff; font-family: monospace; text-align: center; font-size: 16px; letter-spacing: 2px;
}
.input-group input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 10px var(--gold-glow); }

/* SPLASH SCREEN */
#splashScreen { transition: opacity 0.8s ease, filter 0.8s ease; }
.splash-logo { width: 120px; opacity: 0; animation: neonFlicker 1.5s forwards, breathGlow 3s infinite 1.5s; }
.splash-text {
  margin-top: 25px; color: var(--gold); font-size: 18px; font-weight: 700; letter-spacing: 4px; text-align: center;
  opacity: 0; animation: fadeInText 1s forwards 1.2s;
}
.splash-text span { font-size: 10px; color: #888; letter-spacing: 2px; font-weight: 400; }

@keyframes neonFlicker {
  0% { opacity: 0; filter: drop-shadow(0 0 0px var(--gold)); }
  10% { opacity: 0.5; filter: drop-shadow(0 0 10px var(--gold-glow)); }
  20% { opacity: 0; }
  30% { opacity: 0.8; filter: drop-shadow(0 0 15px var(--gold)); }
  40% { opacity: 0.2; }
  50% { opacity: 1; filter: drop-shadow(0 0 25px var(--gold)); }
  100% { opacity: 1; filter: drop-shadow(0 0 20px var(--gold-glow)); }
}
@keyframes breathGlow {
  0%, 100% { filter: drop-shadow(0 0 15px var(--gold-glow)); opacity: 1; transform: scale(1); }
  50% { filter: drop-shadow(0 0 5px var(--gold-glow)); opacity: 0.85; transform: scale(0.98); }
}
@keyframes fadeInText { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
