:root {
  --bg: #050706;
  --surface: #0b110d;
  --surface-2: #10171200;
  --line: rgba(0, 255, 156, 0.12);
  --accent: #f0a830;        /* keep orange/gold */
  --accent-dim: #b3822a;
  --neon: #00ff9c;          /* Mr. Robot / hacker neon green */
  --neon-dim: #0f8f5c;
  --neon-glow: rgba(0, 255, 156, 0.55);
  --green: #34d17a;         /* button green */
  --green-bg: #06180f;
  --cyan: #4fc3e8;
  --magenta: #ff2e7e;       /* synthwave accent */
  --text: #d8ffe9;
  --mut: #4f7a63;
  --mut-2: #2a4235;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(0,255,156,0.06), transparent 55%),
    radial-gradient(ellipse at 50% 120%, rgba(255,46,126,0.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  -webkit-font-smoothing: antialiased;
}

/* global scanline + flicker overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.10) 3px,
    rgba(0,0,0,0.10) 4px
  );
  mix-blend-mode: multiply;
  animation: flicker 4.5s infinite steps(60);
}
@keyframes flicker {
  0%,19%,21%,23%,80%,100% { opacity: 0.55; }
  20%,22% { opacity: 0.3; }
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 28px 16px;
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--neon); }
.brand-icon { width: 30px; height: 30px; color: var(--neon); filter: drop-shadow(0 0 6px var(--neon-glow)); }
.brand-text {
  font-size: 13px; letter-spacing: 1px; font-weight: 500;
  color: var(--neon);
  text-shadow: 0 0 8px var(--neon-glow);
}
.brand-cursor {
  display: inline-block; width: 9px; height: 15px;
  background: var(--neon); margin-left: -6px;
  box-shadow: 0 0 8px var(--neon-glow);
  animation: cursorblink 1s steps(2) infinite;
}
@keyframes cursorblink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }

.stats-toggle {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--neon); font-family: inherit; font-size: 12px; letter-spacing: 1px;
  padding: 8px 16px; border-radius: 4px; cursor: pointer; transition: all .2s;
  text-transform: uppercase;
}
.stats-toggle:hover {
  color: #001a10; background: var(--neon); border-color: var(--neon);
  box-shadow: 0 0 18px var(--neon-glow);
}

.stage {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  gap: clamp(20px, 6vw, 90px);
  padding: 20px 0;
}

/* ---- DIGITAL CLOCK ---- */
.clock-wrap {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  flex-shrink: 0;
}

.digital-clock {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px clamp(24px, 4vw, 46px) 24px;
  background:
    linear-gradient(180deg, rgba(0,255,156,0.03), rgba(0,0,0,0.4));
  box-shadow:
    0 0 0 1px rgba(0,255,156,0.05),
    0 0 40px rgba(0,255,156,0.08),
    inset 0 0 60px rgba(0,0,0,0.6);
  min-width: clamp(300px, 40vw, 460px);
}
.digital-clock.is-running {
  border-color: rgba(0,255,156,0.3);
  box-shadow:
    0 0 0 1px rgba(0,255,156,0.1),
    0 0 60px rgba(0,255,156,0.18),
    inset 0 0 60px rgba(0,0,0,0.6);
}

/* faux CRT scanlines inside the clock */
.digital-clock .scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,255,156,0.03) 0px,
    rgba(0,255,156,0.03) 1px,
    transparent 2px,
    transparent 4px
  );
}
.digital-clock .grid-bg {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
  background-image:
    linear-gradient(rgba(0,255,156,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,156,0.06) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 80%);
}

.clock-top {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
  font-size: 11px; letter-spacing: 2px;
  color: var(--magenta);
  text-shadow: 0 0 6px rgba(255,46,126,0.5);
  text-transform: uppercase;
}
.rec-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--mut-2);
}
.rec-dot.active {
  background: var(--magenta);
  box-shadow: 0 0 10px var(--magenta);
  animation: recpulse 1.1s ease-in-out infinite;
}
@keyframes recpulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }
.clock-mode { color: var(--neon); text-shadow: 0 0 6px var(--neon-glow); }

