
/* ═══════════════════════════════════════
   CSS VARIABLES
   ═══════════════════════════════════════ */
:root {
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #1a1a1a;
  --bg4: #222222;
  --text: #f0f0f0;
  --text2: #999999;
  --text3: #555555;
  --red: #e63333;
  --red-glow: rgba(230,51,51,0.25);
  --red-dim: rgba(230,51,51,0.08);
  --white: #ffffff;
  --border: #2a2a2a;
  --font-jp: 'Zen Kaku Gothic New', sans-serif;
  --font-en: 'Oswald', sans-serif;
  --font-display: 'Bebas Neue', sans-serif;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  /* Glass effect defaults */
  --glass-surface-blur: 8px;
  --glass-surface-opacity: 60%;
  --glass-surface-tint: var(--bg2);
  --glass-ui-blur: 6px;
  --glass-ui-opacity: 60%;
  --glass-ui-tint: var(--bg3);
  --glass-footer-blur: 6px;
  --glass-footer-opacity: 30%;
  --glass-footer-tint: var(--bg2);
  /* Header / UI */
  --chrome-bg: #0a0a0a;
  --header-bg: rgba(10,10,10,0.88);
  --header-border: rgba(255,255,255,0.06);
  --menu-overlay: rgba(0,0,0,0.6);
  --btn-text: #ffffff;
  --entry-border: rgba(255,255,255,0.04);
}

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

html { scroll-behavior: smooth; overflow-x: clip; overscroll-behavior-y: none; height: 100%; }

/* Design mode: sharp overrides */
body.sharp .filter-chip { border-radius: 0; }
body.sharp .timeline-tag { border-radius: 0; }
body.sharp .page-btn { border-radius: 0; }
body.sharp .view-toggle { border-radius: 0; }
body.sharp .view-slider { border-radius: 0; }
body.sharp .view-btn { border-radius: 0; }
body.sharp .reaction-chip { border-radius: 0; }
body.sharp .emoji-add-btn { border-radius: 0; }
body.sharp .emoji-picker-popup { border-radius: 0; }
body.sharp .timeline-item { border-radius: 0; }
body.sharp .tl-comment-btn { border-radius: 0; }
body.sharp .tl-share-btn { border-radius: 0; }
body.sharp .emoji-add-btn { border-radius: 0; }
body.sharp .timeline-images { border-radius: 0; }
body.sharp .thumb-item { border-radius: 0; }
body.sharp .thumb-grid { border-radius: 0; }
body.sharp .sort-btn { border-radius: 0; }
body.sharp .comment-input { border-radius: 0; }
body.sharp .comment-send { border-radius: 0; }
body.sharp .comment-name-input { border-radius: 0; }
body.sharp .comment-tree-item { border-radius: 0; }
body.sharp .hero-btn { border-radius: 0; }
body.sharp .skill-tag { border-radius: 0; }

/* Design mode: round overrides */
body.round .filter-chip { border-radius: 16px; }
body.round .timeline-tag { border-radius: 12px; }
body.round .thumb-item { border-radius: 0; }
body.round .thumb-grid { border-radius: 12px; }
body.round .page-btn { border-radius: 50%; }
body.round .view-toggle { border-radius: 16px; }
body.round .view-slider { border-radius: 12px; }
body.round .view-btn { border-radius: 12px; }
body.round .reaction-chip { border-radius: 16px; }
body.round .emoji-add-btn { border-radius: 12px; }
body.round .emoji-picker-popup { border-radius: 16px; }
body.round .timeline-item { border-radius: 12px; }
body.round .tl-comment-btn { border-radius: 10px; }
body.round .tl-share-btn { border-radius: 10px; }
body.round .emoji-add-btn { border-radius: 10px; }
body.round .skill-tag { border-radius: 12px; }
body.round .timeline-images { border-radius: 12px; }
body.round .sort-btn { border-radius: 12px; }
body.round .comment-input { border-radius: 12px; }
body.round .comment-send { border-radius: 12px; }
body.round .comment-name-input { border-radius: 12px; }
body.round .comment-tree-item { border-radius: 0 8px 8px 0; }
body.round .tl-slider-counter { border-radius: 10px; }
body.round .clap-panel textarea { border-radius: 12px; }
body.round .post-detail-tag { border-radius: 16px; }
body.round .detail-tag { border-radius: 20px; }
body.round .detail-clear { border-radius: 12px; }
body.round .hamburger { border-radius: 12px; }
body.round .genzai-badge { border-radius: 8px; }
body.round .clap-panel { border-radius: 20px 20px 0 0; }
body.round .dm-popup { border-radius: 20px; }
body.round .dm-field { border-radius: 12px; }
body.round .hero-btn { border-radius: 16px; }

/* Dynamic time theme filter */
/* BG image support */
body.has-bg-image {
  background-repeat: repeat;
  background-position: top left;
  background-attachment: fixed;
}
body.has-bg-image.bg-no-tile {
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-jp);
  font-weight: 400;
  line-height: 1.7;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
  overflow-x: clip;
  overscroll-behavior-y: none;
  overflow-anchor: none;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════
   HEADER
   ═══════════════════════════════════════ */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--header-border);
  transition: background 0.5s;
}

.header-logo {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-logo .red { color: var(--red); }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Hamburger */
.hamburger {
  width: 36px; height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px;
  transition: border-color 0.3s;
}

.hamburger:hover { border-color: var(--red); }

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  transition: all 0.3s;
}

.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ═══════════════════════════════════════
   SLIDE MENU
   ═══════════════════════════════════════ */
.slide-menu {
  position: fixed;
  top: 0; right: -320px;
  width: 320px;
  max-width: 85vw;
  height: 100lvh;
  background: var(--bg2);
  z-index: 490;
  transition: right 0.4s var(--ease);
  padding: 80px 28px 40px;
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

.slide-menu.open { right: 0; }

/* Staggered entrance for menu items */
.slide-menu .menu-section-label,
.slide-menu .menu-link,
.slide-menu .menu-social {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s, transform 0.3s;
}
.slide-menu.open .menu-section-label,
.slide-menu.open .menu-link,
.slide-menu.open .menu-social {
  opacity: 1;
  transform: translateX(0);
}
.slide-menu.open > :nth-child(1) { transition-delay: 0.08s; }
.slide-menu.open > :nth-child(2) { transition-delay: 0.12s; }
.slide-menu.open > :nth-child(3) { transition-delay: 0.16s; }
.slide-menu.open > :nth-child(4) { transition-delay: 0.20s; }
.slide-menu.open > :nth-child(5) { transition-delay: 0.24s; }
.slide-menu.open > :nth-child(6) { transition-delay: 0.28s; }
.slide-menu.open > :nth-child(7) { transition-delay: 0.32s; }
.slide-menu.open > :nth-child(8) { transition-delay: 0.36s; }

.menu-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--menu-overlay);
  z-index: 480;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0s 0.4s;
}

