:root {
  --bg-dark: #0a0d14;
  --bg-card: #121723;
  --bg-card-hover: #171e2e;
  --bg-card-glass: rgba(18, 23, 35, 0.75);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(245, 158, 11, 0.5);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --amber-primary: #f59e0b;
  --amber-light: #fbbf24;
  --amber-glow: rgba(245, 158, 11, 0.25);
  
  --cyan-primary: #06b6d4;
  --cyan-light: #22d3ee;
  --cyan-glow: rgba(6, 182, 212, 0.25);
  
  --emerald-primary: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  
  --danger-primary: #ef4444;
  --font-ui: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-ui);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(245, 158, 11, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 25%, rgba(6, 182, 212, 0.05) 0%, transparent 40%),
    linear-gradient(180deg, rgba(10, 13, 20, 0.8) 0%, var(--bg-dark) 100%);
  background-attachment: fixed;
}

/* App Wrapper */
.app-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px 40px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Navigation Bar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid var(--amber-glow);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.cookie-icon {
  font-size: 24px;
  z-index: 2;
  transition: var(--transition);
}

.brand-logo:hover .cookie-icon {
  transform: scale(1.15) rotate(15deg);
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  border: 2px solid var(--amber-primary);
  opacity: 0;
  animation: pulseAnim 2.5s infinite;
}

@keyframes pulseAnim {
  0% { transform: scale(0.95); opacity: 0.8; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-title .highlight {
  background: linear-gradient(135deg, var(--amber-primary), var(--amber-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--cyan-light);
}

/* Cluster Status Indicator */
.nav-cluster-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card-glass);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(8px);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.status-indicator.live {
  background-color: var(--emerald-primary);
  box-shadow: 0 0 8px var(--emerald-primary);
  animation: blink 2s infinite;
}

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

.status-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.status-latency {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 2px 6px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan-light);
  border-radius: var(--radius-sm);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  transition: var(--transition);
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--amber-primary), #d97706);
  color: #000;
  box-shadow: 0 4px 14px var(--amber-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-outline {
  background: transparent;
  color: var(--cyan-light);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.btn-outline:hover {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--cyan-light);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

/* Wallet Dropdown */
.wallet-control-wrapper {
  position: relative;
}

.wallet-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 6px;
  backdrop-filter: blur(16px);
}

.wallet-dropdown.hidden {
  display: none;
}

.wallet-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.wallet-option:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--border-focus);
}

.wallet-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  background: rgba(6, 182, 212, 0.2);
  color: var(--cyan-light);
  border-radius: var(--radius-full);
}

.wallet-connected-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.connected-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.connected-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.connected-address {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--cyan-light);
  word-break: break-all;
}

.connected-balance {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--amber-light);
}

/* Real-Time Metrics Bar */
.ticker-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 24px 0 28px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
}

.metric-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.metric-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.metric-val-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}

.text-amber { color: var(--amber-light) !important; }
.text-cyan { color: var(--cyan-light) !important; }

.badge-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.badge-tag.green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-primary);
}

/* Tabs Navigation */
.tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: #fff;
  background: rgba(245, 158, 11, 0.12);
  border-bottom: 2px solid var(--amber-primary);
}

/* Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.panel-card.glow-amber {
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: 0 8px 30px rgba(245, 158, 11, 0.05);
}

.panel-card.glow-cyan {
  border-color: rgba(6, 182, 212, 0.3);
  box-shadow: 0 8px 30px rgba(6, 182, 212, 0.05);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.pill-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber-light);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.pill-badge.cyan {
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan-light);
  border-color: rgba(6, 182, 212, 0.3);
}

/* Epoch Progress */
.epoch-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.epoch-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.epoch-val {
  font-family: var(--font-mono);
  color: var(--amber-light);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber-primary), var(--cyan-primary));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.epoch-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 0.8rem;
}

.sub-stat-title {
  color: var(--text-muted);
}

.sub-stat-val {
  font-family: var(--font-mono);
  color: var(--text-primary);
  margin-left: 6px;
}

/* Slot Stream */
.live-pulse-stream h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.slot-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.slot-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border-left: 3px solid var(--amber-primary);
}

/* Perks List */
.perks-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.perk-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.perk-icon {
  font-size: 1.4rem;
  background: rgba(255, 255, 255, 0.04);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.perk-body h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.perk-body p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Forms & Inputs */
.search-bar-wrapper {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.input-text {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  transition: var(--transition);
}

.input-text:focus {
  outline: none;
  border-color: var(--amber-primary);
  box-shadow: 0 0 10px var(--amber-glow);
}

.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-addon-group {
  display: flex;
  position: relative;
  align-items: center;
}

.addon-tag {
  position: absolute;
  right: 14px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--amber-light);
  pointer-events: none;
}

.tx-fees-preview {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
}

.fee-row {
  display: flex;
  justify-content: space-between;
}

.fee-val {
  font-family: var(--font-mono);
  font-weight: 600;
}

.form-actions {
  display: flex;
  gap: 12px;
}

/* Console Log Window */
.console-log-window {
  background: #090c12;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  height: 240px;
  overflow-y: auto;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-entry { color: var(--text-secondary); }
.log-entry.sys { color: var(--amber-light); }
.log-entry.info { color: var(--cyan-light); }
.log-entry.success { color: var(--emerald-primary); }
.log-entry.err { color: var(--danger-primary); }

.btn-clear-logs {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-clear-logs:hover { color: #fff; }

/* Inspector Results */
.inspector-results {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
}

.inspector-results.hidden { display: none; }

.result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.result-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  background: rgba(245, 158, 11, 0.2);
  color: var(--amber-light);
  border-radius: var(--radius-sm);
}

.result-address {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--cyan-light);
  word-break: break-all;
}

.inspector-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.info-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.info-val {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
}

.link-external {
  display: inline-block;
  color: var(--cyan-light);
  font-size: 0.85rem;
  text-decoration: none;
  transition: var(--transition);
}

.link-external:hover {
  text-decoration: underline;
  color: #fff;
}

/* RPC Playground */
.section-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.playground-presets {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.preset-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-preset {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-preset:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--cyan-light);
  color: #fff;
}

.rpc-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.editor-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.code-editor, .code-output {
  width: 100%;
  height: 220px;
  background: #090c12;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.4;
  overflow: auto;
}

.code-editor {
  resize: vertical;
  margin-bottom: 12px;
}

.code-editor:focus {
  outline: none;
  border-color: var(--cyan-light);
}

.code-output {
  color: var(--cyan-light);
  white-space: pre-wrap;
  word-break: break-all;
}

/* Ecosystem Cards */
.ecosystem-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.ecosystem-card:hover {
  border-color: var(--amber-glow);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.eco-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.ecosystem-card h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.ecosystem-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
  flex-grow: 1;
}

.eco-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--amber-light);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.eco-link:hover {
  color: #fff;
  transform: translateX(3px);
}

/* Footer */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding-top: 24px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.rpc-ping-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-right: 8px;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--amber-primary);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { border-left-color: var(--emerald-primary); }
.toast.error { border-left-color: var(--danger-primary); }

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

/* Responsive */
@media (max-width: 900px) {
  .ticker-bar { grid-template-columns: repeat(2, 1fr); }
  .panel-grid-2 { grid-template-columns: 1fr; }
  .panel-grid-3 { grid-template-columns: 1fr; }
  .rpc-editor-grid { grid-template-columns: 1fr; }
  .inspector-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .ticker-bar { grid-template-columns: 1fr; }
  .navbar { flex-direction: column; gap: 14px; align-items: flex-start; }
  .search-bar-wrapper { flex-direction: column; }
}
