:root {
  --ink: #17211c;
  --muted: #667369;
  --paper: #f7f4ed;
  --surface: #ffffff;
  --line: #d8ddd6;
  --green: #55c69f;
  --blue: #4c7ee8;
  --coral: #f36f5b;
  --yellow: #f4c95d;
  --shadow: 0 24px 80px rgba(23, 33, 28, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: #f7f4ed;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
}

button,
select,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 28px;
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0;
}

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

.brand {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.mode,
#status {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.main-panel,
.result-panel {
  min-width: 0;
}

.main-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.source-panel,
.prompt-panel,
.auto-panel,
.tuning-panel,
.preview-card,
.progress-card,
.edit-plan {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.source-panel,
.prompt-panel,
.auto-panel,
.tuning-panel,
.progress-card,
.edit-plan {
  padding: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-title span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 900;
}

.source-grid,
.ai-grid,
.controls {
  display: grid;
  gap: 12px;
}

.source-grid,
.ai-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.source-card,
.ai-grid > div {
  min-width: 0;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
}

.source-card.active {
  border-color: var(--green);
  background: #e9fbf3;
  box-shadow: inset 0 0 0 1px var(--green);
}

.source-card strong,
.source-card small,
.ai-grid strong,
.ai-grid small {
  display: block;
}

.source-card small,
.ai-grid small {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.label {
  margin-bottom: 10px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

textarea {
  width: 100%;
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.65;
  resize: vertical;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-prompts button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #f9fbf8;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

select,
input[type="range"] {
  min-width: 0;
  min-height: 42px;
}

select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
}

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

.primary {
  width: 100%;
  min-height: 58px;
  margin-top: 16px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 17px;
  font-weight: 900;
}

.primary.running {
  background: var(--blue);
}

.result-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.preview-card {
  padding: 14px;
}

.phone {
  width: min(100%, 370px);
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  overflow: hidden;
  border: 10px solid #111816;
  border-radius: 34px;
  background: #111816;
}

.mock-video {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #8fd5ff 0%, #7ad7d4 45%, #174b68 100%);
}

.sun {
  position: absolute;
  top: 72px;
  right: 54px;
  width: 94px;
  height: 94px;
  border-radius: 999px;
  background: #fff0a8;
  box-shadow: 0 0 70px rgba(255, 240, 168, 0.72);
}

.water {
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: 0;
  height: 58%;
  background:
    repeating-linear-gradient(165deg, rgba(255, 255, 255, 0.24) 0 4px, transparent 4px 46px),
    linear-gradient(180deg, rgba(57, 178, 199, 0.95), rgba(14, 62, 96, 0.98));
  transform: translateY(0);
  animation: drift 5s ease-in-out infinite alternate;
}

.mock-video.generated .water {
  animation-duration: 2.8s;
}

.caption {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 82px;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(17, 24, 22, 0.82);
  color: var(--paper);
  font-size: clamp(18px, 4.8vw, 30px);
  font-weight: 900;
  line-height: 1.35;
}

@keyframes drift {
  from {
    transform: translateX(-18px);
  }
  to {
    transform: translateX(18px);
  }
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.progress {
  height: 10px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece8;
}

#progressBar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue), var(--coral));
  transition: width 0.25s ease;
}

ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

li.done {
  color: var(--ink);
  font-weight: 900;
}

.timeline {
  display: flex;
  width: 100%;
  height: 44px;
  overflow: hidden;
  margin: 16px 0;
  border-radius: 8px;
  background: #e7ece8;
}

.timeline div {
  display: grid;
  place-items: center;
  width: var(--w);
  background: var(--c);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

dl div {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
}

dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
    width: min(100% - 28px, 760px);
    padding: 18px 0;
  }

  .result-panel {
    order: -1;
  }

  .phone {
    width: min(70vw, 330px);
  }
}

@media (max-width: 680px) {
  .header {
    align-items: flex-start;
  }

  h1 {
    font-size: 32px;
  }

  .source-grid,
  .ai-grid,
  .controls {
    grid-template-columns: 1fr;
  }

  .source-panel,
  .prompt-panel,
  .auto-panel,
  .tuning-panel,
  .progress-card,
  .edit-plan {
    padding: 16px;
  }

  .phone {
    width: min(82vw, 318px);
  }

  dl div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
