/* 並べ方: 広い画面では左に会話、右にボード/プレビュー/公開のタブ。狭い画面ではタブで1つずつ切り替える */
:root {
  --bg: #f6f3fb;
  --fg: #2a2140;
  --muted: #6b6185;
  --line: #ddd3f0;
  --panel: #ffffff;
  --panel-2: #faf8fe;
  --accent: #6645c2;
  --accent-fg: #ffffff;
  --accent-soft: #ece6fb;
  --pick: #e8608a;
  --ok: #2a9d74;
  --warn: #c07a12;
  --err: #c43d5a;
  --danger: #a3253f;
  --me: #6645c2;
  --me-fg: #ffffff;
  --shadow: 0 1px 2px rgba(42, 33, 64, .06), 0 4px 14px rgba(42, 33, 64, .06);
  --font-ui: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --font-head: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17131f; --fg: #ece6f7; --muted: #a99fc2; --line: #3a3150; --panel: #211b2d; --panel-2: #1c1727;
    --accent: #a58cf0; --accent-fg: #1a1230; --accent-soft: #2e2546; --pick: #f08aab; --ok: #5cc9a0; --warn: #e6a64a; --err: #f0809a; --danger: #f0809a;
    --me: #4b3592; --me-fg: #f4efff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17131f; --fg: #ece6f7; --muted: #a99fc2; --line: #3a3150; --panel: #211b2d; --panel-2: #1c1727;
  --accent: #a58cf0; --accent-fg: #1a1230; --accent-soft: #2e2546; --pick: #f08aab; --ok: #5cc9a0; --warn: #e6a64a; --err: #f0809a; --danger: #f0809a;
  --me: #4b3592; --me-fg: #f4efff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-ui); line-height: 1.7; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.eyebrow { margin: 0; font-family: var(--font-head); font-weight: 800; font-size: 12.5px; letter-spacing: .08em; color: var(--accent); }
.muted { color: var(--muted); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid var(--line); background: var(--panel); border-radius: 999px; padding: 8px 18px; font-weight: 700; cursor: pointer; text-decoration: none; color: var(--fg); transition: transform .08s, background .15s, border-color .15s; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn.big { padding: 13px 26px; font-size: 16.5px; font-family: var(--font-head); font-weight: 800; }
.btn.small { padding: 4px 12px; font-size: 13px; }
.btn.ghost { background: transparent; }

/* ---------- welcome ---------- */
.welcome { min-height: 100%; display: grid; place-items: center; padding: 32px 16px;
  background-image: radial-gradient(var(--line) 1.3px, transparent 1.5px); background-size: 18px 18px; }
.welcome-card { width: 100%; max-width: 620px; background: var(--panel); border: 1.5px solid var(--line); border-radius: 24px; padding: clamp(24px, 5vw, 44px); box-shadow: var(--shadow); display: grid; gap: 18px; }
.welcome h1 { margin: 0; font-family: var(--font-head); font-weight: 800; font-size: clamp(26px, 5vw, 38px); line-height: 1.35; text-wrap: balance; }
.hl { background: linear-gradient(transparent 62%, color-mix(in srgb, var(--pick) 35%, transparent) 62%); }
.steps-intro { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; counter-reset: s; }
.steps-intro li { display: grid; grid-template-columns: 34px 1fr; gap: 2px 12px; align-items: start; counter-increment: s; }
.steps-intro li::before { content: counter(s); grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; }
.steps-intro b { font-family: var(--font-head); }
.steps-intro span { color: var(--muted); font-size: 14.5px; }
.fine { margin: 0; font-size: 13px; color: var(--muted); }
.err { margin: 0; color: var(--err); font-weight: 700; }

/* ---------- app shell ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.work { flex: 1; min-height: 0; display: grid; grid-template-rows: auto 1fr; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1.5px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); flex: none;
  -webkit-mask: none; position: relative; }
.logo::after { content: ""; position: absolute; inset: 7px 9px 6px; border-radius: 50% 50% 3px 3px; background: var(--accent-fg); }
.brand-name { font-family: var(--font-head); font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper { display: flex; gap: 4px; margin: 0 auto; padding: 0; list-style: none; }
.stepper li { display: flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 13.5px; color: var(--muted); }
.stepper li span { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 11.5px; font-family: var(--font-head); }
.stepper li.on { background: var(--accent-soft); color: var(--accent); }
.stepper li.on span { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.stepper li.done span { background: var(--ok); border-color: var(--ok); color: #fff; }
.me { display: flex; align-items: center; gap: 8px; }
.usage { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--line); }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: var(--panel); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; min-width: 200px; box-shadow: var(--shadow); }
.menu-user { margin: 0; font-weight: 700; font-size: 14px; }
#admin-toggle.open { background: var(--ok); border-color: var(--ok); color: #fff; }
.banner.relogin { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; background: color-mix(in srgb, var(--err) 16%, var(--panel)); }
.banner { margin: 0; padding: 8px 16px; background: color-mix(in srgb, var(--warn) 18%, var(--panel)); color: var(--fg); font-weight: 700; font-size: 14px; text-align: center; }

.tabs { display: flex; gap: 4px; padding: 8px 16px 0; background: var(--bg); }
.tabs button { flex: none; white-space: nowrap; border: 0; background: transparent; padding: 8px 16px; border-radius: 12px 12px 0 0; font-weight: 700; color: var(--muted); cursor: pointer; position: relative; }
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--fg); box-shadow: inset 0 2.5px 0 var(--accent); }
.tabs button .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--pick); }

.panes { min-height: 0; display: grid; }
.pane { overflow: hidden; }
.pane { min-height: 0; }

/* wide: chat on the left, the selected side pane on the right.
   While the demo video records (body.v-recording), its pane stays rendered (invisible, behind the page) on other tabs:
   an app inside a hidden pane has a 0×0 page and can't be captured. */
@media (min-width: 980px) {
  .work { grid-template-columns: minmax(420px, min(52%, 720px)) 1fr; grid-template-areas: "chat tabs" "chat side"; }
  .panes { display: contents; }
  .tabs { grid-area: tabs; }
  .only-narrow { display: none; }
  .chat-pane { grid-area: chat; border-right: 1.5px solid var(--line); }
  .side { grid-area: side; display: none; }
  body[data-side="board"] .side[data-pane="board"],
  body[data-side="preview"] .side[data-pane="preview"],
  body[data-side="publish"] .side[data-pane="publish"],
  body[data-side="video"] .side[data-pane="video"],
  body[data-side="pitch"] .side[data-pane="pitch"],
  body[data-side="submit"] .side[data-pane="submit"],
  body[data-side="guide"] .side[data-pane="guide"],
  body[data-side="apikey"] .side[data-pane="apikey"] { display: flex; }
  body.v-recording:not([data-side="video"]) .side[data-pane="video"] { display: flex; position: fixed; left: 0; top: 0; width: 720px; height: 100vh; opacity: 0; z-index: -1; pointer-events: none; }
}
/* narrow: one pane at a time */
@media (max-width: 979.98px) {
  .stepper li { padding: 4px 8px; font-size: 0; gap: 0; }
  .stepper li span { font-size: 11.5px; }
  .usage { display: none; }
  .tabs { overflow-x: auto; }
  .pane { display: none; }
  body[data-view="chat"] .pane[data-pane="chat"],
  body[data-view="board"] .pane[data-pane="board"],
  body[data-view="preview"] .pane[data-pane="preview"],
  body[data-view="publish"] .pane[data-pane="publish"],
  body[data-view="video"] .pane[data-pane="video"],
  body[data-view="pitch"] .pane[data-pane="pitch"],
  body[data-view="submit"] .pane[data-pane="submit"],
  body[data-view="guide"] .pane[data-pane="guide"],
  body[data-view="apikey"] .pane[data-pane="apikey"] { display: flex; }
  body.v-recording:not([data-view="video"]) .pane[data-pane="video"] { display: flex; position: fixed; left: 0; top: 0; width: 720px; height: 100vh; opacity: 0; z-index: -1; pointer-events: none; }
}

/* ---------- chat ---------- */
.chat-pane { display: flex; flex-direction: column; background: var(--panel-2); }
.log { flex: 1; overflow-y: auto; padding: 20px 16px 8px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; }
.msg .who { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 16px; background: var(--accent-soft); }
.msg .body { min-width: 0; flex: 1; display: grid; gap: 10px; }
.bubble { background: var(--panel); border: 1.5px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; width: fit-content; max-width: 100%; }
.msg.me { flex-direction: row-reverse; }
.msg.me .body { justify-items: end; }
.msg.me .bubble { background: var(--me); color: var(--me-fg); border-color: var(--me); border-radius: 16px 4px 16px 16px; }
.msg.sys .bubble { background: transparent; border-style: dashed; color: var(--muted); font-size: 14px; }
.msg.err .bubble { border-color: var(--err); color: var(--err); }
.thinking { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); font-size: 14px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: bob 1s infinite ease-in-out; }
.thinking i:nth-child(2) { animation-delay: .15s; }
.thinking i:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes bob { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-4px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .thinking i { animation: none; } }

.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.choices.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; align-content: start; text-align: left; cursor: pointer; transition: border-color .15s, transform .1s, box-shadow .15s; }
.choice:hover:not(:disabled) { border-color: var(--accent); box-shadow: var(--shadow); }
.choice:disabled { cursor: default; }
.choice.picked { border-color: var(--pick); box-shadow: 0 0 0 2px var(--pick); }
.choices.answered .choice:not(.picked) { opacity: .55; }
.choice-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.choice-head .id { font-family: var(--font-head); font-weight: 800; color: var(--accent); }
.choice-head b { font-family: var(--font-head); font-weight: 800; font-size: 15px; line-height: 1.4; }
.badge { font-size: 11.5px; font-weight: 700; padding: 0 8px; border-radius: 999px; background: var(--pick); color: #fff; white-space: nowrap; }
.choice-note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.mock { position: relative; width: 100%; aspect-ratio: 360 / 450; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.mock iframe { position: absolute; top: 0; left: 0; width: 360px; height: 450px; border: 0; transform-origin: 0 0; transform: scale(var(--s, .5)); pointer-events: none; background: #fff; }
.mock-zoom { position: absolute; right: 6px; bottom: 6px; z-index: 1; border: 0; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 700; background: rgba(20, 14, 35, .7); color: #fff; cursor: zoom-in; }
.chip { border: 1.5px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 14px; cursor: pointer; text-align: left; }
.chip:hover:not(:disabled) { border-color: var(--accent); }
.chip.picked { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.choices.answered .chip:not(.picked) { opacity: .55; }
.chip .badge { margin-left: 6px; }
.ready-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--accent-soft); border-radius: var(--radius); padding: 12px 14px; }
.ready-cta p { margin: 0; font-weight: 700; flex: 1; min-width: 180px; }
.build-progress { display: grid; gap: 6px; }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s; }

.composer { display: flex; gap: 8px; padding: 10px 16px 14px; border-top: 1.5px solid var(--line); background: var(--panel); align-items: flex-end; }
.composer textarea { flex: 1; resize: none; border: 1.5px solid var(--line); border-radius: 14px; padding: 9px 12px; background: var(--panel-2); min-height: 46px; max-height: 180px; line-height: 1.5; }
.composer textarea:focus { border-color: var(--accent); outline: none; }

/* ---------- side panes ---------- */
.side { flex-direction: column; gap: 16px; padding: 20px 16px; overflow-y: auto; background: var(--panel); }
.board-card, .publish-card { display: grid; gap: 10px; }
.board-card h2, .publish-card h2 { margin: 0; font-family: var(--font-head); font-weight: 800; font-size: clamp(21px, 2.6vw, 26px); line-height: 1.35; text-wrap: balance; }
.pitch { margin: 0; color: var(--muted); }
.board-items { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.board-items li { display: flex; gap: 8px; align-items: baseline; padding: 8px 12px; border-radius: 12px; background: var(--panel-2); border: 1.5px solid var(--line); }
.st { flex: none; font-size: 11.5px; font-weight: 700; padding: 0 8px; border-radius: 999px; border: 1.5px solid var(--line); color: var(--muted); white-space: nowrap; }
.st.ok { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.st.now { border-color: var(--pick); color: var(--pick); }
.build-box { display: grid; gap: 10px; justify-items: start; padding: 14px; border-radius: var(--radius); background: var(--accent-soft); }
.build-box p { margin: 0; font-size: 14.5px; }
.build-box.ready { box-shadow: 0 0 0 2px var(--pick); }
.picks ul { margin: 6px 0 0; padding-left: 1.2em; color: var(--muted); font-size: 14px; }

.preview-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.preview-bar .sp { flex: 1; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; padding: 2px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 3px 12px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-fg); }
.preview-stage { flex: 1; min-height: 480px; display: grid; place-items: stretch center; background-image: radial-gradient(var(--line) 1.2px, transparent 1.4px); background-size: 16px 16px; border-radius: var(--radius); padding: 12px; }
.preview-stage .empty { align-self: center; text-align: center; color: var(--muted); }
#preview { width: 100%; height: 100%; min-height: 560px; border: 0; border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.preview-stage.phone #preview { max-width: 390px; border: 6px solid #221b33; border-radius: 30px; }

.field { display: grid; gap: 4px; font-size: 14px; font-weight: 700; }
.field input, .repo-input { border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--panel-2); font-weight: 500; width: 100%; }
.repo-input { display: flex; align-items: center; gap: 2px; }
.repo-input .owner { color: var(--muted); white-space: nowrap; }
.repo-input input { border: 0; background: transparent; padding: 0; flex: 1; min-width: 0; outline: none; }
.repo-input:focus-within, .field input:focus { border-color: var(--accent); outline: none; }
.publish-card .btn.big { justify-self: start; margin-top: 4px; }
.progress { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.progress li { display: flex; gap: 8px; align-items: center; font-size: 14.5px; }
.progress li::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.progress li.doing::before { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.progress li.ok::before { content: "✓"; border-color: var(--ok); background: var(--ok); color: #fff; font-size: 11px; display: grid; place-items: center; }
.progress li.ng::before { content: "!"; border-color: var(--err); background: var(--err); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.done { display: grid; gap: 8px; padding: 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--ok) 14%, var(--panel)); }
.done p { margin: 0; }
.done .url { font-family: var(--font-head); font-weight: 800; font-size: 17px; overflow-wrap: anywhere; }

/* zoomed mock */
.zoom { position: fixed; inset: 0; z-index: 50; background: rgba(15, 10, 25, .65); display: grid; place-items: center; padding: 16px; }
.zoom-inner { position: relative; width: min(360px, 100%); aspect-ratio: 360 / 450; border-radius: 16px; overflow: hidden; background: #fff; }
.zoom-inner iframe { position: absolute; top: 0; left: 0; width: 360px; height: 450px; border: 0; transform-origin: 0 0; transform: scale(var(--s, 1)); }
.zoom-close { position: absolute; top: 16px; right: 16px; }

/* ---------- video ---------- */
.opts { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; }
.opts select { border: 1.5px solid var(--line); border-radius: 12px; padding: 7px 10px; background: var(--panel-2); font-weight: 500; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tour { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.v-stage { position: relative; width: 100%; overflow: hidden; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; }
.v-stage iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; background: #fff; }
.v-stage.tall { max-width: 300px; }
#v-out { width: 100%; max-height: 70vh; border-radius: 12px; background: #000; }

/* ---------- pitch: logo, slides, video ---------- */
.part { display: grid; gap: 10px; padding-top: 18px; border-top: 1.5px solid var(--line); }
.part h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 800; font-size: 18px; }
.part h3 .num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-size: 14px; }
.part p { margin: 0; }
.logos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.logos:empty, .slides:empty { display: none; }
.logo-opt { border: 1.5px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; cursor: pointer; text-align: left; }
.logo-opt img { width: 100%; aspect-ratio: 1; border-radius: 12px; display: block; }
.logo-opt span { font-size: 13px; color: var(--muted); line-height: 1.5; }
.logo-opt:hover { border-color: var(--accent); }
.logo-opt[aria-pressed="true"] { border-color: var(--pick); box-shadow: 0 0 0 2px var(--pick); }
.slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.slides img { width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; border: 1.5px solid var(--line); display: block; background: #fff; }
.script { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; font-size: 14px; }
.script .en { display: block; }
.script .ja { display: block; color: var(--muted); font-size: 13px; }
#p-out { width: 100%; max-height: 60vh; border-radius: 12px; background: #000; }
.field select { border: 1.5px solid var(--line); border-radius: 12px; padding: 7px 10px; background: var(--panel-2); font-weight: 500; max-width: 100%; }

/* two-step choosing: selected (not yet sent) */
.choice.selected { border-color: var(--accent); box-shadow: 0 0 0 2.5px var(--accent); }
.chip.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); background: var(--accent-soft); }
.confirm-row { display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--accent-soft); }
.confirm-row p { margin: 0; font-size: 14px; font-weight: 700; }

/* ---------- submission form (same order as the hackathon's form) ---------- */
.remain { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; }
.remain.ok { background: color-mix(in srgb, var(--ok) 14%, var(--panel)); }
.sub-lang { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); }
.sub-lang button { border: 0; background: transparent; padding: 8px 14px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; white-space: nowrap; }
.sub-lang button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.sform { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 4px clamp(14px, 3vw, 24px) 12px; background: var(--panel-2); }
.sform:empty { display: none; }
.fsec { margin: 22px 0 2px; font-family: var(--font-head); font-weight: 800; font-size: 19px; }
.fsub { margin: 26px 0 0; padding-top: 16px; border-top: 1.5px solid var(--line); font-family: var(--font-head); font-weight: 800; font-size: 15.5px; color: var(--accent); }
.fintro { margin: 0; font-size: 13.5px; color: var(--muted); }
.fen { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.ffield { margin: 18px 0; display: grid; gap: 6px; }
.flab { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; font-weight: 700; font-size: 14.5px; }
.star { color: var(--pick); margin-left: 3px; }
.pub { flex: none; font-size: 11.5px; font-weight: 700; color: var(--accent); border: 1.5px solid var(--line); border-radius: 999px; padding: 0 9px; white-space: nowrap; }
.fdesc { margin: 0; font-size: 13px; color: var(--muted); }
.ffield input[type=text], .ffield textarea, .ffield select { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--panel); font-weight: 500; line-height: 1.6; }
.ffield textarea { min-height: 130px; resize: vertical; }
.ffield textarea.short { min-height: 84px; }
.ffield select { width: auto; min-width: 110px; }
.ffield input:focus, .ffield textarea:focus, .ffield select:focus { border-color: var(--accent); outline: none; }
.ffield .need { border-style: dashed; border-color: var(--warn); }
.ffield .need::placeholder { color: var(--warn); }
.fmeta { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.fmeta .row-btns { margin-left: auto; }
.count { font-variant-numeric: tabular-nums; }
.count.over { color: var(--err); font-weight: 700; }
.fcheck { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; font-size: 14.5px; cursor: pointer; }
.fcheck input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.chain-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chain-chips label { display: inline-flex; gap: 6px; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13.5px; font-weight: 700; color: var(--muted); cursor: pointer; background: var(--panel); }
.chain-chips label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--fg); }
.chain-chips input { margin: 0; }
.flogo { width: 88px; height: 88px; border-radius: 16px; border: 1.5px solid var(--line); display: block; }
.javal { padding: 10px 14px; border-radius: 12px; background: var(--panel); border: 1.5px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.javal.empty { background: none; border-style: dashed; color: var(--muted); }
.ref-card { display: grid; gap: 6px; padding: 14px; border-radius: var(--radius); border: 1.5px dashed var(--line); font-size: 14px; }
.ref-card p { margin: 0; }
.ref-card .links { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.ref-card .links li { display: grid; gap: 1px; }
.ref-card .links a { overflow-wrap: anywhere; font-weight: 700; }

/* ---------- guide (補足) ---------- */
.guide img { width: 100%; height: auto; border-radius: 12px; border: 1.5px solid var(--line); display: block; background: #fff; }
.guide-steps { margin: 0; padding-left: 1.4em; display: grid; gap: 18px; }
.guide-steps li { display: grid; gap: 8px; }
.guide-steps li::marker { font-family: var(--font-head); font-weight: 800; color: var(--accent); }
.guide-note { padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); font-weight: 700; font-size: 14.5px; }
.guide h4 { margin: 0; font-family: var(--font-head); font-weight: 800; font-size: 15.5px; }
.guide-dl { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); font-size: 14px; }
.guide-dl p { margin: 0; }
.guide-dl b { display: block; font-family: var(--font-head); }
.guide-warn { padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 14%, var(--panel)); font-size: 14px; }
.guide-warn b { margin-right: 8px; color: var(--warn); }
.gfig { margin: 0; display: grid; gap: 6px; }
.gshot { position: relative; }
.gfig figcaption { font-size: 13px; color: var(--muted); }
.gmarks { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; }
.gmarks li { display: flex; gap: 8px; align-items: baseline; }
.gmarks b { flex: none; min-width: 24px; padding: 0 6px; border-radius: 999px; background: #e5322d; color: #fff; font-size: 12.5px; text-align: center; }

/* ---------- YouTube upload helper ---------- */
.btn.yt { background: #e62117; border-color: #e62117; color: #fff; }
.btn.yt:hover:not(:disabled) { filter: brightness(1.08); border-color: #e62117; }
.yt-box { display: grid; gap: 8px; padding: 12px 14px; border-radius: var(--radius); border: 1.5px solid var(--line); }
.yt-box .fine { margin: 0; }
/* The guide's big sections (1 登録 … 4 最終提出) stand out from the steps inside them. */
.part.guide { margin-top: 18px; padding-top: 22px; border-top: 3px solid var(--accent); }
.part.guide > h3 { font-size: clamp(20px, 2.4vw, 24px); line-height: 1.4; padding: 12px 16px; border-radius: 14px; background: var(--accent-soft); color: var(--fg); }
.part.guide > h3 .num { width: 36px; height: 36px; font-size: 18px; flex: none; }
.guide-steps > li > h4 { font-size: 17px; }
/* Step numbers (a grid item has no list marker of its own, so they are drawn here). */
.guide-steps { list-style: none; padding-left: 0; counter-reset: gstep; }
.guide-steps > li { counter-increment: gstep; position: relative; padding-left: 40px; }
.guide-steps > li::before { content: counter(gstep); position: absolute; left: 0; top: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; font-size: 14px; }
.guide a.zoomable { display: block; cursor: zoom-in; }
.guide a.zoomable:focus-visible img { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ---------- Claude API key ---------- */
.banner.nokey { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.key-warn { padding: 12px 16px; border-radius: 14px; border: 2px solid var(--err); background: color-mix(in srgb, var(--err) 10%, var(--panel)); font-size: 14.5px; }
.key-warn p { margin: 0 0 6px; color: var(--err); font-size: 15.5px; }
.key-warn ul { margin: 0; padding-left: 1.2em; display: grid; gap: 2px; }
.key-status { padding: 10px 14px; border-radius: 12px; font-weight: 700; font-size: 14.5px; background: var(--panel-2); border: 1.5px solid var(--line); }
.key-status.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--panel)); }
.key-status code { font-family: ui-monospace, Menlo, monospace; font-size: 13.5px; }
.key-input { display: flex; gap: 6px; align-items: center; }
.key-input input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; }
.key-check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.key-check input { margin-top: 5px; accent-color: var(--accent); }
.key-list { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; font-size: 14.5px; }

/* ---------- popups (作成者からのお願い / APIキーの案内) ---------- */
.modal { width: min(560px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow-y: auto; border: 1.5px solid var(--line); border-radius: 22px; padding: 26px 26px 22px; background: var(--panel); color: var(--fg); box-shadow: 0 30px 80px rgba(20, 12, 40, .35); }
.modal::backdrop { background: rgba(20, 14, 35, .55); }
.modal[open] { display: grid; gap: 12px; animation: modal-in .25s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }
.modal h2 { margin: 0; font-family: var(--font-head); font-weight: 800; font-size: 22px; line-height: 1.4; text-wrap: balance; }
.modal p { margin: 0; font-size: 15px; }
.promo-app { display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; align-items: center; padding: 14px; border-radius: 16px; background: var(--accent-soft); }
.promo-icon { width: 76px; height: 76px; border-radius: 18px; box-shadow: 0 6px 16px rgba(20, 12, 40, .2); }
.promo-body { display: grid; gap: 6px; justify-items: start; }
.promo-body b { font-family: var(--font-head); font-size: 18px; }
.promo-body span { font-size: 13px; color: var(--muted); line-height: 1.5; }
.promo-qr { margin: 0; text-align: center; }
.promo-qr img { width: 96px; height: 96px; border-radius: 8px; background: #fff; padding: 4px; display: block; }
.promo-qr figcaption { font-size: 11px; color: var(--muted); line-height: 1.4; margin-top: 4px; }
.modal-btns { justify-content: flex-end; }
.modal-steps { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; font-size: 15px; }
.plan { padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); font-size: 14.5px; }
.plan p { color: var(--warn); margin-bottom: 4px; }
.plan ul { margin: 0; padding-left: 1.2em; display: grid; gap: 3px; }
.key-warn-line { color: var(--err); font-size: 14.5px; }
@media (max-width: 520px) { .promo-app { grid-template-columns: 64px 1fr; } .promo-icon { width: 64px; height: 64px; } .promo-qr { display: none; } }
.modal.warn { border: 2px solid var(--err); }
.modal.warn .eyebrow { color: var(--err); }
/* Security points the reader must not miss: bold red */
.danger { color: var(--danger); font-weight: 800; }
.key-list li.danger::marker, .key-warn li.danger::marker, .plan li.danger::marker { color: var(--danger); }
.nostore { margin: 0; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--panel)); font-size: 14.5px; }
.nostore b { color: var(--fg); }