.menu-overlay.open { opacity: 1; pointer-events: auto; visibility: visible; transition: opacity 0.4s, visibility 0s; }

.menu-section-label {
  font-family: var(--font-en);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text3);
  text-transform: uppercase;
  margin-bottom: 12px;
  margin-top: 28px;
}
.menu-section-label.work { color: var(--red); }
.menu-section-label.personal { color: var(--red); }

.menu-section-label:first-child { margin-top: 0; }

.menu-link {
  display: block;
  padding: 12px 0;
  font-family: var(--font-en);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
  border-bottom: 1px solid var(--border);
}

.menu-link:hover { color: var(--sub-accent, #6366f1); }
.menu-link:hover span:not(.sub) { color: inherit !important; }

.menu-link .sub {
  font-family: var(--font-jp);
  font-size: 11px;
  font-weight: 400;
  color: var(--text3);
  display: block;
  margin-top: 2px;
}

.menu-social {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  max-width: 232px;
}

.menu-social a {
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  text-decoration: none;
  font-size: 16px;
  transition: all 0.3s;
}

.menu-social a:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ═══════════════════════════════════════
   H-ARTWORKS HERO
   ═══════════════════════════════════════ */
.hero-hartworks {
  min-height: var(--hero-h, 100svh);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  padding-top: 70px;
  padding-bottom: 0;
  box-sizing: border-box;
}
.hero-center-wrap {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  text-align: center; width: 100%; min-height: 0;
}
@media (max-width: 768px) {
  .hero-hartworks { padding-top: 70px; padding-bottom: 0; }
}

.hero-hartworks::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: var(--hero-glow-display, block);
  background: 
    radial-gradient(ellipse at 20% 80%, var(--red-glow) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(255,255,255,0.03) 0%, transparent 50%);
  pointer-events: none;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 14vw, 9rem);
  line-height: 0.9;
  letter-spacing: 0.04em;
  color: var(--text);
  position: relative;
  z-index: 1;
  animation: heroIn 1s var(--ease);
}

.hero-title .red { color: var(--red); }

.hero-subtitle {
  font-family: var(--font-en);
  font-size: clamp(0.7rem, 2vw, 0.9rem);
  letter-spacing: 0.4em;
  color: var(--text3);
  text-transform: uppercase;
  margin-top: 32px;
  z-index: 1;
  animation: heroIn 1s 0.2s var(--ease) both;
}

.hero-notice {
  margin-top: 32px;
  padding: 10px 24px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text2);
  z-index: 1;
  animation: heroIn 1s 0.4s var(--ease) both;
}

.hero-enter {
  margin-top: 48px;
  z-index: 1;
  animation: heroIn 1s 0.6s var(--ease) both;
}

.hero-enter a {
  font-family: var(--font-en);
  font-size: 14px;
  letter-spacing: 0.2em;
  color: var(--red);
  text-decoration: none;
  border: 1px solid var(--red);
  padding: 12px 36px;
  transition: all 0.3s;
  text-transform: uppercase;
}

.hero-enter a:hover {
  background: var(--red);
  color: var(--white);
}

/* Hero two buttons */
.hero-buttons{display:flex;flex-direction:row;gap:16px;margin-top:40px;z-index:1;animation:heroIn 1s .6s var(--ease) both;align-items:center}
.hero-btn{
  font-family:var(--font-en);font-size:14px;letter-spacing:.15em;text-decoration:none;
  padding:14px 36px;transition:background .35s ease, color .35s ease;
  display:block;min-width:200px;text-align:center;cursor:pointer;
  position:relative;overflow:hidden;border-radius:var(--radius-btn, 0);
}
.hero-btn .btn-default, .hero-btn .btn-hover {
  transition: opacity 0.35s ease;
  display:block;
}
.hero-btn .btn-hover {
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  opacity:0;
  font-family:var(--font-jp);font-size:11px;letter-spacing:.08em;
}
.hero-btn:hover .btn-default { opacity:0; }
.hero-btn:hover .btn-hover { opacity:1; }

.hero-btn-work{
  border:1px solid var(--text);color:var(--text);
  background:transparent;transition:background .35s ease, color .35s ease;
}
.hero-btn-work:hover{background:var(--text);color:var(--bg)}

.hero-btn-hobby{
  border:1px solid var(--red);color:var(--red);
  background:transparent;transition:background .35s ease, color .35s ease;
}
.hero-btn-hobby:hover{background:var(--red);color:var(--white)}

