:root {
  --bg: #080808;
  --surface: #111116;
  --surface-2: #18181f;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --muted: #9ca3af;
  --accent: #f4ff4f;
  --accent-text: #080808;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 16px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(8, 8, 8, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

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

.brand-logo {
  width: 34px;
  height: 34px;
}

.brand-title {
  display: block;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.4px;
}

.brand-sub {
  display: block;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.2px;
}

.accent {
  color: var(--accent);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.content {
  flex: 1;
  padding: 16px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  background: rgba(244, 255, 79, 0.1);
  border: 1px solid rgba(244, 255, 79, 0.25);
  padding: 6px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
  margin: 0 0 8px;
}

h2 {
  font-size: 19px;
  margin: 0 0 12px;
}

h3 {
  font-size: 15px;
  margin: 0 0 8px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.tutorial-card p {
  font-size: 14px;
  color: #d1d5db;
  line-height: 1.5;
  margin: 6px 0;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin: 12px 0 6px;
}

.field-label:first-child {
  margin-top: 0;
}

.input, .textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  padding: 13px 14px;
  outline: none;
  font-family: inherit;
}

.input:focus, .textarea:focus {
  border-color: var(--accent);
}

.textarea {
  resize: vertical;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 6px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  padding: 10px;
  border-radius: 9px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--accent);
  color: var(--accent-text);
}

.btn {
  border: none;
  border-radius: 12px;
  font-weight: 800;
  font-size: 14px;
  padding: 14px 16px;
  cursor: pointer;
  letter-spacing: 0.4px;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

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

.btn-ghost {
  background: var(--surface-2);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-full {
  width: 100%;
  margin-top: 10px;
}

.action-stack {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-pill-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.badge {
  font-size: 11px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.badge-active {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.12);
}

.badge-paused {
  color: #facc15;
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.1);
}

.feedback {
  font-size: 13px;
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
}

.feedback.error {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.14);
}

.feedback.success {
  color: #86efac;
  background: rgba(34, 197, 94, 0.14);
}

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

.logs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
}

.log-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-weight: 700;
}

.log-ok { color: #4ade80; }
.log-err { color: #f87171; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 28px 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(14, 14, 18, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
}

.nav-item {
  background: none;
  border: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
}

.nav-item svg {
  width: 20px;
  height: 20px;
}

.nav-item.active {
  color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.hidden {
  display: none !important;
}
