:root {
  color-scheme: light;
  --ink: #111816;
  --ink-soft: #394740;
  --muted: #66736d;
  --paper: #f7f6f1;
  --surface: rgba(255, 255, 255, .86);
  --surface-strong: #ffffff;
  --line: rgba(17, 24, 22, .13);
  --jade: #1f806c;
  --jade-soft: #dff1ec;
  --gold: #c8963f;
  --red: #a43e32;
  --shadow: 0 26px 70px rgba(22, 31, 28, .16);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 14%, rgba(31, 128, 108, .13), transparent 28rem),
    linear-gradient(180deg, #fbfaf6 0%, #eef4f0 53%, #fbfaf6 100%);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(17, 24, 22, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 22, .035) 1px, transparent 1px);
  background-size: 44px 44px;
  content: "";
}

#wordField {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .62;
}

body.modal-open {
  overflow: hidden;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr auto;
  align-items: center;
  gap: 22px;
  padding: 18px 0;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: min(260px, 100%);
}

.brand img {
  display: block;
  width: 100%;
  height: auto;
}

.top-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 15px;
}

.top-nav a,
.header-action,
.icon-button,
.ghost-button,
.copy-button,
.secondary-button,
.primary-button,
.mode-tab,
.auth-tab {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
}

.top-nav a:hover {
  background: rgba(255, 255, 255, .72);
  border-color: var(--line);
}

.header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 12px 30px rgba(17, 24, 22, .18);
  white-space: nowrap;
}

.header-account {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.header-user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .72);
}

.header-user span {
  max-width: 160px;
  overflow: hidden;
  padding-left: 10px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-section {
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(520px, 1.35fr);
  align-items: center;
  gap: 42px;
  min-height: calc(100vh - 92px);
  padding: 22px 0 64px;
}

.intro-block {
  max-width: 500px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--jade);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 20px;
  font-size: clamp(40px, 5vw, 72px);
  line-height: 1.04;
  font-weight: 800;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.14;
}

h3 {
  margin-bottom: 12px;
  font-size: 22px;
}

.lede {
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.82;
}

.signal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.signal-row span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(31, 128, 108, .22);
  border-radius: var(--radius);
  color: var(--jade);
  background: rgba(223, 241, 236, .7);
  font-size: 14px;
  font-weight: 700;
}

.text-studio {
  border: 1px solid rgba(17, 24, 22, .14);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  overflow: hidden;
}

.studio-toolbar,
.control-strip,
.output-head {
  display: flex;
  align-items: center;
}

.studio-toolbar {
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  gap: 6px;
  width: min(420px, 100%);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 24, 22, .04);
}

.mode-tab {
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.mode-tab.is-active {
  color: var(--ink);
  background: #fff;
  border-color: rgba(17, 24, 22, .12);
  box-shadow: 0 8px 24px rgba(17, 24, 22, .08);
}

.ghost-button,
.copy-button {
  padding: 0 14px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .64);
  border-color: var(--line);
}

.studio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 390px;
}

.is-hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 22, .52);
  backdrop-filter: blur(16px);
}

.auth-dialog {
  width: min(460px, 100%);
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 34px 90px rgba(17, 24, 22, .28);
  padding: 22px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.dialog-head h2 {
  font-size: 28px;
}

.icon-button {
  width: 42px;
  color: var(--ink-soft);
  background: rgba(17, 24, 22, .05);
  border-color: var(--line);
  font-size: 26px;
  line-height: 1;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 24, 22, .04);
  margin-bottom: 16px;
}

.auth-tab {
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab.is-active {
  color: var(--ink);
  background: #fff;
  border-color: rgba(17, 24, 22, .12);
  box-shadow: 0 8px 24px rgba(17, 24, 22, .08);
}

.modal-form {
  display: grid;
  gap: 13px;
}

.modal-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.modal-form input {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, .9);
  outline: none;
}

.modal-form input:focus {
  border-color: rgba(31, 128, 108, .48);
  box-shadow: 0 0 0 3px rgba(31, 128, 108, .12);
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 8px;
}

.secondary-button {
  padding: 0 12px;
  color: var(--jade);
  background: var(--jade-soft);
  border-color: rgba(31, 128, 108, .2);
  font-weight: 800;
  white-space: nowrap;
}

.status-line {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-line[data-type="success"] {
  color: var(--jade);
}

.status-line[data-type="error"] {
  color: var(--red);
}

.editor-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  padding: 18px;
}

.editor-pane + .editor-pane {
  border-left: 1px solid var(--line);
}

.editor-pane > span,
.output-head span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

textarea,
.output-text {
  width: 100%;
  min-height: 320px;
  margin-top: 12px;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 17px;
  line-height: 1.78;
}

textarea {
  resize: none;
  outline: none;
}

