/* ==========================================================================
   晚晚 · 夏日手帖 | 海原车站 (https://www.qqneko.com/)
   吉卜力夏日水粉绘本统一视觉规范：明朝宋楷字体、手绘钢笔水彩图标、和纸藏书票按钮与画框
   ========================================================================== */

:root {
  --font-serif: "Songti SC", "Hiragino Mincho ProN", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", "Baskerville", Georgia, serif;
  --font-hand: "Kaiti SC", "STKaiti", "KaiTi", "FangSong", "Songti SC", serif;

  --paper-bg: #f8f5ec;
  --paper-card: #fcf8ee;
  --paper-card-end: #f1e8d4;
  --ink-main: #2b241d;
  --ink-soft: #5f5548;
  --ink-faint: #847868;
  --ink-line: rgba(43, 36, 29, 0.16);
  --ink-border: rgba(43, 36, 29, 0.42);
  --hanko-red: #c54432;
  --accent-tone: #1c6ca8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--paper-bg);
  color: var(--ink-main);
  font-family: var(--font-serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Subtle Handmade Watercolor Paper Grain Overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  opacity: 0.026;
  background-image: radial-gradient(#2b241d 0.6px, transparent 0.6px);
  background-size: 12px 12px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ==========================================================================
   1. 2.35:1 Japanese Theatrical Cinemascope Shell
   ========================================================================== */
.cinemascope {
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  padding: 0 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 68px 1fr 122px;
  overflow-x: hidden;
}

.cinemascope > * {
  min-width: 0;
}

/* ==========================================================================
   2. Unified Top Masthead: Vermilion Cat Hanko + Literary Nav + Sound Tag
   ========================================================================== */
.gh-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gh-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: inherit;
}

.gh-hanko {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  transition: transform 0.28s ease;
}

.gh-brand:hover .gh-hanko {
  transform: rotate(-4deg) scale(1.04);
}

.gh-brand-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--ink-main);
}

.gh-brand-sub {
  font-family: var(--font-hand);
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  padding-left: 10px;
  border-left: 1px solid var(--ink-line);
}

.gh-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.gh-nav-item {
  appearance: none;
  background: none;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-serif);
  font-size: 13.5px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  position: relative;
  padding: 4px 2px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.gh-nav-item:hover {
  color: var(--ink-main);
}

.gh-nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.gh-nav-item.is-active {
  color: var(--ink-main);
  font-weight: 600;
}

.gh-nav-item.is-active::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--hanko-red) 0%, rgba(197, 68, 50, 0.35) 100%);
}

/* Unified Sewn Washi Sound Toggle Tag */
.gh-sound-tag {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border: 1px solid var(--ink-border);
  border-radius: 3px;
  background: rgba(255, 252, 244, 0.72);
  font-family: var(--font-hand);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  color: var(--ink-main);
  box-shadow: 0 1px 3px rgba(43, 36, 29, 0.05);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.gh-sound-tag:hover {
  background: #fffdf8;
  border-color: rgba(43, 36, 29, 0.62);
}

.gh-sound-tag:active {
  transform: translateY(1px);
}

.gh-sound-tag svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  transform-origin: 50% 12%;
}

.gh-sound-tag.is-playing svg {
  animation: furinSway 3.6s ease-in-out infinite;
}

.gh-sound-tag.is-muted {
  color: var(--ink-faint);
  border-color: rgba(43, 36, 29, 0.24);
  background: rgba(248, 245, 236, 0.5);
}

@keyframes furinSway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(6deg); }
}

/* ==========================================================================
   3. Studio Ghibli Layout-Exhibition Framed Stage & Interactive Canvas
   ========================================================================== */
.gh-frame {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1.2px solid rgba(43, 36, 29, 0.34);
  overflow: hidden;
  background: #6eb3e6;
  box-shadow: 0 4px 18px rgba(43, 36, 29, 0.06);
}

.gh-frame::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 0.8px solid rgba(255, 252, 244, 0.54);
  pointer-events: none;
  z-index: 3;
}

.widescreen-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 52%;
  transform: scale(1.035);
  z-index: 0;
  pointer-events: none;
}

#gliderCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  cursor: pointer;
  touch-action: none;
}

/* ==========================================================================
   4. Unified Hand-Inked Bookplate Button & Stamp-Card Tally
   ========================================================================== */
