:root {
  --bg: #f6f7f9;
  --surface: #fff;
  --text: #1a1d21;
  --muted: #5f6b7a;
  --line: #dfe3e8;
  --accent: #111;
  --accent-text: #fff;
  --ok-bg: #e7f6ec;
  --ok-text: #14532d;
  --err-bg: #fdecec;
  --err-text: #7f1d1d;
  --warn-bg: #fff4d6;
  --warn-text: #6b4a00;
  --info-bg: #f0f2f5;
  --info-text: #5f6b7a;
  --stop-bg: #ffd60a;
  --stop-text: #000;
  --danger: #b42318;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", Roboto, sans-serif;
  line-height: 1.65;
  overflow-wrap: anywhere; /* 長い日本語・ユーザー名・URL は折り返す */
  word-break: normal;
  -webkit-text-size-adjust: 100%;
}
img { max-width: 100%; height: auto; }
a { color: #0b57d0; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 28px; padding-bottom: 56px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; min-height: 56px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: .01em; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; flex: 1; }
.nav a { color: var(--text); text-decoration: none; font-size: .92rem; padding: 4px 0; }
.nav a:hover { text-decoration: underline; }
.lang { margin-left: auto; font-size: .85rem; display: flex; gap: 10px; }
.lang a { color: var(--muted); text-decoration: none; }
.lang a[aria-current] { color: var(--text); font-weight: 700; }
form.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; padding: 4px 0; font: inherit; font-size: .92rem; color: var(--text); cursor: pointer; }
button.link:hover { text-decoration: underline; }

.banner { padding: 10px 0; font-size: .92rem; }
.banner.stop { background: var(--stop-bg); color: var(--stop-text); font-weight: 700; border-top: 2px solid var(--stop-text); border-bottom: 2px solid var(--stop-text); padding: 14px 0; font-size: 1.05rem; }
.banner.info { background: var(--info-bg); color: var(--info-text); border-bottom: 1px solid var(--line); }
.banner.info.exhausted { background: var(--err-bg); color: var(--err-text); border-bottom-color: var(--err-text); font-weight: 600; }

.flash { padding: 14px 16px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid transparent; font-weight: 600; }
.flash.success { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-text); }
.flash.error { background: var(--err-bg); color: var(--err-text); border-color: var(--err-text); }

h1 { font-size: 1.75rem; line-height: 1.3; margin: 0 0 16px; }
h2 { font-size: 1.15rem; margin: 28px 0 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; margin-bottom: 20px; }
.card h2:first-child { margin-top: 0; }
.hero { padding: 32px 0 20px; }
.hero .lead { font-size: 1.1rem; color: #2d343c; max-width: 44em; }
.note { color: var(--muted); font-size: .9rem; }
ul, ol { padding-left: 1.4em; }
li { margin: 4px 0; }

.button, button.primary {
  display: inline-block; min-height: 48px; padding: 12px 24px; border-radius: 8px; border: 2px solid var(--accent);
  background: var(--accent); color: var(--accent-text); font: inherit; font-size: 1.05rem; font-weight: 700; line-height: 1.3;
  text-align: center; text-decoration: none; cursor: pointer; max-width: 100%;
}
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid #0b57d0; outline-offset: 2px; }
.button:hover, button.primary:hover { opacity: .88; }
.button.secondary { background: var(--surface); color: var(--accent); }
.button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.card .button, .card button.primary { margin: 4px 0; }

input[type=text], input[type=search], input[type=number], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 8px; font: inherit; font-size: 1rem; background: var(--surface); color: var(--text);
}
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-weight: 600; margin: 14px 0 4px; }
.counter { font-size: .85rem; color: var(--muted); text-align: right; }
.counter.over { color: var(--danger); font-weight: 700; }

table { width: 100%; border-collapse: collapse; background: var(--surface); table-layout: fixed; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 18px 0; font-size: .85rem; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.site-footer a { color: var(--muted); }

@media (max-width: 600px) {
  .card { padding: 16px; }
  h1 { font-size: 1.4rem; }
  .bar { gap: 8px 16px; padding-top: 8px; padding-bottom: 8px; }
  .brand { flex: 1 1 auto; }
  .lang { order: 2; }
  .nav { order: 3; flex: 1 1 100%; gap: 2px 14px; }
  .nav a, button.link { padding: 8px 0; }
  /* 表は横にはみ出させず、行ごとに縦に積む */
  table, thead, tbody, tr, th, td { display: block; width: 100%; }
  thead { position: absolute; left: -9999px; }
  tr { border-bottom: 2px solid var(--line); padding: 6px 0; }
  td { border-bottom: 0; padding: 4px 0; }
  /* ボタンは画面幅いっぱい（指でもカーソルでも当てやすい） */
  .card form .button, .card form button.primary, .card > .button { display: block; width: 100%; }
  form.inline { display: block; }
  form.inline .button { width: 100%; }
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214; --surface: #1a1d21; --text: #eceff3; --muted: #9aa5b1; --line: #2c3238;
    --accent: #eceff3; --accent-text: #101214;
    --info-bg: #1a1d21; --info-text: #9aa5b1;
    --ok-bg: #12301f; --ok-text: #b7ebc9; --err-bg: #3a1616; --err-text: #f7c4c4; --warn-bg: #3a2e0c; --warn-text: #f3dca0;
  }
  a { color: #8ab4f8; }
  .hero .lead { color: #cfd6de; }
  .counter.over { color: #ff8a80; }
}
.avatar { border-radius: 50%; }
.card.danger { border-color: #b42318; }
.form-error { background: var(--err-bg); color: var(--err-text); padding: 10px 14px; border-radius: 8px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 0; }
.post-media { max-width: 100%; height: auto; border-radius: 8px; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; flex: none; }
dl dt { font-weight: 600; margin-top: 8px; }
dl dd { margin: 0; }
