/* GT UNLIMITED — Financial Terminal
 * High-end visual design: Ethereal Glass + Asymmetrical Bento
 */

:root {
  --bg: #050505;
  --bg-elevated: #0a0a0a;
  --surface: #0d0d0d;
  --surface-raised: #111111;
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f5f5;
  --text-muted: #7a7a7a;
  --text-dim: #525252;
  --acc: #00ff9d;
  --acc-dim: #00cc7d;
  --acc-glow: rgba(0, 255, 157, 0.18);
  --danger: #ff4d4d;
  --warning: #ffb84d;
  --info: #4da6ff;
  --radius-outer: 24px;
  --radius-inner: calc(var(--radius-outer) - 6px);
  --radius-sm: 14px;
  --ease-fluid: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-snap: cubic-bezier(0.16, 1, 0.3, 1);
  --font-sans: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --header-h: 44px;
  --topbar-h: 56px;
}

body.light-mode {
  --bg: #f6f6f3;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-raised: #fafaf8;
  --hairline: rgba(0, 0, 0, 0.07);
  --hairline-strong: rgba(0, 0, 0, 0.12);
  --text: #0a0a0a;
  --text-muted: #6b6b6b;
  --text-dim: #999999;
  --acc: #2563eb;
  --acc-dim: #1d4ed8;
  --acc-glow: rgba(37, 99, 235, 0.14);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background 0.5s var(--ease-fluid), color 0.5s var(--ease-fluid);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Ambient background orbs */
.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-glow::before,
.ambient-glow::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  transition: opacity 0.6s var(--ease-fluid);
}

.ambient-glow::before {
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, var(--acc) 0%, transparent 70%);
  top: -20vw;
  right: -15vw;
}

.ambient-glow::after {
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, var(--info) 0%, transparent 70%);
  bottom: -15vw;
  left: -10vw;
  opacity: 0.18;
}

body.light-mode .ambient-glow::before,
body.light-mode .ambient-glow::after {
  opacity: 0.12;
}

/* Film grain overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Ticker */
.ticker-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: var(--header-h);
  background: rgba(var(--bg), 0.7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
  z-index: 40;
  overflow: hidden;
}

.ticker-header iframe,
.ticker-header .tradingview-widget-container {
  height: var(--header-h) !important;
}

/* Floating Top Bar */
.top-bar-shell {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: min(calc(100% - 32px), 1400px);
  padding: 5px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--hairline);
  border-radius: var(--topbar-h);
  backdrop-filter: blur(20px);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: background 0.4s var(--ease-fluid), border-color 0.4s var(--ease-fluid);
}

body.light-mode .top-bar-shell {
  background: rgba(255, 255, 255, 0.55);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.top-bar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 18px;
  font-size: 12px;
  gap: 16px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.terminal-id {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.08em;
  font-size: 13px;
  font-family: var(--font-mono);
}

.terminal-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--acc);
  box-shadow: 0 0 12px var(--acc-glow);
  animation: pulse 2s var(--ease-fluid) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.mode-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: all 0.35s var(--ease-fluid);
}

