﻿:root {
  --bg: #f7f7f8;
  --panel-bg: #ffffff;
  --text: #19191a;
  --text-muted: #82828b;
  --border: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(0, 0, 0, 0.2);
  --accent-base: #19191a;
  --accent-hover: #323236;
  --accent-glow: rgba(0, 0, 0, 0.1);
  --danger: #e5484d;
  --shadow-fly: 0 12px 24px -10px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.02);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 1), 0 1px 2px rgba(0, 0, 0, 0.04);
  --radius: 6px;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --transition: 0.15s cubic-bezier(0.2, 0, 0, 1);
}

[data-theme="dark"] {
  --bg: #0C0C0C;
  --panel-bg: #141414;
  --text: #EDEDED;
  --text-muted: #8F8F8F;
  --border: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(255, 255, 255, 0.3);
  --accent-base: #EDEDED;
  --accent-hover: #FFFFFF;
  --accent-glow: rgba(255, 255, 255, 0.15);
  --shadow-fly: 0 12px 24px -10px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.8);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 1px 2px rgba(0, 0, 0, 0.2);
}

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

html {
  font-size: 14px; /* compact */
  scroll-behavior: smooth;
  color-scheme: light dark;
}

body {
  background-color: var(--bg);
  background-image: radial-gradient(circle at 50% 0%, var(--accent-glow), transparent 400px);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  justify-content: center;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 4px;
  transition: var(--transition);
}

a:hover {
  text-decoration-color: var(--text);
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
  outline: none;
  background: none;
  border: none;
}

button {
  cursor: pointer;
  transition: var(--transition);
}

.shell {
  width: 100%;
  max-width: 920px; /* tightly constrained */
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Minimal Hero */
.hero {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-switch {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chip-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}

.chip-link:hover {
  color: var(--text);
}

.toggle-btn {
  color: var(--text-muted);
  display: flex;
  padding: 6px;
  border-radius: var(--radius);
}

.toggle-btn:hover {
  color: var(--text);
  background-color: rgba(125, 125, 125, 0.1);
}

.theme-icon {
  width: 16px;
  height: 16px;
}

.hero-kicker {
  display: flex;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.hero-copy h1 {
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  margin-bottom: 4px;
}

.hero-note {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Architecture */
.layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr; /* precise asymmetric split */
  gap: 24px;
  align-items: start;
}

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

/* Elevated Panel */
.panel {
  background-color: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-fly);
}

.panel-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.panel-title h2 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.panel-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Advanced Form Fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}

.tag {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Linear-style inputs */
.input-shell, .textarea-shell {
  display: flex;
  align-items: center;
  background-color: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

[data-theme="dark"] .input-shell, 
[data-theme="dark"] .textarea-shell {
  background-color: rgba(255, 255, 255, 0.02);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.input-shell:focus-within, .textarea-shell:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1.5px var(--border-focus);
}

.input-icon {
  padding: 0 10px;
  color: var(--text-muted);
  display: flex;
}

.input-icon svg {
  width: 14px;
  height: 14px;
}

.input-shell input, .input-shell select, .textarea-shell textarea {
  width: 100%;
  padding: 8px 10px 8px 0;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.input-shell select {
  appearance: none;
  cursor: pointer;
  padding-left: 10px;
}

.select-shell {
  position: relative;
}

.select-shell::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--text-muted);
  pointer-events: none;
}

.textarea-shell textarea {
  padding: 10px;
  min-height: 70px;
  resize: vertical;
}

/* Craft Buttons */
.toolbar {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.action-btn, .ghost-btn, .pill-btn {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  user-select: none;
}

/* Primary Button High-End Contrast */
.action-btn {
  background-color: var(--accent-base);
  color: var(--bg);
  flex: 1;
  box-shadow: var(--shadow-inset);
}

[data-theme="dark"] .action-btn {
  color: #000;
}

.action-btn:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

.action-btn:active {
  transform: translateY(0);
}

/* Secondary Button */
.ghost-btn {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.ghost-btn:hover {
  background-color: rgba(125, 125, 125, 0.05);
}

.pill-btn {
  color: var(--text-muted);
}

.pill-btn:hover {
  color: var(--text);
  background-color: rgba(125, 125, 125, 0.08);
}

.tiny-btn {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.hidden {
  display: none !important;
}

/* Inline Card */
.panel-card {
  padding: 12px;
  background-color: rgba(125, 125, 125, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

/* Code / Terminal Block */
.rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.terminal-card {
  background-color: #0c0c0c; /* strict black */
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: var(--shadow-fly);
  overflow: hidden;
  color: #e5e5e5;
}

[data-theme="light"] .terminal-card {
  background-color: #FAFAFA; /* light IDE execution block */
  border: 1px solid var(--border);
  color: #111;
}

.terminal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background-color: rgba(255,255,255,0.02);
}

[data-theme="light"] .terminal-top {
  border-bottom: 1px solid var(--border);
  background-color: #F0F0F0;
}

.dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.dot.red { background-color: #e5484d; }
.dot.amber { background-color: #f5a623; }
.dot.green { background-color: #30a46c; }

.terminal-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: #888;
  font-family: var(--font-mono);
}

.console {
  padding: 12px;
  min-height: 140px;
  max-height: 280px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  word-break: break-all;
}

.console span {
  display: block;
  margin-bottom: 2px;
}

.console span::before {
  content: '→';
  color: #888;
  margin-right: 6px;
}

.console span.error { color: var(--danger); }
.console span.error::before { content: '×'; color: var(--danger); margin-right: 6px; }
.console span.success { color: #30a46c; }
.console span.success::before { content: '✓'; color: #30a46c; margin-right: 6px; }
.console span.info::before { content: '·'; color: #666; margin-right: 6px; }

.terminal-actions {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
  background-color: rgba(255,255,255,0.02);
}

[data-theme="light"] .terminal-actions {
  border-top: 1px solid var(--border);
  background-color: #F0F0F0;
}

.terminal-note {
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #888;
  border-top: 1px dashed rgba(255,255,255,0.1);
}

[data-theme="light"] .terminal-note {
  border-top-color: var(--border);
  color: var(--text-muted);
}

/* Results block */
.result {
  border: 1px solid var(--border);
  background-color: var(--panel-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 0.9rem;
}

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

.result.success .status-dot { background-color: #30a46c; }
.result.error .status-dot { background-color: var(--danger); }

.result-body {
  font-size: 0.85rem;
  color: var(--text-muted);
  word-break: break-all;
}

.otp-code {
  display: block;
  font-size: 1.8rem;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  color: var(--text);
  padding: 12px;
  text-align: center;
  background: rgba(125, 125, 125, 0.04);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.dual-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.dual-actions > * {
  flex: 1;
}

/* Spinner precise styling */
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(125,125,125,0.3);
  border-radius: 50%;
  border-top-color: currentColor;
  animation: spin 0.6s linear infinite;
}

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

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(125, 125, 125, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(125, 125, 125, 0.5); }

/* Animation */
.fade-in {
  animation: glideIn 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
}

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

.input-shell select option {
  background-color: var(--panel-bg);
  color: var(--text);
}
