* { box-sizing: border-box; }
html, body, #main { min-height: 100%; margin: 0; }
body {
  background: #fafbfd;
  color: #10141c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv01", "cv03", "cv04", "cv11", "ss03";
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { letter-spacing: -0.024em; }
button, textarea, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: progress; opacity: 0.62; }
::selection { background: #cfe0ff; }
@keyframes mspin { to { transform: rotate(360deg); } }
@keyframes mfade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.top-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 62px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e8ebf1;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 18px; cursor: pointer; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: #2563eb; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(37,99,235,.35); }
.brand-mark div { width: 9px; height: 9px; background: #fff; border-radius: 2px; transform: rotate(45deg); }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: 26px; }
.nav-links button { border: 0; background: transparent; color: #5a6473; border-radius: 8px; padding: 8px 13px; font-size: 14px; font-weight: 500; }
.nav-links .active { color: #2563eb; background: #edf2ff; font-weight: 600; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.search { display: flex; align-items: center; gap: 8px; width: 230px; padding: 8px 12px; background: #f4f6f9; border: 1px solid #eaedf2; border-radius: 9px; color: #939dad; font-size: 13px; }
.search span { margin-left: auto; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11px; color: #b3bac7; border: 1px solid #e0e4ec; border-radius: 4px; padding: 1px 5px; }
.credits { padding: 7px 12px; border: 1px solid #e5e9f0; border-radius: 9px; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 13px; font-weight: 500; }
.avatar { width: 34px; height: 34px; border-radius: 9px; background: #2563eb; color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 600; }

.page { max-width: 1400px; margin: 0 auto; padding: 40px 40px 90px; display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 32px; animation: mfade .25s ease; }
.model-rail { display: grid; align-content: start; gap: 10px; }
.eyebrow { color: #2563eb; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; }
.model-card { width: 100%; text-align: left; background: #fff; border: 1px solid #e8ebf1; border-radius: 14px; padding: 15px 16px; box-shadow: 0 1px 2px rgba(16,20,28,.03); }
.model-card.selected { border-color: #bcd0ff; box-shadow: 0 0 0 3px rgba(37,99,235,.09); }
.model-card strong { display: block; margin-top: 7px; font-size: 15px; }
.model-card small { display: block; margin-top: 5px; color: #939dad; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11.5px; }
.model-category { color: #3a4453; background: #f4f6f9; border: 1px solid #e8ebf1; border-radius: 7px; padding: 3px 8px; font-size: 11px; font-weight: 600; }

.model-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.title-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.title-row h1 { font-size: 30px; font-weight: 700; }
.category-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: #3a4453; background: #f4f6f9; border: 1px solid #e5e9f0; border-radius: 8px; padding: 6px 11px; }
.model-title p { margin-top: 14px; max-width: 710px; color: #5a6473; font-size: 15.5px; line-height: 1.55; text-wrap: pretty; }
.model-title a { display: inline-flex; margin-top: 13px; color: #2563eb; font-size: 14px; font-weight: 500; text-decoration: none; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tags span { font-size: 12.5px; font-weight: 500; color: #3a4453; background: #f4f6f9; border: 1px solid #e8ebf1; border-radius: 7px; padding: 4px 10px; }
.auth-card { display: flex; align-items: center; gap: 8px; color: #5a6473; font-size: 13px; }
.auth-card button, .ghost, .select-btn, .settings-block button, .code-head button { padding: 8px 13px; background: #fff; border: 1px solid #e0e4ec; border-radius: 9px; color: #3a4453; font-size: 13.5px; font-weight: 600; }
.auth-card button:first-of-type { color: #fff; background: #2563eb; border-color: #2563eb; }

.tabs { display: flex; gap: 4px; margin-top: 30px; border-bottom: 1px solid #e8ebf1; }
.tab { padding: 12px 16px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: #7a8494; font-size: 14.5px; font-weight: 500; }
.tab.active { color: #10141c; border-bottom-color: #2563eb; font-weight: 600; }

.playground-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 24px; align-items: start; margin-top: 26px; }
.panel { background: #fff; border: 1px solid #e8ebf1; border-radius: 16px; box-shadow: 0 1px 2px rgba(16,20,28,.03); }
.input-panel, .result-panel { padding: 24px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.panel-title h2 { font-size: 17px; font-weight: 600; }
.field-label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; margin-bottom: 9px; }
.field-label span { color: #2563eb; }
.field-label.spaced { margin-top: 24px; }
.prompt-box, .url-input { width: 100%; border: 1px solid #e0e4ec; border-radius: 11px; background: #fcfdfe; color: #10141c; outline: none; }
.prompt-box { min-height: 96px; padding: 14px; resize: vertical; font-size: 14.5px; line-height: 1.5; }
.url-input { padding: 12px 13px; font-size: 14px; font-family: "IBM Plex Mono", ui-monospace, monospace; }
.hint { margin-top: 8px; color: #b3bac7; font-size: 12px; }
.upload-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.optional-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.video-thumb, .add-tile { position: relative; width: 172px; height: 104px; border-radius: 11px; overflow: hidden; border: 1px solid #e0e4ec; background: repeating-linear-gradient(135deg,#eaeef4 0 9px,#f2f5f9 9px 18px); }
.video-thumb { display: grid; place-items: center; }
.play { width: 34px; height: 34px; border-radius: 50%; background: rgba(16,20,28,.55); }
.video-thumb span { position: absolute; left: 8px; bottom: 7px; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 10.5px; color: #fff; background: rgba(16,20,28,.6); padding: 2px 6px; border-radius: 5px; }
.add-tile { border: 1.5px dashed #d2d8e2; background: #fcfdfe; display: grid; place-items: center; color: #939dad; font-size: 20px; font-weight: 500; }
.add-tile small { display: block; font-size: 12.5px; }
.settings-block { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; padding-top: 20px; border-top: 1px solid #eef1f6; }
.settings-block h3 { font-size: 14px; }
.settings-block p { margin-top: 2px; color: #939dad; font-size: 12.5px; }
.button-row { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; }
.run { display: flex; align-items: center; gap: 9px; padding: 11px 22px; background: #2563eb; border: 0; border-radius: 10px; color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.run.slim { padding: 8px 14px; box-shadow: none; }
.run span { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; opacity: .7; background: rgba(255,255,255,.18); padding: 2px 6px; border-radius: 5px; }

.result-stack { display: grid; gap: 20px; }
.result-title { display: flex; align-items: center; gap: 11px; }
.status { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 7px; color: #7a8494; background: #f0f3f8; }
.status.success { color: #15924e; background: #e7f6ee; }
.status.error { color: #d5413e; background: #fbecec; }
.status.running { color: #1b4dcc; background: #edf2ff; }
.segmented { display: flex; gap: 3px; padding: 3px; background: #f4f6f9; border: 1px solid #eaedf2; border-radius: 9px; }
.segmented span { font-size: 13px; font-weight: 500; color: #7a8494; padding: 5px 11px; border-radius: 7px; }
.segmented .active { color: #10141c; background: #fff; border: 1px solid #e5e9f0; font-weight: 600; }
.media-frame { position: relative; aspect-ratio: 16/9; border-radius: 13px; overflow: hidden; background: #11161f; display: flex; align-items: center; justify-content: center; border: 1px solid #1c2433; }
.media-frame video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.empty-result { display: flex; flex-direction: column; align-items: center; gap: 14px; color: #aeb8c8; font-size: 13.5px; font-weight: 500; }
.play-outline { width: 38px; height: 38px; border: 2px solid #374154; border-radius: 10px; }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.18); border-top-color: #6f9bff; border-radius: 50%; animation: mspin .8s linear infinite; }
.next-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.blue { padding: 10px 16px; background: #2563eb; border: 0; border-radius: 10px; color: #fff; font-size: 14px; font-weight: 600; }
.price-note { margin-top: 18px; color: #7a8494; font-size: 13.5px; line-height: 1.6; }
.price-note strong { color: #10141c; }
.logs-panel { overflow: hidden; }
.logs-title { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #eef1f6; }
.logs-title h3 { font-size: 15px; font-weight: 600; }
.logs-title span { color: #939dad; font-size: 12.5px; font-weight: 500; }
.log-box { min-height: 140px; background: #0e1320; color: #cdd6e6; padding: 18px 20px; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12.5px; line-height: 1.85; }

.api-grid { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 24px; margin-top: 26px; }
.endpoint-api-grid { grid-template-columns: minmax(0,1fr) 360px; }
.api-main { display: grid; gap: 20px; }
.api-key-card { padding: 22px; }
.api-key-card h3, .api-aside h3 { margin-bottom: 12px; font-size: 13.5px; font-weight: 600; }
code { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.code-panel { overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #eef1f6; }
pre { margin: 0; padding: 22px; background: #0e1320; color: #cdd6e6; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 13px; line-height: 1.75; overflow-x: auto; white-space: pre-wrap; }
.api-aside { display: grid; gap: 16px; align-content: start; }
.api-aside .panel { padding: 18px; }
.req-field { display: flex; justify-content: space-between; gap: 12px; margin-top: 11px; font-size: 13px; }
.req-field code { color: #2563eb; }
.req-field span { color: #939dad; }
.webhook-note { background: #edf2ff; border: 1px solid #d6e2ff; border-radius: 14px; padding: 18px; color: #3a5bb5; font-size: 12.5px; line-height: 1.6; }
.webhook-note strong { display: block; color: #1b4dcc; margin-bottom: 6px; font-size: 13px; }
.endpoint-catalog { overflow: hidden; }
.api-runner { padding: 20px; }
.api-runner .panel-title { margin-bottom: 16px; }
.json-input { width: 100%; min-height: 170px; padding: 13px; border: 1px solid #e0e4ec; border-radius: 11px; background: #fcfdfe; color: #10141c; outline: none; resize: vertical; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12.5px; line-height: 1.6; }
.json-input.small { min-height: 82px; }
.endpoint-catalog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px 20px; border-bottom: 1px solid #eef1f6; }
.endpoint-catalog-head h3 { font-size: 16px; font-weight: 600; }
.endpoint-catalog-head p { margin-top: 5px; color: #7a8494; font-size: 13px; line-height: 1.5; }
.endpoint-catalog-head span { min-width: 38px; padding: 6px 10px; border-radius: 999px; background: #edf2ff; color: #1b4dcc; text-align: center; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; font-weight: 600; }
.endpoint-list { max-height: 460px; overflow: auto; }
.endpoint-row { display: grid; grid-template-columns: 72px minmax(0,1fr) 120px; gap: 12px; width: 100%; align-items: center; padding: 13px 18px; border: 0; border-bottom: 1px solid #f0f3f8; background: #fff; text-align: left; }
.endpoint-row:hover, .endpoint-row.selected { background: #f7f9ff; }
.endpoint-row.selected { box-shadow: inset 3px 0 0 #2563eb; }
.endpoint-method { display: inline-flex; justify-content: center; min-width: 54px; padding: 4px 8px; border-radius: 7px; background: #10141c; color: #fff; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11px; font-style: normal; font-weight: 600; letter-spacing: .03em; }
.endpoint-row strong { display: block; overflow: hidden; color: #10141c; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.endpoint-row small { display: block; overflow: hidden; margin-top: 4px; color: #7a8494; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.endpoint-row em { overflow: hidden; color: #939dad; font-size: 12px; font-style: normal; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.endpoint-empty { padding: 24px 20px; color: #7a8494; font-size: 13px; }
.endpoint-detail-route { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.endpoint-detail-route code { color: #10141c; font-size: 12px; word-break: break-all; }
.endpoint-detail p { margin-bottom: 14px; color: #5a6473; font-size: 13px; line-height: 1.55; }
.response-list { margin-top: 18px; }
.response-list span { display: block; margin-top: 7px; color: #5a6473; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11.5px; line-height: 1.45; }

.requests-view { margin-top: 26px; }
.requests-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.requests-header h2 { font-size: 21px; font-weight: 600; }
.search-wide, .empty-history { background: #fff; border: 1px solid #e8ebf1; border-radius: 11px; padding: 13px 14px; color: #b3bac7; font-size: 13.5px; margin-bottom: 16px; }
.request-row { display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid #e8ebf1; border-radius: 12px; padding: 13px 16px; box-shadow: 0 1px 2px rgba(16,20,28,.02); margin-bottom: 10px; }
.request-thumb { width: 64px; height: 42px; border-radius: 8px; flex: none; background: repeating-linear-gradient(135deg,#e6eaf1 0 7px,#eff2f7 7px 14px); display: grid; place-items: center; }
.play-small { width: 13px; height: 13px; background: rgba(16,20,28,.45); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.request-row small { display: block; color: #939dad; margin-top: 3px; font-size: 12.5px; }
.request-row strong { color: #3a4453; min-width: 130px; font-size: 13.5px; }
.row-cost { margin-left: auto; text-align: right; }

.analytics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 26px; }
.stat-card { padding: 20px; }
.stat-card span { display: block; color: #939dad; font-size: 13px; font-weight: 500; }
.stat-card strong { display: block; margin-top: 8px; font-size: 28px; font-weight: 600; }
.stat-card small { display: block; margin-top: 8px; color: #15924e; font-size: 12.5px; font-weight: 500; }

@media (max-width: 980px) {
  .top-actions .search { display: none; }
  .page { grid-template-columns: 1fr; padding: 28px 18px 70px; }
  .model-rail { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
  .playground-grid, .api-grid, .analytics-grid, .optional-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .nav-links, .credits { display: none; }
  .top-nav { padding: 0 14px; }
  .model-header, .requests-header { align-items: stretch; flex-direction: column; }
  .request-row { align-items: flex-start; flex-direction: column; }
  .row-cost { margin-left: 0; text-align: left; }
}
