/* ============================================
   DESIGN TOKENS
   ============================================ */

:root {
  --bg: #0f0f12;
  --bg-2: #16161c;
  --surface: #17171d;
  --surface-soft: #1d1d24;
  --line: #2e2e38;
  --line-strong: #facc15;
  --text: #f5f5f7;
  --muted: #a7a8af;
  --accent: #facc15;
  --accent-2: #eab308;

  /* Spacing scale */
  --sp-4: 4px;
  --sp-8: 8px;
  --sp-12: 12px;
  --sp-16: 16px;
  --sp-24: 24px;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  /* Timing */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 200ms;
}

/* ============================================
   RESET & BASE
   ============================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
}

body {
  width: 390px;
  min-height: 560px;
  background:
    radial-gradient(circle at 15% 0%, rgba(250, 204, 21, 0.16), transparent 34%),
    radial-gradient(circle at 95% 10%, rgba(250, 204, 21, 0.1), transparent 42%),
    linear-gradient(180deg, var(--bg), #0b0b0d);
  color: var(--text);
  padding: var(--sp-16);
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   LAYOUT
   ============================================ */

.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 60% -10%, rgba(250, 204, 21, 0.08), transparent 45%);
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
}

.shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-12);
}

.hidden {
  display: none !important;
}

/* ============================================
   HERO HEADER
   ============================================ */

.hero {
  display: flex;
  gap: var(--sp-12);
  align-items: center;
  background: linear-gradient(180deg, rgba(28, 28, 34, 0.95), rgba(20, 20, 25, 0.96));
  border: 1px solid #2c2c35;
  border-top: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-12);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
  transition: box-shadow var(--dur) var(--ease);
}

.hero-logo {
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  object-fit: cover;
  border: 1px solid #393943;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-kicker {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  color: var(--accent);
  font-weight: 800;
}

.hero-title {
  font-size: 14px;
  line-height: 1.25;
  font-weight: 800;
  color: var(--text);
}

.hero-subtitle {
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
}

/* ============================================
   SURFACE CARD
   ============================================ */

.surface {
  width: 100%;
  background: linear-gradient(180deg, var(--surface), #131319);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.36);
  padding: var(--sp-16);
}

/* ============================================
   VIEWS (SETUP / MAIN / PROFILE)
   ============================================ */

.setup-view,
.main-view {
  display: flex;
  flex-direction: column;
  gap: var(--sp-12);
}

.setup-top {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.setup-step-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.65px;
  color: var(--accent);
  font-weight: 800;
}

.section-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.15px;
}

.setup-help {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.setup-input {
  width: 100%;
  border-radius: var(--r-md);
  border: 1px solid #3a3a45;
  background: #1d1d25;
  color: var(--text);
  padding: var(--sp-12);
  font-size: 13px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.setup-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.14);
}

.setup-actions {
  display: flex;
  gap: var(--sp-8);
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-8);
}

.top-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  border: none;
  border-radius: var(--r-md);
  padding: 10px var(--sp-16);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    all var(--dur) var(--ease),
    transform 120ms var(--ease);
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #111111;
  box-shadow: 0 4px 12px rgba(250, 204, 21, 0.2);
}

.btn.primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 6px 18px rgba(250, 204, 21, 0.3);
}

.btn.primary:disabled {
  background: #454956;
  color: #9095a4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.dark {
  background: linear-gradient(180deg, #24242e, #1a1a22);
  color: #f5f5f7;
  border: 1px solid #3a3a45;
}

.btn.dark:hover:not(:disabled) {
  border-color: #505060;
  background: linear-gradient(180deg, #2a2a34, #1e1e28);
}

.btn.dark:disabled {
  background: #3f4047;
  color: #8f9098;
  border-color: #4b4b54;
  cursor: not-allowed;
}

.btn.ghost {
  background: linear-gradient(180deg, #24242d, #1a1a22);
  color: #f6f6f7;
  border: 1px solid #3a3a44;
}

.btn.ghost:hover:not(:disabled) {
  border-color: #505060;
  background: linear-gradient(180deg, #2a2a34, #1e1e28);
}

.btn.ghost.danger {
  color: #ffb3b3;
  border-color: #632a2a;
}

.btn.ghost.danger:hover:not(:disabled) {
  border-color: #8a3a3a;
  background: linear-gradient(180deg, #2a1a1a, #1f1515);
}

.btn.ghost:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.small {
  padding: 6px 10px;
  font-size: 11px;
}

/* Loading spinner for buttons */
.btn.loading {
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #111;
  border-radius: 50%;
  animation: ls-spin 600ms linear infinite;
}

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

/* ============================================
   FORM ELEMENTS
   ============================================ */

.select,
textarea,
input {
  width: 100%;
  border-radius: var(--r-md);
  border: 1px solid #383843;
  background: #1d1d25;
  color: var(--text);
  font-size: 12px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.select {
  padding: var(--sp-8) 10px;
}

textarea {
  resize: vertical;
  min-height: 64px;
  padding: 10px var(--sp-12);
  line-height: 1.5;
}

input {
  padding: var(--sp-8) 10px;
}

textarea::placeholder,
input::placeholder {
  color: #7f8088;
  transition: opacity var(--dur) var(--ease);
}

textarea:focus::placeholder,
input:focus::placeholder {
  opacity: 0.5;
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.14);
}

/* ============================================
   CODE PREVIEW
   ============================================ */

.code-preview {
  background: #101015;
  color: #f4f4f7;
  border: 1px solid #2c2c35;
  border-radius: var(--r-md);
  padding: var(--sp-12);
  font-size: 11px;
  line-height: 1.5;
  max-height: 130px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Menlo, monospace;
  scrollbar-width: thin;
  scrollbar-color: #48506a #101015;
}

.code-preview:empty::before {
  content: "Code preview appears here after extraction.";
  color: #7f8088;
  font-style: italic;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
}

/* ============================================
   SECTIONS & ROWS
   ============================================ */

.section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.section label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  font-weight: 800;
  color: #c8c8ce;
}

.row {
  display: flex;
  gap: var(--sp-8);
}

.complexity-row {
  align-items: center;
}

.complexity-input {
  flex: 1;
  min-width: 0;
  height: 34px;
}

/* ============================================
   FOOTER & STATUS
   ============================================ */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-8);
}

.hint {
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}

.status {
  min-height: 20px;
  border: 1px solid #33333d;
  background: #1a1a21;
  border-radius: var(--r-sm);
  padding: 6px var(--sp-8);
  font-size: 11.5px;
  text-align: center;
  color: #f5f5f7;
  transition: all var(--dur) var(--ease);
}

.status.success {
  color: #fff2a5;
  border-color: #6d5f20;
  background: #2a2410;
}

.status.error {
  color: #ffb3b3;
  border-color: #6c3030;
  background: #251516;
}

/* ============================================
   PROFILE VIEW
   ============================================ */

.profile-view {
  display: flex;
  flex-direction: column;
  gap: var(--sp-12);
}

.profile-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(250, 204, 21, 0.2);
  border-radius: var(--r-lg);
  padding: var(--sp-16);
  display: flex;
  flex-direction: column;
  gap: var(--sp-12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  transition: border-color var(--dur) var(--ease);
}

.profile-card:hover {
  border-color: rgba(250, 204, 21, 0.35);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: #1e2333;
  border: 1px solid #3a3f4f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  transition: border-color var(--dur) var(--ease);
}

.profile-card:hover .avatar {
  border-color: rgba(250, 204, 21, 0.4);
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-name {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
}

.profile-meta {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-8);
}
