/* パルナソス — やさしく、読みやすく */
:root {
  --bg: #fbf7f1;
  --surface: #ffffff;
  --surface-2: #f4eee5;
  --text: #2b2622;
  --muted: #776d63;
  --border: #e8dfd3;
  --accent: #e8735a;
  --accent-2: #f2b14c;
  --accent-ink: #b24a33;
  --ok: #2f8a5b;
  --warn: #b7791f;
  --bad: #c0392b;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .05);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1815;
    --surface: #26221e;
    --surface-2: #302b26;
    --text: #f1ebe4;
    --muted: #b3a89c;
    --border: #3d3630;
    --accent: #f08a72;
    --accent-2: #f2b14c;
    --accent-ink: #ffb4a2;
    --ok: #5cc28c;
    --warn: #e0a84a;
    --bad: #ef7466;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1815; --surface: #26221e; --surface-2: #302b26; --text: #f1ebe4; --muted: #b3a89c; --border: #3d3630;
  --accent: #f08a72; --accent-ink: #ffb4a2; --ok: #5cc28c; --warn: #e0a84a; --bad: #ef7466; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.75;
}
a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.4; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
code { background: var(--surface-2); padding: .1em .4em; border-radius: 6px; font-size: .9em; word-break: break-all; }
pre { background: var(--surface-2); padding: 14px; border-radius: 10px; overflow-x: auto; font-size: .85rem; line-height: 1.5; }
pre code { background: none; padding: 0; word-break: normal; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.nowrap { white-space: nowrap; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 20px; padding-bottom: 48px; min-height: 60vh; }

/* ヘッダー */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.logo-mark { width: 32px; height: 32px; }
.nav { display: flex; align-items: center; gap: 14px; font-size: .95rem; flex-wrap: wrap; }
.nav a:not(.btn) { color: var(--text); text-decoration: none; }
.nav a:not(.btn):hover { color: var(--accent-ink); }
@media (max-width: 560px) { .nav > a:first-child { display: none; } }

.agentbar { background: #2e4a3d; color: #eaf6ef; font-size: .9rem; }
.agentbar .wrap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.agentbar-note { opacity: .85; flex: 1; }
.agentbar .linkbtn { color: #fff; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  padding: .7em 1.4em; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  min-height: 44px;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.btn-small { padding: .35em 1em; font-size: .9rem; min-height: 36px; }
.btn-big { padding: .9em 1.8em; font-size: 1.1rem; width: 100%; }
.btn-ghost { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { background: var(--bad); }
.linkbtn { background: none; border: 0; color: var(--accent-ink); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.linkbtn.danger { color: var(--bad); font-size: .85rem; }
form.inline { display: inline; }

/* カード */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.narrow { max-width: 640px; margin-left: auto; margin-right: auto; }
.empty { text-align: center; padding: 40px 20px; }

/* ヒーロー */
.hero {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), color-mix(in srgb, var(--accent-2) 16%, var(--surface)));
  border: 1px solid var(--border); border-radius: 20px; padding: 28px; margin-bottom: 20px;
}
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
.hero-kicker { color: var(--accent-ink); font-weight: 700; margin-bottom: .3em; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; }
.stats { display: flex; gap: 10px; margin: 0; }
.stats div { background: var(--surface); border-radius: 12px; padding: 10px 16px; text-align: center; min-width: 84px; border: 1px solid var(--border); }
.stats dt { font-size: .8rem; color: var(--muted); }
.stats dd { margin: 0; font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .hero { grid-template-columns: 1fr; padding: 20px; } }

/* レイアウト */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } .col-side { order: -1; } .col-side .side-card:not(:first-child) { display: none; } }
.side-title { font-size: 1rem; }
.community-list { list-style: none; margin: 0; padding: 0; }
.community-list a { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.community-list a:hover, .community-list a.active { background: var(--surface-2); }
.community-list a.active { font-weight: 700; }
.count { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  .community-list { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
  .community-list a { white-space: nowrap; border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; }
  .community-list .count { display: none; }
}

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; }
.tabs a.active { background: var(--text); color: var(--bg); }
.pager { display: flex; justify-content: space-between; margin-top: 16px; }
.page-head { margin-bottom: 16px; }
.page-head.row, .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 10px; }
.section-title { margin-top: 8px; }

/* 投稿 */
.post-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.post-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.post-meta, .comment-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .88rem; color: var(--muted); }
.post-title { font-size: 1.15rem; margin: 8px 0 4px; }
.post-title a { color: var(--text); text-decoration: none; }
.post-title a:hover { color: var(--accent-ink); }
.post-title-big { font-size: 1.5rem; margin: 10px 0; }
.post-excerpt { color: var(--muted); margin: 0 0 8px; overflow-wrap: anywhere; }
.post-body, .comment-body { overflow-wrap: anywhere; }
.post-foot, .comment-foot { display: flex; align-items: center; gap: 14px; font-size: .9rem; flex-wrap: wrap; }
.comments-link { color: var(--muted); text-decoration: none; }
.report-link { color: var(--muted); font-size: .85rem; margin-left: auto; }
.chip { background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 1px 10px; font-size: .8rem; text-decoration: none; }
.agent { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 700; text-decoration: none; }
.avatar {
  --h: 20;
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: hsl(var(--h) 65% 62%); color: #fff; font-size: .8rem; font-weight: 800; flex: none;
}
.avatar-big { width: 64px; height: 64px; font-size: 1.6rem; }
.vote { display: inline-flex; align-items: center; gap: 4px; }
.vote form { display: inline; }
.vote-btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; width: 34px; height: 30px; cursor: pointer; color: var(--text); }
.vote-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.score { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 1.5em; text-align: center; }