.mode-toggle:hover {
  border-color: var(--hairline-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.mode-icon {
  font-size: 13px;
  transition: transform 0.5s var(--ease-fluid);
}

.mode-toggle:hover .mode-icon {
  transform: rotate(180deg);
}

.clocks {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-family: var(--font-mono);
}

.clocks span {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.clocks b {
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
  margin-left: 5px;
  transition: color 0.4s var(--ease-fluid);
}

/* System HUD */
.system-hud {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  transition: border-color 0.3s var(--ease-fluid), background 0.3s var(--ease-fluid);
}

body.light-mode .system-hud {
  background: rgba(255, 255, 255, 0.35);
}

.system-hud:hover {
  border-color: var(--hairline-strong);
}

.hud-status {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hud-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  box-shadow: 0 0 0 rgba(0, 255, 157, 0);
  transition: background 0.3s var(--ease-fluid), box-shadow 0.3s var(--ease-fluid);
}

.hud-status.online .hud-dot {
  background: var(--acc);
  box-shadow: 0 0 10px var(--acc-glow);
  animation: hud-pulse 2s var(--ease-fluid) infinite;
}

.hud-status.offline .hud-dot {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(255, 77, 77, 0.35);
}

@keyframes hud-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.hud-latency {
  min-width: 44px;
  text-align: right;
  color: var(--text-dim);
  transition: color 0.3s var(--ease-fluid);
}

.hud-latency.active {
  color: var(--acc);
}

.hud-flow {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.hud-flow-bar {
  width: 3px;
  background: var(--text-dim);
  border-radius: 2px;
  transition: height 0.2s var(--ease-fluid), background 0.3s var(--ease-fluid);
}

.hud-flow.active .hud-flow-bar {
  background: var(--acc);
  animation: flow-bar 0.6s var(--ease-fluid) infinite alternate;
}

.hud-flow-bar:nth-child(1) { height: 4px; animation-delay: 0s; }
.hud-flow-bar:nth-child(2) { height: 8px; animation-delay: 0.15s; }
.hud-flow-bar:nth-child(3) { height: 5px; animation-delay: 0.3s; }

.hud-flow.active .hud-flow-bar:nth-child(1) { height: 10px; }
.hud-flow.active .hud-flow-bar:nth-child(2) { height: 14px; }
.hud-flow.active .hud-flow-bar:nth-child(3) { height: 8px; }

@keyframes flow-bar {
  0% { transform: scaleY(1); }
  100% { transform: scaleY(0.55); }
}

/* Widget status indicator */
.widget-status {
  display: inline-flex;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  margin-right: 8px;
  transition: background 0.3s var(--ease-fluid), box-shadow 0.3s var(--ease-fluid);
}

.widget-status.loading {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(255, 184, 77, 0.35);
  animation: status-blink 1s var(--ease-fluid) infinite;
}

.widget-status.online {
  background: var(--acc);
  box-shadow: 0 0 8px var(--acc-glow);
}

.widget-status.offline {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(255, 77, 77, 0.35);
}

@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Widget data flash on update */
@keyframes data-flash {
  0% { opacity: 0; }
  50% { opacity: 0.08; }
  100% { opacity: 0; }
}

.widget-body::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--acc);
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}

.widget-body.flash::after {
  animation: data-flash 0.6s var(--ease-fluid);
}

/* Toast notifications */
.toast-stack {
  position: fixed;
  top: calc(var(--header-h) + var(--topbar-h) + 24px);
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 80;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 340px;
  padding: 12px 16px;
  background: rgba(13, 13, 13, 0.92);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(20px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  font-size: 12px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(20px);
  opacity: 0;
  animation: toast-in 0.35s var(--ease-snap) forwards;
}

body.light-mode .toast {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

.toast.out {
  animation: toast-out 0.25s var(--ease-fluid) forwards;
}

@keyframes toast-in {
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  to { transform: translateX(20px); opacity: 0; }
}

.toast-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  line-height: 1.4;
}

/* Responsive HUD */
@media (max-width: 768px) {
  .system-hud {
    gap: 10px;
    padding: 5px 10px;
  }

  .hud-label {
    display: none;
  }

  .hud-flow {
    display: none;
  }

  .toast-stack {
    right: 12px;
    top: calc(var(--header-h) + var(--topbar-h) + 12px);
    left: 12px;
    align-items: stretch;
  }

  .toast {
    max-width: none;
  }
}

/* Grid Container */
.grid-container {
  flex: 1;
  margin-top: calc(var(--header-h) + var(--topbar-h) + 28px);
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 10;
}

.grid-stack {
  min-height: calc(100vh - var(--header-h) - var(--topbar-h) - 60px);
  background-image:
    linear-gradient(var(--hairline) 1px, transparent 1px),
    linear-gradient(90deg, var(--hairline) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center top;
  border-radius: var(--radius-outer);
}

body.light-mode .grid-stack {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
}

/* Grid Items — Double Bezel */
.grid-stack-item-content {
  background: transparent !important;
  border: none !important;
  border-radius: var(--radius-outer) !important;
  display: flex !important;
  flex-direction: column;
  overflow: hidden !important;
  padding: 6px;
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid var(--hairline) !important;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    border-color 0.4s var(--ease-fluid),
    box-shadow 0.4s var(--ease-fluid),
    transform 0.4s var(--ease-fluid);
}

body.light-mode .grid-stack-item-content {
  background: rgba(255, 255, 255, 0.5) !important;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.grid-stack-item-content:hover {
  border-color: var(--hairline-strong) !important;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

body.light-mode .grid-stack-item-content:hover {
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.drag-handle {
  height: 32px;
  margin: 0 6px;
  background: transparent;
  cursor: move;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 10px;
  color: var(--text-muted);
  justify-content: space-between;
  border-bottom: 1px solid var(--hairline);
  z-index: 10;
  user-select: none;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.3s var(--ease-fluid);
}

.grid-stack-item-content:hover .drag-handle {
  color: var(--text);
}

.drag-handle-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drag-handle-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drag-handle-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  font-family: inherit;
  transition: all 0.25s var(--ease-fluid);
}

.drag-handle-btn:hover {
  color: var(--danger);
  background: rgba(255, 77, 77, 0.08);
}

.widget-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  margin: 6px;
  border-radius: var(--radius-inner);
  background: rgba(0, 0, 0, 0.2);
}

body.light-mode .widget-body {
  background: rgba(0, 0, 0, 0.02);
}

.widget-body iframe,
.widget-body .tradingview-widget-container,
.widget-body #tv-main {
  width: 100%;
  height: 100%;
  border: none;
}

.calc-frame {
  background: #ffffff;
}

.widget-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: var(--surface);
  z-index: 5;
  font-family: var(--font-mono);
  gap: 12px;
}

.widget-loader::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--hairline);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.widget-error {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 16px;
  gap: 10px;
  background: var(--surface);
}

.widget-error.visible {
  display: flex;
}

.widget-error button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline);
  color: var(--text);
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  border-radius: 999px;
  letter-spacing: 0.05em;
  transition: all 0.3s var(--ease-fluid);
}