.output-pane {
  background:
    linear-gradient(rgba(31, 128, 108, .07), rgba(31, 128, 108, 0) 42%),
    rgba(255, 255, 255, .42);
}

.output-head {
  justify-content: space-between;
  gap: 12px;
}

.output-text {
  white-space: pre-wrap;
}

.control-strip {
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .72);
}

.range-control,
.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.range-control input {
  width: 150px;
  accent-color: var(--jade);
}

.toggle-control input {
  width: 18px;
  height: 18px;
  accent-color: var(--jade);
}

.primary-button {
  min-width: 150px;
  padding: 0 18px;
  color: #fff;
  background: var(--jade);
  box-shadow: 0 12px 30px rgba(31, 128, 108, .24);
}

.section-band {
  padding: 84px 0 34px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.scene-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.scene-card {
  min-height: 220px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 18px 44px rgba(17, 24, 22, .08);
}

.scene-kicker {
  display: inline-flex;
  margin-bottom: 36px;
  color: var(--gold);
  font-weight: 800;
}

.scene-card p,
.voice-section p,
.site-footer p {
  color: var(--muted);
  line-height: 1.76;
}

.voice-section {
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(240px, .7fr) minmax(260px, .8fr);
  align-items: center;
  gap: 28px;
  padding: 76px 0;
}

.voice-meter {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  gap: 10px;
  height: 160px;
  padding: 18px;
  border: 1px solid rgba(17, 24, 22, .12);
  border-radius: var(--radius);
  background: rgba(17, 24, 22, .92);
}

.voice-meter span {
  display: block;
  min-height: 28px;
  border-radius: 999px 999px 6px 6px;
  background: linear-gradient(180deg, #f0c878, #57b59a);
  animation: pulseBar 1.8s ease-in-out infinite;
}

.voice-meter span:nth-child(1) {
  height: 42%;
}

.voice-meter span:nth-child(2) {
  height: 72%;
  animation-delay: .16s;
}

.voice-meter span:nth-child(3) {
  height: 96%;
  animation-delay: .32s;
}

.voice-meter span:nth-child(4) {
  height: 64%;
  animation-delay: .48s;
}

.voice-meter span:nth-child(5) {
  height: 50%;
  animation-delay: .64s;
}

.site-footer {
  padding: 34px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
}

.footer-main {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(220px, .8fr) minmax(220px, .8fr);
  align-items: start;
  gap: 28px;
  padding-bottom: 24px;
}

.footer-brand strong {
  color: var(--ink);
  font-size: 22px;
}

.footer-brand p {
  max-width: 360px;
  margin: 10px 0 0;
  line-height: 1.7;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .52);
  color: var(--ink-soft);
  font-weight: 700;
}

.footer-contact {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.footer-contact span,
.footer-bottom {
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: var(--jade);
  font-weight: 800;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(17, 24, 22, .08);
}

@keyframes pulseBar {
  0%,
  100% {
    transform: scaleY(.76);
  }

  45% {
    transform: scaleY(1);
  }
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 220px 1fr;
  }

  .top-nav {
    display: none;
  }

  .header-action {
    justify-self: end;
  }

  .workspace-section {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 40px;
  }

  .intro-block {
    max-width: 760px;
  }

  .voice-section {
    grid-template-columns: 1fr;
  }

  .footer-main {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-contact {
    justify-items: start;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 22px, 1180px);
  }

  .site-header {
    grid-template-columns: 190px auto;
    gap: 12px;
  }

  .header-action {
    min-height: 38px;
    padding: 0 12px;
    font-size: 14px;
  }

  h1 {
    font-size: 42px;
  }

  .lede {
    font-size: 16px;
  }

  .studio-toolbar,
  .control-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-tabs {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
  }

  .studio-grid,
  .scene-grid {
    grid-template-columns: 1fr;
  }

  .editor-pane + .editor-pane {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  textarea,
  .output-text {
    min-height: 230px;
    font-size: 16px;
  }

  .range-control {
    justify-content: space-between;
  }

  .range-control input {
    width: min(170px, 52vw);
  }

  .primary-button,
  .ghost-button,
  .copy-button {
    width: 100%;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .voice-meter {
    height: 126px;
  }

  .site-footer {
    padding-bottom: 32px;
  }

  .footer-main,
  .footer-bottom {
    grid-template-columns: 1fr;
  }

  .footer-main,
  .footer-bottom {
    display: grid;
  }

  .footer-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .footer-links a {
    justify-content: center;
  }

  .footer-bottom {
    gap: 8px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 12px;
  }

  .auth-dialog {
    padding: 18px;
  }
}

@media (max-width: 420px) {
  .site-header {
    grid-template-columns: 1fr;
  }

  .brand {
    width: 190px;
  }

  .header-action {
    justify-self: stretch;
  }

  h1 {
    font-size: 36px;
  }
}
