:root {
  color-scheme: light;
  --bg: #f7f0dd;
  --bg-2: #f2e6cf;
  --surface: rgba(255, 252, 244, 0.58);
  --ink: #1d150c;
  --muted: #6b5a43;
  --accent: #c2692e;
  --accent-2: #2d5a3c;
  --accent-link: #b05a8a;
  --accent-hover: #7a1a5c;
  --line: rgba(45, 34, 22, 0.2);
  --overscroll: #efe3c6;
  --max-width: 860px;
  --base: 0.85rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171411;
  --bg-2: #1f1b16;
  --surface: rgba(255, 255, 255, 0.035);
  --ink: #ebe3d3;
  --muted: #a69984;
  --accent: #e08a4c;
  --accent-2: #5aa374;
  --accent-link: #d98bb5;
  --accent-hover: #f0b3d4;
  --line: rgba(235, 227, 211, 0.16);
  --overscroll: #14110e;
}

* { box-sizing: border-box; }
html { background-color: var(--overscroll); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Roboto Mono", "Courier New", monospace;
  font-size: var(--base);
  line-height: 1.7;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #fdf6e7 0%, rgba(253, 246, 231, 0) 65%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 50%, #f9f2e2 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(1200px 600px at 10% -10%, #241f19 0%, rgba(36, 31, 25, 0) 65%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 50%, #1a1612 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.page {
  max-width: var(--max-width);
  width: calc(100% - clamp(32px, 12vw, 120px));
  margin-inline: auto;
  padding: 56px 0 88px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.header-left { display: flex; align-items: baseline; gap: 8px; }
.site-title {
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}
.site-title:hover { color: var(--accent); }
.site-meta { color: var(--muted); font-size: 0.85rem; }

.theme-toggle {
  width: 28px; height: 28px; padding: 0; flex: none;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 4px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.theme-toggle svg { width: 15px; height: 15px; display: block; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle:hover { color: var(--accent-hover); border-color: var(--accent-hover); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease;
}
.card:hover { border-color: var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h2 { margin: 0; font-size: 1rem; font-weight: 600; }
.card p { margin: 6px 0 0; color: var(--muted); font-size: 0.8rem; }
.card-foot { font-size: 0.76rem; color: var(--accent-link); }

.badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--line);
}
.badge-public { color: var(--accent-2); border-color: var(--accent-2); }
.badge-private { color: var(--accent); border-color: var(--accent); }
.badge-magic { color: var(--accent-link); border-color: var(--accent-link); }
