:root {
  --bg-color: #0b0f19;
  --surface-color: #111827;
  --surface-border: #1f293d;
  --surface-hover: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.25);
  --accent: #a855f7;
  --success: #10b981;
  --warning: #f59e0b;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

.app-container {
  width: 100%;
  max-width: 1040px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--surface-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-mark {
  font-size: 2.2rem;
  color: var(--primary);
  filter: drop-shadow(0 0 10px var(--primary-glow));
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* Grid Layout */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  background-color: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 1rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
}

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

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.badge {
  background-color: rgba(56, 189, 248, 0.15);
  color: var(--primary);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Output Display */
.display-container {
  background-color: #060911;
  border: 1px solid var(--surface-border);
  border-radius: 0.75rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 180px;
}

.primary-result {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 0 25px var(--primary-glow);
  word-break: break-all;
  line-height: 1.1;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.primary-result.pulse {
  transform: scale(1.08);
  opacity: 0.8;
}

.result-details {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Controls */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.control-group label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

select, input[type="number"] {
  background-color: #060911;
  border: 1px solid var(--surface-border);
  border-radius: 0.5rem;
  color: var(--text-main);
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
}

select:focus, input[type="number"]:focus {
  border-color: var(--primary);
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.range-inputs input {
  flex: 1;
  font-family: var(--font-mono);
}

.range-inputs span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.primary-btn {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #ffffff;
  border: none;
  border-radius: 0.5rem;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: transform 0.1s ease, filter 0.2s ease;
}

.primary-btn:hover {
  filter: brightness(1.1);
}

.primary-btn:active {
  transform: scale(0.98);
}

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.metric-box {
  background-color: #060911;
  border: 1px solid var(--surface-border);
  border-radius: 0.6rem;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

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

.mini-btn {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--primary);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mini-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
}

.mini-btn.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--success);
}

#mic-canvas {
  width: 100%;
  height: 24px;
  background: #020617;
  border-radius: 4px;
  display: block;
  margin: 0.2rem 0;
}

.metric-source {
  font-size: 0.65rem;
  background-color: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.metric-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.metric-value .unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: normal;
}

.metric-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.font-mono {
  font-family: var(--font-mono);
}

/* Hash Box */
.hash-box {
  background-color: #060911;
  border: 1px solid var(--surface-border);
  border-radius: 0.6rem;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hash-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.hash-algo {
  font-size: 0.65rem;
  color: var(--accent);
  font-family: var(--font-mono);
}

.hash-display {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  word-break: break-all;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

/* History Card */
.history-card {
  grid-column: 1 / -1;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.8rem;
  background-color: #060911;
  border: 1px solid var(--surface-border);
  border-radius: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.history-val {
  font-weight: 700;
  color: var(--primary);
}

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

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

.text-btn:hover {
  color: var(--text-main);
}

.footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 1rem 0;
  border-top: 1px solid var(--surface-border);
}

.footer code {
  color: var(--primary);
  font-family: var(--font-mono);
}
