:root {
  --bg: #060607;
  --term-green: #4af626;
  --accent: #b26cff;
  --text: #e0e0e0;
  --border: rgba(255, 255, 255, 0.1);
  --glass: rgba(0, 0, 0, 0.6);
  --toast-bg: #111;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Fira Code', monospace;
  overflow-x: hidden;
  min-height: 100vh;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#bg-canvas {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: -1; opacity: 0.4;
}

/* Boot Screen */
#boot-screen {
  position: fixed; inset: 0; background: #000; padding: 20px;
  font-family: 'VT323', monospace; font-size: 18px; color: #bbb;
  z-index: 100; overflow-y: auto; overscroll-behavior: contain;
}
#boot-log { padding-bottom: 50px; }
.log-line { margin-bottom: 2px; opacity: 0.9; white-space: pre-wrap; word-break: break-all; }
.log-ok { color: var(--term-green); font-weight: bold; margin-right: 10px; }
.log-warn { color: #ffbd2e; font-weight: bold; margin-right: 10px; }
.log-time { color: #666; margin-right: 10px; }
.log-hex { color: #444; margin-right: 8px; }

/* CRT Effect */
.scanline {
  position: fixed; top: 0; left: 0; width: 100%; height: 100px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.05), rgba(255,255,255,0));
  animation: scan 6s linear infinite; pointer-events: none; z-index: 200;
}
@keyframes scan { 0% { transform: translateY(-100%); } 100% { transform: translateY(100vh); } }

/* Gate */
.gate {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); z-index: 50; cursor: pointer;
  transition: opacity 0.5s ease;
}
.gate__content { text-align: center; }
.gate__prompt { 
  font-size: 20px; color: var(--term-green); margin-bottom: 15px; 
  text-shadow: 0 0 10px rgba(74, 246, 38, 0.4);
}
.gate__sub { 
  color: #666; font-size: 14px; letter-spacing: 3px; text-align: center;
  font-family: 'Fira Code', monospace; font-weight: bold;
}
.blink { animation: blinker 1s steps(2, start) infinite; }
@keyframes blinker { 50% { opacity: 0; } }

/* App */
.app {
  max-width: 900px; margin: 0 auto; padding: 40px 20px;
  opacity: 0; transition: opacity 1.5s ease;
}

.header { text-align: center; margin-bottom: 40px; }

.ascii-logo {
  font-family: 'Fira Code', monospace; font-size: 10px; line-height: 1.1;
  white-space: pre; display: inline-block; font-weight: bold;
}
@media (min-width: 400px) { .ascii-logo { font-size: 12px; } }
@media (min-width: 600px) { .ascii-logo { font-size: 16px; } }

.chroma-text {
  background: linear-gradient(90deg, #b26cff, #4aa3ff, #4af626, #ff5aa5, #b26cff);
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text;
  color: transparent; animation: chroma 5s linear infinite;
  filter: drop-shadow(0 0 5px rgba(178, 108, 255, 0.3));
}
@keyframes chroma { to { background-position: 200% center; } }

/* Bio Bar (Idea B) */
.status-bar {
  margin-top: 15px; display: flex; justify-content: center; gap: 10px; font-size: 11px; flex-wrap: wrap;
}
.status-tag { 
  color: #a0a0a0; background: rgba(255, 255, 255, 0.05); 
  padding: 6px 10px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 500; letter-spacing: 0.5px;
}

/* Grid */
.grid-section { margin-bottom: 40px; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px;
}

.tile {
  background: var(--glass); border: 1px solid var(--border); padding: 18px; border-radius: 8px;
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text);
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94); position: relative; overflow: hidden;
}
.tile:hover {
  background: rgba(255, 255, 255, 0.08); border-color: var(--accent);
  transform: translateY(-4px); box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
.tile::before {
  content: ""; position: absolute; top: 0; left: 0; width: 2px; height: 100%;
  background: var(--accent); opacity: 0; transition: opacity 0.2s;
}
.tile:hover::before { opacity: 1; }

.btn-tile { width: 100%; cursor: pointer; font-family: inherit; font-size: inherit; text-align: left; }
.tile__icon img { width: 22px; height: 22px; filter: drop-shadow(0 0 5px rgba(255,255,255,0.2)); }
.tile__label { font-size: 14px; font-weight: 500; }

/* Stats */
.stats-section {
  border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: var(--glass); backdrop-filter: blur(10px);
}
.panel__head { 
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 0 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 8px;
}
.h2 { font-size: 14px; margin: 0; color: var(--text); font-family: 'Fira Code', monospace; font-weight: bold; }
.panel__note { font-size: 12px; color: #666; font-family: 'Fira Code', monospace; }
.stats-wrapper { overflow-x: auto; border-radius: 6px; width: 100%; display: flex; justify-content: center; }
.activity-graph { width: 100%; max-width: 100%; height: auto; display: block; opacity: 0.9; }

/* Footer */
.footer {
  margin-top: 60px; display: flex; justify-content: space-between; align-items: center;
  padding-top: 20px; border-top: 1px solid var(--border); font-size: 12px;
}
.muted { color: #555; font-family: 'Fira Code', monospace; }
.footer__right { display: flex; align-items: center; gap: 12px; }

.vol-btn { background: none; border: none; cursor: pointer; padding: 5px; color: var(--text); opacity: 0.8; transition: opacity 0.2s; display: flex; align-items: center; }
.vol-btn:hover { opacity: 1; }
.vol-btn svg { display: block; }
.vol { width: 80px; height: 4px; -webkit-appearance: none; background: #333; border-radius: 2px; outline: none; }
.vol::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; background: var(--accent); border-radius: 50%; cursor: pointer; box-shadow: 0 0 10px var(--accent); }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); animation: fadeIn 0.2s ease;
}
.modal[hidden] { display: none; }
.modal-content {
  background: var(--bg); border: 1px solid var(--accent); border-radius: 12px; padding: 20px;
  width: 90%; max-width: 400px; box-shadow: 0 0 20px rgba(178, 108, 255, 0.2);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.modal-title { margin: 0; font-size: 16px; color: var(--accent); }
.close-btn { background: none; border: none; color: #666; font-size: 24px; cursor: pointer; }
.close-btn:hover { color: #fff; }
.qr-wrapper { text-align: center; margin: 20px 0; }
.qr-code { width: 150px; height: 150px; border-radius: 8px; border: 4px solid #fff; }
.address-box {
  display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.05); padding: 10px;
  border-radius: 6px; border: 1px dashed var(--border);
}
.address-box code { font-size: 10px; color: #888; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-btn { background: none; border: none; color: var(--accent); cursor: pointer; }
.copy-btn:hover { color: #fff; }

.copy-msg {
  text-align: center; font-size: 12px; color: var(--term-green);
  margin-top: 10px; opacity: 0; transition: opacity 0.2s;
}
.copy-msg.visible { opacity: 1; }

/* Toast Notifications (Top Right) */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: #111; color: #fff; padding: 12px 16px; border-radius: 8px;
  border: 1px solid var(--accent); border-left: 4px solid var(--accent);
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
  font-size: 13px; font-family: 'Fira Code', monospace;
  display: flex; align-items: center; gap: 10px;
  animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  min-width: 250px;
}
.toast.hiding { animation: slideOut 0.3s forwards; }
.toast-icon { font-size: 16px; }

@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { to { transform: translateX(100%); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .scanline { display: none; } .blink { animation: none; } .chroma-text { animation: none; }
  .tile:hover { transform: none; } #bg-canvas { display: none; } .modal { animation: none; }
  .toast { animation: none; }
}