:root {
  --bg: #07090f;
  --panel: #10141e;
  --panel-2: #171c28;
  --text: #f4f6fb;
  --muted: #929bad;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #9eff00;
  --accent-2: #6d5cff;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(109, 92, 255, 0.22), transparent 38%),
    radial-gradient(circle at 95% 20%, rgba(158, 255, 0, 0.08), transparent 32%),
    var(--bg);
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }

.shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 22px 16px 100px;
}

.topbar, .section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; letter-spacing: -0.04em; }
h2 { font-size: clamp(30px, 9vw, 48px); line-height: 0.98; letter-spacing: -0.055em; }
h3 { margin-bottom: 0; font-size: 20px; letter-spacing: -0.03em; }

.balance {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}
.balance { cursor: pointer; }

.balance strong { color: var(--text); }
.balance-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.hero {
  position: relative;
  overflow: hidden;
  margin: 28px 0 18px;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(109, 92, 255, 0.2), rgba(16, 20, 30, 0.8));
}

.hero::after {
  position: absolute;
  right: -45px;
  bottom: -70px;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(158, 255, 0, 0.26);
  border-radius: 50%;
  content: "";
  box-shadow: inset 0 0 60px rgba(158, 255, 0, 0.07);
}

.hero h2 { max-width: 570px; margin-bottom: 14px; }
.hero p:last-child { max-width: 460px; margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.hero-label { color: var(--accent); font-size: 13px; font-weight: 700; }

.workspace-panel {
  margin: 0 0 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 20, 30, 0.82);
}
.workspace-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.workspace-controls label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.workspace-controls select, .memory-card textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--bg);
}
.secondary.compact { margin: 0; padding: 11px 13px; font-size: 12px; }
.memory-card { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.memory-card summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.memory-card textarea { margin: 10px 0; resize: vertical; }
.memory-card small { display: block; margin-top: 8px; }
.chat-messages { display: grid; gap: 9px; }
.chat-message { max-width: 90%; padding: 12px 14px; border-radius: 15px; white-space: pre-wrap; line-height: 1.45; }
.chat-message.user { justify-self: end; background: rgba(109, 92, 255, 0.28); }
.chat-message.assistant { justify-self: start; border: 1px solid var(--line); background: var(--panel); }
.chat-message small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.conversation-context { margin: 0 0 14px; color: var(--accent); font-size: 12px; }

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -16px 28px;
  padding: 0 16px;
  scrollbar-width: none;
}

.filter {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 15px;
  background: var(--panel);
}

.filter.active { border-color: var(--accent); color: #071000; background: var(--accent); }
.section-title { margin-bottom: 14px; }
.section-title span { color: var(--muted); font-size: 13px; }

.catalog {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.model-card {
  min-height: 190px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  background: linear-gradient(150deg, var(--panel-2), var(--panel));
  transition: transform 140ms ease, border-color 140ms ease;
}

.model-card:active { transform: scale(0.98); border-color: rgba(158, 255, 0, 0.6); }
.model-card.unavailable { cursor: not-allowed; opacity: .48; filter: grayscale(.35); }
.model-card.unavailable:active { transform: none; border-color: var(--line); }
.model-icon { display: block; margin-bottom: 32px; font-size: 28px; }
.model-card strong { display: block; margin-bottom: 8px; font-size: 16px; }
.model-card p { margin-bottom: 16px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.model-price { color: var(--accent); font-size: 12px; font-weight: 800; }

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(5px);
}

.sheet {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  width: min(100%, 760px);
  max-height: 88vh;
  margin: auto;
  padding: 26px 20px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 28px 28px 0 0;
  background: #111621;
  box-shadow: 0 -30px 90px rgba(0, 0, 0, 0.5);
}

.sheet h2 { margin-bottom: 12px; font-size: 34px; }
.sheet-close {
  float: right;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 25px;
  background: rgba(255, 255, 255, 0.04);
}

.sheet-description, .refund-note { color: var(--muted); line-height: 1.5; }
.parameter-box { margin: 22px 0; }
.prompt-box { display: block; margin: 20px 0 12px; }
.prompt-box span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.prompt-box textarea, .prompt-box input[type="file"] {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: var(--bg);
}
.prompt-box textarea { resize: vertical; min-height: 118px; }
.parameter-box label { display: block; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.parameter-box input {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: var(--bg);
}

.quote-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  margin: 22px 0 14px;
  padding: 18px;
  border: 1px solid rgba(158, 255, 0, 0.22);
  border-radius: 18px;
  background: rgba(158, 255, 0, 0.055);
}

.quote-box span { color: var(--muted); }
.quote-box strong { color: var(--accent); }
.quote-box small { grid-column: 1 / -1; color: var(--muted); }
.primary {
  width: 100%;
  padding: 16px;
  border: 0;
  border-radius: 16px;
  color: #0b0d10;
  font-weight: 850;
  background: var(--accent);
}
.primary:disabled { opacity: 0.48; }
.secondary {
  width: 100%;
  margin-top: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  font-weight: 750;
  background: var(--panel-2);
}
.terms-row { display: flex; align-items: flex-start; gap: 8px; margin: 14px 2px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.terms-row a { color: var(--accent); }
.status { min-height: 20px; margin: 12px 2px 0; color: var(--accent); font-size: 13px; }
.refund-note { margin: 12px 4px 0; text-align: center; font-size: 12px; }
.history-section { margin-top: 34px; }
.link-button { border: 0; color: var(--accent); background: transparent; }
.jobs { display: grid; gap: 10px; }
.job-card { padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.job-head { display: flex; justify-content: space-between; gap: 10px; }
.job-card small, .muted { color: var(--muted); }
.job-result { margin: 10px 0 0; white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.job-id { display: block; margin-top: 7px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; word-break: break-all; }
.job-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.job-files button { padding: 8px 10px; border: 0; border-radius: 10px; color: #071000; background: var(--accent); font-size: 12px; font-weight: 700; cursor: pointer; }
.job-files button:disabled { cursor: wait; opacity: .6; }
.retry-button { width: 100%; margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: var(--panel-2); }
.ledger { display: grid; gap: 8px; }
.ledger-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.ledger-row div { display: grid; gap: 4px; }
.ledger-row small, .ledger-row span { color: var(--muted); font-size: 11px; }
.ledger-row span { text-align: right; }
.status-pill { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.status-pill.succeeded { color: var(--accent); }
.status-pill.failed { color: #ff7f7f; }
.service-footer {
  margin-top: 42px;
  padding: 22px 0 calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.service-footer nav { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.service-footer a { color: var(--text); text-decoration: none; }
.service-footer p { margin: 13px 0 0; line-height: 1.5; }
[hidden] { display: none !important; }

@media (min-width: 620px) {
  .catalog { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .workspace-controls { grid-template-columns: 1fr; }
}

