:root {
  --bg-top: #f5ede3;
  --bg-bottom: #ecdfcf;
  --panel: rgba(255,255,255,0.78);
  --panel-strong: rgba(255,255,255,0.92);
  --ink: #2f261e;
  --muted: #6f6559;
  --line: rgba(110,80,49,0.15);
  --accent: #81553a;
  --accent-soft: rgba(129,85,58,0.10);
  --shadow: 0 16px 34px rgba(47,38,30,0.12);
  --radius: 18px;
  --header-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.62), transparent 30%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  font-family: Georgia, serif;
  overscroll-behavior-x: none;
}

body.drawer-open { overflow: hidden; }

button, input, select, textarea { font: inherit; }

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(245,237,227,0.84);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-left, .header-right, .header-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-left {
  min-width: 0;
  flex: 1 1 auto;
}

.header-title-wrap {
  min-width: 0;
  flex-wrap: wrap;
}

.brand {
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 0.02em;
}

.meta-text {
  color: var(--muted);
  font-size: 14px;
}

.status-pill {
  max-width: 56vw;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: var(--ink);
}

.burger-btn { position: relative; }

.burger-lines,
.burger-lines::before,
.burger-lines::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.18s ease, opacity 0.18s ease;
  content: "";
}

.burger-lines::before { transform: translateY(-6px); }
.burger-lines::after { transform: translateY(4px); }

body.drawer-open .burger-lines { background: transparent; }
body.drawer-open .burger-lines::before { transform: translateY(2px) rotate(45deg); }
body.drawer-open .burger-lines::after { transform: translateY(0) rotate(-45deg); }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0,0,0,0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(88vw, 360px);
  height: 100vh;
  z-index: 90;
  background: rgba(248,243,236,0.96);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--line);
  box-shadow: 0 22px 50px rgba(0,0,0,0.16);
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
}

body.drawer-open .drawer { transform: translateX(0); }
body.drawer-open .drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.drawer-title {
  font-size: 22px;
  font-weight: bold;
}

.close-btn {
  font-size: 28px;
  line-height: 1;
}

.drawer-content {
  flex: 1 1 auto;
  overflow: auto;
  padding: 10px 16px 24px;
}

.drawer-section + .drawer-section {
  margin-top: 18px;
}

.drawer-section h2 {
  margin: 0 0 10px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.drawer-nav {
  display: grid;
  gap: 8px;
}

.menu-link,
.date-link {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.menu-link.is-active,
.date-link.is-active {
  background: var(--accent-soft);
  border-color: rgba(129,85,58,0.24);
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.thumb-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.7);
  cursor: pointer;
  aspect-ratio: 1 / 1;
  padding: 0;
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-item.is-active {
  outline: 2px solid rgba(129,85,58,0.38);
}

.thumb-empty {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.page-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 12px 28px;
}

.viewer-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.page-view,
.gallery-view {
  padding: 18px;
}

.is-hidden { display: none !important; }

.home-stack {
  display: grid;
  gap: 18px;
}

.hero-banner {
  min-height: 180px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(129,85,58,0.12), rgba(255,255,255,0.58));
}

.hero-banner img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 180px;
  object-fit: cover;
}

.intro-card,
.content-card,
.featured-strip {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  padding: 18px;
}

.intro-card h1,
.content-card h1:first-child,
.content-card h2:first-child,
.content-card h3:first-child {
  margin-top: 0;
}

.page-lead {
  color: var(--muted);
  margin-top: -4px;
}

.content-wrap {
  display: grid;
  gap: 18px;
}

.content-card img,
.content-card figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
}

.content-card table {
  width: 100%;
  border-collapse: collapse;
}

.content-card td,
.content-card th {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
}

.section-heading {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.featured-card {
  display: block;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
  color: var(--ink);
}

.featured-card:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.featured-media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: rgba(255,255,255,0.5);
}

.featured-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.featured-meta {
  padding: 10px 12px 12px;
}

.featured-date {
  font-size: 13px;
  color: var(--muted);
}

.featured-name {
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.35;
  word-break: break-word;
}

.gallery-view {
  padding: 14px;
}

.gallery-frame {
  position: relative;
  min-height: 52vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-figure {
  margin: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-figure img {
  display: block;
  max-width: 100%;
  max-height: 76vh;
  width: auto;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 18px 34px rgba(0,0,0,0.16);
  background: rgba(255,255,255,0.35);
}

.gallery-caption {
  margin-top: 12px;
  color: var(--muted);
  text-align: center;
  min-height: 1.4em;
}

.nav-hit {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 22%;
  min-width: 48px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.nav-left { left: 0; }
.nav-right { right: 0; }

.empty-state {
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 760px) {
  .page-shell {
    padding: 10px 0 18px;
  }

  .viewer-card {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .page-view,
  .gallery-view {
    padding: 14px;
  }

  .brand { font-size: 20px; }
  .status-pill { max-width: 48vw; }
  .featured-grid { grid-template-columns: 1fr; }
  .thumb-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-banner { min-height: 140px; }
  .hero-banner img { min-height: 140px; }
}
