: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; gap: 10px;
  padding: 6px 16px; padding-top: max(6px, env(safe-area-inset-top)); background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: .06em; text-decoration: none; color: var(--text); display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.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 16px calc(40px + env(safe-area-inset-bottom)); }
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; }
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: 13px/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: 13px/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; }
.anchor { scroll-margin-top: 76px; }
.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 button { display: block; 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; }
.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); }
.card-head { margin-bottom: 12px; }
.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)); } }
