:root {
  --bg: #0c1118;
  --text: #e8eef6;
  --dim: #8fa3b8;
  --mute: #5c7086;
  --accent: #3dffa8;
  --model: #f0a46a;
  --font: "Sora", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.92em;
  color: var(--model);
}

.model-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(240, 164, 106, 0.12), transparent 55%),
    radial-gradient(700px 400px at 92% 0%, rgba(61, 255, 168, 0.06), transparent 50%),
    linear-gradient(180deg, #10161f 0%, var(--bg) 50%, #090d12 100%);
}

.model-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(148, 174, 204, 0.12);
}

.model-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.model-brand__mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: url("/static/img/logo.png") center / contain no-repeat;
  flex-shrink: 0;
}

.model-brand__name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.model-brand__tag {
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(240, 164, 106, 0.35);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--model);
}

.model-top__note {
  flex: 1;
  min-width: 200px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--mute);
}

.model-top__home {
  font-size: 13px;
  color: var(--dim);
}

.model-top__home:hover {
  color: var(--text);
}

.model-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  min-height: 0;
}

.model-side {
  padding: 24px 20px 28px;
  border-right: 1px solid rgba(148, 174, 204, 0.1);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
}

.model-side h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.model-side__lead {
  font-size: 14px;
  line-height: 1.5;
  color: var(--dim);
}

.model-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed rgba(240, 164, 106, 0.4);
  background: rgba(240, 164, 106, 0.06);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.model-upload:hover {
  border-color: rgba(240, 164, 106, 0.7);
  background: rgba(240, 164, 106, 0.1);
}

.model-upload input {
  display: none;
}

.model-upload span {
  font-size: 13px;
  font-weight: 600;
  color: var(--model);
  text-align: center;
}

.model-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-btn {
  padding: 9px 14px;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #0c1118;
  background: linear-gradient(135deg, var(--model), var(--accent));
  cursor: pointer;
}

.model-btn--ghost {
  background: transparent;
  color: var(--dim);
  border: 1px solid rgba(148, 174, 204, 0.2);
}

.model-btn--ghost:hover {
  color: var(--text);
  border-color: rgba(148, 174, 204, 0.4);
}

.model-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--mute);
}

.model-ai {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(110, 200, 255, 0.18);
  background: rgba(110, 200, 255, 0.05);
}

.model-ai__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.model-ai__head h2 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6ec8ff;
}

.model-ai__head span {
  font-size: 11px;
  color: var(--mute);
}

.model-ai__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.model-ai__chips button {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 174, 204, 0.18);
  background: rgba(8, 12, 18, 0.45);
  color: var(--dim);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.model-ai__chips button:hover {
  color: var(--text);
  border-color: rgba(110, 200, 255, 0.4);
}

.model-ai__chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 160px;
  overflow: auto;
  min-height: 48px;
}

.model-ai__msg {
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: 8px;
}

.model-ai__msg--user {
  align-self: flex-end;
  background: rgba(110, 200, 255, 0.12);
  color: var(--text);
  max-width: 95%;
}

.model-ai__msg--bot {
  align-self: flex-start;
  background: rgba(8, 12, 18, 0.55);
  color: var(--dim);
  max-width: 95%;
  border: 1px solid rgba(148, 174, 204, 0.1);
}

.model-ai__msg--err {
  color: #ff8e8e;
  border-color: rgba(255, 110, 110, 0.25);
}

.model-ai__form {
  display: flex;
  gap: 6px;
}

.model-ai__form input {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid rgba(148, 174, 204, 0.18);
  background: rgba(8, 12, 18, 0.7);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.model-ai__form input:focus {
  outline: none;
  border-color: rgba(110, 200, 255, 0.45);
}

.model-ai__form button {
  flex-shrink: 0;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #0c1118;
  background: linear-gradient(135deg, #6ec8ff, var(--accent));
  cursor: pointer;
}

.model-ai__form button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.model-blender {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(148, 174, 204, 0.1);
}

.model-blender h2 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 10px;
}

.model-blender ol {
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--dim);
  margin-bottom: 10px;
}

.model-blender p {
  font-size: 12px;
  line-height: 1.45;
  color: var(--mute);
}

.model-stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 420px;
  background: #070b10;
}

.model-stage__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  border-bottom: 1px solid rgba(148, 174, 204, 0.1);
}

.model-stage__bar span:last-child {
  letter-spacing: 0.04em;
  font-weight: 500;
  text-transform: none;
  color: var(--accent);
}

#model-canvas {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: block;
  touch-action: none;
}

.model-library-block {
  margin: 14px 0;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 174, 204, 0.12);
}
.model-library-block h2 {
  margin: 0 0 4px;
  font-size: 0.85rem;
}
.model-library {
  max-height: 160px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.model-library__row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(10, 16, 24, 0.7);
  border: 1px solid rgba(148, 174, 204, 0.12);
  font-size: 0.72rem;
}
.model-library__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #d7e2ee;
  font-family: ui-monospace, monospace;
}
.model-library__kind {
  color: #3dffa8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 0 0 auto;
}
.model-library__empty {
  margin: 0;
  color: #7f91a6;
  font-size: 0.78rem;
}

@media (max-width: 820px) {
  .model-layout {
    grid-template-columns: 1fr;
  }

  .model-side {
    border-right: none;
    border-bottom: 1px solid rgba(148, 174, 204, 0.1);
  }

  .model-stage {
    min-height: 55vh;
  }
}
