/*
 * routes/creator.css — characters.html / create-ar.html / create.html / editor.html / onboarding.html でしか当たらない CSS（style.css から
 * scripts/split-route-css.js で機械分割・2026-09-07・07-static F4 第2段）。
 *
 * このバンドルのルールは**初期描画に要る**ので、読み込みは素の <link rel=stylesheet>（同期）。
 * ここのスタイルは直接このファイルを編集する（style.css に書くと test/route-css-split.test.js が赤にする）。
 * 編集したら node scripts/split-route-css.js --bump で <link> の ?v=（内容ハッシュ）を揃える。
 * どのルールがここに来るか / どのページが link するかの判定は scripts/route-css-config.js。
 */

/* 匿名時は WS 未接続なので接続ドットは誤表示になる — 非表示にする */
body.dc-anon .connection-dot { display: none; }

.connection-dot {
  width: 8px;
  height: 8px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

/* Notifications Button */
.notifications-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--r-8);
  color: var(--gray-400);
  cursor: pointer;
  transition: all 0.2s ease;
}

.notifications-btn:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

.dc-composer {
  width: 100%;
  max-width: 560px;
  background: var(--glass-white-strong);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--r-24);
  box-shadow: var(--glass-shadow);
  padding: 14px 14px 10px;
  transition: box-shadow .3s var(--ease-out);
}

.dc-composer.focused { box-shadow: var(--glass-shadow), 0 0 0 3px var(--red-light); }

.dc-composer textarea {
  flex: 1; border: 0; outline: none; resize: none; background: transparent;
  font-family: inherit; font-size: 16px; line-height: 1.5;
  /* 2026-07-29: 48px→56px、モバイルの 72px は撤廃。
     旧 placeholder は「どんなゲームにする？＋例文」の2行構成だったので 48px（狭幅では3行=72px）
     が必要だった。問いを .create-hero-title に出したので中身は例文1行だけになり、
     72px のままだと空行が2行ぶん白く空いて「壊れている」ように見える（実測）。
     56px = 例文1行＋書き足す余白1行ぶん。1行ぴったりにすると「1行しか書けない欄」に見えて
     長文を書く気が起きないため、余白1行は残す。
     長文向けに JS(autoResizeComposerInput) が scrollHeight まで伸ばし、上限176px(≒7行)。
     スクロールバーは上限に達した時だけ JS が .is-overflowing で有効化する */
  min-height: 56px; max-height: 176px; overflow-y: hidden;
  color: var(--gray-900);
}

.dc-composer textarea.is-overflowing { overflow-y: auto; }

/* 上限到達時のみスクロール */
.dc-composer textarea::placeholder { color: var(--gray-400); }

/* サジェストチップ（白紙対策）: 選択肢を聞くのではなく「例を見せる」。🎲で入替、タップは入力欄への流し込みのみ */
.dc-chips {
  width: 100%; max-width: 560px;
  display: flex; gap: 8px; overflow-x: auto;
  padding: 0 2px 6px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
          mask-image: linear-gradient(90deg, #000 92%, transparent);
}

.dc-chips::-webkit-scrollbar { display: none; }

.character-callout {
  display: flex;
  align-items: center;
  gap: var(--s-8);
}

.character-shelf-link,
.character-create-button,
.character-create-inline {
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-700);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.character-create-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: var(--s-6);
  padding: 0 var(--s-12);
  border-radius: var(--r-8);
  font-weight: 800;
}

.character-create-button:hover,
.character-shelf-link:hover,
.character-create-inline:hover {
  border-color: var(--red);
  color: var(--red);
}

.character-create-button:disabled,
.character-create-inline:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.character-callout-list {
  display: flex;
  align-items: stretch;
  gap: var(--s-8);
  max-width: 100%;
  overflow-x: auto;
  padding: var(--s-4) 0;
}

.create-character-choice {
  width: 112px;
  flex: 0 0 112px;
  min-height: 84px;
  padding: var(--s-8);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-12);
  background: var(--white);
  display: grid;
  gap: var(--s-6);
  justify-items: start;
  color: var(--gray-900);
  cursor: pointer;
}

.create-character-choice:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.create-character-choice-thumb {
  width: 64px;
  aspect-ratio: 3 / 2;
  min-height: 42px;
  border-radius: var(--r-8);
  background:
    linear-gradient(135deg, rgba(255, 59, 48, 0.08), rgba(31, 41, 55, 0.08)),
    var(--gray-100);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--gray-400);
  font-size: 0.65rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.create-character-choice-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 900;
}

.character-callout-more,
.character-callout-empty {
  min-height: 84px;
  flex: 0 0 auto;
  border: 1px dashed var(--gray-300);
  border-radius: var(--r-12);
  background: rgba(255, 255, 255, 0.72);
}

.character-callout-more {
  min-width: 104px;
  padding: 0 var(--s-12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-700);
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: none;
}

.character-card {
  min-width: 0;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-8);
  background: var(--white);
  overflow: hidden;
}

.character-card-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  background:
    linear-gradient(135deg, rgba(255, 59, 48, 0.08), rgba(31, 41, 55, 0.08)),
    var(--gray-100);
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
}

.character-card-thumb:hover {
  filter: brightness(0.98);
}

.character-card-thumb:active {
  filter: brightness(0.95);
}

.character-card-body {
  padding: var(--s-10);
}

.character-card-name {
  font-size: 0.9375rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-card-status {
  margin-top: 2px;
  min-height: 16px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
}

.character-card-status[data-status="ready"] {
  color: #047857;
}

.character-card-status[data-status="failed"],
.character-card-status[data-status="needs_more_reference"] {
  color: #B42318;
}

.character-create-game-button {
  width: 100%;
  margin-top: var(--s-10);
}

.character-use-button,
.character-retry-button {
  min-height: 32px;
  border: none;
  border-radius: var(--r-8);
  font-weight: 800;
  cursor: pointer;
}

.character-use-button {
  background: var(--gray-900);
  color: var(--white);
}

.character-use-button:disabled,
.character-retry-button:disabled {
  background: var(--gray-200);
  color: var(--gray-500);
  cursor: not-allowed;
}

.character-mini-card {
  position: relative;
  min-width: 0;
  max-width: 220px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-8);
  background: var(--white);
  padding: var(--s-4) var(--s-8);
  cursor: default;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
}

.character-mini-card-sheet {
  width: auto;
}

.character-mini-card-toggle {
  max-width: 100%;
  border-radius: 999px;
  cursor: pointer;
  padding-right: var(--s-12);
}

.character-mini-card-thumb {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--r-4);
  background:
    linear-gradient(135deg, rgba(255, 59, 48, 0.08), rgba(31, 41, 55, 0.08)),
    var(--gray-100);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.character-mini-card-thumb-small {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
}

.character-mini-card-name {
  margin-top: 0;
  max-width: 120px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--gray-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-mini-card-toggle .character-mini-card-name {
  max-width: 190px;
}

.character-mini-card-status {
  min-height: 40px;
  color: var(--gray-500);
  font-size: 0.75rem;
  font-weight: 800;
  cursor: default;
}

.character-modal-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: var(--s-8);
  margin-top: var(--s-12);
}

.character-modal-preview-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--r-8);
  border: 1px solid var(--gray-200);
}

.character-upload-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: var(--s-24);
  border: 2px dashed #C5C5BF;
  border-radius: 18px;
  background: var(--white);
  color: #0F1115;
  cursor: pointer;
  overflow: hidden;
  text-align: center;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease;
}

.character-upload-icon {
  width: 60px;
  height: 60px;
  margin-bottom: var(--s-14);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0F1115;
  color: var(--white);
  box-shadow: 0 2px 0 rgba(15, 17, 21, 0.16);
  transition: transform 0.2s ease;
}

.character-upload-dropzone:hover,
.character-upload-dropzone:focus-within {
  border-color: #0F1115;
  border-style: solid;
  background: #FAFAF7;
}

.character-upload-dropzone:hover .character-upload-icon,
.character-upload-dropzone:focus-within .character-upload-icon {
  transform: translateY(-2px);
}

.character-upload-dropzone:active {
  transform: scale(0.995);
}

.character-upload-dropzone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.character-create-privacy-note {
  margin-top: var(--s-12);
  padding: 0;
  background: transparent;
  color: #9CA3AF;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
  letter-spacing: 0.02em;
}

.characters-page-header {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #ECEBE6;
  backdrop-filter: blur(14px);
}

.characters-back-link {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  color: #0F1115;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background-color 0.16s ease;
}

.characters-back-link:hover {
  background: #F2F2EE;
}

.characters-main {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: var(--s-32) var(--s-24) calc(var(--bottom-nav-reserved-space-comfy) + var(--s-32));
}

.characters-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-16);
  margin-bottom: var(--s-32);
}

.characters-title-row h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 950;
  line-height: 0.94;
  letter-spacing: -0.025em;
  color: #0F1115;
}

.characters-create-top {
  min-height: 44px;
  padding: 0 var(--s-18);
  background: #0F1115;
  color: var(--white);
  border: 1.5px solid #0F1115;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 0.02em;
  transition: background-color 0.16s ease, transform 0.06s ease;
}

.characters-create-top:hover {
  background: #2A2C32;
}

.characters-create-top:disabled,
.characters-create-top:disabled:hover {
  background: var(--white);
  border-color: #ECEBE6;
  color: #B5B7BD;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.characters-create-top:active {
  transform: translateY(1px);
}

.characters-empty-state {
  position: relative;
  min-height: 480px;
  border: 1.5px solid rgba(28, 26, 23, 0.08);
  border-radius: 32px;
  background:
    radial-gradient(120% 70% at 0% 0%, rgba(255, 199, 39, 0.22), transparent 55%),
    radial-gradient(110% 60% at 100% 100%, rgba(255, 59, 48, 0.10), transparent 55%),
    #FFFDF7;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 18px 48px rgba(28, 26, 23, 0.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  padding: clamp(36px, 5vw, 56px) clamp(28px, 5vw, 48px);
  overflow: hidden;
}

.characters-empty-state::after {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255, 199, 39, 0.5), transparent 60%);
  filter: blur(50px);
  pointer-events: none;
  z-index: 0;
}

.characters-empty-state > * {
  position: relative;
  z-index: 1;
}

.characters-empty-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 var(--s-20);
  padding: 6px 14px;
  background: #1C1A17;
  color: #FFFFFF;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  border-radius: 999px;
  transform: rotate(-1.5deg);
  box-shadow: 0 6px 14px rgba(28, 26, 23, 0.16);
}

.characters-empty-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #FFC727;
  box-shadow: 0 0 0 3px rgba(255, 199, 39, 0.3);
}

.characters-empty-title {
  margin: 0 0 var(--s-20);
  font-size: clamp(1.9rem, 5.8vw, 3.4rem);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: #1C1A17;
}

.characters-empty-title-accent {
  position: relative;
  display: inline-block;
  color: #FF3B30;
}

.characters-empty-title-accent::after {
  content: "";
  position: absolute;
  left: -3%;
  right: -3%;
  bottom: 0.05em;
  height: 0.24em;
  background: #FFC727;
  border-radius: 999px;
  z-index: -1;
  opacity: 0.85;
  transform: skew(-6deg);
}

.characters-empty-state .characters-empty-copy {
  max-width: 420px;
  margin: 0 0 var(--s-32);
  color: #4A463F;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.6;
}

.characters-empty-state .character-create-button.characters-empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 0 28px 0 32px;
  background: #FF3B30;
  color: #FFFFFF;
  border: 2.5px solid #1C1A17;
  border-radius: 999px;
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 6px 0 #1C1A17,
    0 18px 32px rgba(255, 59, 48, 0.32);
  transition: transform 0.18s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)), box-shadow 0.18s ease, background-color 0.18s ease;
}

.characters-empty-state .character-create-button.characters-empty-cta:hover {
  transform: translateY(-3px);
  background: #E5251A;
  box-shadow:
    0 9px 0 #1C1A17,
    0 22px 38px rgba(255, 59, 48, 0.42);
}

.characters-empty-state .character-create-button.characters-empty-cta:active {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 #1C1A17,
    0 10px 20px rgba(255, 59, 48, 0.3);
}

.characters-empty-cta-arrow {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 1.05rem;
}

.characters-empty-state .characters-empty-note {
  max-width: 320px;
  margin: var(--s-20) 0 0;
  color: rgba(28, 26, 23, 0.5);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

@media (max-width: 540px) {
.characters-empty-state {
    min-height: 420px;
    padding: clamp(28px, 6vw, 40px) clamp(22px, 5vw, 32px);
    border-radius: 26px;
  }

.characters-empty-title {
    font-size: clamp(1.7rem, 7vw, 2.6rem);
  }

.characters-empty-state .character-create-button.characters-empty-cta {
    min-height: 58px;
    font-size: 1rem;
  }

.characters-hero-share span {
    display: none;  /* モバイルではアイコンのみ */
  }

.characters-hero-share {
    padding: 0;
    width: 36px;
    justify-content: center;
  }
}

.characters-progress-card {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: var(--s-20);
  align-items: center;
  margin-bottom: var(--s-16);
  padding: var(--s-18);
  border: 1.5px solid rgba(230, 0, 18, 0.18);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(230, 0, 18, 0.06), rgba(255, 183, 3, 0.08)),
    #FFFFFF;
}

.characters-progress-card h3,
.characters-progress-card p,
.characters-progress-card ol {
  margin: 0;
}

.characters-progress-card h3 {
  color: #0F1115;
  font-size: 1.05rem;
  font-weight: 950;
  letter-spacing: -0.01em;
}

.characters-progress-card p {
  margin-top: var(--s-6);
  color: #5F646D;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.5;
}

.characters-progress-card ol {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-8);
  padding: 0;
}

.characters-progress-card li {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  min-width: 0;
  color: #6C7079;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.3;
}

.characters-progress-card li > span {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 2px solid #D7D7D2;
  background: #FFFFFF;
}

.characters-progress-card li[data-state="done"] {
  color: #047857;
}

.characters-progress-card li[data-state="done"] > span {
  border-color: #047857;
  background: #047857;
  box-shadow: inset 0 0 0 4px #FFFFFF;
}

.characters-progress-card li[data-state="active"] {
  color: #0F1115;
}

.characters-progress-card li[data-state="active"] > span {
  border-color: #E60012;
  border-top-color: transparent;
  animation: character-spin 0.8s linear infinite;
}

/* ── Hero ───────────────────────────────────── */

.characters-spotlight {
  display: block;
  margin-bottom: var(--s-48);
}

.characters-page.is-detail-view .characters-title-row,
.characters-page.is-detail-view .characters-roster-section {
  display: none;
}

