:root {
  --ink: #181a1f;
  --muted: #6f737e;
  --line: #e5e3df;
  --paper: #ffffff;
  --canvas: #f5f3ef;
  --soft: #f1f2f7;
  --accent: #ff5a43;
  --accent-dark: #dd3e2b;
  --accent-soft: #fff0ec;
  --violet: #6e55d8;
  --green: #147d61;
  --shadow: 0 18px 50px rgba(28, 26, 22, 0.08);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 11% -5%, rgba(255, 90, 67, 0.11), transparent 28rem),
    var(--canvas);
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", Inter, sans-serif;
  line-height: 1.55;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(110, 85, 216, 0.28);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px max(24px, calc((100vw - 1380px) / 2));
  border-bottom: 1px solid rgba(229, 227, 223, 0.9);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: var(--ink);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 25px;
  font-style: italic;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.model-pill,
.api-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  color: #4d5059;
  font-size: 11px;
  font-weight: 700;
}

.model-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 0 4px rgba(110, 85, 216, 0.1);
}

.api-status.ready {
  border-color: rgba(20, 125, 97, 0.24);
  background: #eef9f5;
  color: var(--green);
}

.api-status.missing {
  border-color: rgba(221, 62, 43, 0.22);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.api-status.mock {
  border-color: rgba(110, 85, 216, 0.2);
  background: #f2efff;
  color: var(--violet);
}

.page-shell {
  width: min(1380px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 80px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 64px;
  align-items: end;
  padding: 8px 4px 44px;
}

.eyebrow {
  margin: 0 0 15px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.24em;
}

.hero h1 {
  max-width: 820px;
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif;
  font-size: clamp(42px, 5.3vw, 78px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 1.07;
}

.hero h1 span {
  color: var(--accent);
}

.hero-copy {
  max-width: 750px;
  margin: 23px 0 0;
  color: #5f626b;
  font-size: 15px;
  line-height: 1.85;
}

.hero-note {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  padding: 21px;
  border: 1px solid #dedbd4;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.hero-note .note-icon {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
}

.hero-note strong {
  display: block;
  margin: 1px 0 4px;
  font-size: 14px;
}

.hero-note p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(370px, 0.75fr);
  gap: 24px;
  align-items: start;
  min-width: 0;
  isolation: isolate;
}

.asset-column {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 24px;
  min-width: 0;
  max-width: 100%;
  contain: inline-size;
}

.panel {
  border: 1px solid rgba(224, 221, 215, 0.9);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.asset-panel,
.result-panel {
  min-width: 0;
  max-width: 100%;
  padding: clamp(24px, 3vw, 38px);
}

.asset-panel {
  overflow: hidden;
}

.control-rail {
  position: sticky;
  z-index: 2;
  top: 92px;
  min-width: 0;
  max-width: 100%;
}

.control-panel {
  padding: 28px;
}

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

.panel-heading.compact {
  margin-bottom: 22px;
}

.step-label {
  display: flex;
  align-items: center;
  gap: 13px;
}

.step-label > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.step-label p,
.step-label h2 {
  margin: 0;
}

.step-label p {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.step-label h2 {
  margin-top: 2px;
  font-size: 22px;
  letter-spacing: -0.025em;
}

.panel-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
  margin-bottom: 15px;
}

.choice-row.sub-choice:empty {
  display: none;
}

.choice-button {
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid #d9d7d2;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  transition: border-color 0.18s, background 0.18s, color 0.18s, transform 0.18s;
}

.choice-button:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}

.choice-button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.choice-button.series.active {
  border-color: var(--violet);
  background: var(--violet);
}

.asset-state {
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  min-height: 110px;
  border: 1px dashed #ddd9d1;
  border-radius: 17px;
  background: #faf9f7;
}

.asset-state > p,
.skeleton-line {
  display: block;
  margin: 0;
  padding: 38px 20px;
  color: #90939a;
  text-align: center;
  font-size: 12px;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(155px, 100%), 1fr));
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 12px;
}

.asset-card {
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 14px;
  background: #eeece8;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}

.asset-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(26, 25, 22, 0.11);
}

.asset-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 90, 67, 0.13);
}

.asset-card.selected::after {
  content: "✓";
  position: absolute;
  top: 9px;
  right: 9px;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(221, 62, 43, 0.3);
}

.asset-card img {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 142px;
  object-fit: cover;
  transition: opacity 0.25s ease, filter 0.25s ease;
  background:
    linear-gradient(135deg, rgba(110, 85, 216, 0.12), rgba(255, 90, 67, 0.13)),
    #ebe9e5;
}

img[data-image-state="loading"] {
  opacity: 0.35;
  filter: saturate(0.45);
}

img[data-image-state="waiting"] {
  opacity: 0.18;
  filter: grayscale(1);
}

img[data-image-state="ready"] {
  opacity: 1;
  filter: none;
}

.asset-card .asset-copy {
  display: block;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  padding: 11px 12px 13px;
  background: #fff;
}

