/* boost AI — ブルーと濃紺を基調とした制作ツール */

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Noto+Sans+JP:wght@400;500;600;700&display=swap");

:root {
  --bg: #0b1220;
  --bg-raised: #101b2d;
  --bg-card: #142036;
  --bg-card-hover: #1b2d48;
  --bg-input: #0d1728;
  --border: #2a3b56;
  --border-soft: #1e2c43;
  --text: #eef0f6;
  --text-dim: #a5b4cb;
  --text-faint: #8193ad;
  --accent: #1a56ff;
  --accent-strong: #93baff;
  --accent-soft: rgba(26, 86, 255, 0.14);
  --accent-2: #3b82f6;
  --accent-2-soft: rgba(59, 130, 246, 0.14);
  --accent-deep: #1643c7;
  --on-accent: #f7faff;
  --success: #6ee7b7;
  --success-soft: rgba(110, 231, 183, 0.14);
  --danger: #ff5c7a;
  --danger-soft: rgba(255, 92, 122, 0.14);
  --warn: #ffc861;
  --warn-soft: rgba(255, 200, 97, 0.14);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-card:
    0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
  --font-display: "Space Grotesk", "Noto Sans JP", sans-serif;
  --font-body: "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(
      1200px 600px at 12% -10%,
      rgba(26, 86, 255, 0.1),
      transparent 60%
    ),
    radial-gradient(
      900px 500px at 100% 0%,
      rgba(59, 130, 246, 0.08),
      transparent 55%
    ),
    var(--bg);
}

a {
  color: inherit;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* --- レイアウト --- */

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 18, 32, 0.82);
  backdrop-filter: blur(10px);
}
.topbar .brand {
  justify-self: start;
}
.topbar .nav {
  justify-self: center;
}
.topbar .nav-user {
  justify-self: end;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: block;
}
.brand-ai {
  color: var(--accent-2);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  text-decoration: none;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}

.nav a:hover {
  color: var(--text);
  background: var(--bg-card);
}
.nav a.active {
  color: var(--bg);
  background: var(--text);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10.5px;
  font-weight: 800;
  vertical-align: middle;
  animation: pulse 1.6s ease-in-out infinite;
}
.nav a.active .nav-badge {
  background: var(--bg);
  color: var(--text);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-faint);
}

.nav-user .logout {
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}
.nav-user .logout:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.page-head {
  padding: 40px 0 24px;
}

.page-head h1 {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}

.page-head p {
  color: var(--text-dim);
  margin: 0;
  font-size: 14.5px;
}

.billing-notice {
  margin-top: 14px;
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  border: 1px solid rgba(255, 200, 97, 0.35);
  color: var(--warn);
  font-size: 13px;
  line-height: 1.6;
  max-width: 720px;
}
.billing-notice strong {
  color: var(--warn);
}

/* --- フラッシュ / トースト --- */

.flash-stack {
  position: fixed;
  top: 78px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 48px));
}

.flash {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.5;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  animation: slide-in 0.22s ease;
}

.flash.error {
  border-color: rgba(255, 92, 122, 0.4);
  background: var(--danger-soft);
  color: #ffb3c2;
}
.flash.success {
  border-color: rgba(110, 231, 183, 0.4);
  background: var(--success-soft);
  color: #b9f5da;
}

@keyframes slide-in {
  from {
    transform: translateX(16px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* --- ボタン --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
  text-decoration: none;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--on-accent);
  box-shadow: 0 8px 20px rgba(26, 86, 255, 0.28);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 10px 26px rgba(26, 86, 255, 0.4);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

.btn-block {
  width: 100%;
}
.btn-sm {
  padding: 7px 14px;
  font-size: 12.5px;
}

/* --- カード共通 --- */

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* --- ログイン画面 --- */

.auth-wrap {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 36px 32px;
  text-align: center;
}

.auth-card .brand {
  justify-content: center;
  margin-bottom: 22px;
  font-size: 20px;
}

.auth-card h1 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 6px;
}

.auth-card p.sub {
  color: var(--text-faint);
  font-size: 13.5px;
  margin: 0 0 28px;
}

.field {
  text-align: left;
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 7px;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="url"],
.field textarea,
.field select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 11px 13px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

/* --- モデルギャラリー画面 --- */

.builder {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 980px) {
  .builder {
    grid-template-columns: 1fr;
  }
}

.gallery-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 11px 18px;
  color: var(--text);
  font-size: 14px;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}