.characters-spotlight-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 var(--s-12) 0 var(--s-8);
  margin: 0 0 var(--s-24);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #6B7280;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.characters-spotlight-back:hover,
.characters-spotlight-back:focus-visible {
  background: #F2F2EE;
  color: #0F1115;
  outline: none;
}

.characters-spotlight-back svg {
  flex: 0 0 auto;
}

.characters-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: var(--s-32);
  align-items: center;
  border: 1px solid #ECEBE6;
  border-radius: 28px;
  background: #FFFFFF;
  padding: var(--s-32);
}

.characters-hero-art {
  position: relative;
  margin: 0;
  align-self: start;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 22px;
  background: #F2F2EE;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(15, 17, 21, 0.05);
}

.characters-hero-art-fallback {
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 950;
  letter-spacing: -0.04em;
  color: #C5C5BF;
}

.characters-hero-art.is-generating::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  z-index: 1;
}

.characters-hero-art.is-generating::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border: 4px solid rgba(15, 17, 21, 0.14);
  border-top-color: #0F1115;
  border-radius: 999px;
  animation: character-spin 0.8s linear infinite;
  z-index: 2;
}

.characters-hero-info {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
  padding: 0;
}

.characters-hero-titlebar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-12);
  margin-bottom: var(--s-16);
}

.characters-hero-actions-row {
  display: inline-flex;
  align-items: center;
  gap: var(--s-6);
  flex-shrink: 0;
}

.characters-hero-share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1.5px solid #0F1115;
  border-radius: 999px;
  background: var(--white);
  color: #0F1115;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.005em;
  cursor: pointer;
  transition: background-color 0.16s ease, transform 0.06s ease;
  -webkit-tap-highlight-color: transparent;
}

.characters-hero-share:hover {
  background: #F2F2EE;
}

.characters-hero-share:active {
  transform: translateY(1px);
}

.characters-hero-share svg {
  flex: 0 0 auto;
}

.characters-hero-status {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  margin-bottom: var(--s-16);
}

.characters-hero-name {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 950;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: #0F1115;
  overflow-wrap: anywhere;
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  padding: 2px 8px;
  margin-left: -8px;
  border-radius: 8px;
  cursor: text;
  transition: background-color 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}

.characters-hero-name:hover,
.characters-hero-name:focus-visible {
  background: #F4F4F0;
  outline: none;
}

.characters-hero-name-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: #8A8F98;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.characters-hero-name:hover .characters-hero-name-edit,
.characters-hero-name:focus-visible .characters-hero-name-edit {
  opacity: 1;
}

@media (hover: none) {
.characters-hero-name-edit {
    opacity: 0.6;
  }

.characters-variant-redo {
    opacity: 1;
    transform: scale(1);
  }
}

.characters-hero-name.is-editing {
  cursor: text;
  background: #F4F4F0;
}

.characters-hero-name-input {
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  outline: none;
  padding: 0;
  margin: 0;
  width: 100%;
  min-width: 0;
}

.characters-hero-name-input::placeholder {
  color: #C5C5BF;
  font-weight: 700;
}

.characters-hero-desc {
  margin: 0 0 var(--s-24);
  max-width: 50ch;
  color: #4A4F58;
  line-height: 1.6;
  font-size: 0.95rem;
}

.characters-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-10);
  align-items: center;
}

/* ── Character ID line (subtle metadata under name) ── */
.characters-hero-id {
  margin: 0 0 var(--s-16);
  color: #8A8F98;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
}

/* ── Movement choice board (Hero の下、2up ポスター + Blank) ── */
.characters-movement-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-16);
  margin-top: var(--s-24);
  margin-bottom: var(--s-32);
}

/* 3枚目 (白紙) は横一杯 */
.characters-movement-board .characters-movement-card-blank {
  grid-column: 1 / -1;
}

.characters-movement-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  border: 1px solid #ECEBE6;
  border-radius: 22px;
  background: var(--white);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.06s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.characters-movement-card:hover {
  border-color: #0F1115;
  box-shadow: 0 2px 0 #0F1115;
  transform: translateY(-1px);
}

.characters-movement-card:active {
  transform: translateY(0);
  box-shadow: 0 0 0 #0F1115;
}

.characters-movement-card:disabled {
  cursor: default;
  opacity: 0.5;
  box-shadow: none;
  transform: none;
}

.characters-movement-card:disabled:hover {
  border-color: var(--gray-200);
  transform: none;
  box-shadow: none;
}

.characters-movement-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--s-18) var(--s-20) var(--s-20);
  min-width: 0;
}

.characters-movement-card-title {
  color: #0F1115;
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.characters-movement-card-desc {
  color: #6C7079;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.005em;
}

.characters-movement-card:disabled .characters-movement-card-desc {
  color: #8A8F98;
}

.characters-linked-games {
  margin-top: 0;
  padding-top: var(--s-24);
  border-top: 1px solid #ECEBE6;
}

.characters-linked-game-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-16);
}

.characters-linked-game-card {
  display: block;
  min-height: 0;
  color: inherit;
  text-decoration: none;
}

.characters-linked-game-card:hover {
  text-decoration: none;
}

.characters-linked-game-card .project-card-thumbnail {
  aspect-ratio: 3 / 4;
}

.characters-linked-game-card .project-card-header {
  padding-top: var(--s-12);
}

.characters-linked-game-card .project-card-title {
  min-height: 2.8em;
}

.characters-linked-game-card .project-card-badge {
  background: #0F1115;
}

.characters-linked-game-card .project-card-badge.is-public {
  background: #34C759;
}

.characters-linked-game-card .project-card-badge.is-share-ready {
  background: #007AFF;
}

.characters-linked-games-more {
  width: 100%;
  margin-top: var(--s-14);
  min-height: 48px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-14);
  background: #FFFFFF;
  color: #0F1115;
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
}

.characters-linked-games-more:disabled {
  color: #8A8F98;
  cursor: wait;
}

.characters-linked-game-empty {
  border: 1.5px dashed var(--gray-200);
  border-radius: 18px;
  padding: var(--s-18);
  color: #6C7079;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.55;
  background: #FAFAF8;
}

@media (max-width: 760px) {
.characters-movement-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-10);
    margin-top: var(--s-20);
  }

.characters-linked-game-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-10);
  }

.characters-movement-card-title {
    font-size: 1rem;
  }

.characters-movement-card-body {
    padding: var(--s-12);
  }

.characters-movement-card-desc {
    font-size: 0.76rem;
  }

.characters-movement-card .character-play-movement-preview {
    aspect-ratio: 16 / 9;
  }

.characters-main {
    padding: var(--s-24) var(--s-16) calc(var(--bottom-nav-reserved-space-comfy) + var(--s-24));
  }

.characters-title-row {
    align-items: center;
    margin-bottom: var(--s-24);
  }

.characters-progress-card {
    grid-template-columns: 1fr;
    gap: var(--s-14);
    padding: var(--s-16);
  }

.characters-progress-card ol {
    grid-template-columns: 1fr;
  }

.characters-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-20);
    padding: var(--s-20);
    border-radius: 22px;
  }

.characters-hero-info {
    padding: 0;
  }

.characters-movement-board {
    margin-top: var(--s-20);
    margin-bottom: var(--s-24);
  }

.characters-linked-games {
    padding-top: var(--s-20);
  }

.characters-hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

.characters-variant-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s-8);
  }

.characters-variant-body {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: var(--s-10);
  }

.characters-variant-body h3 {
    font-size: 0.85rem;
  }

.characters-roster-grid {
    grid-template-columns: 1fr;
    gap: var(--s-16);
  }

.characters-library-tools {
    justify-content: flex-end;
  }

.project-complete-visual {
    width: min(68vw, 260px);
    max-height: 48dvh;
    border-radius: 20px;
  }

.project-complete-expand {
    top: 10px;
    right: 10px;
    width: 42px;
    height: 42px;
  }

.project-complete-asset-tile {
    flex-basis: 88px;
    border-radius: 16px;
  }

.project-complete-next {
    width: 44px;
    height: 44px;
  }

.project-complete-share-card {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
  }
}

/* ── 白紙カード (Canva の Blank と同じ立ち位置) ── */
.characters-movement-card.characters-movement-card-blank {
  flex-direction: row;
  align-items: center;
  gap: var(--s-14);
  padding: var(--s-18) var(--s-20);
  border-style: dashed;
  border-width: 1.5px;
  background: #FAFAF7;
}

.characters-movement-card.characters-movement-card-blank:hover {
  border-color: #0F1115;
  border-style: solid;
  background: var(--white);
  box-shadow: 0 2px 0 #0F1115;
}

.characters-movement-blank-mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: var(--white);
  border: 1.5px solid #ECEBE6;
  color: #0F1115;
}

.characters-movement-blank-mark svg {
  width: 22px;
  height: 22px;
}

.characters-movement-card.characters-movement-card-blank .characters-movement-card-body {
  padding: 0;
  gap: 2px;
}

/* ── アニメ付きプレビュー (sprite sheet を CSS で steps 表示) ── */
.characters-movement-card .character-play-movement-preview {
  --movement-preview-image: none;
  --movement-preview-width: 400%;
  --movement-preview-height: 500%;
  --movement-preview-frames: 4;
  --movement-preview-row: 0%;
  position: relative;
  display: grid;
  place-items: end center;
  width: 100%;
  aspect-ratio: 5 / 3;
  overflow: hidden;
  border-radius: 0;
  background:
    radial-gradient(ellipse 60% 30% at 50% 95%, rgba(0, 0, 0, 0.06) 0, transparent 70%),
    linear-gradient(180deg, #B6E2FF 0%, #DDF1FF 55%, #84C66A 56%, #5DAD55 100%);
}

/* 雲 (走って跳ぶ用に明るい空に浮かぶ) */
.characters-movement-card[data-template-id="side-scroller"] .character-play-movement-preview::before,
.characters-movement-card[data-template-id="side-scroller"] .character-play-movement-preview::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  box-shadow:
    -8px 0 0 -2px rgba(255, 255, 255, 0.92),
    8px -2px 0 -3px rgba(255, 255, 255, 0.92);
}

.characters-movement-card[data-template-id="side-scroller"] .character-play-movement-preview::before {
  width: 22px;
  height: 8px;
  top: 22%;
  left: 18%;
  animation: chm-side-cloud-drift-a 12s linear infinite;
}

.characters-movement-card[data-template-id="side-scroller"] .character-play-movement-preview::after {
  width: 18px;
  height: 7px;
  top: 35%;
  right: auto;
  left: 90%;
  animation: chm-side-cloud-drift-b 16s linear infinite;
}

.characters-movement-card .character-play-movement-ground {
  display: none;  /* デフォルト非表示。template ごとに必要なら override */
}

/* 走って跳ぶの地面: 右から左に流れるダッシュ線で「動いてる」感 */
.characters-movement-card[data-template-id="side-scroller"] .character-play-movement-ground {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14%;
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    rgba(15, 17, 21, 0.24) 0 16px,
    transparent 16px 36px
  );
  border-radius: 999px;
  animation: chm-side-ground-scroll 0.5s linear infinite;
  z-index: 0;
}

.characters-movement-card .character-play-movement-ground::before,
.characters-movement-card .character-play-movement-ground::after {
  content: "";
  position: absolute;
  top: -5px;
  width: 10px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  opacity: 0.75;
}

.characters-movement-card .character-play-movement-ground::before {
  left: 6px;
  transform: rotate(-135deg);
}

.characters-movement-card .character-play-movement-ground::after {
  right: 6px;
  transform: rotate(45deg);
}

.characters-movement-card .character-play-movement-sprite {
  position: relative;
  z-index: 1;
  width: auto;
  height: 88%;
  aspect-ratio: 5 / 9;
  margin-bottom: 6%;
  background-image: var(--movement-preview-image);
  background-repeat: no-repeat;
  background-size: var(--movement-preview-width) var(--movement-preview-height);
  background-position: 0 var(--movement-preview-row);
  filter: drop-shadow(0 3px 0 rgba(15, 17, 21, 0.16));
  animation:
    chm-preview-frames 0.8s steps(var(--movement-preview-frames)) infinite,
    chm-preview-walk 1.6s ease-in-out infinite;
}

/* 走って跳ぶ: 横にぴょんぴょん移動 */
.characters-movement-card[data-template-id="side-scroller"] .character-play-movement-ground::before {
  display: none;
}

.characters-movement-card[data-template-id="side-scroller"] .character-play-movement-sprite {
  height: 108%;            /* セル上下パディングを少し card 外に追い出す */
  margin-bottom: -2%;      /* 足元をダッシュ地面のすぐ上に */
  transform-origin: 50% 100%;
  animation:
    chm-preview-frames 0.5s steps(6, jump-none) infinite,
    chm-side-character-hop 2.4s ease-in-out infinite;
}

/* 歩いて回る: 見下ろし型の草原 */
.characters-movement-card[data-template-id="quarter-adventure"] .character-play-movement-preview {
  background:
    /* 草のドット */
    radial-gradient(circle at 18% 28%, rgba(255, 255, 255, 0.45) 0 1.2px, transparent 1.6px),
    radial-gradient(circle at 78% 22%, rgba(255, 255, 255, 0.45) 0 1px, transparent 1.4px),
    radial-gradient(circle at 30% 78%, rgba(255, 255, 255, 0.4) 0 1px, transparent 1.4px),
    radial-gradient(circle at 88% 70%, rgba(255, 255, 255, 0.4) 0 1px, transparent 1.4px),
    /* 真ん中の照明 */
    radial-gradient(ellipse 45% 30% at 50% 50%, rgba(255, 255, 255, 0.22), transparent 70%),
    linear-gradient(180deg, #7DC76A 0%, #5DAD55 100%);
}

.characters-movement-card[data-template-id="quarter-adventure"] .character-play-movement-ground {
  display: none;  /* 8方向カードでは地面ラインは guide の十字で代用 */
}

.characters-movement-card[data-template-id="quarter-adventure"] .character-play-movement-ground::before,
.characters-movement-card[data-template-id="quarter-adventure"] .character-play-movement-ground::after {
  top: -4px;
  width: 8px;
  height: 8px;
}

.characters-movement-card[data-template-id="quarter-adventure"] .character-play-movement-ground::before {
  left: -1px;
  transform: rotate(-135deg);
}

.characters-movement-card[data-template-id="quarter-adventure"] .character-play-movement-ground::after {
  right: -1px;
  transform: rotate(45deg);
}

.characters-movement-card[data-template-id="quarter-adventure"] .character-play-movement-guide {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 0;
  width: 55%;
  aspect-ratio: 1 / 1;
  color: currentColor;
  opacity: 0.22;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.characters-movement-card[data-template-id="quarter-adventure"] .character-play-movement-guide::before,
.characters-movement-card[data-template-id="quarter-adventure"] .character-play-movement-guide::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120%;
  height: 2px;
  background: currentColor;
  transform-origin: 50% 50%;
}

.characters-movement-card[data-template-id="quarter-adventure"] .character-play-movement-guide::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.characters-movement-card[data-template-id="quarter-adventure"] .character-play-movement-guide::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.characters-movement-card[data-template-id="quarter-adventure"] .character-play-movement-sprite {
  width: auto;
  height: 82%;
  aspect-ratio: 4 / 7;
  margin-bottom: 8%;
  transform-origin: 50% 86%;
  will-change: transform, background-position;
  animation: chm-preview-eight-way 2.8s steps(1, end) infinite;
}

@media (prefers-reduced-motion: reduce) {
.characters-movement-card .character-play-movement-sprite {
    animation: none !important;
    background-position: 0 var(--movement-preview-row);
  }
}

.characters-action-status {
  margin: var(--s-16) 0 0;
  color: #6C7079;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.5;
}

.characters-action-status:empty {
  display: none;
}

.characters-failed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
  margin-top: var(--s-16);
}

