:root {
  color-scheme: light;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --ink: #18212f;
  --muted: #64748b;
  --line: #d8e1eb;
  --paper: #fffdf8;
  --accent: #1f9a8a;
  --accent-dark: #14756b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 18%, rgba(31, 154, 138, 0.13), transparent 28%),
    linear-gradient(135deg, #f8fbff 0%, #fff8ed 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app {
  width: min(1120px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 360px;
  gap: 28px;
  align-items: center;
  padding: 32px 0;
}

.stage {
  position: relative;
  min-height: 640px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid rgba(216, 225, 235, 0.86);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.48)),
    repeating-linear-gradient(
      90deg,
      rgba(31, 154, 138, 0.06) 0,
      rgba(31, 154, 138, 0.06) 1px,
      transparent 1px,
      transparent 42px
    );
  box-shadow: 0 28px 80px rgba(39, 56, 84, 0.14);
}

#live2dCanvas {
  width: 100%;
  height: 100%;
  min-height: 640px;
  display: block;
}

.loading {
  position: absolute;
  inset: auto auto 24px 24px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.loading.is-hidden {
  display: none;
}

.loading.is-error {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.25);
}

.panel {
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 18px 50px rgba(39, 56, 84, 0.12);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.14;
  letter-spacing: 0;
}

.intro {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

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

button,
.upload {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
}

#speakButton {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

#micButton {
  background: #18212f;
  border-color: #18212f;
  color: #ffffff;
}

button:hover,
.upload:hover {
  transform: translateY(-1px);
}

.upload {
  grid-column: 1 / -1;
  position: relative;
}

.upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

audio {
  width: 100%;
}

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

.meter span::before {
  content: "口型开合";
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.meter div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ecf3;
}

.meter i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f9a8a, #f2b84b);
  transition: width 80ms linear;
}

.notes {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    align-content: start;
  }

  .stage,
  #live2dCanvas {
    min-height: 520px;
  }

  .panel {
    padding: 22px;
  }

  h1 {
    font-size: 28px;
  }
}