/* Works History */
.works-history{max-width:800px}
.works-category{margin-bottom:48px}
.works-cat-title{font-family:var(--font-display);font-size:24px;letter-spacing:.06em;color:var(--red);margin-bottom:4px}
.works-cat-sub{font-size:12px;color:var(--text3);margin-bottom:20px;letter-spacing:.05em}
.works-entry{padding:10px 0;border-bottom:1px solid var(--entry-border);font-size:13px;line-height:1.6;transition:background .2s;cursor:default}
.works-entry.has-detail{cursor:pointer;padding-left:4px;border-left:2px solid var(--red-dim, rgba(232,72,85,0.3));margin-left:-6px}
.works-entry.has-detail:active{background:var(--red-dim, rgba(232,72,85,0.08))}
.works-entry.open{border-left-color:var(--red, #e84855)}
.works-entry.open .works-toggle{transform:rotate(90deg);color:var(--red, #e84855)}
.genzai-badge{display:inline-block;background:var(--red, #e84855);color:#fff;font-size:10px;font-weight:600;padding:1px 6px;border-radius:2px;letter-spacing:0.05em;vertical-align:middle;animation:genzaiPulse 3s ease-in-out infinite}
@keyframes genzaiPulse{0%,100%{opacity:1}50%{opacity:0.55}}
/* Page transition */
.page-transition {
  animation: pageFade 0.4s var(--ease);
}
@keyframes pageFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Smooth header color transition */
.header {
  transition: background 0.5s var(--ease), border-color 0.3s;
}
.header-logo, .header-logo .red {
  transition: color 0.5s var(--ease);
}
.hamburger span {
  transition: all 0.3s, background 0.5s var(--ease);
}
.theme-btn {
  transition: all 0.3s, color 0.5s var(--ease), border-color 0.5s var(--ease);
}
.hamburger {
  transition: border-color 0.5s var(--ease);
}
.works-entry:hover{background:var(--red-dim);margin:0 -8px;padding:10px 8px;border-radius:4px}
.works-entry.has-detail:hover{cursor:pointer}
.works-date{font-family:var(--font-en);font-size:12px;color:var(--text3);letter-spacing:.04em;white-space:nowrap;min-width:90px;flex-shrink:0}
.works-desc{color:var(--text2)}
.works-desc a{color:var(--text);text-decoration:none;transition:color .2s}
.works-desc a:hover{color:var(--red)}
.works-note{font-size:12px;color:var(--text3);margin-top:8px;padding-left:102px}

/* View Toggle */
.view-toggle{display:flex;position:relative;margin-bottom:8px;background:color-mix(in srgb, var(--glass-ui-tint) var(--glass-ui-opacity), transparent);backdrop-filter:blur(var(--glass-ui-blur));-webkit-backdrop-filter:blur(var(--glass-ui-blur));border-radius:8px;padding:4px;border:1px solid var(--border);overflow:hidden}
.view-slider{position:absolute;top:4px;left:4px;width:calc(50% - 4px);height:calc(100% - 8px);background:var(--sub-accent, var(--red));border-radius:6px;transition:transform 0.3s ease;pointer-events:none;z-index:0}
.view-toggle.timeline-active .view-slider{transform:translateX(100%)}

/* Detail Filter */
.detail-filter-toggle{padding:10px 0;font-size:13px;color:var(--text);cursor:pointer;transition:color .2s;letter-spacing:.03em;user-select:none;font-weight:500}
.detail-filter-toggle:hover{color:var(--red)}
.detail-arrow{display:inline-block;transition:transform .3s;font-size:10px;margin-right:4px}
.detail-arrow.open{transform:rotate(90deg)}
.detail-filter-panel{max-height:0;overflow:hidden;transition:max-height .4s ease}
.detail-filter-panel.open{max-height:800px}
.detail-filter-wrap{background:color-mix(in srgb, var(--glass-surface-tint) var(--glass-surface-opacity), transparent);backdrop-filter:blur(var(--glass-surface-blur));-webkit-backdrop-filter:blur(var(--glass-surface-blur));margin:0 -24px;padding:0 24px}
.detail-cat-group{display:none}
.detail-cat-group.active{display:block}
.detail-group{padding:12px 0 16px;border-bottom:0.5px solid var(--border)}
.detail-group-label{font-family:var(--font-jp);font-size:12px;color:var(--text2);margin-bottom:8px}
.detail-group-label .dlg-parent{font-size:11px;color:var(--text3)}
.detail-tags{display:flex;flex-wrap:wrap;gap:6px;max-height:80px;overflow-y:auto;scrollbar-width:thin}
.detail-tag{padding:5px 12px;background:none;border:1px solid var(--border);border-radius:20px;color:var(--text);font-family:var(--font-jp);font-size:11px;cursor:pointer;transition:all .2s}
.detail-tag:hover{border-color:var(--red);color:var(--red)}
.detail-tag.selected{background:var(--red);border-color:var(--red);color:#fff}
.detail-actions{padding:10px 0;display:flex;justify-content:flex-end}
.detail-clear{background:none;border:1px solid var(--border);border-radius:6px;padding:5px 14px;color:var(--text2);font-family:var(--font-jp);font-size:11px;cursor:pointer;transition:all .2s}
.detail-clear:hover{border-color:var(--red);color:var(--red)}
.detail-no-cat{font-size:12px;color:var(--text3);padding:12px 0;font-style:italic}
.detail-level-section.depth-1{margin-top:0}
.detail-level-section.depth-2{margin-top:0;margin-left:1em;padding:12px 0 8px 12px;border-left:3px solid var(--red)}
.detail-level-section.depth-2 .detail-group{border-bottom:none;padding-top:0}
.detail-level-section.depth-2 > .detail-tags{margin-bottom:8px}
.detail-level-header{margin-bottom:10px}
.detail-level-header .dlh-label{font-family:var(--font-jp);font-size:12px;color:var(--text2)}
.detail-level-header .dlh-parent{font-size:12px;color:var(--text2)}
.detail-tags.sub-accent-tags .detail-tag{border-color:color-mix(in srgb, var(--sub-accent, #6366f1) 40%, transparent)}
.detail-tags.sub-accent-tags .detail-tag:hover{border-color:var(--sub-accent, #6366f1);color:var(--sub-accent, #6366f1)}
.detail-tags.sub-accent-tags .detail-tag.selected{background:var(--sub-accent, #6366f1);border-color:var(--sub-accent, #6366f1);color:#fff}
.view-btn{flex:1;padding:8px 12px;background:none;border:none;border-radius:6px;color:var(--text3);font-family:var(--font-jp);font-size:12px;cursor:pointer;transition:color .2s;text-align:center;letter-spacing:.03em;position:relative;z-index:1}
.view-btn.active{color:#fff}
.view-btn:hover:not(.active){color:var(--text2)}

/* View visibility */
.timeline-view,.grid-view{display:none}
.active-view{display:block}

/* Thumb Grid */
.thumb-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:3px;margin-top:16px;border-radius:3px;overflow:hidden}
.thumb-item{aspect-ratio:1;overflow:hidden;cursor:pointer;border-radius:0;background:var(--bg3);display:block;min-height:0;border:none}
.thumb-item img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .3s}
.thumb-item:hover img{transform:scale(1.06)}
.thumb-item:hover{box-shadow:inset 0 0 0 2px var(--red)}
.thumb-item.page2{display:none}
.thumb-overlay{position:absolute;bottom:0;left:0;right:0;padding:8px;background:linear-gradient(to top,rgba(0,0,0,.85) 0%,transparent);opacity:0;transition:opacity .3s;pointer-events:none}
.thumb-item{position:relative}
.thumb-item:hover .thumb-overlay{opacity:1}
.thumb-title{font-family:var(--font-en);font-size:11px;font-weight:600;color:#fff;line-height:1.3}
.thumb-meta{font-size:9px;color:rgba(255,255,255,.6);margin-top:2px;font-family:var(--font-en);letter-spacing:.04em}
.thumb-cr{position:absolute;font-size:7px;color:rgba(255,255,255,0.25);font-family:var(--font-en);text-shadow:0 1px 2px rgba(0,0,0,0.5);pointer-events:none;z-index:1}
.thumb-cr.cr-top-left{top:4px;left:4px}.thumb-cr.cr-top-right{top:4px;right:4px}.thumb-cr.cr-bottom-left{bottom:4px;left:4px}.thumb-cr.cr-bottom-right{bottom:4px;right:4px}
.thumb-cr.cr-left{top:4px;left:4px}.thumb-cr.cr-right{top:4px;right:4px}

/* Pagination */
.pagination{display:flex;justify-content:center;gap:6px;margin-top:20px;padding-bottom:8px}
.page-btn{width:36px;height:36px;border:1px solid var(--border);border-radius:6px;background:color-mix(in srgb, var(--glass-ui-tint) var(--glass-ui-opacity), transparent);backdrop-filter:blur(var(--glass-ui-blur));-webkit-backdrop-filter:blur(var(--glass-ui-blur));color:var(--text2);font-family:var(--font-en);font-size:14px;cursor:pointer;transition:all .2s;display:flex;align-items:center;justify-content:center}
.page-btn:hover{border-color:var(--red);color:var(--red)}
.page-btn.active{background:var(--red);border-color:var(--red);color:#fff}

/* ═══════════════════════════════════════
   WITH537 SECTION
   ═══════════════════════════════════════ */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 24px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.5rem);
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.section-title .red { color: var(--red); }
.red { color: var(--red); }

.section-line {
  width: 40px;
  height: 3px;
  background: var(--red);
  margin-bottom: 16px;
}

/* ═══════════════════════════════════════
   STICKY FILTER BAR
   ═══════════════════════════════════════ */
.filter-bar {
  z-index: 50;
  background: none;
  padding: 10px 0;
  margin: 0 -24px;
  padding-left: 24px;
  padding-right: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: background 0.5s;
}

[data-theme="light"] .sticky-toolbar {
  background: rgba(242,240,237,0.98);
}
[data-theme="light"] .view-toggle-wrap {
  background: rgba(242,240,237,0.98);
}
[data-theme="light"] .filter-bar {
  background: none;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: 6px 16px;
  background: color-mix(in srgb, var(--glass-ui-tint) var(--glass-ui-opacity), transparent);
  backdrop-filter: blur(var(--glass-ui-blur));
  -webkit-backdrop-filter: blur(var(--glass-ui-blur));
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text2);
  font-family: var(--font-en);
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  text-transform: uppercase;
}

.filter-chip:hover { border-color: var(--red); color: var(--text); }

.filter-chip.active {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

/* ═══════════════════════════════════════
   TIMELINE
   ═══════════════════════════════════════ */
.timeline {
  margin-top: 24px;
}

.timeline-item {
  padding: 24px 16px;
  border-bottom: none;
  background: color-mix(in srgb, var(--glass-surface-tint) var(--glass-surface-opacity), transparent);
  backdrop-filter: blur(var(--glass-surface-blur));
  -webkit-backdrop-filter: blur(var(--glass-surface-blur));
  border-radius: 3px;
  margin-bottom: 8px;
  animation: fadeUp 0.5s var(--ease) both;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item.neighbor-item {
  border-left: 2px solid var(--sub-accent, #6366f1);
  padding-left: 12px;
  margin-left: 4px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.timeline-date {
  font-family: var(--font-en);
  font-size: 12px;
  color: var(--text3);
  letter-spacing: 0.08em;
  padding-left: 10px;
  border-left: 3px solid var(--red, #e63333);
  opacity: 0.7;
}

.timeline-tags {
  display: flex;
  gap: 6px;
}

.timeline-tag {
  font-family: var(--font-en);
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--bg2) 50%, transparent);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.timeline-tag:hover { border-color: var(--red); color: var(--red); }

.timeline-text {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.8;
  padding: 0 1em;
}

.timeline-images {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
}

.timeline-images::after { display: none; }

/* ── Tiling mode (default) ── */
.timeline-images.tiling-mode {
  display: grid;
  gap: 4px;
}
.timeline-images.tiling-mode.single { grid-template-columns: 1fr; }
.timeline-images.tiling-mode.double { grid-template-columns: 1fr 1fr; }
.timeline-images.tiling-mode.triple { grid-template-columns: 1fr 1fr; }
.timeline-images.tiling-mode.triple > :first-child { grid-row: span 2; }
.timeline-images.tiling-mode.triple > :first-child .timeline-img { aspect-ratio: auto; height: 100%; }
.timeline-images.tiling-mode.quad { grid-template-columns: 1fr 1fr; }
.timeline-images.tiling-mode.multi-5plus { grid-template-columns: 1fr 1fr; }
.timeline-images.tiling-mode.multi-5plus > :first-child { grid-column: span 2; }
.timeline-images.tiling-mode.multi-5plus > :first-child .timeline-img { aspect-ratio: 16/10; }
.timeline-images.tiling-mode .timeline-img { aspect-ratio: 1; transition: transform 0.4s; }
.timeline-images.tiling-mode.single .timeline-img { aspect-ratio: 16/10; }
.timeline-images.tiling-mode .timeline-img:hover { transform: scale(1.02); }

/* ── Slider mode ── */
.timeline-images.slider-mode { position: relative; overflow: hidden; }
.timeline-images.slider-mode .tl-img-wrap { display: block; }
.timeline-images.slider-mode.single .timeline-img { aspect-ratio: 16/10; }

.tl-slider-track {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}
.tl-slider-track > .tl-img-wrap {
  flex: 0 0 100%;
  min-width: 0;
}
.tl-slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  font-size: 16px;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: opacity 0.2s;
}
.tl-slider-arrow.left { left: 6px; }
.tl-slider-arrow.right { right: 6px; }
.tl-slider-arrow:hover { background: rgba(0,0,0,0.7); }
.tl-slider-counter {
  position: absolute;
  bottom: 6px;
  right: 8px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-en);
  z-index: 3;
  backdrop-filter: blur(4px);
}

.tl-img-wrap {
  position: relative;
  overflow: hidden;
}
.tl-img-cr {
  position: absolute;
  bottom: 4px;
  font-family: var(--font-en);
  font-size: 8px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.04em;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  z-index: 2;
  white-space: nowrap;
}
.tl-img-cr.cr-left { left: 6px; }
.tl-img-cr.cr-right { right: 6px; }
.tl-img-cr.cr-top-left { top: 4px; bottom: auto; left: 6px; }
.tl-img-cr.cr-top-right { top: 4px; bottom: auto; right: 6px; }
.tl-img-cr.cr-bottom-left { left: 6px; }
.tl-img-cr.cr-bottom-right { right: 6px; }

.tl-img-wrap .timeline-img,
.timeline-img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  cursor: pointer;
  display: block;
}

.timeline-actions {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  align-items: center;
}

.timeline-item-title {
  font-family: var(--font-en);
  font-size: 11px;
  color: var(--text3);
  letter-spacing: .06em;
  margin-top: 6px;
}

.clap-button {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--text2);
  font-family: var(--font-jp);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s;
}

.clap-button:hover {
  border-color: var(--red);
  color: var(--red);
}

.clap-button.clapped {
  background: var(--red-dim);
  border-color: var(--red);
  color: var(--red);
}

/* Emoji Reactions */
.reactions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  max-width: 100%;
}
.reaction-chip {
  display: flex; align-items: center; gap: 4px;
  height: 36px; padding: 0 10px; border-radius: 3px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--glass-ui-tint) var(--glass-ui-opacity), transparent); color: var(--text2);
  backdrop-filter: blur(var(--glass-ui-blur)); -webkit-backdrop-filter: blur(var(--glass-ui-blur));
  font-size: 15px; cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.reaction-chip img { pointer-events: none; }
.reaction-chip:hover, .reaction-chip.mine {
  border-color: var(--red); background: var(--red-dim); color: var(--red);
}
.reaction-chip .rc-count { font-size: 11px; font-family: var(--font-en); }
.emoji-add-btn {
  width: 36px; height: 36px; border-radius: 3px;
  border: 1px dashed var(--border);
  background: color-mix(in srgb, var(--glass-ui-tint) var(--glass-ui-opacity), transparent); color: var(--text3);
  backdrop-filter: blur(var(--glass-ui-blur)); -webkit-backdrop-filter: blur(var(--glass-ui-blur));
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.emoji-add-btn img { pointer-events: none; }
.emoji-add-btn:hover { border-color: var(--red); color: var(--red); }
.emoji-picker-popup {
  position: fixed; z-index: 9000;
  background: var(--bg2, #1a1a1a); border: 1px solid var(--border);
  border-radius: 12px; padding: 8px;
  display: flex; gap: 4px; flex-wrap: wrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  max-width: 240px;
}
.emoji-picker-popup button {
  width: 40px; height: 40px; border: none;
  background: none; border-radius: 8px;
  font-size: 22px; cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.emoji-picker-popup button img { pointer-events: none; }
.emoji-picker-popup button:hover { background: rgba(255,255,255,0.1); }

.tl-comment-btn {
  background: color-mix(in srgb, var(--glass-ui-tint) var(--glass-ui-opacity), transparent);
  backdrop-filter: blur(var(--glass-ui-blur)); -webkit-backdrop-filter: blur(var(--glass-ui-blur));
  border: 1px solid var(--border);
  color: var(--text3);
  font-size: 16px;
  cursor: pointer;
  width: 36px; height: 36px;
  padding: 0;
  border-radius: 3px;
  transition: color 0.2s, border-color 0.2s;
  line-height: 1;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.tl-comment-btn:hover { color: var(--text); border-color: var(--text3); }

.tl-share-btn {
  background: color-mix(in srgb, var(--glass-ui-tint) var(--glass-ui-opacity), transparent);
  backdrop-filter: blur(var(--glass-ui-blur)); -webkit-backdrop-filter: blur(var(--glass-ui-blur));
  border: 1px solid var(--border);
  color: var(--text3);
  cursor: pointer;
  width: 36px; height: 36px;
  padding: 0;
  border-radius: 3px;
  transition: color 0.2s, border-color 0.2s;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tl-share-btn:hover { color: var(--text); border-color: var(--text3); }
.tl-share-btn:active { transform: scale(0.92); }

.comment-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-en);
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.comment-header-bar {
  width: 3px;
  height: 14px;
  background: var(--red);
  border-radius: 2px;
  flex-shrink: 0;
}

.comment-toggle {
  background: none;
  border: none;
  color: var(--text3);
  font-family: var(--font-jp);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s;
}

.comment-toggle:hover { color: var(--text); }

/* Comment panel */
.comment-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease);
}

.comment-panel.open {
  max-height: 2000px;
}

.comment-input-area {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.comment-input-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.comment-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-jp);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.comment-input:focus { border-color: var(--red); }
.comment-input::placeholder { color: var(--text3); }

.comment-send {
  padding: 10px 20px;
  background: var(--red);
  border: none;
  border-radius: 6px;
  color: var(--btn-text);
  font-family: var(--font-jp);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: stretch;
  transition: background 0.2s;
}

.comment-send:hover { background: var(--red); filter: brightness(0.85); }

/* Comment tree items */
.comment-tree { margin-top: 10px; }
.comment-tree-item {
  padding: 6px 10px;
  margin-bottom: 4px;
  background: color-mix(in srgb, var(--bg3) 50%, transparent);
  border-left: 2.5px solid transparent;
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  gap: 6px;
}
.cmt-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}
.cmt-content { flex: 1; min-width: 0; }
.cmt-content .cmt-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}
.cmt-content .cmt-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}
.cmt-content .cmt-date {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--font-mono, monospace);
}
.cmt-content .cmt-body {
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
}
.cmt-content .cmt-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.cmt-like-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text3);
  font-size: 11px;
  cursor: pointer;
  padding: 3px 8px;
  font-family: var(--font-jp);
  transition: all .2s;
}
.cmt-like-btn:hover { border-color: var(--text3); }
.cmt-like-btn.liked { color: var(--red); border-color: var(--red); }
@keyframes heartPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.5); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.cmt-like-btn.heart-pop { animation: heartPop 0.4s ease; }
.cmt-reply-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text3);
  font-size: 12px;
  cursor: pointer;
  padding: 3px 10px;
  font-family: var(--font-jp);
}
.cmt-reply-btn:hover { color: var(--text); border-color: var(--text3); }
.cmt-del-btn {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 10px;
  cursor: pointer;
  padding: 2px 4px;
  font-family: var(--font-jp);
  opacity: 0.6;
}
.cmt-del-btn:hover { opacity: 1; color: var(--red); }
.comment-replies {
  margin-left: 0;
  padding-left: 16px;
}
.comment-replies .comment-replies {
  padding-left: 0;
}
.comment-replies .comment-tree-item {
  opacity: 0.92;
  font-size: 12px;
}
.comment-tree-item.cmt-orphan {
  border-left: 2.5px solid transparent;
}
.comment-tree-item.cmt-has-replies {
  border-left: 2.5px solid var(--border);
}
.comment-tree-item.cmt-reply {
  border-left: 2.5px solid var(--border);
}
.cmt-reply-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0 4px 16px;
  padding-left: 0;
}
.cmt-reply-form .comment-input-row {
  display: flex;
  gap: 6px;
}
.cmt-reply-form .comment-input {
  flex: 1;
  min-width: 0;
}
.cmt-reply-form .comment-send {
  flex-shrink: 0;
}
.comment-tree-empty {
  font-size: 12px;
  color: var(--text3);
  text-align: center;
  padding: 12px 0 4px;
}
.comment-name-input {
  padding: 8px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-jp);
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.comment-name-input:focus { border-color: var(--red); }
.comment-name-input::placeholder { color: var(--text3); }

/* ═══════════════════════════════════════
   GALLERY GRID (for Works page)
   ═══════════════════════════════════════ */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.gallery-card {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg3);
  cursor: pointer;
  transition: transform 0.3s;
}

.gallery-card:hover { transform: translateY(-3px); }

.gallery-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  transition: transform 0.5s;
}

.gallery-card:hover img { transform: scale(1.04); }

.gallery-card .card-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.gallery-card:hover .card-overlay { opacity: 1; }

.gallery-cr {
  position: absolute;
  top: 6px; left: 6px;
  font-size: 8px;
  color: rgba(255,255,255,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  z-index: 2;
  pointer-events: none;
}

.card-title {
  font-family: var(--font-en);
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.card-meta {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
  letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════
   ABOUT
   ═══════════════════════════════════════ */
#page-about .section,
#home-about .section {
  background: color-mix(in srgb, var(--glass-surface-tint) var(--glass-surface-opacity), transparent);
  border-radius: var(--radius, 3px);
  backdrop-filter: blur(var(--glass-surface-blur));
  -webkit-backdrop-filter: blur(var(--glass-surface-blur));
}

.about-content {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: start;
}

.about-avatar {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius, 2px);
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  font-size: 12px;
  overflow: hidden;
}
body.round .about-avatar { border-radius: 50%; }

.about-bio { max-width: 600px; }

.about-bio h3 {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}

.about-bio p {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 12px;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
}

.skill-tag {
  font-family: var(--font-en);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text2);
  text-transform: uppercase;
}

/* ═══════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════ */
.footer {
  margin-top: auto;
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid var(--border);
  font-family: var(--font-en);
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 0.15em;
  background: color-mix(in srgb, var(--glass-footer-tint) var(--glass-footer-opacity), transparent);
  backdrop-filter: blur(var(--glass-footer-blur));
  -webkit-backdrop-filter: blur(var(--glass-footer-blur));
}

/* ═══════════════════════════════════════
   WEB CLAP (Panel)
   ═══════════════════════════════════════ */

.clap-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 8000;
  opacity: 0;
  transition: opacity 0.3s, visibility 0s 0.3s;
  pointer-events: none;
  visibility: hidden;
}
.clap-panel-overlay.open { opacity: 1; pointer-events: auto; visibility: visible; transition: opacity 0.3s, visibility 0s; }