.characters-quiet-actions {
  margin-top: var(--s-16);
  align-self: flex-start;
  color: #6C7079;
  font-size: 0.82rem;
  font-weight: 800;
}

.characters-quiet-actions summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 var(--s-12);
  border: 1px solid #D8D6CE;
  border-radius: 999px;
  background: #FFFFFF;
  cursor: pointer;
}

.characters-quiet-actions summary::-webkit-details-marker {
  display: none;
}

.characters-quiet-actions summary::after {
  content: "+";
  margin-left: var(--s-8);
  font-weight: 950;
}

.characters-quiet-actions[open] summary::after {
  content: "-";
}

.characters-quiet-actions-body {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
  margin-top: var(--s-10);
}

.characters-template-rebuild-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
  margin-top: 0;
}

.characters-template-rebuild,
.characters-quiet-action {
  min-height: 36px;
  padding: 0 var(--s-14);
  border: 1.5px solid #D8D6CE;
  border-radius: 999px;
  background: #FFFFFF;
  color: #0F1115;
  font-size: 0.8rem;
  font-weight: 900;
  cursor: pointer;
}

.characters-quiet-action {
  background: #F8F8F5;
}

.characters-template-rebuild:not(:disabled):hover,
.characters-quiet-action:not(:disabled):hover {
  border-color: #0F1115;
  background: #F8F8F5;
}

.characters-template-rebuild:disabled,
.characters-quiet-action:disabled {
  color: #8A8F98;
  background: #F2F2EE;
  cursor: default;
}

.characters-source-thumb,
.characters-asset-thumb {
  background-size: cover;
  background-position: center;
  background-color: #F2F2EE;
}

.characters-source-thumb {
  width: 36px;
  height: 36px;
  border: 1px solid #ECEBE6;
  border-radius: 10px;
}

/* ── Sub-section headers (used by linked-games inside spotlight) ── */

.characters-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-12);
  margin: 0 0 var(--s-16);
  padding: 0;
}

.characters-section-header h2 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  color: #0F1115;
}

.characters-section-header span {
  color: #0F1115;
  font-weight: 900;
  font-size: 0.92rem;
  letter-spacing: 0;
}

.characters-section-header span small {
  color: #8A8F98;
  font-weight: 800;
}

.character-stock {
  display: inline-flex;
  align-items: center;
  gap: var(--s-14);
  line-height: 1;
}

.character-stock__meter {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  min-height: 24px;
}

.character-stock__label,
.character-stock__monthly-label {
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #9CA3AF;
}

.character-stock__pips {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.character-stock__pips i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #0F1115;
  transition: background-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.character-stock__pips i:not(.is-on) {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px #D8D8D2;
}

.character-stock__hint {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-size: 0.78rem;
  font-weight: 900;
  color: #0F1115;
  font-variant-numeric: tabular-nums;
}

.character-stock__hint small {
  font-size: 0.6rem;
  font-weight: 800;
  color: #9CA3AF;
  letter-spacing: 0.04em;
}

.character-stock__monthly {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: var(--s-14);
  border-left: 1px solid #ECEBE6;
}

.character-stock__monthly-value {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  font-size: 0.78rem;
  font-weight: 900;
  color: #0F1115;
  font-variant-numeric: tabular-nums;
}

.character-stock__monthly-value em {
  font-style: normal;
  font-weight: 800;
  font-size: 0.6rem;
  color: #9CA3AF;
  margin-left: 1px;
}

.character-stock__monthly-value small {
  font-size: 0.6rem;
  font-weight: 800;
  color: #9CA3AF;
  letter-spacing: 0.04em;
  margin-right: 2px;
}

.character-stock__filter {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: var(--r-full);
  background: var(--gray-100);
  color: #6B7280;
  font-size: 0.62rem;
  font-weight: 900;
  white-space: nowrap;
}

@media (max-width: 480px) {
.character-stock { gap: var(--s-10); }

.character-stock__monthly { padding-left: var(--s-10); }

#chatInput {
    font-size: 16px;
  }

.welcome-message {
    padding: var(--s-16);
  }

.welcome-icon {
    width: 64px;
    height: 64px;
    margin-bottom: var(--s-16);
  }

.welcome-icon svg {
    width: 32px;
    height: 32px;
  }

.welcome-message h3 {
    font-size: 1.5rem;
  }

.welcome-message p {
    font-size: 0.9375rem;
    margin-bottom: var(--s-16);
  }

.example-chip {
    padding: var(--s-8) var(--s-12);
    font-size: 0.875rem;
  }

.quota-exceeded-error {
    gap: var(--s-8);
    padding: var(--s-12);
  }

.quota-error-icon {
    width: 32px;
    height: 32px;
  }

.quota-error-icon svg {
    width: 18px;
    height: 18px;
  }

.quota-error-title {
    font-size: 0.8125rem;
  }

.quota-error-detail {
    font-size: 0.75rem;
  }

.quota-error-reset {
    font-size: 0.6875rem;
  }
}

.characters-style-board {
  margin-bottom: var(--s-48);
}

.characters-library-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-12);
  margin: 0 0 var(--s-16);
  padding: var(--s-10) 0;
  border-top: 1px solid #ECEBE6;
  border-bottom: 1px solid #ECEBE6;
}

.characters-search,
.characters-sort {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
}

.characters-search span,
.characters-sort span {
  color: #9CA3AF;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.characters-search input,
.characters-sort select {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #0F1115;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 0 var(--s-12);
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.characters-sort select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: var(--s-24);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%230F1115' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M1 1l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right var(--s-10) center;
}

.characters-sort select:hover {
  background-color: #F5F5F2;
}

.characters-search input:focus,
.characters-sort select:focus {
  outline: 2px solid rgba(15, 17, 21, 0.16);
  border-color: #0F1115;
}

.characters-more-menu {
  position: relative;
  flex: 0 0 auto;
  z-index: 5;
}

.characters-more-menu summary {
  list-style: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1.5px solid #ECEBE6;
  border-radius: 999px;
  background: #FFFFFF;
  color: #0F1115;
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.characters-more-menu summary::-webkit-details-marker {
  display: none;
}

.characters-more-menu[open] summary,
.characters-more-menu summary:hover {
  border-color: #0F1115;
}

.characters-more-menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 148px;
  padding: var(--s-6);
  border: 1px solid #ECEBE6;
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: 0 18px 44px rgba(15, 17, 21, 0.16);
}

.characters-more-menu-popover button {
  display: block;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #0F1115;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 900;
  text-align: left;
  padding: 0 var(--s-10);
  cursor: pointer;
}

.characters-more-menu-popover button:hover {
  background: #F2F2EE;
}

.characters-more-menu-popover button[data-character-page-action="delete-character"] {
  color: #D90012;
}

/* ── Single generated character sheet ───────── */

.characters-sheet-board {
  margin-bottom: var(--s-48);
}

.characters-sheet-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  border: 1.5px solid #ECEBE6;
  border-radius: 20px;
  background: #FFFFFF;
}

.characters-sheet-image {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 320px;
  background: #F2F2EE;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8A8F98;
  font-size: 0.84rem;
  font-weight: 900;
  overflow: hidden;
}

.characters-sheet-card.is-generating .characters-sheet-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  z-index: 1;
}

.characters-sheet-card.is-generating .characters-sheet-image::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 3px solid rgba(15, 17, 21, 0.16);
  border-top-color: #E60012;
  border-radius: 999px;
  animation: character-spin 0.8s linear infinite;
  z-index: 2;
}

.characters-sheet-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-16);
  padding: var(--s-16) var(--s-18);
  border-top: 1px solid #ECEBE6;
}

.characters-sheet-body h3 {
  margin: 0;
  color: #0F1115;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.characters-sheet-body small {
  display: block;
  margin-top: 2px;
  color: #8A8F98;
  font-size: 0.72rem;
  font-weight: 800;
}

.characters-sheet-redo {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 var(--s-16);
  border: 1.5px solid #ECEBE6;
  border-radius: 999px;
  background: #FFFFFF;
  color: #0F1115;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.characters-sheet-redo:not(:disabled):hover {
  border-color: #0F1115;
}

.characters-sheet-redo:disabled {
  color: #8A8F98;
  cursor: default;
}

/* ── Variant cards (Sato 3-up grid) ─────────── */

.characters-variant-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-12);
}

.characters-variant-card-wrap {
  position: relative;
  border-radius: 20px;
  overflow: visible;
}

.characters-variant-card {
  display: block;
  width: 100%;
  border: 1.5px solid #ECEBE6;
  border-radius: 20px;
  background: #FFFFFF;
  padding: 0;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  color: inherit;
  font: inherit;
  transition: border-color 0.16s ease, transform 0.06s ease;
}

.characters-variant-card:not(:disabled):hover {
  border-color: #0F1115;
}

.characters-variant-card:not(:disabled):active {
  transform: translateY(1px);
}

.characters-variant-card:disabled {
  cursor: default;
}

.characters-variant-card-wrap.is-selected .characters-variant-card {
  border-color: #0F1115;
  border-width: 2px;
  box-shadow: 0 0 0 4px rgba(15, 17, 21, 0.05);
}

.characters-variant-card-wrap.is-base .characters-variant-card {
  border-style: dashed;
  border-color: #C5C5BF;
}

.characters-variant-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #F2F2EE;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8A8F98;
  font-size: 0.78rem;
  font-weight: 800;
  overflow: hidden;
}

.characters-variant-card-wrap.is-generating .characters-variant-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  z-index: 1;
}

.characters-variant-card-wrap.is-generating .characters-variant-image::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 3px solid rgba(15, 17, 21, 0.16);
  border-top-color: #E60012;
  border-radius: 999px;
  animation: character-spin 0.8s linear infinite;
  z-index: 2;
}

.characters-variant-body {
  padding: var(--s-12) var(--s-16) var(--s-16);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-8);
}

.characters-variant-body h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #0F1115;
}

.characters-variant-body small {
  color: #8A8F98;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.characters-variant-card-wrap.is-selected .characters-variant-body small {
  color: #0F1115;
  font-weight: 900;
}

.characters-variant-redo {
  position: absolute;
  top: var(--s-8);
  right: var(--s-8);
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 17, 21, 0.82);
  color: #FFFFFF;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.18s ease, transform 0.18s ease, background-color 0.16s ease;
  z-index: 3;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.characters-variant-redo svg {
  width: 16px;
  height: 16px;
}

.characters-variant-card-wrap:hover .characters-variant-redo,
.characters-variant-card-wrap:focus-within .characters-variant-redo,
.characters-variant-card-wrap.is-generating .characters-variant-redo {
  opacity: 1;
  transform: scale(1);
}

.characters-variant-redo:not(:disabled):hover {
  background: #0F1115;
}

.characters-variant-redo:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ── Roster grid ───────────────────────────── */

.characters-roster-section {
  margin-top: var(--s-8);
}

.characters-roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-16);
}

.characters-roster-item {
  position: relative;
  border: 1.5px solid #ECEBE6;
  border-radius: 18px;
  background: #FFFFFF;
  padding: var(--s-12);
  text-align: left;
  cursor: pointer;
  color: #0F1115;
  transition: border-color 0.16s ease, transform 0.06s ease, box-shadow 0.16s ease;
}

.characters-roster-item:hover {
  border-color: #0F1115;
  box-shadow: 0 2px 0 #0F1115;
  transform: translateY(-1px);
}

.characters-roster-open {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.characters-roster-item:active {
  transform: translateY(0);
  box-shadow: 0 0 0 #0F1115;
}

.characters-roster-item.is-selected {
  border-color: #0F1115;
  border-width: 2px;
  padding: calc(var(--s-12) - 0.5px);
}

.characters-roster-item.is-selected::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  width: 10px;
  height: 10px;
  background: #0F1115;
  border-radius: 999px;
}

.characters-roster-thumb {
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 12px;
  background: #F2F2EE;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.characters-roster-item span,
.characters-roster-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.characters-roster-item span {
  margin-top: var(--s-10);
  font-weight: 900;
  font-size: 0.92rem;
  letter-spacing: -0.005em;
}

.characters-roster-item small {
  margin-top: 2px;
  color: #8A8F98;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.characters-roster-item.is-selected small {
  color: #0F1115;
  font-weight: 900;
}

@media (max-width: 420px) {
.characters-variant-grid {
    grid-template-columns: 1fr 1fr;
  }

.characters-movement-board {
    grid-template-columns: 1fr;
    gap: var(--s-12);
  }
}

.character-upload-title {
  font-size: 1.18rem;
  font-weight: 950;
  letter-spacing: -0.01em;
  color: #0F1115;
}

.character-upload-subtitle {
  max-width: 300px;
  margin-top: var(--s-8);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.45;
  color: #6B7280;
}

.character-modal-status {
  display: none;
  flex: 1 0 100%;
  align-items: flex-start;
  gap: 9px;
  min-height: 44px;
  margin: 0 0 var(--s-4);
  padding: 11px 13px;
  border: 1.5px solid rgba(255, 59, 48, 0.24);
  border-radius: 14px;
  background: #FFF4F3;
  color: #D92D20;
  box-shadow: 0 10px 22px rgba(255, 59, 48, 0.10);
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.42;
  text-align: left;
}

.character-modal-status:not(:empty) {
  display: flex;
}

.character-modal-status:not(:empty)::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--red);
  color: var(--white);
  font-size: 0.78rem;
  font-weight: 950;
}

