:root {
  --bg: #0b0b0b;
  --fg: #f2f2f2;
  --muted: #9a9a9a;
  --line: #3a3a3a;
  --line-soft: #262626;
  --bar: 52px;
  --sans: 'Zen Kaku Gothic New', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
body { overscroll-behavior: none; }
a { color: var(--fg); }
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

/* ---------- 共通 ---------- */
.topbar {
  height: var(--bar); display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px; border-bottom: 1px solid var(--line-soft); background: var(--bg);
}
.tb-link { display: flex; align-items: center; min-height: 44px; text-decoration: none; font-size: 14px; }
.tb-site { font-weight: 700; }
.tb-mid { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.tb-btn { display: flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--fg); text-decoration: none; font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  background: transparent; color: var(--fg); border: 1px solid var(--line); border-radius: 0; text-decoration: none;
  font-size: 14px; cursor: pointer;
}
.btn:hover { border-color: var(--fg); }
.btn-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 700; }
.btn-lg { min-height: 52px; font-size: 16px; width: 100%; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-muted { color: var(--muted); border-color: var(--line-soft); cursor: default; }
.btn[disabled] { opacity: .5; cursor: default; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 4px; }

.page { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
.section { padding: 24px 16px; display: flex; flex-direction: column; gap: 18px; }
.h1 { font-size: 22px; font-weight: 700; margin: 0; }
.h2 { font-size: 16px; font-weight: 700; margin: 8px 0 0; }
.lead { font-size: 15px; line-height: 1.7; margin: 0; color: #d0d0d0; }
.hint { font-size: 12px; line-height: 1.7; color: var(--muted); margin: 0; }
.empty { color: var(--muted); text-align: center; padding: 48px 16px; margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.foot { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 32px 16px 48px; font-size: 12px; }
.foot a { color: var(--muted); text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.prose p, .prose li { font-size: 14px; line-height: 1.8; color: #d6d6d6; }
.prose ul { margin: 0; padding-left: 1.2em; }
.prose p { margin: 0; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.prompt { white-space: pre-wrap; word-break: break-all; font-family: var(--mono); font-size: 12px; line-height: 1.7; border: 1px solid var(--line); padding: 12px; margin: 0; color: #d6d6d6; }

/* フォーム */
.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-size: 13px; color: var(--muted); }
input[type=text], input[type=url] {
  height: 48px; padding: 0 12px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 0;
  font-family: inherit; font-size: 16px; width: 100%;
}
input[type=text]:focus, input[type=url]:focus { border-color: var(--fg); outline: none; }
input[type=file]:not(.visually-hidden) { font-size: 13px; color: var(--muted); }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 180px;
  border: 1px dashed #5a5a5a; cursor: pointer; text-align: center; padding: 16px; position: relative;
}
.drop.over, .drop:focus-within { border-color: var(--fg); }
.drop.ready { border-style: solid; border-color: var(--fg); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.7; color: #c4c4c4; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--fg); flex-shrink: 0; }
.details summary { cursor: pointer; font-size: 14px; min-height: 44px; display: flex; align-items: center; }
.details[open] { display: flex; flex-direction: column; gap: 10px; }
.error { color: #ff8a80; font-size: 13px; line-height: 1.6; margin: 0; border: 1px solid #5a2a26; padding: 10px 12px; }
.progress { height: 4px; background: var(--line-soft); }
.bar { height: 100%; width: 0; background: var(--fg); transition: width .2s; }

/* 作者ページ */
.profile { padding: 24px 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.who { display: flex; gap: 14px; align-items: center; }
.avatar { width: 56px; height: 56px; object-fit: cover; background: var(--line-soft); }
.handle { font-size: 24px; font-weight: 700; margin: 0 0 2px; word-break: break-all; }
.stats { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 0; }
.stats b { color: var(--fg); font-weight: 500; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
.tile { position: relative; aspect-ratio: 1; display: block; text-decoration: none; overflow: hidden; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.tile:has(img) .tile-title { display: none; }
.tile-title, .tile-plays {
  position: absolute; left: 0; background: var(--bg); color: var(--fg); padding: 2px 6px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile-title { bottom: 22px; font-size: 12px; font-weight: 700; }
.tile-plays { bottom: 0; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.manage { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.manage li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; border-bottom: 1px solid var(--line-soft); padding: 6px 0; font-size: 14px; }
.manage li a { flex: 1 1 140px; text-decoration: none; }
.manage .mono { font-size: 12px; }
.admin { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.admin-row { border: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }

/* ---------- フィード ---------- */
.app { height: 100dvh; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; overflow: hidden; }
.feed {
  flex: 1; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain;
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }
.item {
  height: calc(100dvh - var(--bar)); scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; flex-direction: column;
}
.stage { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.poster-title {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px;
  font-size: 28px; font-weight: 700; text-align: center; line-height: 1.4;
}
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: transparent; }
.stage .play {
  position: absolute; left: 50%; bottom: 32px; transform: translateX(-50%);
  min-height: 44px; padding: 0 22px; background: var(--bg); color: var(--fg); border: 0; cursor: pointer; font-size: 14px; white-space: nowrap;
}
.stage .loading { position: absolute; left: 12px; top: 12px; background: var(--bg); padding: 4px 8px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.challenge {
  position: absolute; left: 12px; top: 12px; z-index: 2; background: var(--bg); padding: 8px 12px; font-size: 13px;
}
.challenge b { font-family: var(--mono); font-weight: 500; }

.info {
  flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 0;
  background: var(--bg); border-top: 1px solid var(--line-soft);
}
.info-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.meta { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.title { font-size: 18px; font-weight: 700; line-height: 1.3; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.byline { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--muted); }
.byline a { color: var(--muted); text-decoration: none; }
.byline .mono { font-size: 12px; }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--line); border-radius: 0; cursor: pointer; color: var(--fg);
}
.icons { display: flex; gap: 8px; }
.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.act {
  height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; background: transparent; color: var(--fg);
  border: 1px solid var(--line); border-radius: 0; cursor: pointer; text-decoration: none; font-size: 13px;
}
.act.like { font-family: var(--mono); }
.act.post { background: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 700; }
.act.off { color: #555; border-color: var(--line-soft); cursor: default; }

/* 画面下のスワイプ誘導(常時):▽が上から下へ流れる */
.swipe {
  height: 52px; display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 12px; color: var(--muted); padding-bottom: env(safe-area-inset-bottom);
  user-select: none; cursor: pointer; background: none; border: 0; width: 100%;
}
.chev { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 30px; }
.chev i {
  display: block; width: 10px; height: 10px; margin-top: -4px;
  border-right: 2px solid var(--fg); border-bottom: 2px solid var(--fg); transform: rotate(45deg);
  opacity: .12; animation: flow 1.2s linear infinite;
}
.chev i:nth-child(2) { animation-delay: .2s; }
.chev i:nth-child(3) { animation-delay: .4s; }
@keyframes flow { 0% { opacity: .12; } 30% { opacity: 1; } 70%, 100% { opacity: .12; } }
@media (prefers-reduced-motion: reduce) { .chev i { animation: none; opacity: .7; } }
.item.last .swipe { visibility: hidden; }
.swipe .pc { display: none; }
@media (hover: hover) and (pointer: fine) { .swipe .sp { display: none; } .swipe .pc { display: inline; } }

/* 遊び終わり・メニュー */
.sheet {
  position: absolute; inset: 0; z-index: 3; background: rgba(11, 11, 11, .92); display: flex; flex-direction: column;
  justify-content: flex-end; gap: 12px; padding: 16px;
}
.sheet[hidden] { display: none; }
.result { display: flex; flex-direction: column; gap: 6px; margin-bottom: auto; margin-top: 24px; }
.result .label { font-size: 13px; color: var(--muted); }
.result .score { font-family: var(--mono); font-size: 64px; line-height: 1; }
.preview { border: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.preview .text { font-size: 15px; line-height: 1.6; white-space: pre-line; word-break: break-all; }
.btn-tip { min-height: 48px; border-color: var(--fg); font-weight: 700; }
.menu-list { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.menu-list .h2 { margin: 0 0 4px; }
.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); z-index: 10; background: var(--fg); color: var(--bg);
  padding: 10px 16px; font-size: 13px; max-width: calc(100% - 32px);
}

/* チップの案内(作者ページ) */
.notice { border: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.notice.warn { border-color: var(--fg); }
.notice .big { font-size: 40px; line-height: 1; }
.notice .big small { font-size: 14px; color: var(--muted); }

/* 作者向けページ */
.points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0; counter-reset: p; }
.points li { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-top: 1px solid var(--line-soft); counter-increment: p; }
.points li b { font-size: 16px; }
.points li b::before { content: counter(p, decimal-leading-zero) '  '; font-family: var(--mono); font-weight: 500; color: var(--muted); }
.points li span { font-size: 14px; line-height: 1.8; color: #d6d6d6; }
.tip-hosts dd { line-height: 1.8; }
.creators h2 { margin-top: 16px; }
