:root {
  --bg: #0a0a0c;
  --bg-2: #131318;
  --bg-3: #1c1c22;
  --text: #f5f5f7;
  --text-dim: #a0a0a8;
  --accent: #ff3d8b;
  --accent-2: #8b5cf6;
  --line: #26262d;
  --good: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.container { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* Brand bar */
.bar {
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  background: rgba(10,10,12,0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.bar-inner { display: flex; justify-content: space-between; align-items: center; }
.brand {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}
.brand .grad {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.bar nav { display: flex; gap: 20px; font-size: 14px; }
.bar nav a { color: var(--text-dim); text-decoration: none; }
.bar nav a:hover { color: var(--text); }
.bar nav a.active { color: var(--text); }

/* Hero */
.hero {
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 61, 139, 0.25), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.25), transparent 50%),
    var(--bg);
  padding: 100px 0 80px;
  text-align: center;
}
.badge {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 24px;
  letter-spacing: 0.05em;
}
h1 {
  font-size: clamp(28px, 5.5vw, 48px);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
h1 .grad, h2 .grad, .price-num .grad {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
p.lead {
  font-size: 17px;
  color: var(--text-dim);
  max-width: 480px;
  margin: 0 auto 32px;
}
.cta {
  display: inline-block;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 14px 32px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  font-size: 15px;
  border: none;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(255, 61, 139, 0.3);
  transition: transform 0.2s ease;
}
.cta:hover:not(:disabled) { transform: translateY(-2px); }
.cta:disabled { opacity: 0.5; cursor: not-allowed; }
.cta-ghost {
  display: inline-block;
  background: transparent;
  color: var(--text);
  padding: 14px 32px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  font-size: 15px;
  border: 1px solid var(--line);
  cursor: pointer;
}

/* Sections */
section { padding: 64px 0; border-bottom: 1px solid var(--line); }
section:last-child { border-bottom: none; }
h2 {
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
  text-align: center;
}
.sub {
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 36px;
  font-size: 15px;
}

/* Service cards */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 600px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px 24px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-3px); }
.card .ico {
  font-size: 32px;
  margin-bottom: 14px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.card h3 {
  font-size: 20px;
  margin-bottom: 8px;
  font-weight: 800;
}
.card p { color: var(--text-dim); font-size: 14px; margin-bottom: 16px; }
.card .arr { color: var(--accent); font-weight: 700; font-size: 13px; }

/* Drop zone (UI app) */
.app {
  background: var(--bg-2);
  border-radius: 20px;
  padding: 28px 24px;
  margin-bottom: 24px;
}
.drop {
  border: 2px dashed var(--line);
  border-radius: 16px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.drop:hover, .drop.drag {
  border-color: var(--accent);
  background: rgba(255,61,139,0.05);
}
.drop .pict { font-size: 36px; margin-bottom: 10px; }
.drop p { color: var(--text-dim); font-size: 14px; }
.drop input[type="file"] { display: none; }
.file-info {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--bg-3);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: left;
}
.file-info b { color: var(--text); }

/* Form */
.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.field input[type="text"],
.field textarea {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.dur-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.dur-pick button {
  flex: 1;
  min-width: 80px;
  padding: 12px 16px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
}
.dur-pick button.on {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

/* Status */
.status {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  display: none;
}
.status.show { display: block; }
.status.info { background: rgba(139,92,246,0.12); color: var(--text); border-left: 3px solid var(--accent-2); }
.status.ok { background: rgba(52,211,153,0.12); color: var(--good); border-left: 3px solid var(--good); }
.status.err { background: rgba(248,113,113,0.12); color: var(--bad); border-left: 3px solid var(--bad); }

.spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress bar */
.progress {
  margin-top: 16px;
  display: none;
}
.progress.show { display: block; }
.progress-track {
  background: var(--bg-3);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
  transition: width 0.2s ease;
  border-radius: 999px;
}
.progress-bar.indeterminate {
  width: 30% !important;
  animation: indet 1.4s ease-in-out infinite;
}
@keyframes indet {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.progress-meta b { color: var(--text); font-weight: 700; }

/* Floating feedback button */
.feedback-fab {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 50;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 28px rgba(255, 61, 139, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s ease;
  letter-spacing: 0.02em;
}
.feedback-fab:hover { transform: translateY(-2px); }
.feedback-fab .lbl-full { display: inline; }
.feedback-fab .lbl-mini { display: none; }
@media (max-width: 480px) {
  .feedback-fab { padding: 10px 14px; font-size: 12px; bottom: 12px; right: 12px; }
}

/* Subtitle Editor */
.editor-section {
  margin-top: 22px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 22px;
}
.editor-section h3 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
}
.editor-section .desc {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 16px;
}
.editor-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .editor-grid { grid-template-columns: minmax(180px, 240px) 1fr; align-items: start; }
}
.editor-video-box {
  position: relative;
}
.editor-video-box video {
  width: 100%;
  background: #000;
  border-radius: 10px;
  display: block;
}
.editor-current {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
  white-space: pre-wrap;
  font-weight: 700;
  min-height: 0;
}
.editor-list {
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}
.editor-list::-webkit-scrollbar { width: 6px; }
.editor-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.subtitle-row {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.subtitle-row.active {
  border-color: var(--accent);
  background: linear-gradient(90deg, rgba(255,61,139,0.1), rgba(139,92,246,0.05));
}
.subtitle-row .play-btn {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  flex-shrink: 0;
}
.subtitle-row .play-btn:hover { border-color: var(--accent); color: var(--accent); }
.subtitle-row .right { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.subtitle-row .ts {
  font-size: 10px;
  color: var(--text-dim);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.05em;
}
.subtitle-row textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  min-height: 36px;
  line-height: 1.5;
  padding: 2px 0;
}
.subtitle-row textarea:focus {
  outline: none;
}
.subtitle-row.dirty {
  border-color: var(--warn);
}
.subtitle-row.saved {
  border-color: var(--good);
  animation: savedPulse 1s ease;
}
.subtitle-row.edited:not(.dirty):not(.saved):not(.active) {
  border-color: rgba(52, 211, 153, 0.4);
}
@keyframes savedPulse {
  0% { background: rgba(52, 211, 153, 0.18); }
  100% { background: var(--bg-3); }
}
.dirty-pill {
  font-size: 11px;
  color: var(--good);
  font-weight: 700;
  padding: 3px 10px;
  background: rgba(52, 211, 153, 0.12);
  border-radius: 999px;
}
.editor-toolbar {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.editor-toolbar .grow { flex: 1; }
.dirty-pill-old { /* legacy unused */ display: none; }

/* iOS auto-zoom prevention — any form element below 16px triggers zoom on focus.
   Set all inputs/textareas/selects to >= 16px universally as safety net. */
input, textarea, select, button {
  font-size: 16px;
}

/* Burn panel — テロップ焼き込み */
.burn-section {
  margin-top: 24px;
  background: linear-gradient(135deg, rgba(255,61,139,0.05), rgba(139,92,246,0.05));
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 16px;
  padding: 22px 22px;
}
.burn-section h3 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
}
.burn-section .desc {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 18px;
}
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (min-width: 600px) { .preset-grid { grid-template-columns: repeat(4, 1fr); } }
.preset-card {
  background: var(--bg-3);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 18px 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
  aspect-ratio: 9/10;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.preset-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.preset-card.on {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255,61,139,0.1), rgba(139,92,246,0.1));
}
.preset-card.on::before {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 12px;
  font-weight: 900;
  color: var(--accent);
}
.preset-preview {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2a1f3d, #1a1a2e);
  border-radius: 8px;
  margin-bottom: 8px;
  position: relative;
  min-height: 60px;
}
.preset-preview .text {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 4px 8px;
}
.preset-card .name {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 700;
}
.preset-card.on .name { color: var(--text); }

/* Preset preview styles */
.preview-reel { color: #fff; -webkit-text-stroke: 1.5px #000; }
.preview-pop { color: #FFF000; -webkit-text-stroke: 1.5px #000; }
.preview-minimal { color: #fff; opacity: 0.95; }
.preview-box {
  color: #fff;
  background: rgba(255, 61, 139, 0.85);
  padding: 4px 10px !important;
  border-radius: 4px;
}

.size-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.size-pills button {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}
.size-pills button.on {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
}

/* History panel (collapsible) */
.history {
  margin-bottom: 20px;
  background: rgba(19, 19, 24, 0.4);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px 14px;
}
.history[open] { padding-bottom: 12px; }
.history > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  user-select: none;
}
.history > summary::-webkit-details-marker { display: none; }
.history > summary::marker { content: ''; }
.history-title {
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-title::before {
  content: "▶";
  color: var(--accent);
  font-size: 9px;
  transition: transform 0.2s ease;
  display: inline-block;
}
.history[open] .history-title::before { transform: rotate(90deg); }
.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.history-head h3 {
  font-size: 13px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
}
.history-clear {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
}
.history-clear:hover { color: var(--bad); }
.history-item {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
}
.history-item-head .when { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.history-item-head .meta-pill {
  padding: 2px 8px;
  background: var(--bg-3);
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.05em;
}
.history-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-mini {
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}
.btn-mini:hover { border-color: var(--accent); }
.btn-mini.primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
}
.history-empty {
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
  padding: 16px;
  font-style: italic;
}

/* AI reasoning panel */
.ai-panel {
  margin-top: 18px;
  background: linear-gradient(135deg, rgba(255,61,139,0.06), rgba(139,92,246,0.06));
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 14px;
  padding: 18px 20px;
}
.ai-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.ai-panel-head .ai-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.ai-panel-head .grad {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ai-panel-head .model-tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
}
.ai-block { margin-bottom: 14px; }
.ai-block:last-child { margin-bottom: 0; }
.ai-block-label {
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 700;
}
.ai-block-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}
.ai-removed-list {
  margin: 0;
  padding-left: 0;
}
.ai-removed-list li {
  list-style: none;
  padding: 6px 0 6px 22px;
  font-size: 13px;
  color: var(--text-dim);
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.ai-removed-list li:last-child { border-bottom: none; }
.ai-removed-list li::before {
  content: "✗";
  position: absolute;
  left: 4px;
  color: var(--bad);
  font-weight: 900;
}

/* Notice */
.notice {
  background: rgba(251, 191, 36, 0.08);
  border-left: 3px solid var(--warn);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.notice b { color: var(--warn); }

/* Roadmap */
.roadmap-list {
  background: var(--bg-2);
  border-radius: 16px;
  padding: 24px;
}
.roadmap-list li {
  list-style: none;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--text-dim);
}
.roadmap-list li:last-child { border-bottom: none; }
.roadmap-list li::before {
  content: "→ ";
  color: var(--accent);
  font-weight: 900;
  margin-right: 4px;
}
.roadmap-list li b { color: var(--text); }

/* Result */
.result {
  margin-top: 20px;
  display: none;
}
.result.show { display: block; }
.result-body {
  background: var(--bg-3);
  border-radius: 12px;
  padding: 18px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line);
}
.result-meta {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--bg-3);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-dim);
}
.result-meta b { color: var(--text); }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}
.faq-q { font-weight: 700; margin-bottom: 4px; font-size: 15px; }
.faq-a { color: var(--text-dim); font-size: 14px; }

/* Footer */
footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 32px 0;
}