.clap-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg2, #1a1a1a);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  z-index: 8001;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), visibility 0s 0.35s;
  max-height: 70vh;
  overflow-y: auto;
  visibility: hidden;
}
.clap-panel.open { transform: translateY(0); visibility: visible; transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), visibility 0s; }
.clap-panel-handle {
  width: 40px; height: 4px;
  background: var(--text3);
  border-radius: 2px;
  margin: 0 auto 16px;
  opacity: 0.4;
}
.clap-panel-title {
  font-family: var(--font-en);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.clap-panel-sub {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 16px;
}
.clap-panel textarea {
  width: 100%;
  min-height: 80px;
  background: var(--bg3, #111);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-jp);
  font-size: 14px;
  padding: 12px;
  resize: vertical;
  box-sizing: border-box;
}
.clap-panel textarea:focus { outline: none; border-color: var(--red); }
.clap-panel-name {
  width: 100%;
  background: var(--bg3, #111);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-jp);
  font-size: 13px;
  padding: 10px 12px;
  margin-top: 8px;
  box-sizing: border-box;
}
.clap-panel-name:focus { outline: none; border-color: var(--red); }
.clap-panel-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}
.clap-send-btn {
  flex: 1;
  padding: 12px;
  background: var(--red);
  color: var(--btn-text);
  border: none;
  border-radius: 8px;
  font-family: var(--font-jp);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.clap-send-btn:hover { opacity: 0.85; }
.clap-send-btn:disabled { opacity: 0.4; cursor: default; }
.clap-anon-note {
  font-size: 10px;
  color: var(--text3);
  margin-top: 6px;
}

/* DM popup */
.dm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 8000;
  opacity: 0; pointer-events: none; visibility: hidden;
  transition: opacity 0.3s, visibility 0s 0.3s;
}
.dm-overlay.open { opacity: 1; pointer-events: auto; visibility: visible; transition: opacity 0.3s, visibility 0s; }
.dm-popup {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 90vw; max-width: 400px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg2, #1a1a1a);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  z-index: 8001;
  opacity: 0; pointer-events: none; visibility: hidden;
  transition: opacity 0.25s, transform 0.25s, visibility 0s 0.25s;
}
.dm-popup.open {
  opacity: 1; pointer-events: auto; visibility: visible;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 0.25s, transform 0.25s, visibility 0s;
}
.dm-field {
  width: 100%;
  background: var(--bg3, #111);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-jp);
  font-size: 13px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-sizing: border-box;
  outline: none;
}
.dm-field:focus { border-color: var(--red); }
.dm-field.error { border-color: var(--red); }

/* ═══════════════════════════════════════
   LIGHTBOX
   ═══════════════════════════════════════ */
.lightbox {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.95);
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox.active { opacity: 1; pointer-events: auto; touch-action: none; }

.lightbox-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  z-index: 702;
}

.lightbox-arrow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 60px;
  border-radius: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  z-index: 701;
  display: none;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.6s ease;
}
.lightbox-arrow::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0; right: 0;
  transition: opacity 0.6s ease;
}
.lightbox-arrow.left { left: 0; }
.lightbox-arrow.left::before { background: linear-gradient(to right, rgba(0,0,0,0.5), transparent); }
.lightbox-arrow.right { right: 0; }
.lightbox-arrow.right::before { background: linear-gradient(to left, rgba(0,0,0,0.5), transparent); }
.lightbox.has-nav .lightbox-arrow { display: flex; }
/* Idle state: fade out background, arrow to 50% */
.lightbox-arrow.idle { opacity: 0.5; }
.lightbox-arrow.idle::before { opacity: 0; }