.chip:hover {
  color: var(--text);
  border-color: var(--text-faint);
}
.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  max-height: 74vh;
  overflow-y: auto;
  padding-right: 4px;
}

.model-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.model-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-faint);
}
.model-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.vendor-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--vendor-color, var(--accent-2));
}
.vendor-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--vendor-color, var(--accent-2));
}

.model-card .model-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15.5px;
  line-height: 1.3;
}

.model-card .model-summary {
  font-size: 12.5px;
  color: var(--text-faint);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.model-card .variant-count {
  margin-top: auto;
  font-size: 11px;
  color: var(--text-faint);
}

/* --- フォームパネル --- */

.form-panel {
  position: sticky;
  top: 90px;
  padding: 22px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.form-panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--text-faint);
}
.form-panel-empty .glyph {
  font-size: 34px;
  opacity: 0.6;
}

.selected-model-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.selected-model-head h2 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 2px 0 4px;
}

.variant-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.variant-tab {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-dim);
  cursor: pointer;
}
.variant-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.field-group {
  margin-bottom: 16px;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.field-label .req {
  color: var(--accent-strong);
}
.field-hint {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 5px;
  line-height: 1.5;
}

/* enum -> chip選択 */
.enum-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.enum-chip {
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.enum-chip:hover {
  border-color: var(--text-faint);
  color: var(--text);
}
.enum-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* range スライダー（秒数など） */
.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.range-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
}
.range-value {
  min-width: 54px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

/* トグル（boolean） */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
}
.toggle-row .toggle-text {
  font-size: 13px;
  color: var(--text);
}
.toggle-row .toggle-hint {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

.switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex: none;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.15s ease;
  cursor: pointer;
}
.switch .track::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  top: 3px;
  left: 3px;
  transition: transform 0.15s ease;
}
.switch input:checked + .track {
  background: var(--accent);
}
.switch input:checked + .track::after {
  transform: translateX(18px);
  background: var(--on-accent);
}

/* アップロード / URL 素材入力 */
.upload-zone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
  position: relative;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-zone .upload-label {
  font-size: 12.5px;
  color: var(--text-dim);
}
.upload-zone .upload-sub {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 3px;
}

.media-preview {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
}
.media-preview img,
.media-preview video {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  background: #000;
}
.media-preview .media-url {
  flex: 1;
  font-size: 11.5px;
  color: var(--text-faint);
  word-break: break-all;
}
.media-preview .media-remove {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}
.media-preview .media-remove:hover {
  color: var(--danger);
}

.url-fallback {
  margin-top: 8px;
}
.url-fallback input {
  font-size: 12px;
}