.seg-row {
  position: relative;
  display: flex; align-items: flex-start; justify-content: center;
  gap: 6px;
}
.seg-block { display: flex; flex-direction: column; align-items: center; }
.seg-val {
  position: relative;
  font-size: clamp(46px, 8vw, 92px);
  font-weight: 700;
  line-height: 1;
  color: var(--neon);
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  text-shadow:
    0 0 8px var(--neon-glow),
    0 0 22px rgba(0,255,156,0.35);
}
/* glitch layers */
.seg-val::before,
.seg-val::after {
  content: attr(data-text);
  position: absolute; top: 0; left: 0;
  width: 100%; overflow: hidden;
}
.seg-live::before {
  color: var(--magenta);
  animation: glitchA 2.6s infinite steps(2);
  opacity: 0.6;
}
.seg-live::after {
  color: var(--cyan);
  animation: glitchB 3.3s infinite steps(2);
  opacity: 0.5;
}
@keyframes glitchA {
  0%,92%,100% { transform: translate(0,0); clip-path: inset(0 0 0 0); }
  93% { transform: translate(-2px,-1px); clip-path: inset(0 0 60% 0); }
  96% { transform: translate(2px,1px); clip-path: inset(40% 0 0 0); }
}
@keyframes glitchB {
  0%,90%,100% { transform: translate(0,0); clip-path: inset(0 0 0 0); }
  91% { transform: translate(2px,0); clip-path: inset(20% 0 40% 0); }
  95% { transform: translate(-2px,0); clip-path: inset(60% 0 10% 0); }
}
.seg-lbl {
  margin-top: 8px; font-size: 9px; letter-spacing: 3px;
  color: var(--mut); text-transform: uppercase;
}
.seg-colon {
  font-size: clamp(40px, 7vw, 82px);
  font-weight: 700; line-height: 1;
  color: var(--neon);
  margin-top: 2px;
  text-shadow: 0 0 10px var(--neon-glow);
  animation: colonblink 1s steps(2) infinite;
}
@keyframes colonblink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0.25; } }

.clock-status {
  position: relative;
  margin-top: 18px; text-align: center;
  font-size: 12px; letter-spacing: 1px;
  color: var(--neon-dim);
  text-shadow: 0 0 5px rgba(0,255,156,0.3);
}

.flash {
  margin-top: 16px; font-size: 13px; color: var(--accent);
  max-width: 320px; text-align: center;
  text-shadow: 0 0 8px rgba(240,168,48,0.4);
  animation: fadein .3s ease;
  letter-spacing: 0.5px;
}
@keyframes fadein { from { opacity: 0; transform: translateY(4px);} to { opacity:1; transform:none;} }

/* ---- SIDE + PLAY BUTTONS ---- */
.side-btn {
  width: 108px; height: 108px; border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--neon); font-family: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; transition: all .2s; flex-shrink: 0;
}
.side-btn:hover {
  border-color: var(--neon);
  box-shadow: 0 0 20px rgba(0,255,156,0.15);
  transform: translateY(-2px);
}
.side-btn:active { transform: translateY(0) scale(.97); }
.side-btn span { font-size: 13px; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; }
.side-btn .ico { width: 24px; height: 24px; color: var(--neon); }
.side-btn:disabled { opacity: .3; cursor: not-allowed; }
.side-btn:disabled:hover { transform: none; box-shadow: none; border-color: var(--line); }

.right-col { display: flex; flex-direction: column; gap: 20px; flex-shrink: 0; }

.play-btn {
  width: 122px; height: 122px; border-radius: 8px;
  background: var(--green-bg);
  border: 1px solid rgba(52,209,122,.4);
  color: var(--green); font-family: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; transition: all .2s;
  box-shadow: 0 0 30px rgba(52,209,122,.15);
  text-transform: uppercase;
}
.play-btn:hover {
  transform: translateY(-2px);
  border-color: var(--green);
  box-shadow: 0 0 45px rgba(52,209,122,.35);
}
.play-btn:active { transform: translateY(0) scale(.97); }
.play-btn span { font-size: 15px; font-weight: 700; letter-spacing: 1px; }
.play-btn .ico.big { width: 34px; height: 34px; }
.play-btn.is-pause {
  background: #221a08; border-color: rgba(240,168,48,.5); color: var(--accent);
  box-shadow: 0 0 30px rgba(240,168,48,.18);
}
.play-btn.is-pause:hover { box-shadow: 0 0 45px rgba(240,168,48,.32); }

.dots-row {
  display: flex; justify-content: center; gap: 12px;
  padding: 4px 0 14px;
}
.dot {
  width: 9px; height: 9px; border-radius: 2px;
  background: var(--mut-2); transition: all .3s;
}
.dot.accent { background: var(--accent); box-shadow: 0 0 10px rgba(240,168,48,.6); }
.dot.cyan { background: var(--neon); box-shadow: 0 0 10px var(--neon-glow); }