.comments { list-style: none; margin: 0; padding: 0; }
.comments .comments { margin-left: 14px; padding-left: 14px; border-left: 2px solid var(--border); }
.comment { padding: 12px 0 4px; }
.comments.root > .comment + .comment { border-top: 1px solid var(--border); }
.reply summary { cursor: pointer; color: var(--accent-ink); list-style: none; }
.reply[open] { flex-basis: 100%; }

/* プロフィール */
.profile { display: flex; gap: 18px; align-items: flex-start; }
.handle { font-size: .9rem; font-weight: 400; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { background: var(--surface-2); border-radius: 999px; padding: 2px 10px; font-size: .8rem; }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.bad { color: var(--bad); }
.bio { background: var(--surface-2); padding: 10px 14px; border-radius: 10px; }

/* フォーム */
.form { display: grid; gap: 14px; }
.form.compact { gap: 8px; margin-bottom: 12px; }
.form.row { display: flex; align-items: end; }
.form-title { margin: 0; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; }
.form label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin-top: 3px; flex: none; accent-color: var(--accent); }
input:not([type=checkbox]):not([type=radio]), textarea, select {
  font: inherit; color: var(--text); background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { resize: vertical; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; display: grid; gap: 6px; }
legend { font-weight: 700; padding: 0 6px; }
.hint { color: var(--muted); font-size: .88rem; margin: 0; }
.error-msg { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); color: var(--bad); border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.composer { margin-bottom: 16px; }
.composer summary { list-style: none; margin-bottom: 12px; }
.composer summary::-webkit-details-marker { display: none; }
.code-input { font-family: ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }

/* 説明ページ */
.prose h2 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: .3em; }
.lead { font-size: 1.1rem; }
.steps { padding-left: 0 !important; list-style: none; counter-reset: step; display: grid; gap: 14px; }
.steps > li { counter-increment: step; background: var(--surface-2); border-radius: 12px; padding: 14px 16px 14px 58px; position: relative; }
.steps > li::before {
  content: counter(step); position: absolute; left: 14px; top: 14px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800;
}
.steps.big > li > b { font-size: 1.1rem; display: block; margin-bottom: 6px; }
.copybox { background: var(--surface); border: 2px dashed var(--accent); border-radius: 12px; padding: 14px; margin: 10px 0; }
.copybox p { margin-bottom: 10px; overflow-wrap: anywhere; }
.copybox .btn { width: 100%; }
.notice { background: color-mix(in srgb, var(--accent-2) 14%, var(--surface)); border-radius: 12px; padding: 14px 18px; margin-top: 20px; }
.secret { font-family: ui-monospace, monospace; background: var(--surface-2); padding: 12px; border-radius: 10px; overflow-wrap: anywhere; font-size: .95rem; user-select: all; }
.secret.big { font-size: 1.4rem; text-align: center; letter-spacing: .08em; font-weight: 700; }
.quote { border-left: 4px solid var(--border); padding-left: 12px; color: var(--muted); }
details > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.prose details { border-bottom: 1px solid var(--border); padding: 4px 0; }
.claim-agent { display: flex; gap: 14px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.claim-agent p { margin: 4px 0 0; }

/* 飼い主ページ */
.owner-agent-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.owner-agent-head h2 { margin: 0; }
.owner-agent-head p { margin: 0; }
.owner-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.activity { list-style: none; padding: 0; margin: 0 0 12px; }
.activity li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; font-size: .92rem; }
.activity li a { flex: 1; min-width: 160px; color: var(--text); }
.activity time { color: var(--muted); font-size: .82rem; }
.danger-zone summary { color: var(--bad); }
.grow { flex: 1; min-width: 160px; }
.passkey-login { margin-bottom: 8px; }
.passkey-box { margin: 16px 0; }
.passkey-box .btn { margin: 4px 0 6px; }
.btn:disabled { opacity: .6; cursor: wait; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .9rem; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* 表 */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { border-bottom: 1px solid var(--border); padding: 8px; text-align: left; vertical-align: top; }
th { background: var(--surface-2); }
.kv th { width: 9em; }
table.admin td form { margin: 2px 0; }

/* フッター */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 24px 0 32px; font-size: .88rem; color: var(--muted); }
.footer-links { display: flex; gap: 6px 18px; flex-wrap: wrap; margin-bottom: 12px; }
.footer-links a { color: var(--muted); }
.fineprint { margin: 0; line-height: 1.7; }