.featured-remix-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--gray-900);
}

/* --- Card --- */

.featured-remix-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-16);
  overflow: hidden;
  scroll-snap-align: start;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), border-color 0.3s ease;
  /* Staggered entrance */
  opacity: 0;
  animation: shelfCardIn 0.5s var(--ease-out) forwards;
}

.featured-remix-card:nth-child(1) { animation-delay: 0s; }

.featured-remix-card:nth-child(2) { animation-delay: 0.05s; }

.featured-remix-card:nth-child(3) { animation-delay: 0.1s; }

.featured-remix-card:nth-child(4) { animation-delay: 0.15s; }

.featured-remix-card:nth-child(5) { animation-delay: 0.2s; }

.featured-remix-card:nth-child(6) { animation-delay: 0.25s; }

.featured-remix-card:nth-child(7) { animation-delay: 0.3s; }

.featured-remix-card:nth-child(8) { animation-delay: 0.35s; }

.featured-remix-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 59, 48, 0.18);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(255, 59, 48, 0.06);
}

/* --- Thumbnail --- */

.featured-remix-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--gray-100);
  overflow: hidden;
  cursor: pointer;
}

.featured-remix-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease-out);
}

.featured-remix-card:hover .featured-remix-cover img {
  transform: scale(1.05);
}

/* --- Card body --- */

.featured-remix-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: var(--s-12);
  gap: var(--s-4);
}

.featured-remix-card-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--gray-900);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-card-description {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}

@media (min-width: 769px) {
.featured-remix-title {
    font-size: 1.375rem;
  }

.featured-remix-card-title {
    font-size: 0.9375rem;
  }

.create-hero-title,
  .create-hero .dc-composer,
  .create-hero .dc-chips,
  .create-hero .dc-blank-row {
    max-width: none;
  }
}

/* "See more" card in Photo Remix shelf */
.featured-remix-more {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  border: 2px dashed var(--gray-200);
}

.featured-remix-more:hover {
  border-color: var(--red);
  background: rgba(255, 59, 48, 0.03);
}

/* Section title clickable */
.featured-remix-title {
  cursor: pointer;
}

/* Games Filter Bar - Nintendo × Kashiwa Sato Style */
.games-filter-bar {
  --slider-index: 0;
  position: relative;
  display: flex;
  background: var(--gray-100);
  border-radius: var(--r-16);
  padding: 4px;
  margin-bottom: var(--s-24);
  gap: 4px;
  overflow: hidden;
}

/* Animated Slider - Glassmorphism Water/Slime */
.filter-slider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px - 8px) / 3);
  background: var(--gray-100);
  border-radius: var(--r-12);
  z-index: 0;
  pointer-events: none;
  transition:
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    width 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    border-radius 0.3s ease;
  transform: translateX(calc(var(--slider-index) * (100% + 4px)));
}

/* Stretch effect when moving - more blobby */
.filter-slider.stretching {
  width: calc((100% - 8px - 8px) / 3 + 16px);
  border-radius: var(--r-16);
}

.filter-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--s-12) var(--s-8);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  background: transparent;
  border: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  border-radius: var(--r-12);
  cursor: pointer;
  transition: color 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1;
  position: relative;
}

.filter-count {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
}

.filter-tab:active {
  transform: scale(0.95);
}

.filter-tab:active .filter-count {
  transform: scale(0.9);
}

.current-active-job-section {
  margin-bottom: var(--s-16);
}

.current-active-job-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: var(--s-16);
  align-items: center;
  padding: var(--s-16);
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.08), rgba(255, 149, 0, 0.08));
  border: 1px solid rgba(255, 59, 48, 0.18);
  border-radius: var(--r-20);
  box-shadow: 0 10px 24px rgba(255, 59, 48, 0.08);
}

.current-active-job-thumb {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: var(--r-16);
  overflow: hidden;
  background: var(--gray-100);
}

.current-active-job-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.current-active-job-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--s-8);
  background: linear-gradient(135deg, #ff7b72, #ffb86b);
}

.current-active-job-thumb-placeholder span {
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.35;
  word-break: break-word;
}

.current-active-job-copy {
  min-width: 0;
}

.current-active-job-kicker {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--red);
}

.current-active-job-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-8);
  margin-top: 6px;
}

.current-active-job-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.current-active-job-badge,
.project-card-processing-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: var(--r-full);
  background: var(--red);
  color: var(--white);
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 10px rgba(255, 59, 48, 0.2);
}

.current-active-job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
  margin-top: var(--s-8);
  font-size: 0.75rem;
  color: var(--gray-500);
  font-weight: 700;
}

.current-active-job-progress {
  color: var(--red);
}

.current-active-job-message {
  margin-top: 6px;
  font-size: 0.875rem;
  color: var(--gray-700);
  line-height: 1.5;
  word-break: break-word;
}

.current-active-job-actions {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.current-active-job-btn {
  min-width: 96px;
  height: 38px;
  padding: 0 var(--s-14);
  border-radius: var(--r-full);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.current-active-job-btn:active {
  transform: scale(0.97);
}

.current-active-job-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.current-active-job-btn.secondary {
  background: var(--white);
  color: var(--gray-900);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.current-active-job-btn.danger {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 6px 16px rgba(255, 59, 48, 0.25);
}

/* 生成中カード: 「Studioで開く」は主ボタンではなく控えめなテキストリンク */
.current-active-job-link {
  align-self: center;
  background: none;
  border: none;
  padding: 4px 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.current-active-job-link:hover {
  color: var(--gray-900);
}

/* Creator Menu */
.creator-menu {
  margin-top: var(--s-24);
  margin-bottom: var(--bottom-nav-reserved-space-tight);
  background: var(--glass-white);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-radius: var(--r-16);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
}

.creator-menu-item {
  display: flex;
  align-items: center;
  gap: var(--s-12);
  width: 100%;
  padding: 14px var(--s-16);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--gray-900);
  text-align: left;
  letter-spacing: -0.01em;
}

.creator-menu-item:last-child {
  border-bottom: none;
}

.creator-menu-item:active {
  background: rgba(0, 0, 0, 0.04);
}

@media (hover: hover) {
.creator-menu-item:hover {
    background: rgba(0, 0, 0, 0.03);
  }

.deleted-project-restore:hover {
    background: #ff2d20;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.35);
  }
}

.creator-menu-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--red-light);
  border-radius: var(--r-8);
  color: var(--red);
}

.creator-menu-item-label {
  flex: 1;
}

.creator-menu-badge {
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  border-radius: var(--r-full);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--white);
}

.creator-menu-chevron {
  flex-shrink: 0;
  color: var(--gray-400);
  transition: transform 0.2s ease;
}

.creator-menu-item:active .creator-menu-chevron {
  transform: translateX(2px);
}

.deleted-project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-12);
  padding: var(--s-12) var(--s-16);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.deleted-project-row:last-child {
  border-bottom: none;
}

.deleted-project-copy {
  min-width: 0;
}

.deleted-project-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-900);
  word-break: break-word;
  letter-spacing: -0.01em;
}

.deleted-project-meta {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--gray-400);
}

.deleted-project-restore {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 var(--s-16);
  background: var(--red);
  border: none;
  border-radius: var(--r-full);
  color: var(--white);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.25);
}

.deleted-project-restore:active {
  transform: scale(0.96);
}

/* Pagination */
.project-grid-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 0;
  padding-bottom: calc(16px + var(--effective-safe-bottom, var(--page-safe-bottom, var(--safe-bottom, 0px))));
  margin-bottom: 60px;
}

.pagination-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--gray-200, #e5e5e5);
  background: var(--gray-50, #fafafa);
  color: var(--gray-700, #333);
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--gray-100, #f0f0f0);
  border-color: var(--gray-300, #d1d1d6);
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.pagination-info {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500, #8e8e93);
  min-width: 48px;
  text-align: center;
}

/* Published Badge */
.project-card-badge {
  position: absolute;
  top: var(--s-8);
  left: var(--s-8);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--white);
  background: #34C759;
  border-radius: var(--r-full);
  z-index: 3;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.project-card-badge svg {
  flex-shrink: 0;
}

.project-card-processing-badge {
  position: absolute;
  top: var(--s-8);
  right: var(--s-8);
  z-index: 3;
}

.project-card-actions {
  position: absolute;
  top: 0;
  right: var(--s-8);
  display: flex;
  flex-shrink: 0;
  gap: var(--s-4);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.project-card:hover .project-card-actions {
  opacity: 1;
}

.project-card-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-8);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.project-card-actions button:hover {
  background: var(--gray-100);
}

.project-card-brand-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 2px 7px;
  border-radius: var(--r-full);
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.project-card-date.has-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.project-card-share-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-6);
}

.project-card-public-link {
  width: 100%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 var(--s-8);
  border-radius: var(--r-8);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-700);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: all 0.2s ease;
}

.project-card-public-link:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.project-card-studio-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  white-space: nowrap;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--r-8);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.project-card-studio-link:hover { background: var(--gray-100); border-color: var(--gray-300); color: var(--gray-800); }

.project-card-studio-link svg { flex: none; opacity: 0.7; }

/* Project card overflow (⋮) menu — consolidates rename/delete + guards against accidental delete */
.project-card-menu { position: relative; flex: none; }

.project-card-menu > summary {
  list-style: none;
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s ease;
}

.project-card-menu > summary::-webkit-details-marker { display: none; }

.project-card-menu > summary:hover { background: var(--gray-100); color: var(--gray-700); }

.project-card-menu[open] > summary { background: var(--gray-100); border-color: var(--gray-300); color: var(--gray-800); }

.project-card-menu-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  width: max-content;
  min-width: 168px;
  max-width: 260px;
  padding: 5px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05), 0 14px 30px -10px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.project-card-menu-popover button {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px;
  width: 100%; min-height: 40px; padding: 0 11px;
  white-space: nowrap;
  background: transparent; border: none; border-radius: 8px;
  color: var(--gray-800); font-size: 0.82rem; font-weight: 600;
  text-align: left; cursor: pointer; transition: background 0.12s ease;
}

.project-card-menu-popover button:hover { background: var(--gray-100); }

.project-card-menu-popover button svg { flex: none; color: var(--gray-500); }

.project-card-menu-popover button.is-danger { color: var(--red); }

.project-card-menu-popover button.is-danger:hover { background: var(--red-light); }

.project-card-menu-popover button.is-danger svg { color: var(--red); }

/* divider separating the destructive action (delete) from the rest */
.project-card-menu-sep { height: 1px; background: var(--gray-200); margin: 4px 6px; }

/* let the open menu's popover escape the card's overflow:hidden */
body[data-page="create"] .create-draft-list .project-card:has(.project-card-menu[open]),
body[data-page="create"] .projects-list-mode .project-card:has(.project-card-menu[open]) {
  overflow: visible;
  z-index: 5;
}

#newProjectButton {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-12);
  background: var(--gray-100);
  border: none;
  border-radius: var(--r-full);
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
}

#newProjectButton:hover {
  background: var(--gray-200);
  color: var(--gray-900);
  transform: scale(1.05);
}

#newProjectButton svg {
  width: 16px;
  height: 16px;
}

.status-indicator {
  display: none;
  font-size: 0.75rem;
  font-weight: 500;
  padding: var(--s-4) var(--s-12);
  border-radius: var(--r-full);
  background: var(--gray-100);
  color: var(--gray-400);
}

.status-indicator.connected {
  background: rgba(52, 199, 89, 0.15);
  color: #34C759;
}

.status-indicator.processing {
  background: var(--red-light);
  color: var(--red);
  animation: pulse 2s ease-in-out infinite;
}

.message.assistant.post-generation-actions,
.message.assistant.post-generation-actions-restored {
  max-width: 100%;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Play Game Button in Assistant Messages */
.play-game-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  background: var(--red);
  color: var(--white);
  border: none;
  padding: var(--s-12) var(--s-16);
  border-radius: var(--r-full);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3);
}

.play-game-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 59, 48, 0.4);
}

.play-game-btn:active {
  transform: translateY(0);
}

.play-game-btn svg {
  width: 14px;
  height: 14px;
}

/* SYSTEM_LIMIT_EXCEEDED の自動再送カウントダウン（2026-09-03・10-ws-jobs F4）: 文言の下に「やめる」ボタンを縦積み（1 枚を更新し続ける） */
.message.system.system-busy-retry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.message.system .system-busy-retry-cancel {
  background: transparent;
  border: 1px solid var(--gray-200); /* --gray-300 は :root に無い（未定義 var は border ごと落ちる） */
  color: var(--gray-600);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8125rem;
  cursor: pointer;
}

.welcome-message {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--s-24);
  overflow: hidden;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--red) 0%, #FF6B6B 100%);
  border-radius: var(--r-24);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s-24);
  box-shadow: 0 8px 32px var(--red-glow);
  flex-shrink: 0;
}

.welcome-icon svg {
  width: 40px;
  height: 40px;
  color: var(--white);
}

.welcome-message h3 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--s-8);
  color: var(--gray-900);
}

.welcome-message p {
  color: var(--gray-600);
  margin-bottom: var(--s-24);
  max-width: 300px;
  font-size: 1rem;
  line-height: 1.6;
}

.welcome-examples {
  width: 100%;
  max-width: 340px;
  flex-shrink: 1;
  overflow: hidden;
}

.example-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-400);
  margin-bottom: var(--s-12);
}

.example-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-8);
}

.example-chip {
  padding: var(--s-12) var(--s-16);
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--r-full);
  color: var(--gray-900);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.example-chip:hover {
  border-color: var(--red);
  color: var(--red);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 59, 48, 0.2);
}

.remix-success .remix-icon {
  background: linear-gradient(135deg, #10B981 0%, #34D399 100%);
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.3);
}

.remix-success h3 {
  color: #10B981;
}

.remix-tips {
  width: 100%;
  max-width: 340px;
}

.remix-tips .example-label {
  margin-bottom: var(--s-8);
}

.remix-character-cta {
  width: min(100%, 420px);
  margin-top: var(--s-20);
}

.remix-character-cta-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: var(--s-12);
  align-items: center;
  padding: var(--s-12);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.remix-character-cta-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, #E5E7EB, #F8FAFC);
  background-size: cover;
  background-position: center;
}

.remix-character-cta-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
  text-align: left;
}

.remix-character-cta-copy strong {
  color: #111827;
  font-size: 0.9rem;
}

.remix-character-cta-copy span {
  color: #6B7280;
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remix-character-cta-button {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: #111827;
  color: white;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.remix-character-cta-button:active {
  transform: translateY(1px);
}

.chat-input-container {
  flex-shrink: 0;
  padding: var(--s-16);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.5);
}

/* Attached Assets (thumbnails above textarea) */
.attached-assets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
  margin-bottom: var(--s-12);
  padding: var(--s-8);
  background: var(--gray-100);
  border-radius: var(--r-12);
}

