@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* FIX iOS/ULTRAWIDE WHITE BARS */
html { 
  background-color: #000; 
  width: 100%; 
  height: 100%; 
  overflow: hidden; 
  overscroll-behavior: none; 
}

body {
  background-color: #000;
  color: #f0c040;
  font-family: 'Share Tech Mono', monospace;
  margin: 0; padding: 0;
  height: 100dvh; /* Dynamic Viewport Height */
  width: 100%;    /* Ensures full width */
  overflow: hidden; 
  display: flex; 
  justify-content: center; 
  align-items: flex-start;
  text-shadow: 0 0 2px rgba(240, 192, 64, 0.4);
  overscroll-behavior: none;
}

.crt-vignette { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(circle, transparent 60%, rgba(0,0,0,0.85) 100%); pointer-events: none; z-index: 99999; }
.dot-mask { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-image: linear-gradient(rgba(0,0,0,0.3) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,0.3) 1px, transparent 1px); background-size: 3px 3px; pointer-events: none; z-index: 99999; opacity: 0.35; }

.boot-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #000; color: #33ff00; font-family: monospace; padding: 20px; z-index: 50000; display: flex; flex-direction: column; justify-content: flex-end; font-size: 14px; line-height: 1.4; text-shadow: 0 0 4px #33ff00; }
.hidden { display: none !important; }

