:root {
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #ecece5;
  background: #111411;
  font-synthesis: none;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
label.upload,
label.secondary {
  cursor: pointer;
}
button,
input {
  font: inherit;
}
button {
  color: inherit;
}
header {
  height: 82px;
  border-bottom: 1px solid #ffffff12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5vw;
}
.brand {
  color: #d7ef9a;
  text-decoration: none;
  font-size: 28px;
  letter-spacing: -1px;
}
.brand span {
  font-size: 14px;
  color: #727b6b;
  letter-spacing: 0;
  margin-left: 12px;
}
.local {
  font-size: 12px;
  color: #aebba3;
  display: flex;
  align-items: center;
  gap: 9px;
}
.local span {
  margin-left: 12px;
  color: #677060;
}
i {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #d3ed9b;
  border-radius: 50%;
}
main {
  max-width: 1440px;
  margin: auto;
  padding: 44px 5vw 20px;
}
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
}
.eyebrow {
  font-size: 10px !important;
  letter-spacing: 2.7px;
  color: #c1d98f !important;
  margin: 0 0 13px !important;
}
h1 {
  font-size: 38px;
  font-weight: 450;
  letter-spacing: -1.4px;
  margin: 0 0 12px;
}
.intro p {
  font-size: 14px;
  color: #8f9889;
  margin: 0;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
  gap: 24px;
  align-items: start;
}
.stage {
  background: #1b1f18;
  border: 1px solid #ffffff13;
  border-radius: 15px;
  overflow: hidden;
  position: sticky;
  top: 20px;
}
.stage-top,
.stage-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  color: #9ca791;
  font-size: 10px;
  letter-spacing: 1px;
}
.stage-top i {
  margin-right: 8px;
}
.portrait-wrap {
  position: relative;
  margin: 0 18px;
  overflow: hidden;
  border-radius: 8px;
  background: #282c24;
}
canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  cursor: crosshair;
}
.portrait-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 55px 22px 20px;
  background: linear-gradient(transparent, #0009);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  font-size: 12px;
}
.badge {
  font-size: 9px;
  letter-spacing: 1.5px;
  border: 1px solid #ffffff50;
  padding: 6px 9px;
  border-radius: 4px;
}
.stage-bottom {
  font-size: 11px;
  letter-spacing: 0;
  padding: 15px 22px;
}
.icon {
  border: 1px solid #ffffff20;
  background: transparent;
  width: 30px;
  height: 30px;
  border-radius: 50%;
}
aside {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.panel {
  min-width: 0;
  padding: 24px;
  background: #191d17;
  border: 1px solid #ffffff12;
  border-radius: 13px;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
h2 {
  font-size: 15px;
  font-weight: 550;
  margin: 0;
}
.section-title > span {
  font-size: 10px;
  color: #68725f;
}
.panel p {
  font-size: 12px;
  line-height: 1.7;
  color: #8d9785;
  margin: 9px 0 18px;
}
.panel p.warning {
  padding: 10px 12px;
  border: 1px solid #d9b86a66;
  border-radius: 7px;
  background: #4a3d1c55;
  color: #dec98f;
  line-height: 1.5;
}
.portrait-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 12px;
}
.portrait-card {
  min-width: 0;
  padding: 4px;
  border: 1px solid #ffffff12;
  border-radius: 8px;
  background: #22271e;
  color: #aebba3;
  text-align: left;
  cursor: pointer;
}
.portrait-card:hover {
  border-color: #d8edaa88;
}
.portrait-card.selected {
  border-color: #d8edaa;
  box-shadow: 0 0 0 1px #d8edaa44;
}
.portrait-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 5px;
  background: #30352b;
}
.portrait-card span {
  display: block;
  overflow: hidden;
  padding: 7px 3px 3px;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload.compact {
  min-height: 58px;
  padding: 12px 14px;
  flex-direction: row;
  gap: 10px;
}
.upload.compact span {
  font-size: 20px;
}
.upload.compact small {
  margin-left: auto;
}
.gallery-actions {
  margin-top: 10px;
}
.audio-transport {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
#audio-time {
  font-variant-numeric: tabular-nums;
}
.states {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 20px 0 25px;
}
.states button {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #22271e;
  border: 1px solid #ffffff10;
  border-radius: 7px;
  padding: 13px;
  font-size: 18px;
  color: #97a48b;
}
.states button span {
  font-size: 12px;
}
.states button.selected {
  background: #d8edaa;
  color: #252d1d;
  border-color: #d8edaa;
}
.slider-label {
  display: flex;
  justify-content: space-between;
  margin: 16px 0 8px;
  font-size: 12px;
  color: #b4bea9;
}
output {
  color: #86947b;
  font-size: 11px;
}
input[type="range"] {
  width: 100%;
  accent-color: #d6eda5;
  height: 4px;
  cursor: pointer;
  display: block;
  margin: 13px 0 20px;
}
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid #ffffff24;
  padding: 11px 14px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
}
.secondary:hover {
  background: #ffffff08;
}
.full {
  width: 100%;
}
.row {
  display: flex;
  gap: 9px;
}
.row > * {
  flex: 1;
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}
.upload {
  width: 100%;
  color: inherit;
  background: transparent;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 10px;
  border: 1px dashed #63714d;
  border-radius: 8px;
  padding: 20px 10px;
  background: #a6c36d06;
}
.upload > span {
  font-size: 23px;
  color: #d7ebaa;
}
.upload b {
  font-size: 12px;
  font-weight: 500;
}
.upload small {
  font-size: 10px;
  color: #75816a;
}
.hidden {
  display: none;
}
#audio-info {
  font-size: 11px;
  color: #b2c39e;
  margin: 14px 0;
  overflow-wrap: anywhere;
}
.panel p.note {
  font-size: 10px;
  margin: 14px 0 0;
  color: #6f7c63;
}
footer {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #65705d;
  letter-spacing: 0.8px;
  padding: 28px 0;
}
#status {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #d8edaa;
  color: #223018;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 12px;
  display: none;
  z-index: 10;
}
button:focus-visible,
label:focus-within,
a:focus-visible {
  outline: 2px solid #d8edaa;
  outline-offset: 4px;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  margin: 15px 0;
  color: #b4bea9;
}
.check input {
  accent-color: #d6eda5;
}
#loading {
  position: absolute;
  inset: 0;
  background: #1b1f18ed;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: #d6eda5;
  padding: 35px;
  text-align: center;
}
#loading[hidden] {
  display: none;
}
.expression-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 15px 0 22px;
}
.expression-buttons button {
  padding: 11px 5px;
  background: #22271e;
  border: 1px solid #ffffff14;
  border-radius: 6px;
  font-size: 11px;
  color: #b4bea9;
}
.expression-buttons button.selected {
  background: #d8edaa;
  color: #252d1d;
  border-color: #d8edaa;
}
#direction-info {
  min-height: 40px;
  font-size: 11px;
  color: #a5b397;
}
#floating-preview {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 170px;
  z-index: 5;
  overflow: hidden;
  background: #191d17;
  border: 1px solid #c9df9a66;
  border-radius: 12px;
  box-shadow: 0 8px 35px #0009;
}
#floating-preview[hidden] {
  display: none;
}
#mini-avatar {
  width: 100%;
  display: block;
}
#floating-preview > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  font-size: 10px;
  color: #d8edaa;
}
#back-to-portrait {
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 16px;
  cursor: pointer;
}
#mouth-detail {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  margin: 16px 0 20px;
  background: #10120f;
  cursor: default;
}
@media (max-width: 850px) {
  main {
    padding: 28px 20px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .stage {
    position: static;
  }
  .intro {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  h1 {
    font-size: 28px;
  }
  .intro > .secondary {
    padding: 9px 12px;
  }
  header {
    padding: 0 20px;
    height: 65px;
  }
  footer {
    gap: 20px;
    line-height: 1.6;
  }
  .local span {
    display: none;
  }
}
@media (max-width: 360px) {
  main {
    padding: 20px 10px;
  }
  .panel {
    padding: 18px;
  }
  .row {
    flex-wrap: wrap;
  }
  .brand span {
    margin-left: 5px;
  }
  .local {
    font-size: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}

/* The embedded studio adds export/apply actions; keep the introduction readable. */
.intro { flex-wrap: wrap; }
.intro > div:first-child { flex: 1 1 320px; }
.intro > .row { flex: 1 1 100%; flex-wrap: wrap; }
.intro > .row > * { flex: 0 1 auto; }
@media(max-width:600px) {
  .intro > .row > * { flex: 1 1 145px; text-align:center; }
}

.intro > .intro-upload{flex:0 1 350px;margin:0;padding:22px 26px;cursor:pointer;text-align:left;align-items:start;border:1px dashed #c1d98f88;background:#c1d98f0d;min-width:0}
.intro > .intro-upload:hover{background:#c1d98f1a;border-color:#d9ecad}
.intro > .intro-upload small{line-height:1.5}
.intro > .intro-upload b{font-size:17px}
@media(max-width:700px){.intro > .intro-upload{flex:1 1 100%;width:100%}}

.conversation-voice{margin:4px 0 22px;padding-bottom:18px;border-bottom:1px solid #ffffff15}
.conversation-voice label{display:block;font-size:13px;color:#d9ecad;margin-bottom:10px}
.conversation-voice select{width:100%;border:1px solid #5d6d48;border-radius:12px;background:#151b12;color:#eff6e5;font:inherit;padding:12px;cursor:pointer}
.conversation-voice p{font-size:11px;line-height:1.6;margin-bottom:0}

.secondary.send-to-chat { background: #d7ef9a; border-color: #d7ef9a; color: #111411; font-weight: 650; }
.secondary.send-to-chat:hover { background: #e5f6be; }

.portrait-item { position: relative; min-width: 0; }
.portrait-item .portrait-card { width: 100%; height: 100%; }
.portrait-remove { position: absolute; top: 7px; right: 7px; width: 28px; height: 28px; border: 1px solid #ffffff55; border-radius: 50%; background: #182019ee; color: #fff; font-size: 22px; line-height: 1; display: grid; place-items: center; }
.portrait-remove:hover { background: #763d3d; }
.portrait-remove:focus-visible { outline: 2px solid #d7ef9a; outline-offset: 2px; }
.portrait-undo { grid-column: 1 / -1; white-space: normal; }

.send-to-chat-action { display: flex; flex-direction: column; align-items: stretch; gap: 8px; max-width: 260px; }
.send-to-chat-action small { color: #aebba3; font-size: 11px; line-height: 1.5; white-space: normal; }
.intro > .row { align-items: flex-start; }
