.tp-wrap {
  width: 100%;
  padding: 4px 0 28px;
  box-sizing: border-box;
}

.tp-editor-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.tp-editor-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #111827;
}

.tp-count {
  font-size: 13px;
  color: #6b7280;
}

.tp-textarea {
  display: block;
  width: 100%;
  min-height: 240px;
  padding: 14px 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1.7;
  color: #111827;
  background: #fff;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
}

.tp-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.tp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.tp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.4;
}

.tp-btn-primary {
  background: #10b981;
  color: #fff;
}

.tp-btn-primary:hover:not(:disabled) {
  background: #059669;
}

.tp-btn-secondary {
  background: #e5e7eb;
  color: #374151;
}

.tp-btn-secondary:hover:not(:disabled) {
  background: #d1d5db;
}

.tp-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tp-keys-hint {
  margin-top: 14px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.8;
}

.tp-keys-hint kbd,
.tp-footer-keys kbd {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 2px;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  background: #f9fafb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #374151;
}

.tp-intro {
  margin-top: 28px;
  padding: 20px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.tp-intro h2 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
  color: #111827;
}

.tp-intro h2:not(:first-child) {
  margin-top: 20px;
}

.tp-intro h3 {
  margin: 12px 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
}

.tp-intro p,
.tp-intro li {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.7;
  color: #4b5563;
}

.tp-intro ul {
  margin: 0;
  padding-left: 1.3em;
}

/* ===== stage ===== */
.tp-stage {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  background: #000;
  color: #fff;
  user-select: none;
}

.tp-stage[hidden] {
  display: none !important;
}

.tp-toolbar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 14px;
  background: rgba(20, 20, 20, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tp-icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: #374151;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}

.tp-icon-btn.tp-play {
  background: #10b981;
  font-size: 15px;
}

.tp-icon-btn.tp-play.is-playing {
  background: #f59e0b;
}

.tp-icon-btn.tp-close {
  background: #ef4444;
  margin-left: auto;
}

.tp-icon-btn:hover {
  filter: brightness(1.08);
}

.tp-tool-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #e5e7eb;
}

.tp-tool-item input[type="range"] {
  width: 110px;
  accent-color: #10b981;
}

.tp-tool-item input[type="color"] {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #4b5563;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.tp-chip {
  border: 1px solid #4b5563;
  border-radius: 999px;
  background: transparent;
  color: #e5e7eb;
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
}

.tp-chip.is-on {
  background: rgba(16, 185, 129, 0.25);
  border-color: #34d399;
  color: #a7f3d0;
}

.tp-timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  padding: 4px 10px;
  border-radius: 4px;
  background: #1f2937;
  color: #fff;
  min-width: 64px;
  text-align: center;
}

.tp-viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #000;
}

.tp-scroll {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  will-change: transform;
}

.tp-script {
  box-sizing: border-box;
  width: 100%;
  padding: 40vh 8vw 70vh;
  font-size: 56px;
  line-height: 1.6;
  font-weight: 600;
  text-align: center;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: #fff;
  transform-origin: center center;
}

.tp-guide {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 72px;
  margin-top: -36px;
  z-index: 2;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.tp-guide-band {
  flex: 1;
  height: 100%;
  background: rgba(156, 163, 175, 0.22);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.tp-guide-arrow {
  width: 0;
  height: 0;
  border-style: solid;
}

.tp-guide-left {
  border-width: 14px 0 14px 18px;
  border-color: transparent transparent transparent #fff;
}

.tp-guide-right {
  border-width: 14px 18px 14px 0;
  border-color: transparent #fff transparent transparent;
}

.tp-footer-keys {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  justify-content: flex-end;
  padding: 8px 14px;
  font-size: 12px;
  color: #9ca3af;
  background: rgba(0, 0, 0, 0.7);
}

.tp-footer-keys kbd {
  background: #111827;
  border-color: #4b5563;
  color: #e5e7eb;
}

.tp-stage.is-mirror-x .tp-script {
  transform: scaleX(-1);
}

.tp-stage.is-mirror-y .tp-script {
  transform: scaleY(-1);
}

.tp-stage.is-mirror-x.is-mirror-y .tp-script {
  transform: scale(-1);
}

@media (max-width: 900px) {
  .tp-toolbar {
    gap: 8px;
  }
  .tp-tool-item input[type="range"] {
    width: 80px;
  }
  .tp-script {
    padding-left: 5vw;
    padding-right: 5vw;
  }
}