/* ANIMATION */
.system-glitch { animation: glitchSkew 0.2s infinite; }
@keyframes glitchSkew { 0% { transform: translate(0, 0); } 25% { transform: translate(-2px, 1px); text-shadow: 2px 0 #f33, -2px 0 #ff3; } 50% { transform: translate(2px, -1px); text-shadow: -2px 0 #f33, 2px 0 #ff3; } 75% { transform: translate(0, 2px); } 100% { transform: translate(0, 0); } }

.panic-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #000; color: #ff3333; z-index: 100000; display: flex; justify-content: center; align-items: center; font-family: monospace; }
.panic-content { width: 90%; max-width: 400px; border: 2px solid #ff3333; padding: 20px; background: #110000; }
.panic-header { border-bottom: 1px solid #ff3333; margin-bottom: 15px; font-weight: bold; }
.shake-effect { animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake { 10%, 90% { transform: translate3d(-2px, 0, 0); } 40%, 60% { transform: translate3d(8px, 0, 0); } }

.scale-wrapper { width: 100%; height: 100%; display: flex; justify-content: center; opacity: 0; }
.turn-on-effect { animation: crtTurnOn 0.6s ease-out forwards; }
@keyframes crtTurnOn { 0% { transform: scaleY(0.005) scaleX(0); opacity: 1; filter: brightness(5); } 30% { transform: scaleY(0.005) scaleX(1); opacity: 1; filter: brightness(5); } 100% { transform: scaleY(1) scaleX(1); opacity: 1; filter: brightness(1); } }

/* APP LAYOUT */
.app-container { width: 100%; max-width: 460px; height: 100%; display: flex; flex-direction: column; position: relative; z-index: 2; margin: 0 10px; }

.fixed-header { flex: 0 0 auto; background: #000; z-index: 50; padding: 10px 5px 5px 5px; border-bottom: 1px solid #111; }
.brand-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.brand-link { text-decoration: none; display: flex; align-items: center; gap: 8px; color: #fff; opacity: 0.9; }
.brand-icon { font-size: 1.5rem; }
.brand-name { font-size: 1.1rem; font-weight: bold; letter-spacing: 1px; color: #f0c040; }
.brand-sub { font-size: 0.7rem; color: #666; }
.network-graph-wrapper { display: flex; align-items: center; gap: 5px; }
.spark-path { fill: none; stroke: #33ff00; stroke-width: 2; vector-effect: non-scaling-stroke; }
.led-wrapper { display: flex; flex-direction: column; align-items: center; gap: 5px; margin-bottom: 5px; }
.led-label { font-size: 0.7rem; color: #ffb84d; letter-spacing: 1px; opacity: 0.8; }
.led-bar { display: flex; gap: 3px; }
.led-block { width: 20px; height: 20px; border: 1px solid #333; color: #333; font-size: 11px; display: flex; justify-content: center; align-items: center; font-family: 'Share Tech Mono', monospace; font-weight: bold; background-color: #050505; transition: all 0.2s; }
.led-block.active { background-color: #f0c040; color: #000; border-color: #f0c040; box-shadow: 0 0 5px rgba(240, 192, 64, 0.6); }
.led-block.active.danger { background-color: #ff3333; border-color: #ff3333; color: #000; box-shadow: 0 0 8px rgba(255, 51, 51, 0.8); }

/* SCROLL CONTENT */
.scroll-content { 
  flex: 1; overflow-y: auto; padding: 10px; 
  padding-bottom: 30px; 
  position: relative; 
  -webkit-overflow-scrolling: touch; 
}

.hero-card { background: #080808; border: 2px solid #333; border-radius: 12px; padding: 15px; box-shadow: 0 0 20px rgba(0,0,0,0.5); text-align: center; cursor: pointer; margin-bottom: 15px; position: relative; z-index: 10; }
.hero-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #333; padding-bottom: 10px; margin-bottom: 15px; }
.hero-title-group { font-size: 1.4rem; color: #ffb84d; text-transform: uppercase; letter-spacing: 1px; }
.reset-btn { background: #222; border: 1px solid #444; color: #888; font-family: inherit; font-size: 0.7rem; padding: 4px 8px; border-radius: 4px; cursor: pointer; }

/* HERO CLOCK CENTERING */
.hero-clock-wrapper { display: flex; justify-content: center; align-items: center; margin-bottom: 10px; }
.hero-colon { font-size: 42px; margin: 0 5px; color: #444; padding-bottom: 8px; line-height: 1; }
.ampm-box { font-size: 1.2rem; color: #666; margin-left: 10px; margin-bottom: 8px; font-weight: bold; }
.hero-status { font-size: 1.1rem; color: #888; text-transform: uppercase; }

.dashboard-list { background: #080808; border: 2px solid #222; border-radius: 12px; padding: 10px; margin-bottom: 0px; }
/* SPACER FOR GAP */
.list-spacer { width: 100%; height: 100px; /* Gap Size */ pointer-events: none; }

.list-header { display: flex; justify-content: space-between; padding: 0 10px 10px 40px; border-bottom: 1px solid #333; color: #555; font-size: 0.8rem; margin-bottom: 5px; }
.clock-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 6px; border-bottom: 1px dashed #1a1a1a; cursor: pointer; transition: background 0.2s; background-color: #080808; position: relative; }
.clock-row:last-child { border-bottom: none; }
.clock-row:hover { background-color: #161616; }
.clock-row.selected { background-color: #1a1a1a; border-right: 3px solid #ffb84d; }
.clock-row.selected .city-name { color: #ffb84d; }
.drag-handle { cursor: grab; color: #444; font-size: 1.2rem; padding: 10px; margin-right: 5px; touch-action: none; user-select: none; }
.clock-row.dragging { opacity: 0.5; background: #222; border: 1px solid #555; }
.row-info { display: flex; flex-direction: column; flex-grow: 1;}
.city-name { font-size: 1.0rem; color: #ccc; }
.row-sub { font-size: 0.7rem; color: #666; margin-top: 2px; }

.flip-clock.hero-size { width: 55px; height: 77px; border-radius: 6px; font-size: 50px; }

/* MINI CLOCK CENTERING */
.mini-clock-group { display: flex; align-items: center; }
.mini-colon { font-size: 24px; color: #444; margin: 0 2px; padding-bottom: 4px; line-height: 1; }

.flip-clock.mini { width: 29px; height: 41px; border-radius: 4px; font-size: 24px; }
.mini-ampm { font-size: 0.75rem; color: #555; margin-left: 5px; margin-bottom: 5px; min-width: 18px; }
.flip-clock { position: relative; perspective: 1000px; background: #000; line-height: 1; transition: background 0.3s; }
.flip-clock.danger-mode .leaf { background-color: #a00000 !important; border-color: #c00000 !important; }
.flip-clock.danger-mode .inner { background-color: #a00000 !important; color: #ffdd44 !important; }
.leaf { position: absolute; left: 0; width: 100%; height: 50%; overflow: hidden; background: #1a1a1a; border: 1px solid #111; backface-visibility: hidden; z-index: 1; }
.inner { position: absolute; left: 0; width: 100%; height: 200%; display: flex; justify-content: center; align-items: center; padding-top: 4px; font-weight: bold; background-color: #1a1a1a; }
.top, .top-flip { top: 0; border-radius: 4px 4px 0 0; transform-origin: bottom; border-bottom: 1px solid rgba(0,0,0,0.5); }
.top .inner, .top-flip .inner { top: 0; }
.bottom, .bottom-flip { bottom: 0; border-radius: 0 0 4px 4px; transform-origin: top; border-top: 1px solid rgba(255,255,255,0.05); }
.bottom .inner, .bottom-flip .inner { top: -100%; }
.top-flip { z-index: 2; }
.bottom-flip { z-index: 1; transform: rotateX(90deg); }
.flip-clock.flipping .top-flip { animation: flipTop 0.5s ease-in forwards; }
.flip-clock.flipping .bottom-flip { animation: flipBottom 0.5s ease-out 0.25s forwards; }
@keyframes flipTop { 100% { transform: rotateX(-90deg); } }
@keyframes flipBottom { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0deg); } }

/* SCROLL ARROW */
.scroll-indicator { 
  position: absolute; 
  bottom: 85px; /* Above Footer */
  left: 50%; transform: translateX(-50%); 
  color: #f0c040; font-size: 1.2rem; 
  pointer-events: none; opacity: 0; 
  transition: opacity 0.5s ease-in-out; 
  z-index: 100;
}
.scroll-indicator.visible { opacity: 0.6; animation: glitchArrow 2s infinite; }
@keyframes glitchArrow { 0% { transform: translateX(-50%) skew(0deg); } 50% { opacity: 0.3; } 52% { transform: translateX(-50%) skew(10deg); } 54% { transform: translateX(-50%) skew(0deg); } 100% { opacity: 0.6; } }

/* FIXED FOOTER */
.fixed-footer { flex: 0 0 auto; background: #000; border-top: 1px solid #333; z-index: 50; padding: 10px; padding-bottom: max(15px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 5px; }
.peg-footer { display: flex; justify-content: center; align-items: center; padding: 10px; background: #080808; border: 1px solid #333; border-radius: 8px; width: 100%; max-width: 460px; margin: 0 auto; }
.redacted-effect { position: relative; display: inline-block; color: #f0c040; background-color: transparent; padding: 2px 8px; text-decoration: none; font-weight: bold; border: 1px solid #f0c040; transition: all 0.2s; cursor: pointer; }
.redacted-effect:hover { background-color: rgba(240, 192, 64, 0.1); }
.redacted-effect.force-redacted { color: transparent !important; background-color: #f0c040 !important; border-color: #f0c040; animation: glitchText 0.2s infinite; }

@media (max-width: 470px) { .app-container { width: 100%; margin: 0; } }