:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #656d76;
  --border: #d8dbe0;
  --accent: #0b6bcb;
  --danger: #c62828;
  --notice-bg: #fff4d6;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1e2125;
    --text: #e6e8eb;
    --muted: #9aa3ad;
    --border: #353a41;
    --accent: #6cb2ff;
    --danger: #ff7b72;
    --notice-bg: #4a3b10;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  line-height: 1.75;
}
a { color: var(--accent); }
.container { max-width: 860px; margin: 0 auto; padding: 0 16px; }
main.container { padding-top: 24px; padding-bottom: 48px; min-height: 70vh; }
h1 { font-size: 1.7rem; line-height: 1.3; margin: 0.4em 0; }
h2 { font-size: 1.2rem; margin-top: 2em; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.env-banner {
  background: #b45309; color: #fff; text-align: center;
  font-size: 0.85rem; padding: 4px 8px; font-weight: 600;
}
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 4px 16px; padding-top: 10px; padding-bottom: 10px;
}
.site-name { font-weight: 700; color: var(--text); text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-size: 0.95rem; }
.site-footer { border-top: 1px solid var(--border); padding: 16px 0; color: var(--muted); font-size: 0.85rem; }

.profile { display: flex; align-items: center; gap: 20px; margin: 16px 0; }
.avatar { border-radius: 50%; object-fit: cover; flex: none; }
.tagline { margin: 0; color: var(--muted); }

.sns-list { list-style: none; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.sns-list li {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; display: flex; flex-direction: column; overflow-wrap: anywhere;
}
.sns-service { font-size: 0.8rem; color: var(--muted); }

.item-list { list-style: none; padding: 0; }
.item-list li { display: flex; gap: 16px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.item-list time { color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }

.card-list { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; }
.card p { margin: 6px 0; font-size: 0.92rem; }
.card-title { font-weight: 600; }

.markdown { overflow-wrap: anywhere; }
.markdown img { max-width: 100%; height: auto; }
.markdown pre { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 12px; overflow-x: auto; }
.markdown code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; }
.markdown blockquote { margin: 1em 0; padding-left: 12px; border-left: 4px solid var(--border); color: var(--muted); }
.markdown table { display: block; overflow-x: auto; }

.notice { background: var(--notice-bg); border-radius: 6px; padding: 8px 12px; }
.error { color: var(--danger); border: 1px solid var(--danger); border-radius: 6px; padding: 8px 12px; }

/* スライドビューア */
.viewer { margin: 16px 0; background: #111; border-radius: 8px; overflow: hidden; }
.viewer-stage { height: min(62vh, 56vw); min-height: 220px; display: flex; align-items: center; justify-content: center; }
.viewer:fullscreen { border-radius: 0; display: flex; flex-direction: column; }
.viewer:fullscreen .viewer-stage { flex: 1; height: auto; }
.viewer canvas { cursor: pointer; background: #fff; }
.viewer-controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 12px; padding: 8px; background: #222; color: #eee; font-size: 0.9rem;
}
.viewer-controls button { background: #3a3a3a; color: #eee; border-color: #555; }
.office-frame { width: 100%; height: min(62vh, 62vw); min-height: 260px; border: 0; display: block; background: #fff; }
.viewer p { color: #ddd; padding: 0 12px; }

/* フォーム・テーブル (主に管理画面) */
label, .label { display: block; margin: 14px 0 4px; font-size: 0.9rem; font-weight: 600; }
input[type="text"], input[type="url"], input[type="date"], input[type="file"], textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; font-weight: 400;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
}
textarea { font-family: ui-monospace, Consolas, monospace; font-size: 0.9rem; line-height: 1.5; resize: vertical; }
label.checkbox { font-weight: 400; display: flex; gap: 8px; align-items: baseline; }
button, .button {
  display: inline-block; font: inherit; font-size: 0.9rem; padding: 6px 14px; cursor: pointer;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; text-decoration: none;
}
button[type="submit"]:not(.danger):not(.link-button), .button { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) {
  button[type="submit"]:not(.danger):not(.link-button), .button { color: #0b1220; }
}
button.danger { color: var(--danger); border-color: var(--danger); }
.link-button { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; }
form.inline { display: inline; }
.actions { display: flex; align-items: center; gap: 16px; margin-top: 20px; }
.danger-zone { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border); }
.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.preview { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 4px 14px; min-height: 120px; }
@media (max-width: 720px) { .editor { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.row-actions { white-space: nowrap; }
.row-actions form + form { margin-left: 6px; }
.sns-table input { margin-top: 0; }
main { overflow-x: auto; }