/* ---- STATS ---- */
.stats-drawer {
  max-width: 720px; margin: 0 auto 8px; width: 100%;
  animation: fadein .3s ease;
}
.dash { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.dash-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 16px 16px;
  position: relative;
}
.dash-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--neon); box-shadow: 0 0 8px var(--neon-glow);
}
.dash-title { font-size: 10px; letter-spacing: 1.5px; color: var(--mut); margin-bottom: 10px; }
.dash-value {
  font-size: 26px; font-weight: 700; color: var(--neon);
  font-variant-numeric: tabular-nums; line-height: 1;
  text-shadow: 0 0 8px var(--neon-glow);
}
.dash-compare { margin-top: 10px; font-size: 11px; display: flex; align-items: baseline; flex-wrap: wrap; }
.delta { font-weight: 600; }
.delta.up { color: var(--neon); }
.delta.down { color: var(--magenta); }
.delta.neutral { color: var(--mut); }
.dash-vs { color: var(--mut-2); font-size: 10px; margin-left: 5px; }

.chart-wrap {
  margin-top: 14px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
}
.chart-label { font-size: 11px; letter-spacing: .5px; color: var(--mut); margin-bottom: 14px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 90px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar-fill {
  width: 100%; min-height: 2px; border-radius: 2px 2px 0 0;
  background: var(--mut-2);
  transition: height .5s cubic-bezier(.2,.9,.3,1);
}
.bar-fill.today {
  background: linear-gradient(180deg, var(--neon), var(--neon-dim));
  box-shadow: 0 0 12px var(--neon-glow);
}
.bar-day { font-size: 10px; color: var(--mut); margin-top: 8px; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.metric {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 14px; text-align: center;
}
.metric-label { font-size: 10px; letter-spacing: 1px; color: var(--mut); margin-bottom: 8px; }
.metric-value { font-size: 20px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; text-shadow: 0 0 8px rgba(240,168,48,0.3); }
.metric-value.dim { color: var(--neon); text-shadow: 0 0 6px var(--neon-glow); }

.log {
  margin-top: 14px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  max-height: 180px; overflow-y: auto;
}
.log-line {
  display: flex; align-items: center; gap: 14px;
  padding: 7px 0; font-size: 13px; border-bottom: 1px solid var(--line);
}
.log-line:last-child { border-bottom: none; }
.log-time { color: var(--mut); font-variant-numeric: tabular-nums; min-width: 42px; }
.log-name { color: var(--neon-dim); flex: 1; }
.log-dur { color: var(--accent); font-variant-numeric: tabular-nums; text-shadow: 0 0 6px rgba(240,168,48,0.3); }

.wipe-btn {
  margin-top: 14px; background: transparent; border: 1px solid rgba(255,46,126,.3);
  color: var(--magenta); font-family: inherit; font-size: 12px; letter-spacing: .5px;
  padding: 9px 16px; border-radius: 4px; cursor: pointer; transition: all .2s;
  text-transform: uppercase;
}
.wipe-btn:hover { border-color: var(--magenta); box-shadow: 0 0 16px rgba(255,46,126,.25); }

.foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; margin-top: auto;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--mut);
}
.foot-tag { color: var(--neon-dim); }
.foot a { color: var(--neon); text-decoration: none; border-bottom: 1px dotted var(--neon-dim); }
.foot a:hover { color: var(--accent); border-color: var(--accent); text-shadow: 0 0 6px rgba(240,168,48,0.4); }

.log::-webkit-scrollbar { width: 6px; }
.log::-webkit-scrollbar-track { background: transparent; }
.log::-webkit-scrollbar-thumb { background: var(--neon-dim); border-radius: 3px; }

@media (max-width: 760px) {
  .app { padding: 18px 16px 14px; }
  .stage { flex-direction: column; gap: 24px; }
  .digital-clock { min-width: unset; width: 100%; padding: 22px 16px 18px; }
  .seg-val { font-size: 44px; }
  .seg-colon { font-size: 38px; }
  .side-btn, .play-btn { width: 88px; height: 88px; }
  .play-btn .ico.big { width: 28px; height: 28px; }
  .right-col { flex-direction: row; }
  .dash, .metrics { grid-template-columns: 1fr; }
  .brand-text { font-size: 10px; letter-spacing: 0.5px; }
  .foot { flex-direction: column; gap: 6px; }
}

@media (max-width: 480px) {
  .seg-val { font-size: 34px; }
  .seg-colon { font-size: 30px; }
}