.lightbox-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 12px;
  padding: 4px 14px;
  border-radius: 20px;
  font-family: var(--font-en);
  z-index: 701;
  backdrop-filter: blur(4px);
  display: none;
}
.lightbox.has-nav .lightbox-counter { display: block; }

/* Post Detail Overlay */
.post-detail-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #000;
  z-index: 650;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.post-detail-overlay.active {
  opacity: 1;
  pointer-events: auto;
  touch-action: manipulation;
}

.post-detail-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 0 80px;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.35s ease;
}

.post-detail-overlay.active .post-detail-inner {
  transform: translateY(0);
  opacity: 1;
}

.post-detail-close {
  position: fixed;
  top: 12px; right: 12px;
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 660;
  transition: background 0.2s;
}

.post-detail-close:hover {
  background: rgba(255,255,255,0.2);
}

.post-detail-img {
  width: 100%;
  display: block;
  cursor: zoom-in;
}

.post-detail-images {
  position: relative;
  overflow: hidden;
}

.post-detail-slider {
  display: flex;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.post-detail-slide {
  min-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-detail-slide-inner {
  position: relative;
  display: inline-block;
  width: 100%;
}

.post-detail-slide-inner img {
  width: 100%;
  display: block;
  cursor: zoom-in;
}

.post-detail-slide-inner .pd-copyright {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-family: var(--font-en);
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.05em;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  z-index: 2;
}

.post-detail-arrow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 60px;
  background: none;
  border: none;
  border-radius: 0;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  z-index: 5;
  transition: opacity 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.post-detail-arrow::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0; right: 0;
  transition: opacity 0.6s ease;
}
.post-detail-arrow.left { left: 0; }
.post-detail-arrow.left::before { background: linear-gradient(to right, rgba(0,0,0,0.5), transparent); }
.post-detail-arrow.right { right: 0; }
.post-detail-arrow.right::before { background: linear-gradient(to left, rgba(0,0,0,0.5), transparent); }
.post-detail-arrow.idle { opacity: 0.5; }
.post-detail-arrow.idle::before { opacity: 0; }

.post-detail-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
}