.attached-asset-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-4) var(--s-8);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-8);
}

.attached-asset-item img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--r-4);
}

.attached-asset-audio,
.attached-asset-file {
  width: 40px;
  height: 40px;
  border-radius: var(--r-4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.attached-asset-audio {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  color: rgba(255, 255, 255, 0.8);
}

.attached-asset-file {
  background: var(--gray-100);
  color: var(--gray-500);
}

.attached-asset-audio svg,
.attached-asset-file svg {
  width: 20px;
  height: 20px;
}

.attached-asset-name {
  font-size: 0.75rem;
  color: var(--gray-600);
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attached-asset-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--red);
}

.attached-asset-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--gray-600);
  color: var(--white);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.attached-asset-remove:hover {
  background: var(--red);
}

/* Message Attached Assets (thumbnails in sent messages) */
.message-attached-assets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
  margin-bottom: var(--s-8);
}

.message-asset-thumb {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: var(--r-8);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.message-asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-asset-number {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--white);
  background: rgba(0, 0, 0, 0.6);
  padding: 1px 4px;
  border-radius: var(--r-4);
}

#chatInput {
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  overflow-y: auto;
  max-height: 50vh;
}

#chatInput:focus {
  border: none;
  box-shadow: none;
}

#chatInput.expanded {
  min-height: calc(1.5em * 2); /* 2 lines of text */
}

#chatInput::placeholder {
  color: var(--gray-400);
}

#sendButton {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-8);
  padding: var(--s-16);
  background: var(--red);
  border: none;
  border-radius: var(--r-12);
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  box-shadow: 0 4px 12px var(--red-glow);
}

#sendButton:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--red-glow);
}

#sendButton:active:not(:disabled) {
  transform: translateY(0);
}

#sendButton:disabled {
  background: var(--gray-200);
  color: var(--gray-400);
  box-shadow: none;
  cursor: not-allowed;
}

#sendButton.reconnect-mode {
  background: var(--gray-600) !important;
  color: var(--white) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
  cursor: pointer !important;
}

#sendButton.reconnect-mode:hover {
  background: var(--gray-900) !important;
}

#sendButton svg {
  width: 20px;
  height: 20px;
}

#stopButton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-8);
  padding: var(--s-16) var(--s-24);
  background: var(--gray-900);
  border: none;
  border-radius: var(--r-12);
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

#stopButton:hover {
  background: var(--black);
}

.plus-menu-character-title {
  color: var(--gray-600);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.plus-menu-character-status {
  color: var(--gray-500);
  font-size: 0.78rem;
  font-weight: 800;
}

.plus-menu-character-list {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.plus-menu-character-list::-webkit-scrollbar {
  display: none;
}

.plus-menu-character-list .character-mini-card {
  position: relative;
  flex: 0 0 auto;
  max-width: 172px;
  padding: var(--s-4) var(--s-6);
  background: var(--white);
}

.plus-menu-character-list .character-mini-card-thumb {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
}

.plus-menu-character-list .character-mini-card-name {
  max-width: 92px;
  font-size: 0.72rem;
}

.character-mini-card-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  background: var(--white);
  color: var(--gray-600);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.character-mini-card-remove:hover {
  color: var(--red);
  border-color: rgba(255, 58, 51, 0.35);
}

.plus-menu-character-add {
  min-height: 36px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-8);
  background: var(--white);
  color: var(--gray-900);
  padding: 0 var(--s-12);
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

.plus-menu-character-add-icon {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  font-size: 1.2rem;
  line-height: 1;
}

.streaming-status {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--red);
}

.version-notice {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-12);
  margin-bottom: var(--s-12);
  background: var(--blue-light, #EBF5FF);
  border: 1px solid var(--blue, #3B82F6);
  border-radius: var(--r-8);
  font-size: 0.8125rem;
  color: var(--blue, #3B82F6);
}

.version-notice-icon {
  flex-shrink: 0;
}

.version-item {
  padding: var(--s-16);
  border-radius: var(--r-12);
  transition: all 0.2s ease;
  margin-bottom: var(--s-8);
  background: var(--white);
  border: 1px solid var(--gray-200);
  position: relative;
}

.version-item:hover {
  border-color: var(--gray-300);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.version-item.current {
  border-color: var(--red);
  background: var(--red-light);
}

.version-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-8);
}

.version-id {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-400);
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: var(--r-8);
}

.version-item.current .version-id {
  background: rgba(255, 59, 48, 0.15);
  color: var(--red);
}

.version-time {
  font-size: 0.75rem;
  color: var(--gray-400);
}

.version-message {
  font-size: 0.875rem;
  color: var(--gray-900);
  line-height: 1.5;
  margin-bottom: var(--s-12);
}

.version-actions {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  flex-wrap: wrap;
}

.version-current-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--red);
}

.version-changes-btn {
  display: inline-flex;
  align-items: center;
  border: none;
  border-radius: var(--r-full);
  padding: var(--s-8) var(--s-12);
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
}

.version-changes-btn:hover {
  background: var(--gray-200);
  color: var(--gray-900);
  transform: translateY(-1px);
}

.version-changes-btn:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.version-changes-inline {
  margin-top: var(--s-12);
  padding-top: var(--s-12);
  border-top: 1px solid var(--gray-200);
}

.version-changes-inline .changes-summary {
  margin-bottom: var(--s-8);
}

.version-changes-inline .changes-file {
  margin-bottom: var(--s-8);
}

.version-changes-inline .changes-diff,
.version-changes-inline .changes-code {
  max-height: 220px;
  overflow: auto;
  font-size: 0.6875rem;
}

.version-restore {
  padding: var(--s-8) var(--s-16);
  background: var(--gray-100);
  border: none;
  border-radius: var(--r-8);
  color: var(--gray-600);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.version-restore:hover {
  background: var(--red);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--red-glow);
}

.message.style-selection-message {
  max-width: 100% !important;
  width: 100%;
}

.style-scroll-container {
  width: 100%;
  margin-top: var(--s-12);
}

.style-scroll-track {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--s-12);
  overflow-x: auto;
  padding: var(--s-8) 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.style-scroll-track::-webkit-scrollbar {
  display: none;
}

.style-card-chat {
  flex: 0 0 auto;
  width: 140px;
  background: var(--white);
  border-radius: var(--r-16);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s var(--ease-out);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.style-card-chat:hover {
  border-color: var(--red);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.style-card-chat.selected {
  border-color: var(--red);
  background: var(--red-light);
}

.style-card-chat.style-card-hidden {
  display: none;
}

.style-card-image-chat {
  width: 100%;
  height: 100px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
}

.style-card-image-chat img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.style-card-swatch-chat {
  width: 100%;
  height: 100%;
  background: var(--style-swatch, linear-gradient(135deg, var(--gray-200), var(--gray-100)));
  position: relative;
}

.style-card-swatch-chat::after {
  content: '';
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.08);
}

.style-card-info-chat {
  padding: var(--s-12);
  text-align: center;
}

.style-card-name-chat {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-900);
}

.viewpoint-card-chat {
  width: 140px;
}

.viewpoint-card-icon-chat {
  height: 100px;
}

.viewpoint-card-image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.viewpoint-card-cue-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
  background: linear-gradient(135deg, var(--gray-100), var(--white));
}

.style-card-desc-chat {
  margin-top: var(--s-4);
  min-height: 2.4em;
  font-size: 0.6875rem;
  line-height: 1.2;
  color: var(--gray-500);
}

.photo-choice-scroll-container {
  margin-top: var(--s-12);
}

.photo-choice-card {
  position: relative;
  flex: 0 0 auto;
  width: 168px;
  background: var(--white);
  border-radius: var(--r-16);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s var(--ease-out);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.photo-choice-card:hover {
  border-color: var(--red);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.photo-choice-card.selected {
  border-color: var(--red);
  background: var(--red-light);
}

.photo-choice-card-image {
  width: 100%;
  aspect-ratio: 16 / 10; /* 2コマ Before→After 図解が横並びで判読できる比率 */
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.photo-choice-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-choice-card-info {
  padding: var(--s-8) var(--s-12) var(--s-12);
  text-align: center;
}

.photo-choice-card-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-900);
}

.photo-choice-card.photo-choice-card-fallback {
  width: auto;
  min-width: 120px;
}

.photo-choice-card.photo-choice-card-fallback .photo-choice-card-image {
  display: none;
}

.photo-choice-card.photo-choice-card-fallback .photo-choice-card-info {
  padding: var(--s-12) var(--s-16);
}

.photo-choice-code-only-row {
  text-align: center;
  margin-top: var(--s-8);
}

.photo-choice-code-btn {
  padding: var(--s-8) var(--s-16);
  background: transparent;
  border: 2px dashed var(--gray-300);
  border-radius: var(--r-12);
  color: var(--gray-400);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.photo-choice-code-btn:hover:not(:disabled) {
  border-color: var(--red);
  color: var(--red);
}

.photo-choice-code-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.message.photo-choice-message {
  max-width: 100% !important;
  width: 100%;
}

.style-card-more {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.style-more-btn {
  padding: var(--s-16);
  background: transparent;
  border: 2px dashed var(--gray-300);
  border-radius: var(--r-16);
  color: var(--gray-400);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.style-more-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

@media (max-width: 768px) {
.chat-input-container {
    padding-bottom: max(var(--s-16), var(--page-safe-bottom, var(--safe-bottom, 0px)));
  }

#newProjectButton {
    padding: var(--s-8) var(--s-12);
    font-size: 0.8125rem;
  }

.dc-composer {
    max-width: 100%;
  }

.current-active-job-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: var(--s-12);
    padding: var(--s-12);
  }

.current-active-job-thumb {
    width: 72px;
    height: 72px;
  }

.current-active-job-actions {
    grid-column: 1 / -1;
    flex-direction: row;
  }

.current-active-job-btn {
    flex: 1;
    min-width: 0;
  }

.deleted-project-row {
    align-items: flex-start;
    flex-direction: column;
  }

.deleted-project-restore {
    width: 100%;
  }

.project-card-share-actions {
    gap: var(--s-4);
  }

.project-card-public-link {
    min-height: 30px;
    padding: 0 var(--s-6);
    font-size: 0.6875rem;
  }

.project-card-badge {
    padding: 3px 6px;
    font-size: 0.5625rem;
  }

.project-card-processing-badge {
    padding: 3px 6px;
    font-size: 0.5625rem;
  }

.project-card-badge svg {
    width: 8px;
    height: 8px;
  }

.games-filter-bar {
    margin-bottom: var(--s-16);
  }

.filter-tab {
    padding: var(--s-8) var(--s-4);
  }

.filter-count {
    font-size: 1.25rem;
  }

.project-card-actions {
    opacity: 1;
  }

.canvas-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 100%;
  }

#editorCanvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

/* Tool panels - slide up from bottom */
  .tool-panels {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    min-height: 0;
    pointer-events: none;
  }

.tool-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: 16px 16px 0 0;
    padding: var(--s-16);
    padding-bottom: calc(var(--s-16) + var(--effective-safe-bottom, var(--page-safe-bottom, var(--safe-bottom, 0px))));
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    pointer-events: auto;
    max-height: 40vh;
    overflow-y: auto;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  }

.tool-panel:not(.hidden) {
    transform: translateY(0);
  }

/* Panel drag indicator */
  .tool-panel::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--gray-300);
    border-radius: 2px;
  }

.panel-desc {
    color: var(--gray-500);
    text-align: center;
    font-size: 0.8125rem;
    margin-bottom: var(--s-12);
  }

/* Ratio buttons - 6 columns grid */
  .preset-ratios {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--s-6);
    margin-bottom: var(--s-12);
  }

.ratio-shape {
    border-width: 1.5px;
    transform: scale(0.85);
  }

.ratio-label {
    font-size: 0.5625rem;
  }

.ratio-label {
    font-size: 0.625rem;
  }

.crop-info {
    color: var(--gray-500);
    text-align: center;
    font-size: 0.8125rem;
  }

/* Resize inputs */
  .resize-inputs {
    display: flex;
    gap: var(--s-10);
    justify-content: center;
    margin-bottom: var(--s-12);
  }

.input-group {
    display: flex;
    align-items: center;
    gap: var(--s-6);
    background: var(--gray-100);
    border-radius: 10px;
    padding: var(--s-6) var(--s-10);
  }

.input-group label {
    color: var(--gray-500);
    font-size: 0.6875rem;
    min-width: auto;
  }

.input-group input {
    width: 50px;
    padding: var(--s-4);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--gray-300);
    color: var(--gray-800);
    font-size: 0.875rem;
    text-align: center;
  }

.input-group input:focus {
    border-bottom-color: var(--red);
    outline: none;
  }

.input-group span {
    color: var(--gray-400);
    font-size: 0.6875rem;
  }

.checkbox-label {
    color: var(--gray-600);
    justify-content: center;
    margin-bottom: var(--s-8);
    font-size: 0.8125rem;
  }

.checkbox-label input {
    accent-color: var(--red);
    width: 16px;
    height: 16px;
  }

/* Panel actions - compact */
  .panel-actions {
    display: flex;
    gap: var(--s-10);
    margin-top: var(--s-12);
  }

.panel-cancel-btn {
    flex: 1;
    padding: var(--s-12);
    background: var(--gray-100);
    border: none;
    border-radius: 10px;
    color: var(--gray-700);
    font-size: 0.9375rem;
    font-weight: 600;
    min-height: 46px;
    transition: background 0.15s ease;
  }

.panel-cancel-btn:active {
    background: var(--gray-200);
  }

.apply-btn {
    flex: 1.5;
    background: var(--red);
    color: var(--white);
    border: none;
    border-radius: 10px;
    padding: var(--s-12);
    font-size: 0.9375rem;
    font-weight: 600;
    margin-top: 0;
    min-height: 46px;
    transition: opacity 0.15s ease;
  }

.apply-btn:active {
    opacity: 0.85;
    transform: none;
    box-shadow: none;
  }

.crop-info {
    font-size: 0.75rem;
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 0;
  }

/* Processing indicator */
  .processing-indicator {
    color: var(--gray-600);
  }

.processing-indicator .spinner {
    border-color: var(--gray-200);
    border-top-color: var(--red);
  }

/* Make selection box border thicker on mobile */
  .crop-selection-box {
    border-width: 3px;
  }
}

.character-birth-content {
  max-width: min(520px, calc(100vw - 32px));
  border-radius: 28px;
}

