:root {
  --ink: #24201d;
  --paper: #fbf8f2;
  --line: #d7cec3;
  --teal: #176f72;
  --teal-pale: #d9e9e4;
  --vermilion: #db482d;
  --muted: #6b625b;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid #176f72;
  outline-offset: 3px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  min-height: 100vh;
}

.editor {
  padding: 38px clamp(20px, 3vw, 42px);
  border-right: 1px solid var(--line);
  background: #fffcf8;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--vermilion);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
}

.editor h1 {
  margin: 0;
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.15;
}

.intro,
.hint {
  color: var(--muted);
  font-size: 14px;
}

.intro {
  margin: 10px 0 24px;
}

.hint {
  margin: 5px 0 10px;
  font-size: 12px;
}

.mobile-jump {
  display: none;
}

.mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.mode-button {
  padding: 13px 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

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

.mode-button.is-active {
  background: var(--vermilion);
  color: #fff;
}

label:not(.visually-hidden) {
  display: block;
  margin: 15px 0 0;
  font-size: 14px;
  font-weight: 800;
}

label span {
  color: var(--muted);
  font-weight: 500;
}

input,
textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 10px 11px;
  border: 1px solid #bbb0a5;
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ink);
  outline-offset: 2px;
}

input:focus,
textarea:focus {
  border-color: var(--teal);
  outline: 2px solid #7eb7b5;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.list-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.list-heading h2 {
  margin: 0;
  font-size: 18px;
}

.text-button {
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--vermilion);
  font-weight: 800;
  cursor: pointer;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 4px;
}

.editor-actions .text-button {
  font-size: 12px;
  color: var(--muted);
}

.point-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.point {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffdfa;
}

.point-head,
.point-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.point-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.point-title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.drag-label {
  color: #9b8f85;
  font-size: 18px;
}