/* 素材リスト（refs/images 配列） */
.ref-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ref-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--bg-input);
}
.ref-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.ref-item-head .ref-index {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ref-item-head button {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 15px;
}
.ref-item-head button:hover {
  color: var(--danger);
}

.add-ref-btn {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.add-ref-btn:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
}

/* 生成ボタン周り */
.generate-bar {
  position: sticky;
  bottom: -22px;
  margin: 20px -22px -22px;
  padding: 16px 22px;
  background: linear-gradient(180deg, transparent, var(--bg-card) 30%);
}

.generate-error {
  background: var(--danger-soft);
  border: 1px solid rgba(255, 92, 122, 0.4);
  color: #ffb3c2;
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 12.5px;
  margin-bottom: 12px;
}

/* --- ステータス画面 --- */

.status-card {
  padding: 28px;
  margin-bottom: 20px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-badge.queued,
.status-badge.pending,
.status-badge.submitted {
  background: var(--warn-soft);
  color: var(--warn);
}
.status-badge.running {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.status-badge.succeed {
  background: var(--success-soft);
  color: var(--success);
}
.status-badge.failed {
  background: var(--danger-soft);
  color: var(--danger);
}
.status-badge.unknown {
  background: var(--bg-raised);
  color: var(--text-faint);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-input);
  overflow: hidden;
  margin: 18px 0;
}
.progress-fill {
  height: 100%;
  width: 34%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: progress-sweep 1.6s ease-in-out infinite;
}
.progress-fill.done {
  animation: none;
  width: 100%;
}
.progress-fill.error {
  animation: none;
  width: 100%;
  background: var(--danger);
}
@keyframes progress-sweep {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(40%);
  }
  100% {
    transform: translateX(220%);
  }
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.result-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raised);
}
.result-card video {
  width: 100%;
  display: block;
  background: #000;
  aspect-ratio: 16/9;
}
.result-card .result-actions {
  padding: 10px 12px;
  display: flex;
  justify-content: flex-end;
}

/* --- 履歴画面 --- */

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.history-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
}

.history-thumb {
  aspect-ratio: 16/9;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 12px;
}
.history-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.history-model {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
}
.history-prompt {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  max-height: 3em;
  overflow: hidden;
}
.history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.history-time {
  font-size: 11px;
  color: var(--text-faint);
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-faint);
}
.empty-state .glyph {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.6;
}

/* --- スクロールバー --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* ==========================================================================
   海外SaaS系のリッチな装飾エフェクト（Magic UI のCSSコンセプトをバニラCSSへ移植・MIT）
   ========================================================================== */

@property --beam-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

/* Border Beam: 選択中カード/パネルの縁を光が周回する */
.beam-border {
  position: relative;
  isolation: isolate;
}
.beam-border::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--beam-angle),
    transparent 0 78%,
    var(--accent) 88%,
    var(--accent-2) 94%,
    transparent 100%
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: beam-spin 5s linear infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes beam-spin {
  to {
    --beam-angle: 360deg;
  }
}
@media (prefers-reduced-motion: reduce) {
  .beam-border::before {
    animation: none;
  }
}

/* Shimmer: プライマリボタン内をハイライトが通過する */
.btn-primary {
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 20%,
    rgba(255, 255, 255, 0.35) 48%,
    transparent 76%
  );
  transform: translateX(-120%);
  animation: shimmer-sweep 3.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shimmer-sweep {
  0%,
  35% {
    transform: translateX(-120%);
  }
  65%,
  100% {
    transform: translateX(120%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .btn-primary::after {
    animation: none;
    display: none;
  }
}

/* Shine Border: ログインカードの縁をゆっくり流れる光彩 */
.shine-border {
  position: relative;
}
.shine-border::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background-image: radial-gradient(
    ellipse 60% 60% at var(--shine-x, 50%) var(--shine-y, 0%),
    var(--accent) 0%,
    var(--accent-2) 35%,
    transparent 70%
  );
  background-size: 200% 200%;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: shine-drift 8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shine-drift {
  0%,
  100% {
    --shine-x: 15%;
    --shine-y: 0%;
  }
  50% {
    --shine-x: 85%;
    --shine-y: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .shine-border::before {
    animation: none;
  }
}

/* Meteors: 背景を流れる光の粒（ログイン画面のみ） */
.meteor-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.meteor {
  position: absolute;
  top: -10%;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  rotate: 215deg;
  animation: meteor-fall linear infinite;
  opacity: 0;
}
.meteor::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 60px;
  height: 1px;
  translate: -100% -50%;
  background: linear-gradient(90deg, var(--accent), transparent);
}
@keyframes meteor-fall {
  0% {
    opacity: 0;
    transform: translateY(0);
  }
  8% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(420px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .meteor {
    display: none;
  }
}

/* Dot Pattern: ふんわり発光するドット背景（ログイン画面） */
.dot-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.16) 1px,
    transparent 1px
  );
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(
    ellipse 70% 60% at 50% 30%,
    #000 0%,
    transparent 75%
  );
  mask-image: radial-gradient(
    ellipse 70% 60% at 50% 30%,
    #000 0%,
    transparent 75%
  );
}