.asset-card strong,
.asset-card small {
  display: block;
}

.asset-card strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.media-badge {
  position: absolute;
  top: 9px;
  left: 9px;
  padding: 4px 7px;
  border-radius: 99px;
  background: rgba(24, 26, 31, 0.82);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.selection-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 13px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: #6d3329;
  font-size: 11px;
}

.selection-summary p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clear-button {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 750;
}

.control-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.control-group + .control-group,
.settings-panel .control-group:first-child {
  margin-top: 22px;
}

.control-group legend {
  width: 100%;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 680;
  line-height: 1.5;
  letter-spacing: 0.025em;
}

.control-group legend small {
  margin-left: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 550;
}

.output-type-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.output-type {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 70px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #f8f8f7;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

.output-type.active {
  border-color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--ink), 0 8px 18px rgba(20, 20, 20, 0.06);
}

.type-icon {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 10px;
  background: #e9e8e5;
  font-size: 14px;
}

.output-type.active .type-icon {
  background: var(--ink);
  color: #fff;
}

.output-type strong,
.output-type small {
  display: block;
}

.output-type strong {
  font-size: 15px;
}

.output-type small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.segmented,
.number-grid,
.ratio-grid {
  padding: 5px;
  border-radius: 13px;
  background: var(--soft);
}

.segmented {
  display: grid;
  gap: 4px;
}

.segmented.two {
  grid-template-columns: repeat(2, 1fr);
}

.segmented.four {
  grid-template-columns: repeat(4, 1fr);
}

.segmented button,
.number-grid button {
  min-height: 39px;
  padding: 7px 5px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  color: #555967;
  font-size: 12px;
  font-weight: 750;
}

.segmented button.active,
.number-grid button.active {
  border-color: #dedde1;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 9px rgba(30, 30, 32, 0.06);
}

.ratio-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

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

.ratio-grid button {
  display: grid;
  min-width: 0;
  min-height: 59px;
  padding: 7px 2px;
  place-content: center;
  justify-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  color: #555967;
}

.ratio-grid button.active {
  border-color: #dedde1;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 9px rgba(30, 30, 32, 0.06);
}

.ratio-grid b {
  font-size: 10px;
  font-weight: 750;
}

.ratio-grid button[data-value="adaptive"] b {
  font-size: 11px;
}

.ratio-shape {
  display: block;
  border: 1.7px solid currentColor;
  border-radius: 2px;
}

.ratio-shape.square { width: 15px; height: 15px; }
.ratio-shape.portrait { width: 12px; height: 16px; }
.ratio-shape.landscape { width: 18px; height: 13px; }
.ratio-shape.wide { width: 20px; height: 12px; }
.ratio-shape.tall { width: 10px; height: 18px; }
.ratio-shape.tall-soft { width: 11px; height: 17px; }
.ratio-shape.wide-soft { width: 18px; height: 12px; }
.ratio-shape.cinema { width: 22px; height: 9px; }

.smart-glyph {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 900;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
}

.duration-grid {
  grid-template-columns: repeat(6, 1fr);
  margin-top: 7px;
}

.number-grid button {
  min-width: 0;
}

.duration-mode.smart + .duration-grid {
  display: none;
}

.pipeline-preview {
  margin-top: 24px;
  padding: 14px;
  border: 1px solid #e3e0da;
  border-radius: 14px;
  background: #fbfaf8;
}

.pipeline-preview > p {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
  letter-spacing: 0.05em;
}

.route-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 720;
}

.route-steps span {
  padding: 5px 7px;
  border-radius: 7px;
  background: #eceae6;
}

.route-steps i {
  color: #9a9ca3;
  font-style: normal;
}

.selection-metrics {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid #e8e5e0;
  color: var(--muted);
  font-size: 9px;
}

.selection-metrics b {
  color: var(--ink);
  font-size: 11px;
}

.generate-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 58px;
  margin-top: 16px;
  padding: 0 19px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 850;
  box-shadow: 0 12px 25px rgba(221, 62, 43, 0.22);
  transition: background 0.18s, transform 0.18s, opacity 0.18s;
}

.generate-button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.generate-button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

.generate-button i {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-style: normal;
}

.status {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #f1c1b9;
  border-radius: 10px;
  background: var(--accent-soft);
  color: #86382b;
  font-size: 10px;
  line-height: 1.55;
}

.status.success {
  border-color: #b9e2d4;
  background: #eef9f5;
  color: var(--green);
}

.cost-note {
  margin: 10px 4px 0;
  color: #8a8d95;
  font-size: 9px;
  text-align: center;
}

.result-area {
  display: grid;
  gap: 15px;
}

.result-item {
  overflow: hidden;
  border: 1px solid #dfdcd5;
  border-radius: 17px;
  background: #faf9f7;
}

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e2dc;
  background: #fff;
}

.result-toolbar strong,
.result-toolbar small {
  display: block;
}

.result-toolbar strong {
  font-size: 12px;
}

.result-toolbar small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.result-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--violet);
  font-size: 10px;
  font-weight: 750;
}

