@import url("../fonts/yuji-syuku/font.css");

:root {
  color-scheme: dark;
  --font-body: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
  --font-brush: 'Yuji Syuku', serif;
  --yoru: #141a26;
  --sumi: #1c2433;
  --sumi-2: #273044;
  --shiro: #e9e6dd;
  --usuzumi: #8d94a3;
  --yamabuki: #e0a83a;
  --shu: #d9483b;
  --bg: var(--yoru);
  --panel: var(--sumi);
  --panel-2: var(--sumi-2);
  --ink: var(--shiro);
  --muted: var(--usuzumi);
  --line: var(--sumi-2);
  --accent: var(--yamabuki);
  --accent-ink: var(--yoru);
  --duel: var(--shu);
  --radius: 10px;
  --w: 600px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  --tab-height: calc(56px + env(safe-area-inset-bottom));
  margin: 0;
  padding-bottom: var(--tab-height);
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--font-body);
  min-height: 100vh;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--panel); padding: 4px 8px; }
[hidden] { display: none !important; }

/* ---- サイトのナビ ---- */
header.site {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: calc(48px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.brand, main h1, .section-title, .dialog h2 {
  font: 400 22px/1.35 var(--font-brush);
}
.brand { text-decoration: none; white-space: nowrap; }
.site-tools { display: flex; align-items: center; gap: 4px; }
.site-tools a {
  position: relative; display: grid; place-items: center; min-width: 44px; min-height: 44px;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.site-tools a:hover, .site-tools a[aria-current] { color: var(--accent); }
#auth-link { font-size: 13px; }
.site-tools .profile-avatar { width: 28px; height: 28px; }
.site svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.sitenav {
  position: fixed; inset: auto 0 0; z-index: 21;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  height: var(--tab-height);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--panel); border-top: 1px solid var(--line);
}
.sitenav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-top: 2px solid transparent; color: var(--muted);
  font-size: 13px; text-decoration: none; white-space: nowrap;
}
.sitenav a:hover { color: var(--ink); }
.sitenav a[aria-current] { color: var(--accent); border-color: var(--accent); }
.sitenav a:focus-visible { outline-offset: -2px; }

@media (min-width: 1000px) {
  body { --tab-height: 0px; }
  header.site {
    position: fixed; top: 24px; right: calc(50% + var(--w) / 2 + 16px);
    width: 184px; padding: 0; border: 0;
    flex-direction: column; align-items: flex-start;
  }
  .sitenav { position: static; display: grid; width: 100%; height: auto; grid-template-columns: 1fr; padding: 0; background: none; border: 0; }
  .sitenav a { flex-direction: row; justify-content: flex-start; gap: 8px; min-height: 44px; padding: 0 12px; border: 0; border-left: 2px solid transparent; font-size: 15px; }
}

main, .status { width: min(var(--w), calc(100% - 32px)); margin-inline: auto; }
main { padding: 16px 0 32px; overflow-wrap: anywhere; }
main:focus { outline: none; }
.match-page { --tab-height: 0px; }
.match-page > :is(.site, .status, .skip) { display: none; }

/* ---- 自分の状態（沈黙中など） ---- */
.status {
  margin-top: 12px; padding: 8px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13px;
}
.status strong::before { content: ""; display: inline-block; width: 1em; height: 1em; background: url("/img/seal.svg") center / contain no-repeat; margin-inline-end: 4px; vertical-align: -.13em; }
.home-notices { display: grid; gap: 4px; }
.home-notices:not(:has(> :not([hidden]))) { display: none; }
.notice-strip {
  display: flex; align-items: center; gap: 8px; min-height: 44px;
  padding-inline: 12px 4px; background: var(--panel);
  font-size: 13px;
}
.notice-strip > .line-icon { width: 16px; height: 16px; flex: none; color: var(--muted); }
.notice-message { flex: 1; min-width: 0; }
.notice-text-action {
  min-height: 24px; padding: 0 4px; border: 0; background: none; color: var(--accent);
  font-size: inherit; text-decoration: underline; text-underline-offset: 4px; white-space: nowrap; cursor: pointer;
}
.notice-strip .btn { padding: 4px 8px; font-size: inherit; white-space: nowrap; }
.notice-strip .icon-button { font-size: 20px; }
.notice-strip p { margin: 0; }
.notice-name { font: 400 18px/1.35 var(--font-brush); text-decoration: none; }
.notice-name:hover { color: var(--accent); }

/* ---- 町（トップ） ---- */
.clock { font-variant-numeric: tabular-nums; }

.places { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.place {
  display: grid; gap: 4px; padding: 12px; text-decoration: none;
  border-bottom: 1px solid var(--line); border-left: 3px solid var(--board-color, var(--line));
}
.place:is(:hover, :active) { background: var(--panel); }
.board-name { font-family: var(--font-brush); }
.place h2 { font-size: 22px; line-height: 1.35; font-weight: 400; margin: 0; }
.place .muted span + span { margin-inline-start: 8px; }
.town-presence { display: inline-flex; gap: 4px; align-items: center; }
.town-presence .profile-avatar { width: 1.45rem; height: 1.45rem; font-size: 13px; }
[data-slug="tavern"] { --board-color: #d98b2b; }
[data-slug="plaza"] { --board-color: #4c8fae; }
[data-slug="arena"] { --board-color: #c2552c; }
[data-slug="castle"] { --board-color: #6f86d0; }
[data-slug="throne"] { --board-color: #b8933f; }
[data-slug="prison"] { --board-color: #6f7c84; }
[data-slug="redlight"] { --board-color: #e0628a; }
.dot { display: inline-block; width: .55em; height: .55em; border-radius: 50%; background: var(--accent); margin-inline-end: 4px; vertical-align: .08em; }

/* ---- 板 ---- */
.board-head { margin-bottom: 12px; }
.board-head > .page-heading {
  flex-wrap: nowrap; gap: 0; margin-bottom: 8px;
  border-inline-start: 3px solid var(--board-color, var(--line)); padding-inline-start: 8px;
}
.board-head .heading-action { padding: 4px 8px; font-size: 13px; white-space: nowrap; }
.board-head .help { margin-inline-end: 4px; }
.board-head .help > summary { width: 32px; }
.board-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--muted); }
.board-resident { font: 400 15px/1.35 var(--font-brush); }
@media (max-width: 420px) {
  .board-head h1 { font-size: clamp(16px, 4.6vw, 18px); }
}

.threads { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.thread-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0 8px; align-items: center; padding: 4px; border-bottom: 1px solid var(--line); }
.threads .thread-link { display: flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--ink); }
.threads li:has(.thread-link:is(:hover, :active)) { background: var(--panel); }
.threads .author-link { grid-column: 1 / -1; justify-self: start; padding-bottom: 4px; }
.threads .author-link strong { font-size: 13px; }
.threads .count { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13px; }
.empty { color: var(--muted); padding: 12px 0; }
.empty:has(.btn) { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.empty p { margin: 0; }

.author-link { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.author-link strong { color: var(--ink); font-size: 15px; }
.post.npc .author-link strong { font: 400 22px/1.35 var(--font-brush); }
.author-link .muted { font-size: 13px; }
.author-link:hover strong { text-decoration: underline; }
.profile-avatar { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 999px; object-fit: cover; color: white; font-weight: 700; flex: none; }
.profile-avatar[src$="#graphic"] { filter: blur(.35rem); clip-path: circle(50%); }
.profile-editor .profile-avatar { width: 3rem; height: 3rem; }

/* ---- フォーム ---- */
.field { display: grid; gap: 4px; margin: 0 0 12px; }
.field label { font-size: 13px; color: var(--muted); }
input:is(:not([type]), [type="text"], [type="email"], [type="password"], [type="number"], [type="search"]), textarea, select {
  width: 100%; min-height: 44px; padding: 8px 12px; background: var(--panel); color: var(--ink);
  border: 0; border-radius: var(--radius);
}
:is(.dialog, .compose) :is(input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select) {
  background: var(--bg);
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent); outline-offset: 0;
}
.row > input[type="search"] { flex: 1; min-width: 0; }
textarea { resize: vertical; min-height: 4.6rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 44px; padding: 8px 16px; border-radius: var(--radius); border: 1px solid var(--muted);
  background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; line-height: 1.3;
  transition: transform 80ms;
}
.btn:hover:not(:disabled) { border-color: currentColor; }
.btn[aria-pressed="true"], .btn[aria-selected="true"] { color: var(--accent); border-color: var(--accent); }
.btn.ghost { border-color: transparent; }
.btn.ghost:is([aria-pressed="true"], [aria-selected="true"]) { text-decoration: underline; text-underline-offset: 4px; }
.btn.ghost:hover:not(:disabled) { border-color: transparent; text-decoration: underline; }
.btn.primary, .compose .btn[type="submit"] {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.btn.danger { background: var(--duel); border-color: var(--duel); color: #000; }
.btn.primary, .btn.danger, .compose .btn[type="submit"] { font-weight: 700; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.page-heading { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.page-heading :is(h1, h2), .dialog .page-heading h2 { margin: 0; }
.page-heading .heading-action, .coin-balance { margin-inline-start: auto; }
.split { justify-content: space-between; }
.help { font-size: 13px; color: var(--muted); }
.help summary, .post-menu summary, .game-ranking summary { list-style: none; cursor: pointer; }
.help summary::-webkit-details-marker, .post-menu summary::-webkit-details-marker, .game-ranking summary::-webkit-details-marker { display: none; }
.help > summary { display: grid; place-items: center; width: 44px; min-height: 44px; }
.help > summary:hover, .help[open] > summary { color: var(--accent); }
.help > div { padding: 8px 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
:is(.page-heading, .shop-links, .offer, .me-stats dt) > .help > div {
  position: absolute; z-index: 5; inset-inline: 0; margin-top: 4px;
}
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chip { display: inline-block; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; font: 400 13px/1.6 var(--font-body); color: var(--muted); }
.chip.penalty { color: var(--ink); border-color: var(--duel); }
.duel-stakes { margin-block: 8px; }
.duel-stakes .penalty { padding: 4px 16px; font-size: 18px; }
.line-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.btn.icon-button { min-width: 44px; padding: 0; font-size: 22px; }

/* ---- スレッド ---- */
.thread-head h1 { margin: 8px 0 4px; }
.thread-head .board-name { font-size: 22px; }
.filterline { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.collapsed-note button { background: none; border: none; cursor: pointer; padding: 0; text-decoration: underline; }

.post { padding: 12px 8px; border-bottom: 1px solid var(--line); border-left: 2px solid transparent; scroll-margin-top: 5rem; }
.posts > .post:first-child { border-top: 1px solid var(--line); }
.post .meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0 8px; align-items: center; }
.post .no { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.post .body { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.post .meta :is(time, .author-link .muted) { white-space: nowrap; }
.post .meta .author-link { flex-wrap: nowrap; min-width: 0; }
.post .meta .author-link strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-post { position: relative; }
.thread-post .meta { flex-wrap: nowrap; padding-inline-end: 44px; min-height: 26px; }
.thread-post .meta .author-link .muted { display: none; }
.post-menu > summary { position: absolute; inset: .25rem .1rem auto auto; }
.post-menu-actions {
  position: absolute; z-index: 4; inset: 2.9rem .1rem auto auto;
  display: grid; min-width: 10rem; padding: .25rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.post-menu-actions > .act { min-height: 44px; border-color: transparent; border-radius: var(--radius); text-align: start; }
.collapsed-note ~ .post-menu .post-menu-actions > :not(:first-child) { display: none; }
.act.duel { background: var(--duel); color: #000; font-weight: 700; }
.act.duel:hover { background: var(--duel); color: #000; text-decoration: underline; }
.act {
  font-size: 13px; padding: .1rem .55rem; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.act:hover, .act[aria-pressed="true"] { background: var(--panel-2); color: var(--ink); border-color: var(--muted); }
.act[aria-pressed="true"] { font-weight: 700; }
.collapsed-note { font-size: 13px; color: var(--muted); }
.post.fresh { animation: fresh 1.6s ease-out; }
@keyframes fresh { from { background-color: var(--panel-2); } to { background-color: transparent; } }

/* 決闘・処罰の書き込み */
.post:is(.challenge, .invite, .judge, .result, .inquisition, .forced) { border-left-color: var(--duel); }
.duel-announcement { display: block; color: var(--duel); font: 400 22px/1.35 var(--font-brush); }
.howl-mark { font-size: 13px; color: var(--muted); }
:is(.duel-announcement, .match .big.win)::before {
  content: ""; display: inline-block; width: .75em; height: .75em; margin-inline-end: .35em;
  vertical-align: -.08em; background: url("/img/seal.svg") center / contain no-repeat;
}
.feed-item:is(.challenge, .invite, .judge, .result, .inquisition, .forced) .feed-body::before {
  content: ""; display: block; float: left; width: 13px; height: 13px; margin: .45rem .4rem 0 0;
  background: url("/img/seal.svg") center / contain no-repeat;
}

/* 決闘の札（果たし状の下に出る状態） */
.duelcard {
  padding: .7rem .5rem; border-bottom: 1px solid var(--line);
  border-left: 2px solid var(--duel); font-size: 13px; display: grid; gap: .45rem;
}
.duelcard .state { font-weight: 700; }

/* 書き込み欄（画面下に固定） */
.compose {
  position: fixed; inset: auto 0 calc(.35rem + var(--tab-height)); z-index: 20;
  width: min(var(--w), calc(100% - 1rem)); margin-inline: auto; padding: .35rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.compose .note { flex: 1 0 100%; font-size: 13px; color: var(--muted); }
.compose.howl-mode { border-left: 2px solid var(--duel); }
.compose .btn.danger[type="submit"] { background: var(--duel); border-color: var(--duel); color: #000; }
.compose.silenced { text-align: center; }
.composer-form { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.composer-form textarea { flex: 1 1 6ch; min-width: 0; width: auto; height: 44px; min-height: 44px; max-height: 35dvh; resize: none; }
.composer-form:is(.expanded, :has(textarea:not(:placeholder-shown), .previews:not(:empty))) textarea { flex-basis: 100%; height: 6rem; resize: vertical; }
.composer-form .picker { display: contents; }
.composer-form .previews:empty { display: none; }
.composer-form .previews { flex: 1 0 100%; order: 1; }
.composer-form > :is(.small, .btn:last-child) { margin-inline-start: auto; }
.composer-form > .small:not([hidden]) + .btn { margin-inline-start: 0; }
.composer-form .over-limit { color: var(--ink); font-weight: 700; }

/* ---- モーダル ---- */
body:has(#modal-root > .overlay) { overflow: hidden; }
.overlay {
  position: fixed; inset: 0; z-index: 50; overflow: hidden;
  background: rgb(0 0 0 / .65); backdrop-filter: blur(4px);
  display: grid; place-items: end center;
}
.dialog {
  width: min(34rem, 100%); max-height: 92dvh; overflow: auto; overscroll-behavior: contain;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
  animation: sheet-in 140ms ease-out;
}
.dialog::before {
  content: ""; display: block; width: 32px; height: 4px;
  margin: 0 auto 12px; border-radius: 999px; background: var(--muted);
}
@keyframes sheet-in { from { transform: translateY(100%); } }
@media (min-width: 1000px) {
  .overlay { place-items: center; }
  .dialog { width: 34rem; border-radius: var(--radius); padding: 16px 16px 24px; animation: none; }
  .dialog::before { display: none; }
}
.dialog h2 { margin: 0 0 8px; }
.dialog .quote { border-left: 3px solid var(--line); padding: 4px 12px; color: var(--muted); margin: 8px 0 12px; white-space: pre-wrap; max-height: 7em; overflow: hidden; }
.dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.auth-links { display: flex; justify-content: flex-end; align-items: center; gap: 8px; font-size: 13px; }
.auth-links .btn { padding: 4px 8px; color: var(--muted); white-space: nowrap; }
.auth-error:empty { margin: 0; }
.verdict { margin: 8px 0; padding: 8px 12px; background: var(--panel-2); border-radius: var(--radius); }
.verdict.ng { border-left: 2px solid var(--duel); }
.verdict ul { margin: 4px 0 0; padding-inline-start: 16px; }
.offer { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.offer { position: relative; display: flex; align-items: center; }
.offer label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.offer input { margin-top: 4px; }
.confirm-item { background: var(--panel-2); padding: 12px; border-radius: var(--radius); margin: 8px 0; }
.confirm-item dt { font-size: 13px; color: var(--muted); }
.confirm-item dd { margin: 0 0 8px; }

/* ---- トースト ---- */
.toasts:empty { display: none; }
.toasts { position: fixed; left: 50%; bottom: calc(var(--tab-height) + 12px); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(30rem, calc(100% - 24px)); pointer-events: none; }
body:has(#modal-root > .overlay) .toasts { top: calc(env(safe-area-inset-top) + 12px); bottom: auto; }
.toast { background: var(--panel); color: var(--ink); border: 1px solid var(--line); padding: 8px 12px; border-radius: var(--radius); font-size: 13px; }
.toast.error { border-left: 2px solid var(--duel); }
.toast a { margin-inline-start: 4px; pointer-events: auto; }

/* ---- 遊ぶ・持ち物 ---- */
.section-title { margin: 24px 0 8px; }
main h1.section-title { margin-top: 0; }
.games { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.game-tile {
  display: grid; justify-items: center; gap: 4px; padding: 0 0 12px; overflow: hidden;
  background: var(--tile-sky, var(--panel)); border-color: var(--line); font: 400 22px/1.35 var(--font-brush);
}
.game-tile .line-icon {
  width: 100%; height: 112px; stroke: var(--tile-line, var(--accent)); stroke-width: 3.5;
}
.game-tile path:nth-child(1) { fill: var(--tile-scene); stroke: none; }
.game-tile path:nth-child(2) { fill: var(--tile-light); stroke: none; }
.game-tile path:nth-child(3) { fill: var(--tile-dark); stroke: none; }
.game-tile[data-game="kenseki"] {
  --tile-sky: #253451; --tile-scene: #313f5d; --tile-light: #aabed8; --tile-dark: #8198ba; --tile-line: #e5cf9f;
}
.game-tile[data-game="hayauchi"] {
  --tile-sky: #713f42; --tile-scene: #9a5d40; --tile-light: #eeba77; --tile-dark: #533831; --tile-line: #f1d7ad;
}
.game-tile[data-game="dungeon"] {
  --tile-sky: #343435; --tile-scene: #494744; --tile-light: #797570; --tile-dark: #242325; --tile-line: #b7aea0;
}
.game-tile[data-game="kite"] {
  --tile-sky: #30576b; --tile-scene: #416676; --tile-light: #c1d9dd; --tile-dark: #d9a86f; --tile-line: #e1e7d7;
}
.game-play:empty { display: none; }
.game-play, .game-ranking { margin-block: 12px; }
.game-play h3 { margin: 0; font-size: 15px; }
.game-play .btn, .game-start, .duel-send { min-height: 52px; }
.game-ranking > div { padding: 8px 0; }
.game-ranking ol { margin: 8px 0; }
.opponents { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.opponents .btn { font: 400 17px/1.35 var(--font-brush); }
@media (max-width: 400px) { .games { grid-template-columns: 1fr; } }
.stats { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.stats th, .stats td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.stats th { color: var(--muted); font-weight: 400; }
.items { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.items > li { border-bottom: 1px solid var(--line); padding: 12px 4px; }
.items .iname { font-weight: 700; }
.items .qty { color: var(--muted); margin-inline-start: 4px; }
.me-stats {
  position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px; margin: 12px 0; text-align: center; font-variant-numeric: tabular-nums;
}
.me-stats > div { display: grid; align-content: start; }
.me-stats dt { display: flex; align-items: center; justify-content: center; min-height: 32px; font-size: 13px; color: var(--muted); }
.me-stats dd { grid-row: 1; margin: 0; font-size: 22px; line-height: 1.35; }
.me-stats dd > span { display: inline-block; }
.me-stats dd > span + span { margin-inline-start: 4px; }
.me-stats dd small { font-size: 13px; }
.me-stats .help > summary { width: 24px; min-height: 32px; }
.me-stats .help > div { text-align: start; }
.me-actions > li { padding: 0; }
.row-action {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 44px; padding: 8px 4px; background: none; border: 0;
  color: inherit; text-align: start; text-decoration: none; cursor: pointer;
}
.row-action:is(:hover, :active) { background: var(--panel); }
.refusals { padding-inline: 4px; }
.refusals > summary { min-height: 44px; padding: 8px 0; color: var(--muted); cursor: pointer; }
.switch {
  appearance: none; display: grid; align-items: center; flex: none; margin: 0;
  width: 42px; height: 24px; padding: 2px; background: var(--panel-2);
  border: 1px solid var(--muted); border-radius: 999px; cursor: pointer;
}
.switch::before { content: ""; width: 16px; height: 16px; background: var(--muted); border-radius: 999px; }
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::before { background: var(--bg); justify-self: end; }
.switch:disabled { opacity: .55; cursor: wait; }

/* ---- 決闘・手合わせの画面 ---- */
body.in-match { overflow: hidden; }
.match {
  --font-match: "Hiragino Mincho ProN", "Yu Mincho", serif;
  position: fixed; inset: 0; z-index: 30; display: grid; grid-template-rows: auto 1fr auto;
  background: #0f0c0a; color: #f1e6d4; font: 15px/1.7 var(--font-body); color-scheme: dark;
}
.match .small { font-size: .85rem; }
.match :focus-visible { outline-color: #e3a53b; }
.match .top {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: .3rem; align-items: center;
  padding: env(safe-area-inset-top) max(.35rem, env(safe-area-inset-right)) 0 max(.35rem, env(safe-area-inset-left));
  background: var(--bg); color: var(--ink); border-bottom: 1px solid var(--line);
}
.match-title {
  margin: 0; text-align: center; font: 400 clamp(15px, 4vw, 22px)/1.35 var(--font-brush);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.match-title span + span { margin-inline-start: .4em; }
.stage { position: relative; overflow: hidden; touch-action: manipulation; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage .center-msg { position: absolute; left: 0; right: 0; top: 42%; text-align: center; font-family: var(--font-brush); font-size: clamp(2rem, 10vw, 4.5rem); pointer-events: none; background: rgb(0 0 0 / .65); }
.match .bottom { padding: .7rem .8rem calc(.9rem + env(safe-area-inset-bottom)); }
.match .bottom:has(> .result-panel) { background: var(--bg); color: var(--ink); }
.hud { display: flex; justify-content: space-between; gap: .6rem; font-size: .85rem; align-items: center; }
.pips { display: inline-flex; gap: 3px; vertical-align: middle; }
.pip { width: .8rem; height: .8rem; border-radius: 2px; background: #3b302a; }
.pip.hp { background: #d6493a; }
.pip.ki { background: #e8b54a; border-radius: 50%; }
.timer { height: 4px; background: #3b302a; margin: .5rem 0; overflow: hidden; }
.timer i { display: block; height: 100%; background: #e8b54a; transform-origin: left; }
.actions5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.actions5 button {
  font-family: var(--font-match); font-size: 1.7rem; line-height: 1; padding: .7rem 0 .55rem;
  background: #241c17; color: #f6ead6; border: 1px solid #5a4636; border-radius: 4px; cursor: pointer;
  display: grid; gap: .25rem;
}
.actions5 button small { font-family: var(--font-body); font-size: .65rem; color: #b9a58c; }
.actions5 button:disabled { opacity: .3; cursor: not-allowed; }
.actions5 button.picked, .actions5 button.picked:disabled { background: #e8b54a; color: #1a120c; border-color: #e8b54a; opacity: 1; }
.actions5 button.picked small { color: #3a2a1a; }
.actions5 button:active:not(:disabled) { transform: translateY(1px); }
.waiting { text-align: center; font-size: .85rem; color: #b9a58c; min-height: 1.4em; }
.cheers { position: absolute; right: .6rem; bottom: .6rem; display: flex; gap: .3rem; }
.cheers button { background: rgba(0,0,0,.45); color: #f1e6d4; border: 1px solid #4a3d33; border-radius: 999px; padding: .2rem .7rem; cursor: pointer; font-size: .8rem; }
.floaty { position: absolute; font-family: var(--font-match); color: #ffe2a0; pointer-events: none; animation: floaty 1.6s ease-out forwards; }
@keyframes floaty { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-80px); } }
.result-panel { text-align: center; padding: .4rem 0; display: grid; gap: .6rem; justify-items: center; }
.result-panel .big { font-family: var(--font-brush); font-size: 2.6rem; line-height: 1.1; }
.result-panel .big.win { color: var(--yamabuki); }
.result-panel .big.loss { color: var(--usuzumi); }
.result-panel h2 { margin: 0; }
.result-panel .body { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.result-panel .reward { background: #2d241c; border: 1px solid #e8b54a; padding: .5rem .8rem; border-radius: 4px; font-size: .9rem; }
.shoot-hint { text-align: center; color: #b9a58c; font-size: .85rem; }

.noscript { padding: 2rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .btn:active:not(:disabled), .actions5 button:active:not(:disabled) { transform: none; }
}

/* ---- 灰の迷宮 ---- */
.dg-hud { position: absolute; left: .6rem; right: .6rem; top: .5rem; pointer-events: none; font-size: .85rem; display: grid; gap: .3rem; }
.dg-line { font-variant-numeric: tabular-nums; }
.dg-hp { position: relative; height: 15px; background: #3b2a24; border: 1px solid #5a4636; border-radius: 2px; overflow: hidden; max-width: 18rem; }
.dg-hp i { position: absolute; inset: 0 auto 0 0; background: var(--duel); }
.dg-hp span { position: relative; font-size: .72rem; line-height: 15px; padding-left: .4rem; color: #fff; }
.dg-banner { font-family: var(--font-match); font-size: 1.1rem; color: #ffe2a0; }
.dg-equip { min-height: 1.4em; font-size: .82rem; color: #e8d7bb; margin-top: .25rem; }
.dg-pad { position: absolute; right: .6rem; bottom: .6rem; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; gap: .45rem; align-items: end; }
.dg-btn { border-radius: 50%; border: 2px solid #8a6b4a; background: rgba(36, 28, 23, .75); color: #f6ead6; font-family: var(--font-match); touch-action: none; user-select: none; -webkit-user-select: none; }
.dg-btn.small { width: 3.4rem; height: 3.4rem; font-size: .95rem; }
.dg-btn.big { width: 5rem; height: 5rem; font-size: 1.35rem; grid-row: 1 / 3; grid-column: 2; background: rgba(168, 35, 27, .8); border-color: #e0796a; }
.dg-pad .dg-btn.small:first-child { grid-column: 1; grid-row: 1; }
@media (pointer: fine) { .dg-pad { display: none; } }
.dg-spec { position: absolute; inset: 3rem .6rem auto .6rem; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.dg-card { background: rgba(30, 24, 20, .85); border: 1px solid #4a3d33; border-radius: 4px; padding: .7rem; display: grid; gap: .35rem; font-size: .85rem; }
.dg-floor { font-family: var(--font-match); font-size: 2.4rem; line-height: 1; }
.dg-log { grid-column: 1 / -1; font-size: .85rem; color: #e8d7bb; }
ol.weekly { margin: .3rem 0 0; padding-left: 1.6rem; font-variant-numeric: tabular-nums; }
ol.weekly li.mine { font-weight: 700; }
.products .body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.shop-links { position: relative; margin: 12px 0; }
.shop-heading { gap: 0 4px; margin-bottom: 4px; }
.shop-heading .btn, .shop-tabs .btn { padding: 4px 8px; }
.shop-heading .help > summary { width: 32px; }
.shop-heading .help ul { margin: 4px 0 0; padding-inline-start: 24px; }
.shop-filters { justify-content: space-between; margin-bottom: 8px; }
.shop-filters select { width: auto; max-width: 100%; font-size: 13px; }
.shop-tabs { gap: 0; }
.shop-tabs .btn { font-size: 13px; }
.price, .coin-balance { color: var(--yamabuki); font-variant-numeric: tabular-nums; }
.coin-balance { font-weight: 700; white-space: nowrap; }
.game-tag { display: inline-block; padding: 0 4px; border: 1px solid var(--line); border-radius: 999px; font: 400 13px/1.6 var(--font-body); color: var(--muted); white-space: nowrap; }
.products > li { display: grid; gap: 4px; }
.products > .product {
  grid-template-columns: minmax(0, 1fr) auto; gap: 0;
  align-items: start; padding: 0;
}
.product:has(summary:is(:hover, :focus-visible)) { background: var(--panel); }
.product-details > summary {
  display: flex; align-items: center; flex-wrap: wrap; align-content: center; gap: 4px;
  min-height: 44px; padding: 4px; cursor: pointer; list-style: none;
}
.product-details > summary::-webkit-details-marker { display: none; }
.product-details > summary::before {
  content: ""; width: 4px; height: 4px; border: solid var(--muted); border-width: 0 1px 1px 0;
  transform: rotate(-45deg); margin-inline: 4px; flex: none;
}
.product-details[open] > summary::before { transform: rotate(45deg); }
.product-info { display: grid; justify-items: start; gap: 4px; padding: 4px 4px 12px 16px; font-size: 13px; }
.product-swatches { display: inline-flex; gap: 4px; }
.product-swatches .swatch { gap: 4px; margin: 0; }
.product-swatches .swatch i { width: 8px; height: 8px; }
.product > :last-child { white-space: nowrap; }
.product > .btn.price { padding: 4px 8px; font-size: 13px; color: var(--yamabuki); }
.product > .muted { padding: 12px 8px; }
.admin-page > section, .shop-page .listing-form { margin-block: 16px; }
.skin-preview { display: block; width: 180px; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.listing-form { max-width: 32rem; }
.listing-form .skin-preview { margin-bottom: 12px; }
.sprite-editor, .sprite-state-fields { min-width: 0; }
.sprite-editor { margin-bottom: 12px; }
.sprite-editor input[type="file"] { max-width: 100%; }
.sprite-editor fieldset { border: 0; margin: 0 0 .5rem; padding: 0; }
.sprite-state { padding: 8px 0; }
.sprite-state-fields input[type="number"] { width: 4rem; margin-left: .25rem; }
.sprite-editor .btn[aria-pressed="true"] { outline: 2px solid currentColor; outline-offset: -2px; }
.sprite-sheet-diagram { display: grid; grid-template-columns: minmax(5em, auto) repeat(var(--frames), minmax(0, 1fr)); gap: .2rem; max-width: 32rem; align-items: center; font-size: .85rem; }
.sprite-sheet-cell { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--line); }
.listing-colors input[type="text"] { box-sizing: content-box; width: 9ch; }
.skin-choices { align-items: stretch; }
.skin-choices .btn { display: grid; justify-items: center; align-content: start; gap: 4px; }
.skin-choices .skin-preview { width: 108px; }
.skin-choices .btn[aria-pressed="true"] { outline: 2px solid currentColor; outline-offset: -2px; }
.match-preparation { max-height: 65dvh; overflow: auto; }
.swatch { display: inline-flex; gap: 2px; margin-right: .35rem; vertical-align: middle; }
.swatch i { width: .8rem; height: .8rem; border-radius: 2px; border: 1px solid rgba(0,0,0,.3); }

/* ---- タイムライン・呟き・公開プロフィール ---- */
.feed-view { display: grid; gap: 12px; }
.home-card {
  display: grid; gap: 8px; padding: 12px 4px;
  border-block: 1px solid var(--line);
}
.home-card :is(h2, p, ol) { margin: 0; }
.home-card h2 { font: 400 18px/1.35 var(--font-brush); }
.home-card ol { padding-inline-start: 24px; overflow-wrap: anywhere; }
.note-compose p { margin: 0; }
.feed-banner { width: 100%; }
.health-banner { margin-top: 0; padding: 12px; border-radius: var(--radius); background: #a8231b; color: #fff; }
.feed-view .health-banner { margin-bottom: 0; }
.feed-more { justify-self: center; }
.feed-item { padding-inline: 4px; }
.feed-item .meta { flex-wrap: nowrap; }
.feed-body { padding-inline-start: 2.15rem; }
.feed-context { overflow-wrap: anywhere; }
.feed-context a { color: inherit; }
.feed-attribution { overflow-wrap: anywhere; color: var(--muted); font-size: 13px; }
.feed-attribution a { color: inherit; text-decoration: none; }
.feed-attribution a:hover { text-decoration: underline; }
.feed-item .acts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.feed-item .acts .act {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 32px; min-height: 32px;
  padding: 4px; border-color: transparent; border-radius: var(--radius); text-decoration: none;
}
.feed-item .acts .line-icon { width: 16px; height: 16px; }
.public-profile > div, .profile-actions { display: grid; gap: 8px; }
.public-profile-name .profile-avatar { width: 3.5rem; height: 3.5rem; font-size: 1.4rem; }
.public-profile-name h1 { margin: 0; overflow-wrap: anywhere; }
.public-profile-name .muted { font-size: 13px; }
.profile-bio { white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-actions .row-action { border-bottom: 1px solid var(--line); }
.search-results { gap: 0; margin-block: 12px; }
.search-results:not(:empty) { border-top: 1px solid var(--line); }
.search-row { border-bottom: 1px solid var(--line); }
.search-row > .author-link { display: flex; min-height: 44px; padding: 8px 4px; }
.search-row > .author-link:hover { background: var(--panel); }

/* ---- 画像 ---- */
.picker { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.previews { display: flex; gap: .4rem; flex-wrap: wrap; }
.preview { position: relative; width: 64px; height: 64px; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; display: grid; place-items: center; font-size: .7rem; color: var(--muted); }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview .rm { position: absolute; top: 0; right: 0; background: rgba(0,0,0,.6); color: #fff; border: none; width: 20px; height: 20px; cursor: pointer; }
.imgs { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.imgbtn { position: relative; padding: 0; border: 1px solid var(--line); background: var(--panel-2); cursor: zoom-in; border-radius: var(--radius); overflow: hidden; max-width: min(360px, 100%); }
.imgbtn img { display: block; max-width: 100%; height: auto; max-height: 280px; object-fit: contain; }
img.blur { filter: blur(22px) saturate(.6); }
.imgbtn .veil { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 13px; background: rgba(0,0,0,.5); }
.dialog img.full { width: 100%; height: auto; display: block; }
.radios { display: grid; gap: .4rem; margin: .5rem 0 .8rem; }
.radio { display: flex; gap: .5rem; align-items: flex-start; font-size: .92rem; }
.adult-gate { display: grid; gap: .8rem; }
.adult-gate ul { margin: 0; }
.post.hidden .body, .post.removed .body { color: var(--muted); }

/* ---- 通知 ---- */
#notifications-badge {
  position: absolute; top: 9px; right: 9px; width: 8px; height: 8px;
  border-radius: 999px; background: var(--accent);
}
.notification {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.notification.unread, .notification:active { background: var(--panel); }
.notification-heading { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.feed-view:has(> .notification) { gap: 0; border-top: 1px solid var(--line); }
.notification .feed-item { margin-top: 8px; border-bottom: 0; }