/* Text Shimmer: 見出しにグラデーション光沢を流す */
.text-shimmer {
  background: linear-gradient(
    100deg,
    var(--text) 40%,
    var(--accent-2) 50%,
    var(--text) 60%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: text-shimmer-sweep 4s ease-in-out infinite;
}
@keyframes text-shimmer-sweep {
  0%,
  100% {
    background-position: 200% 0;
  }
  50% {
    background-position: -20% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .text-shimmer {
    animation: none;
    background: none;
    color: var(--text);
  }
}

/* ==========================================================================
   仕上げ: グレイン質感・カードスポットライト・登場アニメーション・スケルトン
   ========================================================================== */

/* フィルムグレイン: 画面全体にごく薄いノイズを重ね、フラットさを消す */
.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Card Spotlight: マウス位置に追従する光（JS側で --spot-x / --spot-y を更新） */
.spotlight-card {
  position: relative;
  --spot-x: 50%;
  --spot-y: 50%;
}
.spotlight-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    360px circle at var(--spot-x) var(--spot-y),
    rgba(255, 255, 255, 0.06),
    transparent 72%
  );
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.spotlight-card:hover::after {
  opacity: 1;
}

/* カードの登場アニメーション（表示順にわずかな段差） */
@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.card-rise {
  animation: card-rise 0.32s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
@media (prefers-reduced-motion: reduce) {
  .card-rise {
    animation: none;
  }
}

/* ホバー時の微細なリフト（カード全般） */
.model-card,
.history-card,
.result-card {
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s ease;
}
.model-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}
.history-card:hover,
.result-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

/* フォーカスリングの統一（フォーム部品全般） */
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
.enum-chip:focus-visible,
.chip:focus-visible,
.variant-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ボタンのローディング状態 */
.btn-loading {
  pointer-events: none;
  opacity: 0.85;
}
.btn-loading .spinner {
  width: 14px;
  height: 14px;
  margin-right: 2px;
}
/* 疑似要素にすることで、ポーリングで文言が更新されても稲妻を維持する。 */
.btn-loading .spinner,
.status-badge:is(.pending, .submitted, .submitting, .running)::before,
.skeleton-card::after {
  content: "";
  display: inline-block;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url("favicon.svg") center / contain no-repeat;
  mask: url("favicon.svg") center / contain no-repeat;
  animation: boost-pulse 1.4s ease-in-out infinite;
}
.status-badge:is(.pending, .submitted, .submitting, .running)::before {
  width: 12px;
  height: 14px;
}
@keyframes boost-pulse {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* モデルギャラリーのスケルトンローディング */
.skeleton-card {
  position: relative;
  height: 128px;
  border-radius: var(--radius);
  background: linear-gradient(
    100deg,
    var(--bg-card) 30%,
    var(--bg-card-hover) 50%,
    var(--bg-card) 70%
  );
  background-size: 200% 100%;
  animation: skeleton-sweep 1.4s ease-in-out infinite;
  border: 1px solid var(--border-soft);
}
.skeleton-card::after {
  position: absolute;
  top: calc(50% - 14px);
  left: calc(50% - 14px);
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
@keyframes skeleton-sweep {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-card {
    animation: none;
  }
}

/* タイポグラフィのリズム微調整 */
.page-head h1 {
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.model-card .model-name,
.selected-model-head h2 {
  letter-spacing: -0.01em;
}
.brand {
  letter-spacing: -0.015em;
}

/* ステータスページ: パルスするステップドット */
.progress-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 2px;
}
.progress-steps .step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s ease;
}
.progress-steps .step-dot.active {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.progress-steps .step-dot.done {
  background: var(--success);
}

/* 制作画面: 中央のコンポーザーからモデルライブラリへ続く共通レイアウト */
[hidden] {
  display: none !important;
}
button,
input,
textarea {
  font-family: inherit;
}
button,
a,
summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
a:focus-visible,
label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.studio-page {
  --text-faint: #91a3be;
}
.studio-hero {
  position: relative;
  text-align: center;
  padding: 52px 0 0;
  isolation: isolate;
}
.studio-hero > :not(.dot-field, .meteor-field) {
  position: relative;
  z-index: 1;
}
.studio-hero .dot-field {
  opacity: 0.26;
}
.studio-hero .meteor-field {
  opacity: 0.25;
}
.studio-kicker,
.section-kicker,
.promo-eyebrow {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
}
.studio-kicker {
  color: var(--text-dim);
  margin-bottom: 17px;
}
.studio-kicker span {
  color: var(--accent);
  padding: 0 9px;
}
.studio-hero h1 {
  margin: 0;
  font-size: clamp(25px, 2.8vw, 38px);
  line-height: 1.55;
  font-weight: 700;
  letter-spacing: -0.035em;
}
.mobile-break {
  display: none;
}
.hero-caption {
  font-size: 13px;
  color: var(--text-dim);
  margin: 12px 0 24px;
}
.studio-modes {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
  font-size: 12px;
  font-weight: 600;
}
.studio-modes > a,
.studio-modes > span {
  padding-bottom: 9px;
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.studio-modes > .active {
  color: var(--text);
  border-color: var(--accent);
}
.studio-modes a:hover {
  color: var(--accent-strong);
}
.mini-pill {
  background: var(--accent-soft);
  border-radius: 4px;
  font-size: 10px;
  padding: 2px 5px;
  color: var(--accent-strong);
  margin-left: 5px;
}
.studio-page .composer {
  position: relative;
  top: auto;
  margin: 0 auto;
  max-width: 940px;
  max-height: none;
  overflow: visible;
  padding: 20px;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 12px 48px #0003;
}
.composer.shine-border::before {
  opacity: 0.45;
}
.composer:focus-within {
  border-color: var(--accent);
}
.composer-input {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  min-height: 128px;
}
.composer-input .field-group {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.composer-input .field-label,
.composer-input .field-hint {
  display: none;
}
.studio-page .composer-input textarea {
  display: block;
  width: 100%;
  min-height: 112px;
  padding: 8px 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--text);
  font-size: 15px !important;
  line-height: 1.8;
  resize: vertical;
  box-shadow: none;
}
.composer-input textarea:focus-visible {
  outline-offset: 5px;
  border-radius: 4px;
}
.composer-input textarea::placeholder {
  color: var(--text-faint);
}
.add-material {
  flex: 0 0 52px;
  width: 52px;
  height: 60px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--bg-card-hover);
  color: var(--text-dim);
  font-size: 28px;
  font-weight: 300;
  transition:
    border-color 180ms,
    background 180ms;
}
.add-material:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.composer-instruction {
  color: var(--text-dim);
  font-size: 14px;
}
.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.model-selector {
  display: inline-flex;
  flex-shrink: 1;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 10px 6px 6px;
  min-height: 38px;
}
.model-selector:hover {
  border-color: var(--accent-strong);
}
.chevron {
  color: var(--text-dim);
  margin-left: 5px;
}
.model-selector .model-icon {
  width: 26px;
  height: 26px;
  flex-basis: 26px;
}
.parameter-trigger {
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  padding: 7px 0 7px 14px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  text-align: left;
  line-height: 1.6;
}
.parameter-trigger:hover,
.parameter-trigger[aria-expanded="true"] {
  color: var(--text);
}
.credit-label {
  margin-left: auto;
  white-space: nowrap;
  font: 500 12px var(--font-display);
  color: var(--text-dim);
}
.credit-label small {
  font-size: 10px;
}
.send-button {
  width: 42px;
  height: 42px;
  padding: 10px;
  flex: 0 0 42px;
  color: var(--text);
  border-radius: 50%;
  background: linear-gradient(
    140deg,
    var(--accent-2),
    #1a56ff 65%,
    var(--accent-deep)
  );
  box-shadow: 0 3px 12px var(--accent-soft);
  transition:
    transform 180ms ease-out,
    box-shadow 180ms ease-out;
}
.send-button svg {
  width: 23px;
  height: 23px;
}
.send-button:active:not(:disabled) {
  transform: scale(0.9);
}
.send-button::after {
  animation-iteration-count: 2;
}
.billing-line {
  text-align: center;
  margin: 14px auto 0;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.8;
  max-width: 940px;
}
.billing-line a {
  color: var(--accent-strong);
  text-underline-offset: 3px;
  margin-left: 8px;
}
.disclosure-body {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows 220ms ease-out,
    opacity 180ms ease-out;
}
.disclosure-body.expanded {
  grid-template-rows: 1fr;
  opacity: 1;
}
.disclosure-inner {
  overflow: hidden;
  min-height: 0;
}
.parameter-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  margin-top: 18px;
}
.parameter-fields .field-group {
  margin: 0;
  min-width: 0;
}
.parameter-fields .field-group:has(textarea),
.parameter-fields [data-field-kind="array"],
.parameter-fields [data-field-kind="media"] {
  grid-column: 1/-1;
}
.composer .variant-tabs:not(:empty) {
  margin: 20px 0 0;
}
.composer .generate-error {
  margin-top: 16px;
  margin-bottom: 0;
}
.promo-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 16px;
  margin: 40px 0 44px;
}
.promo-main {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 0 100%, var(--accent-deep) 0%, transparent 65%),
    linear-gradient(110deg, #142f6b, var(--bg-card) 62%, var(--bg));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 25px 28px;
  text-decoration: none;
  min-height: 212px;
}
.promo-eyebrow {
  color: var(--accent-strong);
  font-size: 9px;
  letter-spacing: 0.13em;
}
.promo-main h2 {
  font-size: clamp(18px, 1.65vw, 24px);
  letter-spacing: -0.03em;
  line-height: 1.55;
  margin: 10px 0 8px;
  color: var(--text);
}
.promo-main p {
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-dim);
  margin: 0 0 18px;
  max-width: 320px;
}
.promo-cta {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 7px;
  padding: 9px 12px;
  transition: background 180ms ease-out;
}
.promo-main:hover .promo-cta {
  background: var(--accent-deep);
}
.promo-orbit {
  position: absolute;
  right: -28px;
  top: 10px;
  z-index: -1;
  color: var(--accent-soft);
  font: 300 190px var(--font-display);
  rotate: -25deg;
  transition: transform 400ms ease-out;
}
.promo-main:hover .promo-orbit {
  transform: rotate(8deg) scale(1.05);
}
.promo-scene {
  display: flex;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 16px;
  min-height: 212px;
  padding: 22px;
  color: var(--text);
  background-color: var(--bg-raised);
  background-size: cover;
  background-position: center;
}
.promo-scene::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, #0b122025 20%, #0b1220e8 100%);
}
.scene-cinema {
  background-image:
    radial-gradient(
      ellipse at 68% 30%,
      #efdaba 0%,
      #b9a392 10%,
      transparent 45%
    ),
    linear-gradient(
      165deg,
      #526773 30%,
      #c29673 49%,
      #38515a 50%,
      #203440 67%,
      #101820
    );
}
.scene-detail {
  background-image:
    radial-gradient(
      ellipse at 62% 34%,
      #e4c7ac 0%,
      #ad8268 13%,
      transparent 14%
    ),
    radial-gradient(ellipse at 35% 10%, #91a893 0%, #394d48 40%, #152321 70%);
}
.scene-number {
  font: 500 9px var(--font-display);
  letter-spacing: 0.16em;
  text-shadow: 0 1px 8px #000;
}
.scene-caption {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.scene-caption strong {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.scene-caption small {
  font-size: 10px;
  color: var(--text-dim);
}
button.promo-scene {
  transition:
    transform 180ms ease-out,
    border-color 180ms ease-out;
}
button.promo-scene:hover {
  transform: translateY(-2px);
  border-color: var(--accent-strong);
}
.library-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}
.section-kicker {
  color: var(--text-faint);
  font-size: 9px;
  letter-spacing: 0.13em;
}
.library-heading h2 {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.035em;
  margin: 6px 0 0;
}
.library-heading .search-input {
  flex: 0 1 270px;
  min-width: 0;
  font-size: 12px;
  border-radius: 9px;
  padding: 11px 14px;
  background: var(--bg-input);
}
.model-library {
  scroll-margin-top: 90px;
}
.studio-page .chip-row {
  gap: 7px;
  margin-bottom: 24px;
}
.studio-page .chip {
  background: transparent;
  font-size: 11px;
  font-weight: 500;
  border-color: var(--border);
  padding: 7px 12px;
}
.studio-page .chip.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: var(--accent-soft);
}
.studio-page .model-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: none;
  overflow: visible;
  padding: 0;
  gap: 12px;
}
.studio-page .model-card {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  min-width: 0;
  padding: 22px 18px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  text-align: left;
  transition:
    transform 180ms ease-out,
    box-shadow 180ms ease-out,
    background 180ms ease-out,
    border-color 180ms ease-out;
}
.studio-page .model-card:hover {
  transform: translateY(-2px);
  background: var(--bg-card-hover);
  border-color: var(--accent-strong);
  box-shadow: 0 8px 22px #0005;
}
.studio-page .model-card.selected {
  background: #162c52;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}
.model-icon {
  position: relative;
  display: block;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  overflow: hidden;
}
.model-icon svg,
.model-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.model-icon img {
  object-fit: contain;
  background: var(--bg-raised);
  padding: 3px;
}
.model-copy {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
}
.model-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}
.studio-page .model-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.model-pill {
  display: inline-flex;
  align-items: center;
  flex: none;
  width: fit-content;
  border-radius: 5px;
  padding: 2px 6px;
  background: var(--bg-card-hover);
  color: var(--text-dim);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.7;
  white-space: nowrap;
}
.unlimited-pill {
  color: var(--accent-strong);
  background: var(--accent-soft);
}
.studio-page .model-summary {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.65;
}
.model-note {
  display: block;
  color: var(--accent-2);
  font-size: 11px;
  line-height: 1.65;
  margin-top: 2px;
}
.model-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-faint);
}
.model-meta > span {
  border-left: 1px solid var(--border);
  padding-left: 8px;
}
.model-card > input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.model-card:has(input:checked)::after {
  content: "✓";
  position: absolute;
  right: 10px;
  bottom: 8px;
  color: var(--accent-strong);
  font-size: 10px;
}
.recipe-tabs {
  display: flex;
  gap: 18px;
  padding: 0;
  border: 0;
  margin: 0 0 16px;
}
.recipe-tabs label {
  position: relative;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 12px;
}
.recipe-tabs input {
  position: absolute;
  opacity: 0;
  width: 1px;
}
.recipe-tabs span {
  display: block;
  border-bottom: 2px solid transparent;
  padding: 0 3px 8px;
}
.recipe-tabs input:checked + span {
  color: var(--text);
  border-color: var(--accent);
}
#web-params fieldset {
  padding: 0;
  border: 0;
  margin: 0;
}
#web-params legend {
  color: var(--text-dim);
  font-size: 11px;
  margin-bottom: 10px;
}
#web-params label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  margin: 0 4px 6px 0;
  font-size: 12px;
  font-weight: 400;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