.result-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.result-status.done {
  color: var(--green);
}

.result-status.done::before {
  content: "✓";
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border: 0;
  background: #dff3eb;
  animation: none;
}

.result-status.error {
  color: var(--accent-dark);
}

.result-status.error::before {
  animation: none;
  border-color: currentColor;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.result-content {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(220px, 1fr);
  gap: 18px;
  padding: 16px;
}

.result-media {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  border-radius: 13px;
  background: #e7e4de;
}

.result-media img,
.result-media video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 220px;
  max-height: 430px;
  object-fit: cover;
}

.result-details h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.pipeline-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pipeline-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 9px;
  background: #fff;
  color: #5f626b;
  font-size: 10px;
}

.pipeline-list b {
  color: var(--green);
  font-size: 10px;
}

.keyframe-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin: 10px 0;
}

.keyframe {
  overflow: hidden;
  border-radius: 9px;
  background: #e7e4de;
}

.keyframe img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.keyframe span {
  display: block;
  padding: 5px 7px;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.result-actions a {
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-size: 9px;
  font-weight: 750;
  text-decoration: none;
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 9px;
  background: #fff;
  font-size: 9px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.task-row.active {
  border-color: var(--ink);
  background: #f8f7f4;
  box-shadow: 0 4px 12px rgba(24, 24, 27, 0.08);
}

.task-preview-button {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
  text-align: left;
}

.task-preview-button b {
  color: var(--muted);
  font-size: 8px;
}

.image-candidate-label {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  font-weight: 750;
}

.image-candidate-thumb {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 7px;
  background: #e7e4de;
  object-fit: cover;
}

.image-preview-button:disabled {
  cursor: default;
  opacity: 0.72;
}

.task-row[data-state="done"] .task-preview-button b {
  color: var(--green);
}

.task-row[data-state="failed"] .task-preview-button b,
.task-row[data-state="unknown"] .task-preview-button b {
  color: var(--accent-dark);
}

.task-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 5px;
  padding-right: 7px;
}

.task-row a {
  padding: 6px 8px;
  border-radius: 7px;
  background: #e6f4ee;
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
}

.task-retry-button {
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  cursor: pointer;
  color: #fff;
  font-size: 8px;
  font-weight: 800;
}

.video-preview-message {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  margin: 0;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(24, 24, 27, 0.82);
  color: #fff;
  font-size: 9px;
  line-height: 1.45;
  backdrop-filter: blur(7px);
}

.result-error {
  margin: 0;
  padding: 24px 18px;
  color: var(--accent-dark);
  font-size: 11px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(1380px, calc(100% - 48px));
  margin: 0 auto;
  padding: 0 0 34px;
  color: #8b8e94;
  font-size: 9px;
}

footer p {
  margin: 0;
}

@media (max-width: 1080px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr) 350px;
  }

  .hero {
    gap: 34px;
  }

  .ratio-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .video-ratios {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 880px) {
  .topbar {
    padding-inline: 20px;
  }

  .model-pill {
    display: none;
  }

  .page-shell {
    width: min(100% - 30px, 720px);
    padding-top: 38px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 25px;
  }

  .hero h1 {
    font-size: clamp(39px, 10vw, 66px);
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .control-rail {
    position: static;
  }

  .result-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 64px;
    padding: 10px 15px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand small {
    display: none;
  }

  .api-status {
    max-width: 125px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-shell {
    width: min(100% - 20px, 520px);
    padding: 29px 0 54px;
  }

  .hero {
    padding-inline: 4px;
    padding-bottom: 28px;
  }

  .hero h1 {
    font-size: 40px;
  }

  .hero-copy {
    font-size: 13px;
  }

  .asset-panel,
  .result-panel,
  .control-panel {
    padding: 19px;
    border-radius: 18px;
  }

  .panel-heading {
    align-items: flex-start;
  }

  .panel-hint {
    max-width: 105px;
    text-align: right;
  }

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

  .asset-card img {
    height: 120px;
  }

  .segmented.four {
    grid-template-columns: repeat(2, 1fr);
  }

  .ratio-grid,
  .video-ratios {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .duration-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .selection-summary {
    align-items: flex-start;
  }

  footer {
    display: grid;
    width: calc(100% - 28px);
    text-align: center;
  }
}

/* APIキー入力モーダル（キーは保存せず、再読み込みのたびに再入力） */
.api-status {
  cursor: pointer;
}

.api-key-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(24, 26, 31, 0.45);
  backdrop-filter: blur(4px);
}

.api-key-card {
  width: min(100%, 420px);
  padding: 26px 24px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.api-key-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.api-key-note {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

#api-key-input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

#api-key-input:focus {
  outline: 2px solid rgba(110, 85, 216, 0.35);
  outline-offset: 1px;
}

.api-key-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.api-key-primary {
  flex: 1;
  padding: 11px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.api-key-primary:hover {
  background: var(--accent-dark);
}

.api-key-secondary {
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