.small-button {
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.small-button:hover {
  border-color: var(--vermilion);
  color: var(--vermilion);
}

.small-button:disabled {
  color: #9b938d;
  cursor: default;
}

.point-fields {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.point-fields input {
  min-width: 0;
  margin: 0;
  padding: 8px;
  font-size: 14px;
}

.point-comment {
  margin-top: 8px;
  resize: vertical;
}

.add-button {
  width: 100%;
  min-height: 44px;
  padding: 11px;
  border: 1px dashed var(--teal);
  border-radius: 8px;
  background: #f4fbf8;
  color: var(--teal);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.add-button:disabled {
  border-color: #aaa29a;
  background: #f2efeb;
  color: #706963;
  cursor: default;
}

.status {
  min-height: 20px;
  margin: 12px 0;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

.manual-copy {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--teal);
  border-radius: 10px;
  background: #f4fbf8;
}

.manual-copy h2 {
  margin: 0;
  font-size: 16px;
}

.manual-copy p {
  margin: 6px 0;
  color: var(--muted);
  font-size: 13px;
}

.manual-copy textarea {
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.preview-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: clamp(22px, 4vw, 64px);
  background: linear-gradient(145deg, #e8f1ed, #fbf8f2 60%);
}

.preview {
  width: min(100%, 820px);
  overflow: hidden;
  border-radius: 16px;
  background: #fffaf1;
  box-shadow: 0 18px 44px #183d3d26;
}

.timeline-hero {
  padding: clamp(28px, 6vw, 68px) clamp(24px, 6vw, 60px) 42px;
  background: linear-gradient(135deg, #083d49, #176f72 58%, #265867);
  color: #fff;
}

.preview-film .timeline-hero {
  background: linear-gradient(135deg, #342a3c, #6e4352 58%, #9a6b45);
}

.preview-kicker {
  color: #c9e8df;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
}

.preview-title,
.preview-subtitle,
.comment {
  font-family: Georgia, "Hiragino Mincho ProN", serif;
}

.preview-title {
  margin: 10px 0 9px;
  font-size: clamp(38px, 7vw, 72px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.preview-subtitle {
  margin: 0;
  font-size: clamp(18px, 2.8vw, 29px);
}

.spoiler {
  display: inline-block;
  max-width: 100%;
  margin-top: 16px;
  padding: 5px 10px;
  border: 1px solid #c9e8df99;
  border-radius: 12px;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.timeline-body {
  padding: 26px clamp(20px, 5vw, 52px) 34px;
}

.timeline-row {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
}

.line {
  position: absolute;
  top: 23px;
  left: 14px;
  height: 100%;
  border-left: 3px solid #61a9a6;
}

.timeline-row:last-child .line {
  display: none;
}

.dot {
  z-index: 1;
  width: 22px;
  height: 22px;
  margin-top: 19px;
  border: 5px solid var(--teal);
  border-radius: 50%;
  background: #fffaf1;
}

.timeline-content {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  margin: 7px 0 16px;
  padding: 14px 16px;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 5px 18px #214e4a12;
}

.time {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  max-width: 100%;
  padding: 5px 10px;
  border: 2px solid var(--teal);
  border-radius: 999px;
  color: var(--teal);
  overflow-wrap: anywhere;
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
}

.time::before {
  content: "▶";
  margin-right: 7px;
  font-size: 11px;
}

.time.muted::before {
  display: none;
}

.segment {
  flex: 0 1 auto;
  min-width: 0;
  padding: 5px 11px;
  border-radius: 12px;
  background: var(--teal-pale);
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 800;
}

.comment {
  min-width: 0;
  padding-left: 14px;
  border-left: 1px solid #a9a39b;
  overflow-wrap: anywhere;
  font-size: clamp(17px, 2.2vw, 24px);
  font-weight: 700;
}

.official-link {
  display: inline-block;
  color: var(--teal);
  font-weight: 800;
}

.empty {
  color: var(--muted);
}

.exports {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
  padding-top: 22px;
}

.save-button {
  min-height: 54px;
  padding: 13px 26px;
  border: 0;
  border-radius: 11px;
  background: var(--vermilion);
  color: #fff;
  box-shadow: 0 5px 0 #a72d1c;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.copy-button {
  min-height: 54px;
  padding: 13px 22px;
  border: 2px solid var(--teal);
  border-radius: 11px;
  background: #fff;
  color: var(--teal);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.copy-button:hover {
  background: #f4fbf8;
}

.copy-button:active {
  transform: translateY(1px);
}

.save-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #a72d1c;
}

@media (max-width: 840px) {
  .workspace {
    display: block;
  }

  .editor {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mobile-jump {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    color: var(--teal);
    font-weight: 800;
  }

  .editor > .mobile-jump {
    margin: -10px 0 14px;
  }

  .preview-pane > .mobile-jump {
    align-self: flex-start;
    margin: -8px 0 10px;
  }

  .preview-pane {
    padding: 22px 14px 35px;
  }

  .timeline-content {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }

  .comment {
    flex-basis: 100%;
    padding: 9px 0 0;
    border-top: 1px solid #d6d0c9;
    border-left: 0;
    font-size: 19px;
  }
}

@media (max-width: 420px) {
  .editor {
    padding: 28px 18px;
  }

  .timeline-hero {
    padding: 30px 22px;
  }

  .timeline-body {
    padding: 20px 15px;
  }

  .timeline-content {
    padding: 12px;
  }

  .time {
    min-width: 0;
    font-size: 16px;
  }

  .exports {
    width: 100%;
    justify-content: space-between;
    gap: 16px;
  }

  .save-button {
    padding: 13px 15px;
    font-size: 16px;
  }

  .copy-button {
    font-size: 15px;
  }
}

.time-error {
  margin: 4px 0 8px;
  color: #9a3025;
  font-size: .85rem;
}

.time-error:empty,
.status:empty {
  display: none;
}

.point input[aria-invalid="true"] {
  border-color: #9a3025;
}

.exports > div {
  min-width: 0;
}

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

.related-tools { margin: 24px 0 8px; padding-top: 14px; border-top: 1px solid #e6ddd5; font-size: 13px; line-height: 1.8; }
.related-tools-title { margin: 0 0 4px; font-weight: 700; }
