:root {
  --bg: #f3efe6;
  --bg-deep: #e7e0d2;
  --ink: #1c1914;
  --muted: #5c564c;
  --accent: #2f5d50;
  --accent-soft: #d7e4de;
  --paper: #fffdf8;
  --line: #d2c9b8;
  --shadow: 0 18px 40px rgba(28, 25, 20, 0.08);
  --radius: 18px;
  --font-display: "Segoe UI", "Trebuchet MS", sans-serif;
  --font-body: "Segoe UI", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fff9ee 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #e4efe9 0%, transparent 50%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: #000;
  color: #fff;
  padding: .5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(243, 239, 230, 0.86);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 0;
}
.brand {
  font-family: var(--font-display);
  font-weight: 750;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.1rem;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.nav a:hover { color: var(--accent); }

.install-flash {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  color: var(--ink);
}
.install-flash ul { margin: .4rem 0 0; padding-left: 1.1rem; color: var(--muted); }

.hero {
  padding: 2.5rem 0 1.5rem;
  animation: rise .6s ease both;
}
.brand-mark {
  margin: 0 0 .35rem;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--accent);
}
.hero h1, .hub-header h1 {
  margin: 0 0 .75rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
}
.lead {
  max-width: 42rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  padding: 1rem 0 3rem;
}
.section-link {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease;
}
.section-link:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}
.section-name { font-weight: 750; font-size: 1.15rem; }
.section-hint { color: var(--muted); font-size: .92rem; line-height: 1.4; }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding-top: 1.4rem;
  color: var(--muted);
  font-size: .92rem;
}
.breadcrumbs a { color: var(--accent); text-decoration: none; }

.hub-header { padding: 1rem 0 1.25rem; }

.neighbors {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.25rem;
}
.neighbors a {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
  padding: .35rem .7rem;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 600;
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  padding-bottom: 2rem;
}
.sheet-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: rise .55s ease both;
}
.sheet-open {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
}
.sheet-open img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 400 / 560;
  object-fit: cover;
  background: #f7f4ec;
}
.sheet-card-title {
  display: block;
  padding: .65rem .75rem .85rem;
  font-weight: 650;
  font-size: .95rem;
}

.pagination {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  padding-bottom: 2.5rem;
}
.pagination a {
  min-width: 2.2rem;
  text-align: center;
  padding: .4rem .55rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--paper);
}
.pagination a.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 1.5rem 0 2rem;
  margin-top: 1rem;
}

.hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.modal[hidden] { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  animation: fade .2s ease both;
}
.modal-dialog {
  position: relative;
  width: min(720px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: var(--paper);
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: pop .25s ease both;
}
.modal-close {
  position: sticky;
  top: .5rem;
  float: right;
  margin: .5rem .75rem 0 0;
  border: 0;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  background: var(--bg-deep);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}
.modal-body { padding: 1rem 1.25rem 1.5rem; clear: both; }
.modal-preview {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  margin: .5rem 0 1rem;
}
.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .75rem 0;
}
.badge {
  font-size: .8rem;
  padding: .25rem .55rem;
  border-radius: 999px;
  background: var(--bg-deep);
  color: var(--muted);
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin: 1rem 0;
}
.btn {
  border: 0;
  border-radius: 12px;
  padding: .7rem 1rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}
.btn:disabled {
  opacity: .55;
  cursor: wait;
}
.btn-secondary {
  background: var(--bg-deep);
  color: var(--ink);
}
.ad-slot {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: linear-gradient(135deg, #f6f1e6, #e8f0eb);
  color: var(--muted);
  min-height: 90px;
  display: grid;
  place-items: center;
  text-align: center;
}
.progress {
  height: 8px;
  background: var(--bg-deep);
  border-radius: 999px;
  overflow: hidden;
  margin: .5rem 0 1rem;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .2s linear;
}
.related {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: .6rem;
  margin-top: 1rem;
}
.related button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}
.related img { width: 100%; display: block; aspect-ratio: 3/4; object-fit: cover; }
.muted { color: var(--muted); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
