:root {
  --bg: #11110f;
  --panel: rgba(250, 248, 241, 0.94);
  --panel-soft: rgba(255, 252, 244, 0.72);
  --ink: #1d1c19;
  --muted: #6e6a61;
  --line: rgba(29, 28, 25, 0.12);
  --accent: #f25f3a;
  --accent-strong: #db4928;
  --play-red: #f04438;
  --pause-green: #24b47e;
  --teal: #1d8a83;
  --stage: #070807;
  --cream: #fbf4df;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  color-scheme: light dark;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 15% 20%, rgba(242, 95, 58, 0.18), transparent 30%),
    linear-gradient(135deg, #10100f 0%, #22231e 42%, #0e1616 100%);
  color: var(--ink);
}

button,
textarea,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: clamp(14px, 2vw, 28px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 24px);
  min-height: calc(100vh - clamp(28px, 4vw, 56px));
}

.script-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.05;
}

.status-pill {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: #e8f4ef;
  color: #237064;
  font-size: 12px;
  font-weight: 700;
}

.field-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

textarea {
  width: 100%;
  flex: 1;
  min-height: 360px;
  resize: none;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.75;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

textarea:focus {
  border-color: rgba(29, 138, 131, 0.6);
  background: #fffdfa;
  box-shadow: 0 0 0 4px rgba(29, 138, 131, 0.12);
}

.script-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.button,
.toggle,
.icon-button,
.play-button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  transition:
    transform 150ms ease,
    background 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease;
}

.button:active,
.toggle:active,
.icon-button:active,
.play-button:active {
  transform: translateY(1px);
}

.button.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 28px rgba(242, 95, 58, 0.24);
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.secondary {
  background: rgba(29, 28, 25, 0.08);
  color: var(--ink);
}

.button.secondary:hover {
  background: rgba(29, 28, 25, 0.13);
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#importInput {
  position: fixed;
  top: -100vh;
  left: -100vw;
  width: 0;
  height: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.prompter-stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  min-width: 0;
  min-height: 0;
}

.topbar,
.control-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(8, 10, 10, 0.68);
  color: white;
  backdrop-filter: blur(18px);
}

.recording-chip,
.top-actions,
.toggle-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recording-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

.record-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--play-red);
  box-shadow: 0 0 0 6px rgba(240, 68, 56, 0.16);
  transition:
    background 150ms ease,
    box-shadow 150ms ease;
}

.recording-chip.is-playing .record-dot {
  background: var(--pause-green);
  box-shadow: 0 0 0 6px rgba(36, 180, 126, 0.16);
}

.icon-button {
  width: 42px;
  min-width: 42px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 20px;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.prompter-frame {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(7, 8, 7, 0.98), rgba(7, 8, 7, 0.9)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 42px);
  box-shadow: var(--shadow);
}

.prompter-frame::before,
.prompter-frame::after {
  position: absolute;
  left: 0;
  z-index: 3;
  width: 100%;
  height: 20%;
  content: "";
  pointer-events: none;
}

.prompter-frame::before {
  top: 0;
  background: linear-gradient(180deg, var(--stage), transparent);
}

.prompter-frame::after {
  bottom: 0;
  background: linear-gradient(0deg, var(--stage), transparent);
}

.focus-band {
  position: absolute;
  top: 42%;
  left: 0;
  z-index: 2;
  width: 100%;
  height: 24%;
  border-block: 1px solid rgba(242, 95, 58, 0.42);
  background: linear-gradient(90deg, transparent, rgba(242, 95, 58, 0.12), transparent);
  opacity: 1;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.prompter-frame.no-focus .focus-band {
  opacity: 0;
}

.prompter-text {
  position: absolute;
  top: 52%;
  left: 50%;
  width: min(88%, 980px);
  margin: 0;
  color: var(--cream);
  font-size: 52px;
  font-weight: 800;
  line-height: 1.55;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.75);
  transform: translate(-50%, 0);
  will-change: transform;
  white-space: pre-wrap;
}

.prompter-frame.mirror .prompter-text {
  transform: translate(-50%, 0) scaleX(-1);
}

.control-dock {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) minmax(160px, 1fr) auto;
  padding: 12px;
}

.play-button {
  width: 58px;
  height: 58px;
  min-height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  color: var(--play-red);
  font-size: 24px;
  box-shadow: 0 16px 32px rgba(242, 95, 58, 0.26);
}

.play-button.is-playing {
  color: var(--pause-green);
  box-shadow: 0 16px 32px rgba(36, 180, 126, 0.24);
}

.range-control {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) 34px;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 10px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.toggle-group {
  min-width: max-content;
}

.toggle {
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.78);
}

.toggle.is-active {
  background: var(--cream);
  color: var(--ink);
}

body.stage-fullscreen {
  background: #050505;
}

.prompter-stage:fullscreen {
  padding: 16px;
  background: #050505;
}

.prompter-stage:fullscreen .prompter-frame {
  min-height: calc(100vh - 118px);
}

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

  .prompter-stage {
    order: -1;
  }

  .script-panel {
    min-height: 430px;
  }

  .prompter-frame {
    min-height: 58vh;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 10px;
  }

  .script-panel {
    padding: 18px;
  }

  .brand-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .control-dock {
    grid-template-columns: 1fr;
  }

  .script-actions {
    grid-template-columns: 1fr;
  }

  .play-button {
    justify-self: center;
  }

  .range-control {
    grid-template-columns: 42px 1fr 34px;
    width: 100%;
  }

  .toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .prompter-text {
    width: 92%;
    font-size: 42px;
  }
}
