/* Kako OP responsive index — shared stylesheet */
:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #181b1e;
  --panel-2: #1d2125;
  --text: #d7dadd;
  --muted: #9ca3aa;
  --border: #343a40;
  --link: #c8d8e8;
  --link-visited: #c8b8d8;
  --hover: #252b30;
  --focus: #73879a;
  --shadow: 0 2px 12px rgba(0,0,0,.18);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eceff1;
  --panel: #f7f8f9;
  --panel-2: #ffffff;
  --text: #26292c;
  --muted: #666d73;
  --border: #cdd2d6;
  --link: #253f59;
  --link-visited: #654b70;
  --hover: #e8ecef;
  --focus: #536d82;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

.page {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 14px 14px 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.page-title {
  margin: 0;
  font-size: clamp(1.05rem, 3.8vw, 1.35rem);
  font-weight: 650;
  letter-spacing: .01em;
}

.theme-toggle,
.home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.theme-toggle:hover,
.home-link:hover,
.thread-grid a:hover,
.topic-row:hover { background: var(--hover); }

.theme-toggle:focus-visible,
.home-link:focus-visible,
.thread-grid a:focus-visible,
.topic-row a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.thread-panel { padding: 12px; }
.thread-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
  gap: 7px;
}
.thread-grid a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 7px 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.thread-grid a:visited { color: var(--link-visited); }

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

.topic-panel { overflow: hidden; }
.topic-heading {
  margin: 0;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: .86rem;
  font-weight: 650;
  letter-spacing: .04em;
}
.topic-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.topic-row:last-child { border-bottom: 0; }
.topic-title { min-width: 0; overflow-wrap: anywhere; }
.topic-ref {
  flex: 0 0 auto;
  min-width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.topic-row a { color: var(--link); text-decoration: none; }
.topic-row a:visited { color: var(--link-visited); }
.topic-note { color: var(--muted); }

@media (max-width: 520px) {
  .page { padding: 10px 10px 28px; }
  .thread-panel { padding: 9px; }
  .thread-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .thread-grid a { min-height: 41px; font-size: .96rem; }
  .topic-row { padding: 10px 11px; gap: 10px; }
  .theme-toggle, .home-link { min-height: 38px; padding: 6px 10px; }
}

@media (max-width: 340px) {
  .thread-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
