:root {
  --bg: #0b0c10;
  --panel: #14151b;
  --panel-2: #1c1d25;
  --line: #2c2e38;
  --text: #f4f4f5;
  --muted: #9aa0b0;
  --accent: #4d8dff;
  --accent-2: #7dd3fc;
  --warn: #f5a524;
  --danger: #ef4444;
  --ok: #34d399;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

body {
  min-height: 100dvh;
}

#app {
  min-height: 100dvh;
}

#studio {
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 20px 48px;
}

.studio-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.studio-header h1 {
  margin: 0 0 6px;
  font-size: 32px;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.studio-header p,
.hints {
  color: var(--muted);
}

.studio-header p {
  margin: 0;
  font-size: 14px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ghost-btn.primary {
  background: #2b4d8f;
  border-color: #3d6ec4;
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.studio-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 20;
  max-width: min(92vw, 560px);
  padding: 12px 16px;
  border-radius: 14px;
  background: #f5a524;
  color: #1a1203;
  font-size: 14px;
  font-weight: 650;
  box-shadow: var(--shadow);
}

.share-dialog {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
}

.share-dialog[hidden] {
  display: none !important;
}

.share-card {
  width: min(92vw, 640px);
  padding: 22px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.share-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.share-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.share-card textarea {
  width: 100%;
  min-height: 180px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0e0f14;
  color: var(--text);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}

.share-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.ghost-btn,
.text-action,
.start-btn,
.icon-btn {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.ghost-btn,
.text-action {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
}

.ghost-btn:hover,
.text-action:hover {
  border-color: #4b5060;
}

.text-action.subtle {
  opacity: 0.75;
}

.editor-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.color-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: #101117;
  border-bottom: 1px solid var(--line);
}

.bar-label {
  color: var(--muted);
  font-size: 12px;
  margin-right: 4px;
}

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: var(--c);
  padding: 0;
  cursor: pointer;
}

.swatch:hover,
.swatch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.custom-swatch {
  position: relative;
  background:
    conic-gradient(from 90deg, #f87171, #fbbf24, #34d399, #38bdf8, #c084fc, #f87171);
}

.custom-swatch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.editor {
  min-height: 320px;
  max-height: min(58vh, 560px);
  overflow: auto;
  padding: 22px 24px 28px;
  font-size: 22px;
  line-height: 1.7;
  outline: none;
  white-space: pre-wrap;
}

.editor:empty::before {
  content: attr(data-placeholder);
  color: #6b7180;
}

.pause-mark {
  display: inline-flex;
  align-items: center;
  margin: 0 0.25em;
  padding: 0.12em 0.55em;
  border-radius: 999px;
  background: var(--warn);
  color: #1a1203;
  font-size: 0.55em;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
  user-select: none;
}

.settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin: 22px 0 20px;
  align-items: end;
}

@media (min-width: 820px) {
  .settings {
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto;
  }
}

.settings label,
.mini {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.settings label.check,
.mini.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
}

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

.settings strong,
.mini span {
  color: var(--text);
  font-size: 13px;
}

.start-btn {
  width: 100%;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(180deg, #5b97ff, #3b76e0);
  color: white;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.start-btn:hover {
  filter: brightness(1.05);
}

.hints {
  margin: 18px 0 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.7;
}

#prompter {
  position: fixed;
  inset: 0;
  background: #000;
  color: #fff;
}

#prompter[hidden],
.toast[hidden] {
  display: none !important;
}

.prompter-ui {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 5;
  padding: 10px 12px 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.78), transparent);
  opacity: 1;
  transition: opacity 0.25s ease;
}

#prompter.idle .prompter-ui,
#prompter.idle .foot-hint {
  opacity: 0;
  pointer-events: none;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.topbar .mini {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  padding: 4px 8px;
}

.icon-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #1f1f1f;
  color: #fff;
  font-size: 13px;
}

.icon-btn.play {
  background: #16a34a;
}

.icon-btn.play.is-on {
  background: #ca8a04;
}

.icon-btn.stop {
  background: #dc2626;
}

.icon-btn.fullscreen {
  background: #2563eb;
}

.icon-btn.close {
  margin-left: auto;
  background: #2a2a2a;
}

#prompter:fullscreen,
#prompter:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  background: #000;
}

.mini {
  min-width: 110px;
  flex-direction: row;
  align-items: center;
  color: #d4d4d8;
  font-size: 12px;
}

.mini input[type="range"] {
  width: 86px;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: #d4d4d8;
}

.scrub {
  margin-top: 8px;
}

.stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.stage.is-dragging {
  cursor: grabbing;
}

.band {
  position: absolute;
  left: 0;
  right: 0;
  top: 22%;
  height: 56%;
  background: #141414;
  pointer-events: none;
}

.chevron {
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  border-style: solid;
  transform: translateY(-50%);
  z-index: 2;
}

.chevron.left {
  left: 0;
  border-width: 18px 16px 18px 0;
  border-color: transparent #000 transparent transparent;
}

.chevron.right {
  right: 0;
  border-width: 18px 0 18px 16px;
  border-color: transparent transparent transparent #000;
}

.flip-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.scroll-layer {
  will-change: transform;
}

.script {
  width: 100%;
  max-width: 100%;
  color: #fff;
  text-align: center;
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  user-select: none;
}

.script p {
  margin: 0 0 0.55em;
}

.cue {
  position: absolute;
  left: 0;
  right: 0;
  top: 42%;
  height: 2px;
  background: rgba(255, 255, 255, 0.16);
  z-index: 3;
  pointer-events: none;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, #000 0%, transparent 18%, transparent 82%, #000 100%);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%);
  z-index: 6;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(245, 165, 36, 0.95);
  color: #1a1203;
  font-size: 14px;
  font-weight: 650;
}

.foot-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  z-index: 4;
  margin: 0;
  text-align: center;
  color: #8b8b8b;
  font-size: 12px;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

  .studio-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar .mini:nth-child(n + 4) {
    display: none;
  }
}
