:root {
  color-scheme: dark;
  --bg: #12171e; --panel: #1a2129; --panel-2: #222b35; --text: #e7ebf0; --muted: #a3afbd; --line: #323d4a;
  --accent: #7fa6e8; --accent-bg: #3f6fc0; --accent-text: #fff; --danger: #ff8a7d; --ok: #7ccb92; --draft: #e7b45a; --draft-bg: #2c2719;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.7 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif; }
body { overflow-wrap: anywhere; }
a { color: var(--accent); }
p { margin: 0 0 10px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; flex-wrap: wrap; column-gap: 10px;
  padding: max(6px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left)); background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { flex: none; white-space: nowrap; font-weight: 800; letter-spacing: .06em; text-decoration: none; color: var(--text); display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.brand-mark { display: block; flex: none; width: 32px; height: 32px; }
.brand-sub { font-size: 11px; font-weight: 500; letter-spacing: 0; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; }
nav { margin-left: auto; display: flex; gap: 2px; }
nav a { text-decoration: none; font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; padding: 0 8px; white-space: nowrap; }
main { max-width: 760px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
h1 { font-size: 21px; line-height: 1.4; margin: 4px 0 14px; }
h2 { font-size: 17px; line-height: 1.5; margin: 30px 0 12px; }
h3 { font-size: 16px; line-height: 1.5; margin: 0 0 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.draft { background: var(--draft-bg); border-color: #6d5a2e; }
.stack > * + * { margin-top: 12px; }
.back { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-size: 14px; }
label, .label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
/* 入力欄は必ず16px以上。小さいと iOS Safari がフォーカス時に画面を自動拡大し、画面を移っても拡大が残って右側が切れる */
input[type=text], input[type=url], input[type=password], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
textarea.code { font: 16px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  min-height: 50vh; white-space: pre; overflow-wrap: normal; overflow-x: auto; tab-size: 2; }
textarea.paste { font: 16px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; min-height: 110px; max-height: 40vh; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 46px; padding: 8px 14px; font: inherit; font-weight: 600; line-height: 1.4; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; text-decoration: none; }
button.primary, .btn.primary { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent-text); }
button.save { background: var(--draft); border-color: var(--draft); color: #1d1608; }
button.danger { color: var(--danger); }
button.link { background: none; border-color: transparent; color: var(--accent); font-weight: 500; font-size: 14px; padding: 6px 4px; min-height: 44px; }
button:disabled { opacity: .5; cursor: default; }
.wide { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.row.fill > * { flex: 1 1 140px; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
a.small { display: inline-flex; align-items: center; min-height: 44px; }
.error { color: var(--danger); font-size: 14px; }
.error:empty { display: none; }
.notice { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; font-size: 14px; color: var(--muted); white-space: pre-line; }
.notice.warn { border-color: var(--draft); color: var(--text); }
.notice.bad { border-color: var(--danger); color: var(--text); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.list li.draft { background: var(--draft-bg); border-color: #6d5a2e; }
.list a.item { display: block; padding: 13px 16px; color: var(--text); text-decoration: none; }
.list .item-title { font-weight: 600; }
.list .item-row { padding: 13px 16px; }
.list .item-row .row { margin-top: 10px; }
.badge { display: inline-block; font-size: 12px; line-height: 1.6; padding: 1px 9px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-weight: 500; white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: #3f6b4c; }
.badge.draft { color: var(--draft); border-color: #6d5a2e; }
.badge.bad { color: var(--danger); border-color: #7a453f; }
.choice { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-bottom: 8px; }
.choice a { display: block; padding: 16px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); text-decoration: none; }
.choice > * { word-break: keep-all; }
.choice button { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; width: 100%; text-align: left; padding: 16px 14px; border-radius: var(--radius); background: var(--panel); font-weight: 400; }
.choice strong { display: block; font-size: 16px; margin-bottom: 2px; }
.choice span { font-size: 13px; color: var(--muted); line-height: 1.5; display: block; }
.samples { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sample { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); text-decoration: none; }
.sample img { display: block; width: 100%; height: auto; aspect-ratio: 390 / 480; object-fit: cover; background: #10151c; }
.sample .cap { padding: 10px 12px 12px; }
.sample .genre { font-weight: 700; font-size: 15px; line-height: 1.45; display: block; }
.sample .ctl { font-size: 13px; color: var(--muted); line-height: 1.5; display: block; margin-top: 4px; }
.ideas { list-style: none; margin: 0; padding: 0; }
.ideas li { margin-bottom: 8px; }
.ideas button { width: 100%; justify-content: flex-start; text-align: left; font-weight: 500; }
/* 試遊 */
.preview { position: relative; height: min(62vh, 520px); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #000; margin-bottom: 14px; }
.preview iframe { width: 100%; height: 100%; border: 0; display: block; pointer-events: none; background: #fff; }
.preview .cover { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: rgba(8,11,15,.35); display: flex; align-items: flex-end; padding: 16px; }
.preview .cover span { width: 100%; background: var(--accent-bg); color: #fff; border-radius: 10px; padding: 12px; font-size: 17px; }
.fullplay { position: fixed; inset: 0; z-index: 50; background: #0b0f14; display: flex; flex-direction: column;
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.fullplay .bar { flex: none; display: flex; gap: 8px; align-items: center; padding: 6px 10px; background: var(--panel); }
.fullplay .bar.top { padding-top: max(6px, env(safe-area-inset-top)); }
.fullplay .bar.bottom { padding: 8px 10px max(8px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
.fullplay .bar.bottom button { flex: 1 1 130px; }
.fullplay .bar .title { flex: 1; min-width: 0; font-size: 14px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fullplay .bar button { min-height: 44px; padding: 6px 12px; font-size: 14px; }
.fullplay iframe { flex: 1 1 0; min-height: 0; width: 100%; border: 0; background: #fff; }
.fullplay .error { padding: 0 12px; background: var(--panel); }
.savestate { margin-top: 4px; font-size: 13px; color: var(--muted); min-height: 1.7em; }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
fieldset { border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 600; margin-bottom: 2px; }
.radio { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 9px 0; margin: 0; color: var(--text); font-size: 15px; }
.radio input { width: 20px; height: 20px; flex: none; margin: 2px 0 0; accent-color: var(--accent-bg); }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0 0; font-size: 14px; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; min-width: 0; white-space: pre-wrap; }
dialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 18px; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog p { white-space: pre-line; }
.secret { font: 13px ui-monospace, monospace; word-break: break-all; background: var(--bg); border: 1px dashed var(--line); padding: 10px; border-radius: 8px; user-select: all; }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px);
  background: #39434f; color: #fff; padding: 10px 18px; border-radius: 14px; font-size: 14px; z-index: 100; pointer-events: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.scroll-x { overflow-x: auto; overflow-wrap: normal; }
@media (min-width: 640px) { .samples { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* 制作画面（段階ごと） */
.studio { display: flex; flex-direction: column; min-height: calc(100vh - 65px); min-height: calc(100dvh - 65px - env(safe-area-inset-top));
  margin: -10px 0 calc(-40px - env(safe-area-inset-bottom)); }
.studio-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.studio-work { font-size: 14px; color: var(--muted); line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-bottom: 6px; }
.steps ol { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.steps { margin: 0; display: block; }
.steps .st { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px; padding: 4px 0; font-size: 12px; line-height: 1.3; color: var(--muted);
  border: 0; border-bottom: 3px solid var(--line); text-decoration: none; white-space: nowrap; }
.steps .num { font-size: 13px; font-weight: 700; }
.steps .done .st { color: var(--text); border-color: var(--accent-bg); }
.steps .now .st { color: var(--text); font-weight: 700; border-color: var(--accent); background: var(--panel); border-radius: 8px 8px 0 0; }
.steps a.st { color: var(--accent); }
.steps .off { opacity: .55; }
.studio h1 { font-size: 19px; margin: 2px 0 10px; }
.studio h1:focus { outline: none; }
.studio-more { column-gap: 14px; row-gap: 0; }
textarea.step-text { min-height: clamp(104px, 26vh, 280px); }
.actionbar { position: sticky; bottom: 0; z-index: 5; margin: auto calc(-1 * max(16px, env(safe-area-inset-right))) 0 calc(-1 * max(16px, env(safe-area-inset-left)));
  padding: 10px max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: var(--panel); border-top: 1px solid var(--line); }
.actionbar .error, .actionbar .muted { margin-bottom: 8px; }
.actionbar .muted:empty { display: none; }
body.has-bar #toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
/* 上部の4項目（管理者）を1行に収める */
@media (max-width: 430px) { .topbar { column-gap: 8px; } .topbar nav { gap: 0; } .topbar nav a { padding: 0 4px; } }
/* ロゴを含めて上部を1行に収める。359px 以下の管理者表示（4項目）は、ナビが2行目に折り返る */
@media (max-width: 429px) { .brand-sub { display: none; } }
@media (max-width: 374px) { .topbar nav a { font-size: 13px; padding: 0 3px; } }
@media (max-width: 359px) { .brand { gap: 4px; letter-spacing: .02em; } .brand-mark { width: 26px; height: 26px; } .topbar { column-gap: 6px; } .topbar nav { margin-left: auto; } }
/* プライバシーポリシー */
.policy h2 { margin-top: 28px; }
.policy h3 { margin-top: 16px; font-size: 15px; }
.policy ul { padding-left: 1.2em; margin: 0 0 12px; }
.policy li { margin-bottom: 6px; }
dl.kv.policy-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.policy-kv dt { margin-top: 10px; font-weight: 600; color: var(--text); }
.policy-kv dd { color: var(--muted); }
.policy-links { margin-top: 18px; }

/* LINE ログイン（LINE のボタンの色: #06C755、押下時は黒30%を重ねる） */
button.line { background: #06C755; border-color: #06C755; color: #fff; }
button.line:active { background: #058b3b; }
button.line:hover:not(:disabled) { background: #05b34d; }
.terms { margin: 0 0 6px; padding-left: 1.2em; font-size: 15px; }
.terms li { margin-bottom: 6px; }
.resume { display: block; text-decoration: none; color: var(--text); }
.moving { margin-bottom: 14px; font-size: 14px; }