.character-birth-body {
  padding: 34px 34px 26px;
  text-align: center;
}

.character-birth-icon {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: #FFE36E;
  color: #0F1115;
  font-size: 2rem;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(255, 197, 0, 0.35);
}

.character-birth-kicker {
  margin: 0 0 8px;
  color: #00796B;
  font-size: 0.86rem;
  font-weight: 900;
}

.character-birth-body h2 {
  margin: 0;
  color: #0F1115;
  font-size: clamp(2.4rem, 8vw, 4.4rem);
  line-height: 0.96;
  font-weight: 950;
  letter-spacing: 0;
}

.character-birth-body p:not(.character-birth-kicker) {
  max-width: 360px;
  margin: 18px auto 0;
  color: #5B6068;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.65;
}

.character-birth-actions {
  padding: 22px 28px 28px;
}

.character-starter-content {
  max-width: 920px;
  max-height: min(92vh, 860px);
  display: flex;
  flex-direction: column;
}

.character-starter-lead {
  margin: calc(-1 * var(--s-8)) 0 0;
  max-width: 360px;
  color: var(--gray-600);
  font-size: 0.88rem;
  line-height: 1.55;
  text-align: center;
}

.character-starter-status {
  min-height: 1.35em;
  margin: var(--s-8) auto 0;
  max-width: 420px;
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.character-style-picker {
  display: flex;
  flex-direction: column;
  gap: var(--s-10);
  margin: 0;
}

/* dropzone の状態切替 — empty / filled */
.character-upload-empty,
.character-upload-filled {
  display: contents;
}

form#characterCreateForm[data-step="empty"] .character-upload-filled {
  display: none;
}

form#characterCreateForm[data-step="filled"] .character-upload-empty {
  display: none;
}

form#characterCreateForm[data-step="filled"] .character-upload-filled {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

form#characterCreateForm[data-step="filled"] .character-upload-dropzone {
  cursor: default;
}

form#characterCreateForm[data-step="filled"] .character-upload-dropzone > input#characterImages {
  pointer-events: none;
}

.character-modal-preview-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-10);
  width: 100%;
}

.character-modal-preview-grid img {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: var(--r-12);
  border: 1px solid var(--gray-200);
  background: var(--gray-100);
}

.character-wizard-step {
  display: none;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

#characterCreateForm[data-wizard-step="upload"] .character-wizard-step[data-step="upload"],
#characterCreateForm[data-wizard-step="style"] .character-wizard-step[data-step="style"] {
  display: flex;
}

.character-wizard-header {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: var(--s-12);
  padding: var(--s-24) var(--s-24) var(--s-20);
  border-bottom: 1px solid #ECEBE6;
}

.character-wizard-back {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #0F1115;
  cursor: pointer;
  margin-left: calc(-1 * var(--s-8));
}

.character-wizard-back:hover {
  background: #F2F2EE;
}

.character-wizard-progress {
  color: #9CA3AF;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: none;
}

.character-wizard-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 950;
  letter-spacing: -0.02em;
  color: #0F1115;
}

/* Intro paragraph between header and dropzone — sets expectation. */
.character-wizard-intro {
  margin: 0 0 var(--s-20);
  color: #4A4F58;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.55;
}

.character-wizard-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  flex: 1 1 auto;
  padding: var(--s-20) var(--s-24);
}

.character-wizard-actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-10);
  padding: var(--s-16) var(--s-24) var(--s-24);
  border-top: 1px solid #ECEBE6;
  background: #FFFFFF;
}

.character-wizard-actions > button {
  flex: 1 1 0;
}

.character-create-privacy-note--compact {
  margin-top: var(--s-12);
  font-size: 0.78rem;
}

.character-upload-count {
  margin-top: var(--s-10);
  color: #8A8F98;
  font-size: 0.72rem;
  font-weight: 900;
}

.character-upload-filled-actions {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: var(--s-8);
  margin-top: var(--s-12);
}

.character-upload-add,
.character-upload-replace {
  min-height: 36px;
  padding: 0 var(--s-12);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 900;
  cursor: pointer;
}

.character-upload-add {
  border: 0;
  background: #0F1115;
  color: var(--white);
}

.character-upload-add:disabled {
  cursor: default;
  opacity: 0.48;
}

.character-upload-replace {
  border: 1px solid #D8D8D2;
  background: var(--white);
  color: #0F1115;
}

.character-upload-add-input {
  display: none;
}

.character-template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-10);
  padding: 0 var(--s-24) var(--s-16);
}

.character-starter-play {
  margin: 0 var(--s-24);
  min-height: 360px;
  height: min(52vh, 480px);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-12);
  overflow: hidden;
  background: #101418;
}

.character-starter-play iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #101418;
}

@media (max-width: 520px) {
.character-starter-content {
    width: calc(100% - 24px);
    max-width: none;
    max-height: calc(100vh - 24px);
  }

.character-template-grid {
    grid-template-columns: 1fr;
    max-height: 230px;
    overflow: auto;
  }

.character-starter-play {
    min-height: 300px;
    height: 42vh;
  }

body[data-page="create"] .project-list-view.projects-list-mode .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

body[data-page="create"] .project-list-view.projects-list-mode .project-card-header {
    padding: 10px 10px 0;
  }

body[data-page="create"] .project-list-view.projects-list-mode .project-card-actions {
    top: 8px;
    right: 8px;
    gap: 6px;
  }

body[data-page="create"] .project-list-view.projects-list-mode .project-card-actions > button {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

body[data-page="create"] .project-list-view.projects-list-mode .project-card-actions > button svg {
    width: 16px;
    height: 16px;
  }

body[data-page="create"] .project-list-view.projects-list-mode .project-card-title {
    font-size: 0.86rem;
    line-height: 1.28;
  }

body[data-page="create"] .project-list-view.projects-list-mode .project-card-meta {
    padding: 6px 10px 11px;
  }

body[data-page="create"] .project-list-view.projects-list-mode .project-card-date {
    font-size: 0.68rem;
  }

body[data-page="create"] .project-list-view.projects-list-mode .project-card-thumbnail-placeholder .placeholder-title {
    font-size: 0.92rem;
    line-height: 1.22;
    -webkit-line-clamp: 3;
  }
}

.delete-warning {
  font-size: 0.8125rem;
  color: var(--gray-400);
  margin: var(--s-8) 0 0;
  text-align: center;
}

.asset-thumb {
  position: absolute;
  inset: 0;
}

.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.asset-private-thumb {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, rgba(255, 59, 48, 0.08), rgba(17, 24, 39, 0.08)),
    var(--gray-100);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

/* 生成 3D 造形（造形言語の宣言）のカード: サーバーが描いた WebP を背景に、右上に 3D の印 */
.asset-thumb-prop {
  position: relative;
  background-color: #e6ecf3;
  background-image:
    linear-gradient(45deg, rgba(17, 24, 39, 0.06) 25%, transparent 25%, transparent 75%, rgba(17, 24, 39, 0.06) 75%),
    linear-gradient(45deg, rgba(17, 24, 39, 0.06) 25%, transparent 25%, transparent 75%, rgba(17, 24, 39, 0.06) 75%);
  background-size: 16px 16px, 16px 16px;
  background-position: 0 0, 8px 8px;
}

/* 描画済み: ハイドレーションが inline の background-image を置くので、ここは大きさだけ（正方形の描画なので cover で欠けない） */
.asset-thumb-prop[data-private-asset-loaded="true"] {
  background-size: cover;
}

.asset-prop-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.78);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  pointer-events: none;
}

/* Audio asset thumbnail */
.asset-thumb-audio {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  position: relative;
}

.audio-file-icon {
  width: 28px;
  height: 28px;
  color: rgba(255, 255, 255, 0.2);
  position: absolute;
  top: 8px;
  left: 8px;
}

/* Generic file type icon */
.file-type-icon {
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.asset-name {
  display: none;
}

.upload-icon {
  margin-bottom: var(--s-16);
  color: var(--gray-400);
}

.canvas-wrapper {
  position: relative;
  display: inline-block;
}

#editorCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* Dark overlay outside selection */
.crop-dark-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.crop-dark {
  background: rgba(0, 0, 0, 0.6);
}

.crop-dark-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.crop-dark-middle {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
}

.crop-dark-left {
  height: 100%;
}

.crop-dark-right {
  height: 100%;
  margin-left: auto;
}

.crop-dark-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

/* Selection box */
.crop-selection-box {
  position: absolute;
  border: 2px solid var(--white);
  box-sizing: border-box;
}

/* Grid lines (rule of thirds) */
.crop-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.crop-grid-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.4);
}

.crop-grid-v1 { left: 33.33%; top: 0; bottom: 0; width: 1px; }

.crop-grid-v2 { left: 66.66%; top: 0; bottom: 0; width: 1px; }

.crop-grid-h1 { top: 33.33%; left: 0; right: 0; height: 1px; }

.crop-grid-h2 { top: 66.66%; left: 0; right: 0; height: 1px; }

.tool-panels {
  min-height: 100px;
}

.tool-panel {
  background: var(--gray-50);
  border-radius: var(--r-12);
  padding: var(--s-16);
}

.panel-desc {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: var(--s-12);
}

.preset-ratios {
  display: flex;
  gap: var(--s-8);
  margin-bottom: var(--s-12);
  flex-wrap: wrap;
}

.ratio-shape {
  border: 2px solid var(--gray-400);
  background: transparent;
}

.ratio-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gray-600);
}

/* Ratio shape variants */
.ratio-free {
  width: 24px;
  height: 18px;
  border-style: dashed;
  border-radius: 2px;
}

.ratio-1-1 {
  width: 20px;
  height: 20px;
  border-radius: 2px;
}

.ratio-4-3 {
  width: 24px;
  height: 18px;
  border-radius: 2px;
}

.ratio-16-9 {
  width: 28px;
  height: 16px;
  border-radius: 2px;
}

.ratio-9-16 {
  width: 14px;
  height: 24px;
  border-radius: 2px;
}

.ratio-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.crop-info {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: var(--s-12);
}

.resize-inputs {
  display: flex;
  gap: var(--s-16);
  margin-bottom: var(--s-12);
}

.input-group {
  display: flex;
  align-items: center;
  gap: var(--s-8);
}

.input-group label {
  font-size: 0.875rem;
  color: var(--gray-600);
  min-width: 30px;
}

.input-group input {
  width: 80px;
  padding: var(--s-8);
  border: 2px solid var(--gray-200);
  border-radius: var(--r-8);
  font-size: 0.875rem;
  text-align: center;
}

.input-group input:focus {
  outline: none;
  border-color: var(--red);
}

.input-group span {
  font-size: 0.75rem;
  color: var(--gray-400);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-bottom: var(--s-12);
  cursor: pointer;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

.panel-actions {
  display: flex;
  gap: var(--s-12);
  margin-top: var(--s-16);
}

.panel-cancel-btn {
  flex: 1;
  padding: var(--s-12);
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--r-8);
  color: var(--gray-600);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.panel-cancel-btn:hover {
  background: var(--gray-100);
  border-color: var(--gray-400);
}

.apply-btn {
  flex: 2;
  padding: var(--s-12);
  background: var(--red);
  border: none;
  border-radius: var(--r-8);
  color: var(--white);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.apply-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--red-glow);
}

.processing-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-8);
  padding: var(--s-16);
  color: var(--gray-600);
}

.processing-indicator .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.autofix-progress {
  margin-bottom: var(--s-10);
  padding: var(--s-8) var(--s-10);
  border-radius: var(--r-8);
  background: rgba(255, 59, 48, 0.12);
  color: var(--red);
  font-weight: 600;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
  margin-top: var(--s-12);
  padding-top: var(--s-12);
  border-top: 1px solid var(--gray-200);
}

.suggestion-btn {
  background: var(--white);
  color: var(--red);
  border: 2px solid var(--gray-200);
  padding: var(--s-8) var(--s-16);
  border-radius: var(--r-full);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-btn:hover {
  background: var(--red-light);
  border-color: var(--red);
  transform: translateY(-2px);
}

.style-custom-chat {
  text-align: center;
  margin-top: var(--s-12);
}

.style-custom-btn-chat {
  padding: var(--s-12) var(--s-24);
  background: transparent;
  border: 2px dashed var(--gray-300);
  border-radius: var(--r-12);
  color: var(--gray-400);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.style-custom-btn-chat:hover:not(:disabled) {
  border-color: var(--red);
  color: var(--red);
}

.style-custom-btn-chat:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.restore-buttons {
  display: flex;
  gap: var(--s-12);
  margin-top: var(--s-12);
}

.photo-choice-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
  margin-top: var(--s-12);
}

.photo-choice-pill {
  padding: var(--s-8) var(--s-16);
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: 100px;
  font-size: 0.875rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.photo-choice-pill:hover {
  border-color: var(--red);
  color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.restore-btn {
  padding: var(--s-12) var(--s-24);
  border-radius: var(--r-12);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.restore-btn.confirm {
  background: var(--red);
  color: var(--white);
  border: none;
  box-shadow: 0 4px 12px var(--red-glow);
}

.restore-btn.confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--red-glow);
}

.restore-btn.cancel {
  background: var(--gray-100);
  color: var(--gray-600);
  border: none;
}

.restore-btn.cancel:hover {
  background: var(--gray-200);
}

.message.chat-response {
  max-width: 95%;
}

.discover-card {
  aspect-ratio: 1;
  border-radius: var(--r-16);
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--glass-shadow);
  cursor: pointer;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s ease;
  position: relative;
  animation: scaleIn 0.4s var(--ease-out) backwards;
}

.discover-card:nth-child(1) { animation-delay: 0.05s; }

.discover-card:nth-child(2) { animation-delay: 0.1s; }

.discover-card:nth-child(3) { animation-delay: 0.15s; }

.discover-card:nth-child(4) { animation-delay: 0.2s; }

.discover-card:nth-child(5) { animation-delay: 0.25s; }

.discover-card:nth-child(6) { animation-delay: 0.3s; }

.discover-card:active {
  transform: scale(0.97);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.discover-card-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: linear-gradient(135deg, #FFE5E5, #E5F0FF);
}

.discover-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  color: var(--white);
}

.discover-card-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.discover-card-creator {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 2px;
}

.zapping-slide {
  position: absolute;
  inset: 0;
  transition: transform 0.3s var(--ease-out);
}

.zapping-slide iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--r-16);
  background: var(--white);
}

.zapping-slide.prev {
  transform: translateY(-100%);
}

.zapping-slide.current {
  transform: translateY(0);
}

.zapping-slide.next {
  transform: translateY(100%);
}