.widget-error button:hover {
  border-color: var(--acc);
  color: var(--acc);
  background: var(--acc-glow);
}

/* Widget Menu — Floating Island */
.widget-menu-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  backdrop-filter: blur(16px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.4s var(--ease-fluid);
}

body.light-mode .widget-menu-toggle {
  background: rgba(255, 255, 255, 0.7);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.widget-menu-toggle:hover {
  transform: scale(1.06);
  border-color: var(--acc);
  box-shadow: 0 0 24px var(--acc-glow);
}

.widget-menu-toggle:active {
  transform: scale(0.96);
}

.widget-menu-icon {
  position: relative;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: background 0.3s var(--ease-fluid);
}

.widget-menu-icon::before,
.widget-menu-icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.35s var(--ease-fluid);
}

.widget-menu-icon::before {
  top: -6px;
}

.widget-menu-icon::after {
  top: 6px;
}

.widget-menu-toggle.open .widget-menu-icon {
  background: transparent;
}

.widget-menu-toggle.open .widget-menu-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.widget-menu-toggle.open .widget-menu-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

.widget-menu {
  position: fixed;
  right: 24px;
  bottom: 88px;
  width: 240px;
  background: rgba(13, 13, 13, 0.85);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  z-index: 60;
  backdrop-filter: blur(24px);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transform-origin: bottom right;
  transition: all 0.35s var(--ease-fluid);
}

body.light-mode .widget-menu {
  background: rgba(255, 255, 255, 0.82);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.widget-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.widget-menu-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.widget-menu-list {
  display: flex;
  flex-direction: column;
  max-height: 340px;
  overflow-y: auto;
}

.widget-menu-item {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s var(--ease-fluid);
  border-bottom: 1px solid var(--hairline);
  color: var(--text);
}

.widget-menu-item:last-child {
  border-bottom: none;
}

.widget-menu-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--acc);
  padding-left: 20px;
}

.widget-menu-item .widget-key {
  color: var(--text-dim);
  font-size: 10px;
  font-family: var(--font-mono);
}

/* Command Palette */
.command-palette {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease-fluid), visibility 0.3s var(--ease-fluid);
}

body.light-mode .command-palette {
  background: rgba(0, 0, 0, 0.25);
}

.command-palette.open {
  opacity: 1;
  visibility: visible;
}

.command-palette-box {
  width: min(560px, 92vw);
  background: rgba(13, 13, 13, 0.9);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  backdrop-filter: blur(24px);
  transform: translateY(-10px) scale(0.98);
  transform-origin: top center;
  transition: transform 0.35s var(--ease-fluid);
}