.gh-btn {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 18px 8px 14px;
  background: linear-gradient(180deg, var(--paper-card) 0%, var(--paper-card-end) 100%);
  color: var(--ink-main);
  border: 1.2px solid var(--ink-border);
  border-radius: 3px;
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  cursor: pointer;
  box-shadow:
    0 2px 6px rgba(43, 36, 29, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.gh-btn::before {
  content: "";
  position: absolute;
  inset: 2.5px;
  border: 0.75px solid rgba(43, 36, 29, 0.22);
  border-radius: 1.5px;
  pointer-events: none;
}

.gh-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(43, 36, 29, 0.65);
  box-shadow:
    0 4px 10px rgba(43, 36, 29, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.gh-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 3px rgba(43, 36, 29, 0.08);
}

.gh-btn svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.gh-btn-dot {
  width: 5px;
  height: 5px;
  background: var(--hanko-red);
  transform: rotate(45deg);
  margin-left: 2px;
  opacity: 0.88;
}

.gh-tally {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px;
  background: rgba(255, 252, 244, 0.66);
  border: 1px solid var(--ink-line);
  border-radius: 3px;
}

.gh-tally svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.gh-tally-label {
  font-family: var(--font-hand);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

.gh-tally-num {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-tone);
  font-variant-numeric: tabular-nums;
}

.gh-tally-num small {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--ink-faint);
  margin-left: 3px;
}

.record-seal {
  display: none;
  padding: 1px 4px;
  background: var(--hanko-red);
  color: #fcf8ee;
  font-family: var(--font-hand);
  font-size: 10.5px;
  border-radius: 2px;
  line-height: 1.25;
}

.gh-tally.is-new-record .record-seal {
  display: inline-block;
}

/* ==========================================================================
   5. Bottom Band: Story Headline + Controls + Legal Copyright/ICP
   ========================================================================== */
.bottom-band {
  padding-top: 16px;
  padding-bottom: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.story-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.headline-group {
  display: flex;
  align-items: baseline;
  gap: 18px;
  min-width: 0;
  flex-wrap: nowrap;
}

.headline-group h1 {
  font-family: var(--font-serif);
  font-size: 22.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.headline-group p {
  font-family: var(--font-hand);
  font-size: 13.5px;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.glide-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.gh-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--ink-line);
  font-family: var(--font-serif);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  user-select: text;
  -webkit-user-select: text;
}

.gh-footer-chapter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-hand);
  font-size: 12.5px;
  letter-spacing: 0.12em;
}

.gh-footer-chapter svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.gh-footer-legal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.gh-footer-legal a {
  color: var(--ink-main);
  text-decoration: none;
  border-bottom: 1px dotted rgba(43, 36, 29, 0.32);
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.gh-footer-legal a:hover {
  color: var(--accent-tone);
  border-bottom-color: var(--accent-tone);
}

/* ==========================================================================
   6. Keepsake Wooden Chest Modal (拾光木匣 · 预留企划篇章手札)
   ========================================================================== */
.keepsake-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(28, 36, 46, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.keepsake-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.keepsake-card {
  position: relative;
  width: 100%;
  max-width: 430px;
  padding: 32px 34px 28px;
  background: linear-gradient(180deg, #fdfaf1 0%, #f3ebd9 100%);
  border: 1.2px solid var(--ink-border);
  border-radius: 3px;
  box-shadow: 0 18px 44px rgba(27, 32, 38, 0.2);
  transform: translateY(8px);
  transition: transform 0.24s ease;
}

.keepsake-backdrop.is-open .keepsake-card {
  transform: translateY(0);
}

.keepsake-card::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 0.8px solid rgba(43, 36, 29, 0.2);
  pointer-events: none;
}

.keepsake-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-hand);
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--hanko-red);
  margin-bottom: 12px;
}

.keepsake-head svg {
  width: 20px;
  height: 20px;
}

.keepsake-card h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink-main);
}

.keepsake-card p {
  margin-top: 12px;
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.92;
  color: var(--ink-soft);
}

.keepsake-foot {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.keepsake-stamp {
  font-family: var(--font-hand);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}

/* ==========================================================================
   7. Tablet & Mobile Responsive Layout
   ========================================================================== */
@media (max-width: 1220px) {
  .cinemascope {
    padding: 0 28px;
    grid-template-rows: 64px 1fr 136px;
  }
  .headline-group {
    flex-direction: column;
    gap: 4px;
  }
  .headline-group h1,
  .headline-group p {
    white-space: normal;
  }
}

@media (max-width: 760px) {
  body {
    overflow-y: auto;
    overflow-x: hidden;
  }
  .cinemascope {
    height: auto;
    min-height: 100svh;
    padding: 0 16px;
    grid-template-rows: auto minmax(330px, 54svh) auto;
  }
  .gh-header {
    padding: 12px 0 10px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .gh-brand-title {
    font-size: 16.5px;
  }
  .gh-brand-sub {
    display: none;
  }
  .gh-nav {
    gap: 10px;
    width: 100%;
    justify-content: space-between;
  }
  .gh-nav-item {
    font-size: 12.5px;
    letter-spacing: 0.08em;
  }
  .gh-sound-tag {
    font-size: 11.5px;
    padding: 3px 9px;
    letter-spacing: 0.06em;
  }
  .widescreen-frame img {
    object-position: 34% 54%;
  }
  .story-row {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .headline-group h1 {
    font-size: 17.5px;
    line-height: 1.42;
  }
  .headline-group p {
    font-size: 12.5px;
    line-height: 1.65;
  }
  .glide-panel {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }
  .gh-tally {
    padding: 5px 11px;
    gap: 7px;
  }
  .gh-btn {
    padding: 7px 14px 7px 11px;
    font-size: 13px;
    letter-spacing: 0.12em;
  }
  .gh-footer {
    margin-top: 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    font-size: 11.5px;
  }
}