.message-buttons {
  display: flex;
  gap: var(--s-8);
  margin-top: var(--s-12);
  flex-wrap: wrap;
}

.message-share-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  background: var(--red);
  color: var(--white);
  border: none;
  padding: var(--s-12) var(--s-16);
  border-radius: var(--r-full);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.message-share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.22);
}

.message-share-btn:active {
  transform: translateY(0);
}

.message-share-btn:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.message-share-btn svg {
  width: 14px;
  height: 14px;
  color: currentColor;
}

.changes-summary {
  padding: var(--s-16);
  background: transparent;
  margin-bottom: var(--s-20);
  color: var(--gray-600);
  font-size: 0.875rem;
  line-height: 1.6;
  position: relative;
  padding-left: var(--s-16);
  border-left: 2px solid var(--gray-200);
}

.changes-summary::before {
  content: '変更内容';
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--s-8);
}

/* File Changes - Nintendo Clean Style */
.changes-file {
  margin-bottom: var(--s-16);
  border-radius: var(--r-16);
  overflow: hidden;
  background: var(--gray-900);
}

.changes-file:last-child {
  margin-bottom: 0;
}

.changes-file-header {
  background: var(--gray-900);
  padding: var(--s-12) var(--s-16);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.75rem;
  color: var(--gray-400);
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: var(--s-8);
}

.changes-file-header::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: var(--r-full);
  opacity: 0.8;
}

/* Code Diff - Dark Theme */
.changes-diff,
.changes-code {
  margin: 0;
  padding: var(--s-16);
  background: var(--gray-900);
  overflow-x: auto;
  font-size: 0.8125rem;
}

.changes-diff code,
.changes-code code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
  line-height: 1.6;
}

/* Deleted Code Block */
.changes-diff code.diff-old {
  display: block;
  background: rgba(255, 59, 48, 0.1);
  color: rgba(255, 255, 255, 0.7);
  padding: var(--s-12) var(--s-16);
  padding-right: var(--s-48);
  border-radius: var(--r-8);
  margin-bottom: var(--s-8);
  white-space: pre-wrap;
  word-break: break-all;
  position: relative;
  border: 1px solid rgba(255, 59, 48, 0.2);
}

.changes-diff code.diff-old::before {
  content: '−';
  position: absolute;
  top: var(--s-12);
  right: var(--s-12);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--red);
  background: rgba(255, 59, 48, 0.15);
  border-radius: var(--r-full);
}

/* Added Code Block */
.changes-diff code.diff-new {
  display: block;
  background: rgba(52, 199, 89, 0.1);
  color: rgba(255, 255, 255, 0.9);
  padding: var(--s-12) var(--s-16);
  padding-right: var(--s-48);
  border-radius: var(--r-8);
  white-space: pre-wrap;
  word-break: break-all;
  position: relative;
  border: 1px solid rgba(52, 199, 89, 0.2);
}

.changes-diff code.diff-new::before {
  content: '+';
  position: absolute;
  top: var(--s-12);
  right: var(--s-12);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #34C759;
  background: rgba(52, 199, 89, 0.15);
  border-radius: var(--r-full);
}

#projectTitle.title-updating {
  opacity: 0;
  transform: translateY(-4px);
}

#projectTitle.title-updated {
  animation: titlePop 0.6s var(--ease-out);
}

.quota-display {
  display: flex;
  align-items: center;
  gap: var(--s-12);
  padding: 4px 10px;
  background: var(--gray-100);
  border-radius: var(--r-8);
  font-size: 0.75rem;
  color: var(--gray-600);
}

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

.quota-item svg {
  opacity: 0.7;
}

/* Quota Popup */
.quota-popup {
  position: fixed;
  z-index: 1000;
  animation: quotaPopupIn 0.2s ease-out;
}

.quota-popup-content {
  background: white;
  border-radius: var(--r-12);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  padding: var(--s-16);
  min-width: 220px;
}

.quota-popup-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: var(--s-12);
  padding-bottom: var(--s-8);
  border-bottom: 1px solid var(--gray-200);
}

.quota-popup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.quota-popup-label {
  font-size: 0.8125rem;
  color: var(--gray-600);
}

.quota-popup-value {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-900);
}

.quota-popup-reset {
  margin-top: var(--s-12);
  padding-top: var(--s-8);
  border-top: 1px solid var(--gray-200);
  font-size: 0.75rem;
  color: var(--gray-500);
  text-align: center;
}

.quota-popup-plan {
  margin-bottom: var(--s-12);
  padding-bottom: var(--s-8);
  border-bottom: 1px solid var(--gray-200);
  text-align: center;
}

.quota-popup-plan-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-600);
}

.quota-popup-plan-badge.light {
  background: #EEF2FF;
  color: #4F46E5;
}

.quota-popup-plan-badge.unlimited {
  background: #FEF2F2;
  color: var(--red);
}

.quota-popup-plan-badge.team {
  background: #F0FDF4;
  color: #16A34A;
}

.quota-popup-upgrade {
  display: block;
  margin-top: var(--s-12);
  padding-top: var(--s-8);
  border-top: 1px solid var(--gray-200);
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--red);
  text-decoration: none;
}

.quota-popup-upgrade:hover {
  text-decoration: underline;
}

.quota-popup-coupon {
  display: block;
  width: 100%;
  margin-top: var(--s-12);
  padding-top: var(--s-8);
  border: none;
  border-top: 1px solid var(--gray-200);
  background: transparent;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
}

.quota-popup-coupon:hover {
  text-decoration: underline;
}

.quota-popup-boost {
  margin-bottom: var(--s-10);
  padding: 6px 8px;
  border-radius: var(--r-8);
  background: #F0FDF4;
  color: #166534;
  font-size: 0.75rem;
  text-align: center;
}

.quota-error-upgrade {
  display: inline-block;
  margin-top: var(--s-8);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--red);
  text-decoration: none;
}

.quota-error-upgrade:hover {
  text-decoration: underline;
}

.quota-exceeded-error {
  display: flex;
  align-items: flex-start;
  gap: var(--s-12);
  padding: var(--s-16);
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border-radius: var(--r-12);
  border: 1px solid #F59E0B;
}

.quota-error-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F59E0B;
  border-radius: var(--r-8);
  color: white;
}

.quota-error-content {
  flex: 1;
}

.quota-error-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #92400E;
  margin-bottom: 4px;
  white-space: nowrap;
}

.quota-error-detail {
  font-size: 0.8125rem;
  color: #B45309;
  margin-bottom: 4px;
}

.quota-error-reset {
  font-size: 0.75rem;
  color: #D97706;
}

.coupon-code-input {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* -------- header / stepper -------- */
.onboarding-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 76px;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) clamp(20px, 6vw, 56px) 16px;
  box-sizing: border-box;
}

.onboarding-title {
  margin: 0;
  font-family: 'Zen Maru Gothic', 'Inter', system-ui, sans-serif;
  font-size: clamp(1.8rem, min(7vw, 6.5vh), 4.6rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--onb-ink);
  flex-shrink: 0;
}

.onboarding-title-line {
  display: block;
  position: relative;
}

.onboarding-title-accent {
  position: relative;
  display: inline-block;
  color: var(--onb-red);
}

.onboarding-title-accent::after {
  content: "";
  position: absolute;
  left: -4%;
  right: -4%;
  bottom: 0.06em;
  height: 0.28em;
  background: var(--onb-yellow);
  border-radius: 999px;
  z-index: -1;
  opacity: 0.85;
  transform: skew(-6deg);
}

/* -------- upload (image select screen) -------- */
.onboarding-upload {
  position: relative;
  margin-top: clamp(12px, 2vh, 32px);
  min-height: clamp(160px, 28vh, 280px);
  display: grid;
  /* Stack placeholder + image-preview in a single cell so the empty
     preview slot doesn't claim its own row and shove the placeholder
     into the top half (which left a big gap below). */
  grid-template-areas: "stack";
  place-items: center;
  text-align: center;
  background:
    repeating-linear-gradient(135deg, rgba(255, 199, 39, 0.10) 0 14px, transparent 14px 28px),
    var(--onb-cream-deep);
  border: 2.5px dashed var(--onb-ink);
  border-radius: 24px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.3s var(--onb-easing), border-color 0.3s ease, box-shadow 0.3s ease;
  flex: 1 1 auto;
}

.onboarding-upload:hover {
  border-color: var(--onb-red);
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(255, 59, 48, 0.18);
}

.onboarding-upload.is-filled {
  min-height: 0;
  padding: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  /* Switch off grid stacking + clipping so the thumbs and the add tile
     (and the × buttons that stick out) lay out and show fully. */
  display: block;
  overflow: visible;
  flex: 0 0 auto;
}

.onboarding-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  pointer-events: none;
}

.onboarding-upload strong {
  margin-top: 6px;
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--onb-ink);
  letter-spacing: -0.005em;
}

.onboarding-upload small {
  max-width: 240px;
  margin-top: 2px;
  color: var(--onb-ink-soft);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0;
}

/* Keyboard focus — clearer ring than the default. */
.onboarding-upload input:focus-visible + * + *,
.onboarding-upload:focus-within {
  border-color: var(--onb-red);
  box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.18), 0 18px 40px rgba(255, 59, 48, 0.18);
}

.onboarding-upload.is-drag-active {
  border-style: solid;
  border-color: var(--onb-red);
  background:
    repeating-linear-gradient(135deg, rgba(255, 59, 48, 0.10) 0 14px, transparent 14px 28px),
    #FFF4F0;
  transform: scale(1.01);
  box-shadow: 0 12px 28px rgba(255, 59, 48, 0.22);
}

.onboarding-image-thumb {
  position: relative;
  width: min(160px, 42%);
  min-width: 104px;
  aspect-ratio: 1 / 1;
  pointer-events: none;
}

.onboarding-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 2.5px solid var(--onb-ink);
  border-radius: 18px;
  box-shadow: 4px 4px 0 var(--onb-ink);
  display: block;
}

.onboarding-image-remove {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2.5px solid #fff;
  border-radius: 999px;
  background: var(--onb-ink);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 3px 8px rgba(28, 26, 23, 0.28);
  z-index: 3;
  transition: transform 0.16s var(--onb-easing), background-color 0.16s ease;
}

.onboarding-image-remove svg {
  width: 14px;
  height: 14px;
}

.onboarding-image-remove:hover {
  background: var(--onb-red);
  transform: scale(1.1);
}

.onboarding-image-remove:active {
  transform: scale(0.94);
}

.onboarding-image-add {
  display: grid;
  place-items: center;
  gap: 4px;
  width: min(160px, 42%);
  min-width: 104px;
  aspect-ratio: 1 / 1;
  border: 2.5px dashed rgba(28, 26, 23, 0.32);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--onb-ink-soft);
  pointer-events: none;
}

.onboarding-image-add-mark {
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1;
  color: var(--onb-ink);
}

.onboarding-image-add small {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.onboarding-primary,
.onboarding-secondary {
  position: relative;
  min-height: clamp(52px, 8vh, 66px);
  padding: 0 26px;
  font-family: inherit;
  font-size: clamp(0.96rem, min(2.2vw, 1.9vh), 1.08rem);
  font-weight: 900;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.18s var(--onb-easing), box-shadow 0.18s ease, background 0.2s ease;
}

.onboarding-primary {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  background: var(--onb-red);
  border: 2.5px solid var(--onb-ink);
  border-radius: 999px;
  box-shadow: 0 6px 0 var(--onb-ink), 0 18px 32px rgba(255, 59, 48, 0.32);
  overflow: hidden;
}

.onboarding-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-120%) skewX(-20deg);
  transition: transform 0.7s ease;
  pointer-events: none;
}

.onboarding-primary:not(:disabled):hover {
  transform: translateY(-3px);
  box-shadow: 0 9px 0 var(--onb-ink), 0 22px 38px rgba(255, 59, 48, 0.4);
}

.onboarding-primary:not(:disabled):hover::before {
  transform: translateX(120%) skewX(-20deg);
}

.onboarding-primary:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--onb-ink), 0 10px 20px rgba(255, 59, 48, 0.3);
}

.onboarding-primary:disabled {
  cursor: not-allowed;
  color: rgba(28, 26, 23, 0.4);
  background: #E8E5DD;
  border-color: rgba(28, 26, 23, 0.18);
  box-shadow: 0 4px 0 rgba(28, 26, 23, 0.12);
}

.onboarding-primary-label {
  position: relative;
  z-index: 1;
}

.onboarding-magic {
  position: relative;
  width: clamp(110px, 16vh, 180px);
  height: clamp(110px, 16vh, 180px);
  margin: clamp(2px, 0.6vh, 8px) auto clamp(8px, 1.4vh, 14px);
  flex-shrink: 0;
}

.onboarding-magic-orb {
  position: absolute;
  inset: 32px 46px 22px 46px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 70% 38% at 50% 22%, rgba(255, 255, 255, 0.95), transparent 60%),
    radial-gradient(ellipse at 35% 30%, #fff, #FFC727 55%, #FF3B30 100%);
  border: 3px solid var(--onb-ink);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  color: #fff;
  box-shadow:
    0 10px 24px rgba(255, 59, 48, 0.4),
    inset 0 -10px 18px rgba(0, 0, 0, 0.18),
    inset 0 6px 14px rgba(255, 255, 255, 0.35);
  animation: onb-magic-bob 2.4s ease-in-out infinite;
}

.onboarding-magic-orb svg {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.2));
}

.onboarding-character-sheet {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  margin: 0;
  border: 3px solid var(--onb-ink);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(255, 59, 48, 0.05), rgba(255, 199, 39, 0.18)),
    #fff;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  color: rgba(28, 26, 23, 0.3);
  font-size: 3rem;
  font-weight: 900;
  box-shadow: 8px 8px 0 var(--onb-ink), 0 18px 48px rgba(28, 26, 23, 0.18);
}

@media (max-width: 720px) {
.onboarding-header {
    height: 64px;
    padding-left: 18px;
    padding-right: 18px;
  }

/* upload min-height already uses clamp at base — keep mobile compact. */
  .onboarding-upload {
    min-height: clamp(140px, 24vh, 240px);
  }

.onboarding-upload.is-filled {
    min-height: clamp(160px, 26vh, 280px);
  }

.onboarding-magic-orb {
    inset: 22% 32% 18% 32%;
  }

.onboarding-header-reset {
    padding: 4px 8px;
    font-size: 0.72rem;
  }

.onboarding-header-reset span:last-child {
    display: none;
  }
}

.onboarding-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* When the body has onboarding-birth-open, lock scroll behind the modal */
body.onboarding-birth-open {
  overflow: hidden;
}

