:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f2ea;
  color: #171a1f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f2ea 0%, #e9f1ef 45%, #f7f7fb 100%);
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #15191f;
  color: #f8fafc;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eeb04f;
  color: #15191f;
  font-weight: 800;
  font-size: 24px;
}

.brand-block h1,
.topbar h2,
.result-header h3 {
  margin: 0;
}

.brand-block p,
.topbar p {
  margin: 6px 0 0;
  color: #a9b3c1;
}

.nav-tabs {
  display: grid;
  gap: 10px;
}

.nav-tab {
  border: 1px solid #303844;
  background: transparent;
  color: #cbd5e1;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
}

.nav-tab.active {
  background: #f8fafc;
  border-color: #f8fafc;
  color: #15191f;
  font-weight: 700;
}

.model-summary {
  margin-top: auto;
  display: grid;
  gap: 8px;
  color: #a9b3c1;
  font-size: 13px;
}

.model-summary strong,
.model-summary code {
  color: #f8fafc;
  word-break: break-word;
}

.community-panel {
  display: grid;
  gap: 14px;
  padding-top: 4px;
}

.community-header h2 {
  margin: 0;
  font-size: 16px;
  color: #f8fafc;
}

.community-header p {
  margin: 6px 0 0;
  color: #a9b3c1;
  font-size: 13px;
  line-height: 1.5;
}

.community-list {
  display: grid;
  gap: 12px;
}

.community-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #303844;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.community-copy {
  display: grid;
  gap: 6px;
}

.community-copy strong {
  color: #f8fafc;
  font-size: 15px;
}

.community-copy p {
  margin: 0;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.5;
}

.community-tag {
  color: #eeb04f;
  font-size: 12px;
  font-weight: 700;
}

.community-card img {
  width: 88px;
  height: 88px;
  border-radius: 8px;
  object-fit: cover;
  background: #ffffff;
}

.workspace {
  padding: 28px;
  display: grid;
  gap: 20px;
  align-content: start;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 6px;
}

.panel {
  display: none;
}

.panel.active {
  display: grid;
  gap: 18px;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: start;
}

.input-area,
.controls,
.result-block,
.status-row {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(20, 24, 31, 0.1);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(20, 24, 31, 0.08);
}

.input-area,
.controls,
.result-block {
  padding: 18px;
}

.input-area,
.controls {
  display: grid;
  gap: 12px;
}

label {
  font-weight: 700;
  color: #202632;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #cfd6dd;
  border-radius: 8px;
  padding: 11px 12px;
  background: #ffffff;
  color: #171a1f;
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: #24796f;
  box-shadow: 0 0 0 3px rgba(36, 121, 111, 0.16);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.check-row input {
  width: 18px;
  height: 18px;
  margin: 0;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-button {
  background: #24796f;
  color: #ffffff;
}

.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.ghost-button {
  background: #ffffff;
  border: 1px solid #cfd6dd;
  color: #202632;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf2f7;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.status.loading {
  background: #fff4d7;
  color: #8a5a00;
}

.status.success {
  background: #daf4ea;
  color: #176052;
}

.status.error {
  background: #ffe4e4;
  color: #a11919;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

.raw-output {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
  color: #475569;
  font-size: 13px;
  max-height: 360px;
  overflow: auto;
}

.image-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  min-height: 90px;
}

.image-results img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #d8dee6;
}

.status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
}

.video-output video {
  width: 100%;
  max-height: 520px;
  border-radius: 8px;
  background: #0f172a;
}

.video-link {
  display: inline-flex;
  margin-top: 10px;
  color: #176052;
  font-weight: 800;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .status-row {
    grid-template-columns: 1fr;
    display: grid;
  }
}