body.light-mode .command-palette-box {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.12);
}

.command-palette.open .command-palette-box {
  transform: translateY(0) scale(1);
}

.command-palette-box input {
  width: 100%;
  padding: 18px 20px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hairline);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
  letter-spacing: 0.02em;
}

.command-palette-box input::placeholder {
  color: var(--text-dim);
}

.command-list {
  max-height: 320px;
  overflow-y: auto;
}

.command-item {
  padding: 12px 20px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s var(--ease-fluid);
  border-bottom: 1px solid var(--hairline);
  color: var(--text);
}

.command-item:last-child {
  border-bottom: none;
}

.command-item:hover,
.command-item.active {
  background: rgba(255, 255, 255, 0.04);
  color: var(--acc);
}

.command-item kbd {
  font-size: 10px;
  color: var(--text-dim);
  border: 1px solid var(--hairline);
  padding: 3px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Responsive */
@media (max-width: 1024px) {
  .top-bar-shell {
    width: calc(100% - 24px);
    top: calc(var(--header-h) + 8px);
  }

  .clocks {
    gap: 12px;
  }

  .clocks b {
    font-size: 13px;
  }

  .top-bar-left {
    gap: 12px;
  }
}

@media (max-width: 768px) {
  :root {
    --topbar-h: 48px;
  }

  .top-bar-shell {
    top: var(--header-h);
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
  }

  .top-bar {
    padding: 0 12px 0 14px;
  }

  .terminal-id {
    font-size: 11px;
  }

  .mode-label {
    display: none;
  }

  .clocks {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 4px 10px;
  }

  .clocks span {
    font-size: 9px;
  }

  .clocks b {
    font-size: 11px;
  }

  .grid-container {
    margin-top: calc(var(--header-h) + var(--topbar-h));
    padding: 8px;
  }

  .grid-stack {
    border-radius: var(--radius-sm);
    background-size: 30px 30px;
  }

  .widget-menu-toggle {
    right: 16px;
    bottom: 16px;
    width: 48px;
    height: 48px;
  }

  .widget-menu {
    right: 16px;
    bottom: 76px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* GridStack Overrides */
.grid-stack > .grid-stack-item > .grid-stack-item-content {
  inset: 5px;
}

.grid-stack > .grid-stack-item > .ui-resizable-se {
  right: 8px;
  bottom: 8px;
  background: var(--text-dim);
  border-radius: 50%;
  opacity: 0.4;
  transition: opacity 0.2s var(--ease-fluid);
}

.grid-stack > .grid-stack-item > .ui-resizable-se:hover {
  opacity: 1;
  background: var(--acc);
}

/* ── Animations ── */

/* Widget entrance: staggered fade-up */
@keyframes widget-enter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.grid-stack-item.entering {
  animation: widget-enter 0.55s var(--ease-snap) both;
}

/* Spotlight hover on widgets */
.grid-stack-item-content {
  position: relative;
}

.grid-stack-item-content::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(0, 255, 157, 0.12),
    transparent 40%
  );
  transition: opacity 0.35s var(--ease-fluid);
  z-index: 0;
}

body.light-mode .grid-stack-item-content::after {
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(37, 99, 235, 0.10),
    transparent 40%
  );
}

.grid-stack-item-content:hover::after {
  opacity: 1;
}

/* Ensure widget children stay above spotlight overlay */
.drag-handle,
.widget-body {
  position: relative;
  z-index: 2;
}

/* Magnetic floating menu button */
.widget-menu-toggle {
  will-change: transform;
}

/* Ripple for menu toggle */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.5;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

.widget-menu-toggle .ripple {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--acc);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.widget-menu-toggle.animating-ripple .ripple {
  animation: ripple 0.5s var(--ease-fluid);
}

/* Terminal title decode cursor */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.terminal-id .cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  background: var(--acc);
  margin-left: 4px;
  animation: blink 1s step-end infinite;
  vertical-align: middle;
}

/* Ambient glow slow drift */
@keyframes ambient-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(2vw, 1vh) scale(1.03); }
  66% { transform: translate(-1vw, 2vh) scale(0.98); }
}

.ambient-glow::before {
  animation: ambient-drift 20s ease-in-out infinite;
}

.ambient-glow::after {
  animation: ambient-drift 25s ease-in-out infinite reverse;
}