/* ---- source-image overlay inside the magic orb ---- */
.onboarding-magic-orb.has-source-image {
  background: #fff;
  overflow: hidden;
}

.onboarding-magic-orb.has-source-image > svg {
  display: none;
}

.onboarding-magic-source {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  z-index: 0;
}

.onboarding-magic-orb.has-source-image::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background:
    radial-gradient(ellipse 60% 30% at 50% 22%, rgba(255, 255, 255, 0.55), transparent 70%),
    radial-gradient(circle at 65% 75%, rgba(255, 59, 48, 0.28), transparent 60%);
  pointer-events: none;
  mix-blend-mode: screen;
  animation: onb-magic-shine 2.4s ease-in-out infinite;
}

.onboarding-header-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 59, 48, 0.12);
  border: 1px dashed rgba(255, 59, 48, 0.5);
  border-radius: 999px;
  color: var(--onb-red, #FF3B30);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.onboarding-header-reset:hover {
  background: rgba(255, 59, 48, 0.2);
  transform: translateY(-1px);
}

.onboarding-header-reset span:first-child {
  font-size: 0.95rem;
}

/* ---- reset overlay ---- */
#onboardingResetOverlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  background: rgba(28, 26, 23, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#onboardingResetOverlay .onboarding-reset-card {
  display: grid;
  place-items: center;
  gap: 16px;
  padding: 32px 36px;
  background: var(--onb-paper, #FFFDF7);
  border: 2.5px solid var(--onb-ink, #1C1A17);
  border-radius: 24px;
  box-shadow: 6px 6px 0 var(--onb-ink, #1C1A17);
  font-family: 'Zen Maru Gothic', 'Inter', system-ui, sans-serif;
  font-weight: 800;
  color: var(--onb-ink, #1C1A17);
}

#onboardingResetOverlay .onboarding-reset-spinner {
  width: 44px;
  height: 44px;
  border: 5px solid rgba(255, 59, 48, 0.18);
  border-top-color: var(--onb-red, #FF3B30);
  border-radius: 999px;
  animation: onb-magic-spin 0.9s linear infinite;
}

/* ---- /characters: source-image preview while character sheet is generating ---- */
.characters-hero-art.is-from-source {
  /* Show the uploaded reference image as cover-cropped background instead of contain */
  background-size: cover;
  background-position: center;
}

/* The white overlay from .is-generating dims the photo so it reads as "in progress"  */
.characters-hero-art.is-from-source.is-generating::before {
  background: rgba(255, 255, 255, 0.4);
}

/* Subtle traveling shimmer to suggest "being transformed" */
.characters-hero-art.is-from-source.is-generating::after {
  /* The spinner stays as-is, but pin it to bottom-right so the photo is the hero */
  left: auto;
  right: 18px;
  top: auto;
  bottom: 18px;
  margin: 0;
  width: 32px;
  height: 32px;
  border-width: 3px;
  z-index: 2;
}

.characters-hero-source-badge {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: rgba(15, 17, 21, 0.85);
  color: #fff;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

@media (max-width: 640px) {
.characters-hero-source-badge {
    left: 10px;
    top: 10px;
    padding: 5px 10px;
    font-size: 0.72rem;
  }

.characters-hero-art.is-from-source.is-generating::after {
    right: 12px;
    bottom: 12px;
    width: 26px;
    height: 26px;
  }
}

.project-card-state.is-new {
  background: var(--red);
  color: var(--white);
  letter-spacing: .06em;
}

.current-active-job-badge.completed {
  background: #34C759;
  box-shadow: 0 4px 10px rgba(52, 199, 89, 0.2);
}

.current-active-job-progress.completed {
  color: #1f9d4d;
}

.project-complete-next {
  justify-self: end;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  box-shadow: 0 14px 30px rgba(255, 59, 48, 0.26);
  cursor: pointer;
}

.project-complete-next:active {
  transform: scale(0.94);
}

.project-complete-visual {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 9 / 16;
  justify-self: center;
  overflow: hidden;
  border-radius: 28px;
  background: #111;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.16);
}

.project-complete-expand {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 8;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--gray-900);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
}

.project-complete-visual img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.project-complete-visual iframe {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #000;
}

.project-complete-asset-empty {
  width: 100%;
  min-height: 104px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px dashed rgba(0, 0, 0, 0.14);
  border-radius: 18px;
  color: var(--gray-500);
  font-size: 0.9rem;
  font-weight: 850;
  text-align: center;
}

.project-complete-asset-tile {
  flex: 0 0 96px;
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 7px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  background: #fff;
  color: var(--gray-900);
  font: inherit;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.05);
}

.project-complete-asset-tile.active {
  border-color: var(--red);
  box-shadow: 0 14px 30px rgba(255, 59, 48, 0.18);
}

.project-complete-asset-tile img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  object-fit: cover;
  border-radius: 13px;
  background: #f3f3f3;
}

.project-complete-asset-tile span {
  overflow: hidden;
  color: var(--gray-700);
  font-size: 0.72rem;
  line-height: 1.15;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-complete-tool-dock {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 3400;
  width: min(560px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.16);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.project-complete-tool-dock button {
  min-width: 0;
  min-height: 58px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 6px 4px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--gray-500);
  font: inherit;
  cursor: pointer;
}

.project-complete-tool-dock button span {
  display: inline-grid;
  place-items: center;
  min-height: 20px;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 950;
}

.project-complete-tool-dock button strong {
  color: inherit;
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}

.project-complete-share-step {
  position: fixed;
  inset: 0;
  z-index: 4200;
  display: grid;
  place-items: end center;
  padding: 0;
  background: rgba(17, 17, 17, 0.22);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.project-complete-share-card {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  background: #fafafa;
}

.project-complete-share-card-status {
  width: fit-content;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3446a0;
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 900;
}

.project-complete-share-card-status.is-public {
  background: #e8f7ee;
  color: #13753a;
}

.project-complete-share-card-status.is-pending {
  background: #fff4d8;
  color: #986500;
}

.project-complete-share-card-status.is-blocked {
  background: #ffe7e7;
  color: #b3261e;
}

body.project-complete-expanded-open {
  overflow: hidden;
}

@media (max-width: 760px) and (min-height: 900px) {
.project-complete-visual {
    width: min(72vw, 320px);
    max-height: 58dvh;
  }
}

body[data-page="create"] .create-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-14);
  margin: 0 0 12px;
}

body[data-page="create"] .create-section-head h2 {
  margin: 0;
  color: var(--gray-900);
  font-size: 1.2rem;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.03em;
}

body[data-page="create"] .create-section-head a {
  color: var(--gray-400);
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

body[data-page="create"] .create-filter-hidden {
  display: none;
}

body[data-page="create"] .create-draft-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body[data-page="create"] .create-draft-list .project-card:hover {
  transform: none;
  border-color: var(--red);
  box-shadow: 0 8px 22px -14px rgba(255, 59, 48, 0.3);
}

body[data-page="create"] .create-draft-list .project-card-thumbnail-placeholder {
  padding: 5px;
}

body[data-page="create"] .create-draft-list .project-card-title {
  min-height: 0;
  color: var(--gray-900);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.3;
  -webkit-line-clamp: 1;
}

body[data-page="create"] .create-draft-list .project-card-meta {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 0;
  min-width: 0;
}

body[data-page="create"] .create-draft-list .project-card-date {
  color: var(--gray-400);
  font-size: 0.72rem;
}

body[data-page="create"] .create-draft-list .project-card-actions {
  position: static;
  grid-column: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  align-self: center;
  opacity: 1;
  z-index: 4;
}

body[data-page="create"] .create-draft-list .project-card-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

body[data-page="create"] .create-draft-list .project-card-share-actions .project-card-public-link {
  width: auto;
  min-height: 30px;
}

/* Studio chip is a <button> inside .project-card-actions; opt it out of the 28px icon-button sizing */
body[data-page="create"] .create-draft-list .project-card-actions .project-card-studio-link {
  width: auto;
  height: auto;
}

@media (min-width: 900px) {
body[data-page="create"] .create-draft-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
    row-gap: 8px;
  }
}

body[data-page="create"] .project-list-view.projects-list-mode .projects-full-section .create-section-head {
  margin-bottom: 16px;
}

body[data-page="create"] .project-list-view.projects-list-mode .projects-full-section .create-section-head h2 {
  font-size: 1.32rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

body[data-page="create"] .project-list-view.projects-list-mode .project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px;
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card {
  border-radius: 15px;
  box-shadow: 0 1px 2px rgba(28,28,30,.04), 0 14px 30px -22px rgba(28,28,30,.28);
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card::before {
  display: none;
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px -18px rgba(28,28,30,.32);
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card-thumbnail {
  aspect-ratio: 4 / 5;
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card-thumbnail-placeholder {
  padding: 14px;
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card-thumbnail-placeholder .placeholder-title {
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.24;
  letter-spacing: -0.025em;
  -webkit-line-clamp: 4;
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card-header {
  padding: 12px 13px 0;
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card-actions {
  top: 10px;
  right: 10px;
  gap: 8px;
  opacity: 1;
  z-index: 4;
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card-actions > button {
  width: 36px;
  height: 36px;
  border-color: rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--gray-900);
  box-shadow: 0 8px 22px -14px rgba(0, 0, 0, 0.45);
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card-actions > button:hover {
  border-color: rgba(28, 28, 30, 0.16);
  background: var(--white);
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card-actions > button svg {
  width: 17px;
  height: 17px;
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card-actions .project-card-studio-link {
  gap: 0;
  padding: 0;
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card-studio-label {
  display: none;
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card-title {
  font-size: 0.93rem;
  line-height: 1.32;
  font-weight: 850;
  min-height: 2.46em;
  letter-spacing: -0.02em;
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card-meta {
  gap: 6px;
  padding: 7px 13px 13px;
}

body[data-page="create"] .project-list-view.projects-list-mode .project-card-date {
  font-size: 0.74rem;
  line-height: 1.2;
  font-weight: 700;
}

.caj-receipt{margin-top:12px;padding:11px 14px 6px;background:rgba(255,255,255,.92);border:1.5px dashed rgba(23,23,23,.22);border-radius:14px;text-align:left;color:#171717}

.caj-receipt-title{font-size:.84rem;font-weight:800;margin-bottom:4px}

.caj-receipt-row{display:flex;flex-direction:column;gap:1px;padding:7px 0;border-top:1px solid rgba(23,23,23,.08)}

/* やわらかく読ませる: 太字を一段落として「感じ少なめ」に（2026-07-06 ファウンダー指摘） */
.caj-receipt-idea{font-size:.82rem;font-weight:700;line-height:1.5}

.caj-receipt-idea::before{content:'💡 '}

.caj-receipt-result{font-size:.8rem;font-weight:500;line-height:1.55;color:rgba(23,23,23,.66)}

.caj-receipt-result::before{content:'→ '}

.caj-ai-reply-summary{padding:12px 14px;background:rgba(255,255,255,.92);border:1.5px solid rgba(23,23,23,.12);border-radius:14px;text-align:left;color:#171717}

.caj-ai-reply-summary + .caj-receipt{margin-top:8px}

.caj-ai-reply-summary-text{margin:0;font-size:.86rem;font-weight:600;line-height:1.55;white-space:pre-wrap}

body.create-scrolled .brand-text { display: none; }

.template-genre { margin-bottom: var(--s-24); }

.template-genre.hidden { display: none; }

.template-genre-title {
  margin: 0; font-size: 0.95rem; font-weight: 900;
  letter-spacing: -0.02em; color: var(--gray-900);
}

/* 3列だと1枚 112px。既定の白抜き 0.85rem では2行でも入らないので 0.68rem に落とす */
body[data-page="create"] .template-genre .featured-remix-card-title {
  font-size: 0.68rem;
  letter-spacing: -0.035em;
  /* 3列（375px でカード幅約105px）だと 2行では es/pt/en のテンプレ名が語中で切れる
     （実測 es 5/18・pt 4〜5/18・en 1〜3/18 が切れ、ja は 0/18）。3行に緩める。 */
  -webkit-line-clamp: 3;
}

body[data-page="create"] .template-genre .featured-remix-body { padding: 24px 8px 8px; }

/* サムネ生成待ちのカードは、絵が無いと格子の中で黒い穴になるので畳む */
body[data-page="create"] .template-genre .featured-remix-card.template-card-thumb-missing { display: none; }

body[data-page="create"] .template-genre .featured-remix-card:active { transform: scale(.96); }

body[data-page="create"] .create-draft-list .project-card-thumbnail-placeholder.is-mono {
  background: var(--red-light);
  display: grid;
  place-items: center;
  padding: 0;
}

body[data-page="create"] .create-draft-list .project-card-thumbnail-initial {
  color: var(--red); font-size: 1.25rem; font-weight: 900; line-height: 1;
}

body[data-page="create"] .create-draft-list .project-card-date {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.project-card-state {
  display: inline-flex; align-items: center;
  font-size: 0.66rem; font-weight: 800; letter-spacing: .02em;
  padding: 2px 7px; border-radius: var(--r-full);
  background: var(--gray-100); color: var(--gray-600);
}

.project-card-state.is-public { background: var(--red-light); color: var(--red); }

.announcement-content {
  /* ヒーロー画像を上端まで到達させたいので padding は内側の .announcement-body で持つ */
  padding: 0;
  max-width: 420px;
  text-align: center;
}

/* 16:9 のヒーロー画像。メール用に作った素材をそのまま使い回せる。 */
.announcement-hero {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-24) var(--r-24) 0 0;
}

.announcement-body {
  padding: 24px 24px 28px;
}

.announcement-body h2 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 800;
}

.announcement-body p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary, #666);
  /* 本文は運用者が自由に書くので、長い URL 等でレイアウトが割れないようにする */
  overflow-wrap: anywhere;
}

.announcement-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 22px;
}

.announcement-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  background: var(--brand, #FF3B30);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: filter var(--duration, .2s) var(--ease-out, ease);
}

.announcement-cta:hover,
.announcement-cta:visited {
  color: #fff;
  text-decoration: none;
}

.announcement-cta:hover {
  filter: brightness(0.94);
}

/* 「閉じる」は副次操作。押し間違いを避けるため主ボタンと明確に差をつける。 */
.announcement-close {
  background: none;
  border: none;
  padding: 10px;
  font: inherit;
  font-size: 14px;
  color: var(--text-secondary, #888);
  cursor: pointer;
  border-radius: 999px;
}

.announcement-close:hover {
  background: rgba(0, 0, 0, 0.04);
}

html.native-app .announcement-content {
  margin-top: var(--safe-top, 0px);
  margin-bottom: var(--safe-bottom, 0px);
}
