:root {
  --bg: #0b1020;
  --bg-soft: rgba(15, 23, 42, 0.78);
  --panel: rgba(17, 24, 39, 0.88);
  --border: rgba(148, 163, 184, 0.18);
  --text: #e5eefb;
  --muted: #9fb0cb;
  --accent: #7dd3fc;
  --accent-strong: #38bdf8;
  --danger: #fb7185;
  --success: #4ade80;
  --warning: #fbbf24;
  --shadow: 0 24px 60px rgba(2, 6, 23, 0.42);
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.2), transparent 30%),
    radial-gradient(circle at top right, rgba(125, 211, 252, 0.14), transparent 28%),
    linear-gradient(160deg, #050816 0%, #0b1020 45%, #111827 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.background-glow {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.35;
  pointer-events: none;
}

.background-glow-one { top: 5%; left: 8%; width: 16rem; height: 16rem; background: #0ea5e9; }
.background-glow-two { right: 6%; bottom: 6%; width: 18rem; height: 18rem; background: #22c55e; }

.auth-shell,
.studio-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1rem;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-card,
.panel,
.status-card,
.studio-sidebar {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.78));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card {
  width: min(460px, 100%);
  border-radius: 28px;
  padding: 2rem;
}

.studio-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
  min-height: 100vh;
  align-items: start;
}

.studio-sidebar {
  border-radius: 28px;
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 1rem;
}

.studio-main {
  display: grid;
  gap: 1rem;
}

.panel,
.status-card {
  border-radius: var(--radius);
  padding: 1.25rem;
}

.panel { display: grid; gap: 1rem; }

.panel-header,
.gallery-header,
.status-row,
.button-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.button-row { flex-wrap: wrap; }
.right-align { justify-content: flex-end; }

h1, h2, h3, p { margin: 0; }

h1 { font-size: 2rem; letter-spacing: -0.03em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.lede,
.muted,
.status-label { color: var(--muted); }

.auth-form,
.upload-form,
.prompt-form {
  display: grid;
  gap: 0.85rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  color: var(--muted);
}

input,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(2, 6, 23, 0.45);
  color: var(--text);
  padding: 0.9rem 1rem;
  font: inherit;
}

textarea { resize: vertical; min-height: 110px; }

.primary-button,
.secondary-button,
.ghost-button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.8rem 1.1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.primary-button { background: linear-gradient(135deg, var(--accent-strong), #0f766e); }
.secondary-button { background: rgba(148, 163, 184, 0.12); border-color: rgba(148, 163, 184, 0.2); }
.ghost-button { background: transparent; border-color: rgba(148, 163, 184, 0.2); }
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover { transform: translateY(-1px); }
.full-width { width: 100%; }

.status-dot {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  background: var(--warning);
  box-shadow: 0 0 0 0.35rem rgba(251, 191, 36, 0.12);
}

.status-value { font-size: 1.15rem; font-weight: 700; }

.conversation-area,
.gallery-grid {
  display: grid;
  gap: 0.75rem;
}

.conversation-area {
  min-height: 360px;
  max-height: 48vh;
  overflow: auto;
  padding-right: 0.35rem;
}

.message {
  max-width: 78%;
  border-radius: 18px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(2, 6, 23, 0.34);
}

.message.user { margin-left: auto; background: rgba(8, 47, 73, 0.5); }
.message.assistant { margin-right: auto; }
.message-meta { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.3rem; }

.gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.gallery-item {
  border-radius: 18px;
  min-height: 132px;
  border: 1px dashed rgba(148, 163, 184, 0.2);
  background: linear-gradient(160deg, rgba(148, 163, 184, 0.08), rgba(2, 6, 23, 0.12));
  padding: 0.9rem;
  display: grid;
  align-content: end;
  gap: 0.35rem;
}

.gallery-item strong,
.gallery-item span { overflow-wrap: anywhere; }

.placeholder-card {
  border-radius: 18px;
  border: 1px dashed rgba(125, 211, 252, 0.28);
  padding: 1rem;
  color: var(--muted);
}

.alert {
  border-radius: 16px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(248, 113, 113, 0.25);
  background: rgba(127, 29, 29, 0.25);
  color: #fecaca;
}

@media (max-width: 980px) {
  .studio-shell { grid-template-columns: 1fr; }
  .studio-sidebar { position: static; }
}

@media (max-width: 640px) {
  .auth-shell,
  .studio-shell { width: min(100vw - 1rem, 100%); padding: 0.5rem; }
  .auth-card,
  .panel,
  .status-card,
  .studio-sidebar { border-radius: 22px; }
  .message { max-width: 100%; }
}