#web-params label:has(input:checked) {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: var(--accent);
}
#web-params input {
  accent-color: var(--accent);
  margin: 0;
}
.unlimited-promos {
  grid-template-columns: 1.5fr 1fr;
}
.catalog-status {
  color: var(--text-dim);
  font-size: 12px;
  margin: -5px 0 20px;
}
.result-card img {
  display: block;
  width: 100%;
}
@media (max-width: 1000px) {
  .studio-page .model-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .promo-grid {
    grid-template-columns: 1.4fr 1fr;
  }
  .promo-grid .scene-detail {
    display: none;
  }
  .brand {
    font-size: 14px;
  }
  .nav a {
    font-size: 12px;
    padding: 8px 10px;
  }
  .nav-user > span {
    display: none;
  }
}
@media (max-width: 640px) {
  .shell {
    padding: 0 16px 40px;
  }
  .topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px 16px 10px;
  }
  .brand {
    font-size: 15px;
  }
  .nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }
  .nav a {
    padding: 7px 12px;
  }
  .nav-user .logout {
    font-size: 10px;
  }
  .studio-hero {
    padding-top: 30px;
  }
  .studio-hero h1 {
    font-size: 25px;
    line-height: 1.65;
  }
  .mobile-break {
    display: block;
  }
  .studio-kicker {
    font-size: 9px;
  }
  .hero-caption {
    font-size: 11px;
  }
  .studio-page .composer {
    padding: 16px;
    border-radius: 18px;
  }
  .composer-input {
    gap: 12px;
    min-height: 140px;
  }
  .studio-page .composer-input textarea {
    font-size: 14px !important;
  }
  .add-material {
    flex-basis: 40px;
    width: 40px;
    height: 48px;
  }
  .composer-toolbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .model-selector {
    max-width: calc(100% - 54px);
  }
  .parameter-trigger {
    order: 4;
    flex: 1 1 100%;
    border: 0;
    border-top: 1px solid var(--border);
    padding: 12px 0 0;
  }
  .credit-label {
    order: 5;
    font-size: 11px;
    margin-left: 0;
  }
  .send-button {
    margin-left: auto;
  }
  .billing-line {
    font-size: 10px;
  }
  .parameter-fields {
    grid-template-columns: 1fr;
  }
  .promo-grid {
    margin: 28px 0 32px;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .promo-main {
    padding: 22px;
    min-height: 210px;
  }
  .promo-main h2 {
    font-size: 23px;
  }
  .promo-scene {
    min-height: 175px;
  }
  .library-heading {
    flex-wrap: wrap;
    gap: 16px;
  }
  .library-heading h2 {
    font-size: 21px;
  }
  .library-heading .search-input {
    flex-basis: 100%;
  }
  .studio-page .chip-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .studio-page .chip {
    flex: none;
  }
  .studio-page .model-grid {
    grid-template-columns: 1fr;
  }
  .studio-page .model-card {
    padding: 20px 16px;
  }
  .model-library {
    scroll-margin-top: 135px;
  }
}
/* 装飾だけでなくフォーカス移動・ホバー・開閉も動きを抑える。 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .model-card:hover,
  .history-card:hover,
  .result-card:hover,
  .promo-scene:hover,
  .promo-main:hover .promo-orbit,
  .send-button:active:not(:disabled) {
    transform: none !important;
  }
}
.audio-toggle {
  display: inline-grid;
  place-items: center;
  border: 0;
  padding: 6px;
  color: var(--text-dim);
  background: transparent;
  border-radius: 6px;
}
.audio-toggle svg {
  width: 20px;
  height: 20px;
}
.audio-toggle[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.audio-toggle:hover {
  color: var(--text);
}

/* プロンプト欄の任意画像添付。既存の色・余白トークンに合わせる。 */
.asset-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 0;
}
.asset-toolbar > span,
.asset-frame > span {
  color: var(--text-dim);
  font-size: 12px;
}
.asset-frame {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  max-width: 100%;
}
.asset-frame[hidden] {
  display: none;
}
.asset-add {
  width: 40px;
  height: 40px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}
.asset-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.asset-add:focus-visible,
.asset-preview button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.asset-add:disabled,
.asset-preview button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.asset-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}
.asset-preview[hidden] {
  display: none;
}
.asset-preview img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
}
.asset-preview span {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.asset-preview button {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
}
.asset-preview button:hover {
  color: var(--danger);
}
.composer.asset-dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
@media (max-width: 600px) {
  .asset-toolbar {
    padding: 16px 16px 0;
  }
  .asset-preview span {
    max-width: 120px;
  }
}