.post-detail-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transition: background 0.2s;
}

.post-detail-dot.active {
  background: rgba(255,255,255,0.8);
}

.post-detail-info {
  padding: 20px 16px;
  color: #fff;
}

.post-detail-title {
  font-family: var(--font-en);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.post-detail-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  font-family: var(--font-en);
}

.post-detail-cat {
  padding: 2px 10px;
  background: var(--red);
  border-radius: 4px;
  color: var(--btn-text);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.post-detail-body {
  font-size: 14px;
  line-height: 1.8;
  color: rgba(255,255,255,0.75);
  white-space: pre-line;
  margin-bottom: 16px;
}

/* ═══ Video / Embed ═══ */
.embed-video {
  position: relative;
  width: 100%;
  max-width: 560px;
  padding-bottom: min(56.25%, 315px);
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.embed-video iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.embed-tweet {
  margin: 10px 0;
  max-width: 550px;
}
.post-detail-body .embed-video,
.post-detail-body .embed-tweet,
.timeline-text .embed-video,
.timeline-text .embed-tweet {
  white-space: normal;
}

.post-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.post-detail-tag {
  padding: 2px 8px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 2px;
  font-family: var(--font-en);
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: none;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.post-detail-tag:hover { border-color: rgba(255,255,255,0.5); color: rgba(255,255,255,0.9); }

/* ═══════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════ */
@keyframes heroIn {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes clapBurst {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ═══════════════════════════════════════
   IMAGE PROTECTION & WATERMARK
   ═══════════════════════════════════════ */
img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.lightbox::after { display: none; }

.lb-wrap {
  position: relative;
  display: inline-flex;
  max-width: 92vw;
  max-height: 92vh;
  touch-action: none;
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.15s ease;
  will-change: transform;
}
.lb-wrap.gesturing { transition: opacity 0.15s ease; }
.lb-wrap.zoomed { transition: opacity 0.15s ease; }
.lightbox.active .lb-wrap { transform: scale(1); }
.lb-wrap img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  transition: opacity 0.15s ease;
}

.lb-copyright {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-family: var(--font-en);
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.05em;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
  z-index: 2;
}

.timeline-img {
  position: relative;
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

/* Timeline width constraints */
@media (min-width: 769px) and (max-width: 1024px) {
  .thumb-grid { grid-template-columns: repeat(4, 1fr); }
  .timeline { max-width: 75%; margin: 0 auto; }
}

@media (min-width: 1025px) {
  .hero-title { font-size: clamp(3rem, 8vw, 6rem); }
  .timeline { max-width: 60%; margin: 0 auto; }
}

/* View toggle wrap (same bg as sticky-toolbar) */
.view-toggle-wrap {
  background: var(--bg, #0a0a0a);
  margin: 0 -24px;
  padding: 8px 24px 0;
}
/* Sticky toolbar */
.sticky-toolbar {
  position: sticky;
  top: 60px;
  z-index: 50;
  background: var(--bg, #0a0a0a);
  margin: 0 -24px;
  padding: 0 24px;
}

/* Scroll to top */
/* Scroll to top */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  background: var(--red);
  color: var(--btn-text);
  border: none;
  border-radius: var(--scroll-btn-radius, 4px);
  cursor: pointer;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.scroll-top-btn.visible {
  opacity: 0.7;
  pointer-events: auto;
}
.scroll-top-btn:hover {
  opacity: 1;
  transform: translateY(-2px);
}

/* Sort buttons */
.sort-bar {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.sort-btn {
  font-size: 10px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: none;
  color: var(--text3);
  cursor: pointer;
  font-family: var(--font-en);
  letter-spacing: 0.04em;
  transition: all 0.2s;
}
.sort-btn.active {
  border-color: var(--red);
  color: var(--red);
}

@media (max-width: 768px) {
  .about-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .about-avatar { max-width: 160px; }
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .thumb-grid { grid-template-columns: repeat(3, 1fr); }
  .section { padding: 60px 16px; }
  .works-entry { flex-direction: column; gap: 2px; }
  .works-date { min-width: auto; }
  .works-note { padding-left: 0; }
  /* removed */
}

@media (max-width: 480px) {
  .gallery { grid-template-columns: 1fr; }
  .hero-buttons { flex-direction: column; gap: 10px; }
  .hero-btn { min-width: 220px; }
  .sticky-toolbar { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .view-toggle-wrap { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .detail-filter-wrap { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
}

/* News: wider on tablet/PC */
@media (min-width: 768px) {
  .news-section { max-width: 340px !important; }
}

@keyframes newsFloat {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(4px); opacity: 1; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.scroll-anim-hidden { opacity: 0; }
.scroll-anim-fadeIn { animation: fadeIn 0.6s ease forwards; }
.scroll-anim-slideUp { animation: slideUp 0.6s ease forwards; }
.scroll-anim-slideDown { animation: slideDown 0.6s ease forwards; }

/* BG image animations */
@keyframes bgBreathe { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes bgBlink { 0%,45% { opacity: 1; } 50%,95% { opacity: 0; } 100% { opacity: 1; } }
@keyframes bgFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes bgIdle { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.bg-anim-breathe { animation: bgBreathe 4s ease-in-out infinite; }
.bg-anim-blink { animation: bgBlink 1.2s steps(1) infinite; }
.bg-anim-float { animation: bgFloat 3s ease-in-out infinite; }
.bg-anim-idle { animation: bgIdle 0.8s steps(2) infinite; }

/* Tile flow animations */
/* Tile flow: keyframes are generated dynamically in JS per-layer to match tile size */

/* ═══════ Stage Layer ═══════ */
#stageLayer {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--screen-h, 100vh);
  z-index: -12;
  pointer-events: none;
  overflow: hidden;
}
@keyframes stageRotate {
  0% { transform: rotate(0deg) scale(1.5); }
  100% { transform: rotate(360deg) scale(1.5); }
}
@keyframes stagePulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}
@keyframes stageSlide {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 200%; }
}
@keyframes stageAurora1 {
  0%, 100% { transform: translateX(-20%) translateY(-10%) rotate(0deg); opacity: 0.7; }
  33% { transform: translateX(10%) translateY(5%) rotate(120deg); opacity: 1; }
  66% { transform: translateX(-10%) translateY(-5%) rotate(240deg); opacity: 0.5; }
}
@keyframes stageAurora2 {
  0%, 100% { transform: translateX(20%) translateY(10%) rotate(0deg); opacity: 0.5; }
  33% { transform: translateX(-10%) translateY(-5%) rotate(-120deg); opacity: 0.8; }
  66% { transform: translateX(10%) translateY(5%) rotate(-240deg); opacity: 1; }
}

/* ═══════════════════════════════════════
   Book Viewer
   ═══════════════════════════════════════ */
.book-viewer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  display: flex;
  flex-direction: column;
}
.book-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.3s;
}
@media (max-height: 500px) {
  .book-header {
    padding: 6px 10px;
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
    gap: 8px;
    font-size: 12px;
  }
  .book-close { font-size: 16px; padding: 2px 6px; }
}
/* iframe preview: safe-area-inset-top is inherited but not needed */
.bv-in-iframe .book-header {
  padding-top: 8px;
}
/* Pause all background processing while book viewer is fullscreen */
body.bv-active .bg-outer,
body.bv-active .bg-inner,
body.bv-active #stageLayer,
body.bv-active #particleContainer,
body.bv-active .hero-hartworks::before {
  animation-play-state: paused !important;
  will-change: auto !important;
  visibility: hidden;
}
body.bv-active #particleContainer {
  display: none !important;
}
.book-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  flex-shrink: 0;
}
.book-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-page-counter {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  font-family: var(--font-en, sans-serif);
  flex-shrink: 0;
}
.book-cr {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40%;
  flex-shrink: 1;
  letter-spacing: 0.03em;
}
/* Watermark overlay — sits on .book-viewer (outside preserve-3d) */
.bv-wm-overlay {
  position: absolute;
  top: 60px; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}
.bv-wm-overlay span {
  transform: rotate(-30deg);
  font-size: clamp(14px, 5vw, 32px);
  color: rgba(128,128,128,0.15);
  white-space: nowrap;
  letter-spacing: 0.1em;
  font-family: var(--font-en, sans-serif);
  user-select: none;
  -webkit-user-select: none;
}
.book-footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  padding: 12px 16px;
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.3s;
}
.book-progress {
  width: 100%;
  height: 28px;
  accent-color: var(--red, #e63333);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  touch-action: pan-x;
  margin: 0;
}
.book-progress::-webkit-slider-runnable-track {
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}
.book-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--red, #e63333);
  cursor: pointer;
  margin-top: -9px;
}
.book-viewer.controls-hidden .book-header,
.book-viewer.controls-hidden .book-footer {
  opacity: 0;
  pointer-events: none;
}
.book-pages {
  flex: 1;
  position: relative;
  z-index: 1;
  overflow: hidden;
  touch-action: pan-y;
  transition: transform 0.25s ease;
  background: #000;
}
.book-pages.bv-zoomed {
  touch-action: none;
  overflow: visible;
  transition: none;
}
.book-page {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
}
/* Front/Back face layers */
.bp-front, .bp-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.bp-back {
  transform: rotateY(180deg);
}
/* Paper area — sized by format aspect ratio, background fills image gaps */
.bp-paper {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--bv-page-ratio, 0.707);
  background: #fff;
  overflow: hidden;
}
.book-page img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.bp-paper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* Page curl shadow overlay — display:none by default.
   In preserve-3d, even opacity:0 elements cause rendering artifacts.
   JS toggles display + sets background/opacity during flip only. */
.bp-shadow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
}
/* Static spine gutter — always-visible shadow on the spine edge of each page.
   Uses ::after on bp-paper (overflow:hidden clips to paper area). */
.book-viewer.spread-active .book-page[data-side="left"] .bp-front .bp-paper::after,
.book-viewer.spread-active .book-page[data-side="right"] .bp-front .bp-paper::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 24px;
  pointer-events: none;
  z-index: 2;
}
.book-viewer.spread-active .book-page[data-side="left"] .bp-front .bp-paper::after {
  right: 0;
  background: linear-gradient(to left, rgba(0,0,0,0.15), transparent);
}
.book-viewer.spread-active .book-page[data-side="right"] .bp-front .bp-paper::after {
  left: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.15), transparent);
}
/* Back cover / endpaper placeholder — sized by aspect-ratio within flex parent */
.bp-backcover {
  height: 100%;
  aspect-ratio: var(--bv-page-ratio, 0.707);
  max-width: 100%;
  margin: 0 auto;
}
/* Spread (individual pages positioned side by side via JS) */
.book-viewer.spread-active .book-page {
  width: 50%;
}
/* Spine-align: front faces hug spine, back faces mirror (rotateY 180deg flips axis) */
.book-viewer.spread-active .book-page[data-side="left"] .bp-front {
  justify-content: flex-end;
}
.book-viewer.spread-active .book-page[data-side="left"] .bp-back {
  justify-content: flex-start;
}
.book-viewer.spread-active .book-page[data-side="right"] .bp-front {
  justify-content: flex-start;
}
.book-viewer.spread-active .book-page[data-side="right"] .bp-back {
  justify-content: flex-end;
}
.book-viewer.spread-active .book-page img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Flip mode (3D page turn) */
.book-pages.flip-mode {
  perspective: 1000px;
  perspective-origin: center center;
}
.book-pages.flip-mode .book-page {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Spread + Flip: perspective at spine center */
.book-pages.spread-flip {
  perspective: 1200px;
  perspective-origin: 50% 50%;
}
/* Spine shadow and page-edge box-shadow are applied via JS inline
   style during flip gesture ONLY. CSS rules for these were removed
   because preserve-3d + rotation rebuild corrupts their rendering. */
.book-flip-toggle {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  color: #fff;
  font-size: 18px;
  padding: 4px 10px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  transition: background 0.2s;
}
.book-flip-toggle:active {
  background: rgba(255,255,255,0.3);
}
.book-bookmark-toast {
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  padding: 6px 0 2px;
  transition: opacity 0.5s;
}
/* Novel cover placeholder (no images) */
.book-novel-cover {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--bg3, #1a1a2e), var(--bg2, #111));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text3, #999);
  font-size: 12px;
  border-radius: inherit;
}

/* Novel mode */
.book-novel {
  padding: 24px;
  font-size: var(--book-font-size, 16px);
  line-height: 1.8;
  color: #e0e0e0;
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.book-novel-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

/* Book badge on gallery/TL */
.book-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  font-size: 16px;
  background: rgba(0,0,0,0.6);
  border-radius: 6px;
  padding: 2px 5px;
  pointer-events: none;
  line-height: 1;
}
.book-cover-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.15);
  pointer-events: none;
  transition: background 0.2s;
}
.book-cover-wrap:active .book-cover-overlay {
  background: rgba(0,0,0,0.35);
}
/* end of styles */
.book-cover-badge {
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  letter-spacing: 0.05em;
}
.timeline-item.book-post .timeline-images {
  position: relative;
}
.timeline-item.book-post .timeline-images::after {
  content: '📖';
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  font-size: 16px;
  background: rgba(0,0,0,0.6);
  border-radius: 6px;
  padding: 2px 5px;
  pointer-events: none;
  line-height: 1;
}
