:root {
  color-scheme: dark;
  --ink: #f4f7fb;
  --muted: #9aa8b7;
  --panel: #151a22;
  --panel-2: #0d1118;
  --line: #2a3441;
  --cyan: #63d9ff;
  --amber: #ffbd70;
  --danger: #ff7a90;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    linear-gradient(120deg, rgba(99, 217, 255, 0.1), transparent 35%),
    radial-gradient(circle at 75% 25%, rgba(255, 189, 112, 0.12), transparent 28%),
    #070a0f;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

.stage {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 30%),
    radial-gradient(circle at 50% 90%, rgba(99, 217, 255, 0.12), transparent 32%),
    #090d13;
}

.avatar {
  width: 100%;
  height: 100vh;
}

.loading {
  position: absolute;
  left: 24px;
  bottom: 24px;
  max-width: min(520px, calc(100% - 48px));
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(13, 17, 24, 0.82);
  color: var(--muted);
  backdrop-filter: blur(10px);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100vh;
  padding: 26px;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: -24px 0 80px rgba(0, 0, 0, 0.35);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tab {
  min-height: 38px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.tab.active {
  border-color: color-mix(in srgb, var(--cyan) 55%, var(--line));
  background: rgba(99, 217, 255, 0.1);
  color: var(--ink);
}

.panel-view {
  display: none;
}

.panel-view.active {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
}

.brand {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 13px;
  align-items: start;
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 9px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 18px rgba(255, 189, 112, 0.65);
}

.status-dot.ready {
  background: var(--cyan);
  box-shadow: 0 0 18px rgba(99, 217, 255, 0.65);
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 18px rgba(255, 122, 144, 0.7);
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 760;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.readout span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  min-height: 148px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: var(--panel-2);
  color: var(--ink);
  line-height: 1.5;
  outline: none;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--panel-2);
  color: var(--ink);
  outline: none;
}

textarea:focus,
input:focus,
select:focus,
button:focus-visible {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(99, 217, 255, 0.18);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 10px;
}

button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--cyan);
  color: #061018;
  font-weight: 760;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.07);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.secondary {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.readout {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.upload-form {
  display: grid;
  gap: 12px;
}

.dropzone {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 16px;
  border: 1px dashed color-mix(in srgb, var(--cyan) 45%, var(--line));
  border-radius: 8px;
  background: rgba(99, 217, 255, 0.06);
  cursor: pointer;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone strong {
  color: var(--ink);
}

.dropzone span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 10px;
}

.voice-grid {
  grid-template-columns: 92px minmax(0, 1fr);
}

.compact {
  gap: 6px;
}

.compact span {
  font-size: 11px;
}

.advanced {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(13, 17, 24, 0.5);
}

.advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.advanced[open] {
  display: grid;
  gap: 10px;
}

.advanced textarea {
  min-height: 76px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.icon-button {
  width: auto;
  min-height: 32px;
  padding: 0 10px;
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.model-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.model-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.model-card.active {
  border-color: var(--cyan);
}

.model-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.model-card span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.model-card button {
  min-height: 34px;
  padding: 0 10px;
}

.requirements {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 189, 112, 0.35);
  border-radius: 8px;
  background: rgba(255, 189, 112, 0.07);
}

.requirements strong {
  color: var(--amber);
  font-size: 13px;
}

.requirements ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.readout strong {
  font-size: 14px;
}

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

  .stage,
  .avatar {
    min-height: 58vh;
    height: 58vh;
  }

  .panel {
    min-height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .two-col,
  .voice-grid {
    grid-template-columns: 1fr;
  }
}
