/* ========================================
   电子杂志相册 - Global Styles (iOS Edition)
   Magazine Rack + Magazine Reader
   ======================================== */

/* --- Reset & Variables --- */
:root {
  --bg: #e0e0e0;
  --bg-card: #ffffff;
  --bg-card-hover: #f9f9fb;
  --text: #313131;
  --text-secondary: #585858;
  --accent: #c9a96e;
  --accent-dim: #a68a4e;
  --border: rgba(0,0,0,0.06);
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow: none;
  --transition: 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  --spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", "Menlo", "Consolas", monospace;
}

/* Dark mode */
[data-theme="dark"] {
  --bg: #585858;
  --bg-card: #3e3e3e;
  --bg-card-hover: #2c2c2e;
  --text: #f5f5f7;
  --text-secondary: #dfdfdf;
  --border: rgba(255,255,255,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--accent); text-decoration: none; }
img { display: block; max-width: 100%; }

/* ========================================
   Magazine Rack (index.html)
   ======================================== */

.rack-header {
  text-align: center;
  padding: clamp(40px, 8vh, 80px) 20px clamp(24px, 4vh, 48px);
}

.rack-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 6px;
}

.rack-header .subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 400;
}

.rack-header .accent-line {
  width: 32px;
  height: 2px;
  background: var(--accent);
  margin: 16px auto 0;
  border-radius: 1px;
}

.rack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 22px;
  justify-content: center;
}

/* Layout-controlled column counts */
.rack-grid.cols-3 { grid-template-columns: repeat(3, 1fr); max-width: 1100px; }
.rack-grid.cols-4 { grid-template-columns: repeat(4, 1fr); max-width: 1500px; }

/* Featured card: 2x2 grid span */
.rack-grid.has-featured .magazine-card.featured {
  grid-column: 1 / span 2;
  grid-row: 1 / span 2;
}
.rack-grid.featured-right .magazine-card.featured {
  grid-column: 3 / span 2;
  grid-row: 1 / span 2;
}
.rack-grid.cols-3.featured-right .magazine-card.featured {
  grid-column: 2 / span 2;
  grid-row: 1 / span 2;
}

.magazine-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--spring), background var(--transition);
  border: 1px solid var(--border);
}

.magazine-card:active {
  transform: scale(0.97);
}

.magazine-card .cover-wrap {
  position: relative;
  width: 100%;
  padding-top: 133%; /* 3:4 aspect ratio */
  overflow: hidden;
  background: transparent;
}

.magazine-card .cover-wrap img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.magazine-card:hover .cover-wrap img {
  transform: scale(1.04);
}

.magazine-card .info {
  padding: 14px 16px 16px;
}

.magazine-card .info h3 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}

.magazine-card.featured .info h3 {
  font-size: 1.15rem;
}

.magazine-card .info .meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.magazine-card .info .pages-badge {
  background: var(--accent-dim);
  color: #1a1a1a;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Empty state */
.rack-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
  grid-column: 1 / -1;
}

.rack-empty .icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

/* Loading */
.rack-loading {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
  grid-column: 1 / -1;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Error */
.rack-error {
  text-align: center;
  padding: 80px 20px;
  color: #e74c3c;
  grid-column: 1 / -1;
}

/* Footer */
.rack-footer {
  text-align: center;
  padding: 0 20px 30px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  opacity: 0.4;
  letter-spacing: 0.06em;
}

/* ========================================
   Bottom Toolbar - Rack (index.html)
   ======================================== */

.rack-toolbar {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 200;
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--radius-full);
  padding: 6px 10px;
  box-shadow: none;
}

[data-theme="dark"] .rack-toolbar {
  background: rgba(163, 163, 164, 0.8);
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.tool-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-size: 1rem;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.tool-btn:active {
  transform: scale(0.88);
  background: rgba(128,128,128,0.15);
}

.tool-btn.active {
  color: var(--accent);
}

.tool-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.5;
}

/* ========================================
   Magazine Reader (reader.html)
   ======================================== */

.reader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
}

/* Top bar */
.reader-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
  pointer-events: none;
}

.reader-topbar > * { pointer-events: auto; }

.btn-back {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(200, 200, 200, 0.6);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--transition);
}

/* 返回按钮 - 左下角固定 */
.btn-back-fixed {
  position: absolute;
  bottom: 30px;
  left: 30px;
  z-index: 100;
}

[data-theme="dark"] .btn-back {
  background: rgba(60, 60, 60, 0.75);
  border-color: rgba(255,255,255,0.1);
}

.btn-back:active {
  transform: scale(0.94);
  background: rgba(255,255,255,0.1);
}

.btn-back svg { width: 14px; height: 14px; }

/* Music button in topbar (desktop hint) */
.btn-music {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(200, 200, 200, 0.6);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 7px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-music.playing {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-music svg { width: 14px; height: 14px; }

/* Page container */
.reader-pages {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ========================================
   Page - Blur Background + Foreground
   ======================================== */

.page {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.45s ease;
  opacity: 0;
  pointer-events: none;
}

.page.active {
  opacity: 1;
  z-index: 10;
  pointer-events: auto;
}

/* Background blur layer */
.page-bg-blur {
  position: absolute;
  inset: -10px; /* Extend to cover blur edge bleeding */
  z-index: 0;
  overflow: hidden;
}

.page-bg-blur img,
.page-bg-blur video {
  width: calc(100% + 20px);
  height: calc(100% + 20px);
  object-fit: cover;
  filter: blur(50px) brightness(0.8);
  transform: scale(1.05);
}

/* Foreground layer - contain, long edge fills screen */
.page-fg {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-fg img,
.page-fg video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ========================================
   Cover Page (no blur background)
   ======================================== */

.page-cover {
  flex-direction: column;
  background: var(--bg);
  transition: background var(--transition);
}

.page-cover .cover-image {
  max-width: 92vw;
  max-width: 92dvw;
  max-height: 68vh;
  max-height: 68dvh;
  object-fit: contain;
  border-radius: 6px;
  animation: coverReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  z-index: 1;
  position: relative;
}

@keyframes coverReveal {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.page-cover .cover-title {
  margin-top: 24px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.page-cover .cover-title h2 {
  font-size: 1.4rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--text);
}

.page-cover .cover-title p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.page-cover .hint-swipe {
  margin-top: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.5;
  animation: pulse 2s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* Optional background texture for cover */
.page-cover-bg-texture {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.06;
  pointer-events: none;
}

.page-cover-bg-texture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ========================================
   Video Page Specific
   ======================================== */

.page-video .page-fg {
  background: transparent;
}

.page-video .video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
}

.page-video .video-play-overlay .play-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--spring), background var(--transition);
}

.page-video .video-play-overlay .play-btn:active {
  transform: scale(0.9);
  background: rgba(255,255,255,0.22);
}

.page-video .video-play-overlay .play-btn::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 16px solid white;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  margin-left: 3px;
}

/* ========================================
   Navigation Areas
   ======================================== */

.nav-area {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 45%;
  z-index: 20;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.nav-area-left { left: 0; }
.nav-area-right { right: 0; }

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

@media (hover: hover) {
  .nav-area:hover .nav-arrow {
    opacity: 0.6;
  }
}

.nav-area-left .nav-arrow { left: 8px; }
.nav-area-right .nav-arrow { right: 8px; }

/* ========================================
   Bottom Toolbar - Reader
   ======================================== */

.reader-toolbar {
  position: absolute;
  bottom: 30px;
  right: 30px;
  z-index: 100;
  display: flex;
  gap: 6px;
  background: rgba(200, 200, 200, 0.6);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--radius-full);
  padding: 5px 8px;
}

[data-theme="dark"] .reader-toolbar {
  background: rgba(60, 60, 60, 0.75);
  border-color: rgba(255,255,255,0.1);
}

.reader-toolbar .tool-btn {
  width: 28px;
  height: 28px;
  font-size: 0.95rem;
}

.reader-toolbar .tool-btn.active {
  color: var(--accent);
}

.reader-toolbar .tool-btn.favorited {
  color: #e74c3c;
}

.reader-toolbar .tool-btn.in-cart {
  color: var(--accent);
}

.reader-toolbar .tool-btn svg {
  width: 14px;
  height: 14px;
}

/* Toolbar divider */
.reader-toolbar .tool-divider {
  width: 1px;
  background: rgba(0,0,0,0.1);
  margin: 4px 2px;
  border-radius: 1px;
}

[data-theme="dark"] .reader-toolbar .tool-divider {
  background: rgba(255,255,255,0.1);
}

/* ========================================
   Bottom Bar (Dots + Counter)
   ======================================== */

.reader-bottombar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 99;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 8px 16px 70px;
  background: linear-gradient(to top, rgba(0,0,0,0.35), transparent);
  pointer-events: none;
}

.page-counter {
  font-size: 0.8rem;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  text-align: center;
  opacity: 0.8;
  pointer-events: none;
}

.page-dots {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 55vw;
}

.page-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  pointer-events: auto;
}

.page-dot.active {
  background: var(--accent);
  width: 16px;
  border-radius: 3px;
}

.page-dot.cover-dot {
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
}

.page-dot.cover-dot.active {
  border-color: var(--accent);
  background: var(--accent);
}

/* ========================================
   Page Info Overlay
   ======================================== */

.page-info-overlay {
  position: absolute;
  top: max(52px, calc(env(safe-area-inset-top) + 32px));
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  opacity: 0.4;
  pointer-events: none;
  z-index: 15;
}

/* ========================================
   Wishlist Page
   ======================================== */

.page-wishlist {
  flex-direction: column;
  background: var(--bg-card);
  padding: 50px 16px 100px;
  justify-content: flex-start;
  align-items: stretch !important;
  overflow-y: auto;
}

.page-wishlist .wishlist-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  justify-content: center;
  align-content: start;
}

.page-wishlist .wishlist-thumb {
  position: relative;
  width: 100%;
  padding-top: 133%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.page-wishlist .wishlist-thumb img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page-wishlist .wishlist-num {
  position: absolute;
  bottom: 0;
  left: 0;
  max-width: calc(100% - 20px);
  background: rgba(0,0,0,0.5);
  color: rgba(255,255,255,0.9);
  font-size: 0.55rem;
  font-family: var(--font-mono);
  padding: 3px 6px;
  border-radius: 0 var(--radius-sm) 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-wishlist .wishlist-del {
  position: absolute;
  bottom: 0;
  right: 0;
  height: 20px;
  width: 20px;
  border: none;
  background: rgba(0,0,0,0.5);
  color: rgba(255,255,255,0.7);
  font-size: 0.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s ease;
  line-height: 1;
  padding: 0;
}
.page-wishlist .wishlist-del:hover {
  background: rgba(220,50,50,0.75);
  color: #fff;
}
.page-wishlist .wishlist-del:active {
  transform: scale(0.85);
}

@media (max-width: 640px) {
  .page-wishlist .wishlist-items {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }
}

.page-wishlist .wishlist-empty {
  color: var(--text-secondary);
  font-size: 0.85rem;
  opacity: 0.6;
}

/* Wishlist toolbar */
.wishlist-toolbar {
  display: none;
}

/* ========================================
   Transition Effects
   ======================================== */

/* 1. Fade */
.page.transition-fade-in {
  animation: fxFadeIn 0.8s ease both;
}
.page.transition-fade-out {
  animation: fxFadeOut 0.6s ease both;
}

@keyframes fxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fxFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* 2. Slide from right */
.page.transition-slide-in {
  animation: fxSlideIn 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
.page.transition-slide-out {
  animation: fxSlideOut 0.45s cubic-bezier(0.55, 0.06, 0.68, 0.19) both;
}

@keyframes fxSlideIn {
  from { opacity: 0; transform: translateX(80px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes fxSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-60px); }
}

/* 3. Slide-down cut */
.page.transition-slidedown-in {
  animation: fxSlideDownIn 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
.page.transition-slidedown-out {
  animation: fxSlideDownOut 0.45s cubic-bezier(0.55, 0.06, 0.68, 0.19) both;
}

@keyframes fxSlideDownIn {
  from { opacity: 0; transform: translateY(-80px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fxSlideDownOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(60px); }
}

/* 4. Slow Zoom */
.page.transition-zoom-in {
  animation: fxZoomIn 0.9s cubic-bezier(0.25, 0.1, 0.25, 1) both;
}
.page.transition-zoom-out {
  animation: fxZoomOut 0.6s ease both;
}

@keyframes fxZoomIn {
  from { opacity: 0; transform: scale(1.08); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes fxZoomOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.96); }
}

/* ========================================
   Loading State
   ======================================== */

.reader-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.reader-loading .spinner {
  margin-bottom: 16px;
}

/* Error state */
.reader-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #e74c3c;
  text-align: center;
  padding: 20px;
}

.reader-error button {
  margin-top: 16px;
  padding: 10px 24px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  transition: transform var(--spring);
}

.reader-error button:active {
  transform: scale(0.94);
}

/* ========================================
   Touch Hint
   ======================================== */

.touch-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-size: 1.5rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.2em;
}

.touch-hint.visible {
  opacity: 0.5;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 640px) {
  .rack-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    padding: 0 12px 22px;
  }
  .rack-grid.cols-3,
  .rack-grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  /* On mobile 2-col, featured still spans both columns */
  .rack-grid.has-featured .magazine-card.featured {
    grid-column: span 2;
    grid-row: span 2;
  }
  .rack-grid.featured-right .magazine-card.featured {
    grid-column: span 2;
  }

  .magazine-card .info {
    padding: 10px 12px 12px;
  }

  .magazine-card .info h3 {
    font-size: 0.82rem;
  }
  .magazine-card.featured .info h3 {
    font-size: 0.95rem;
  }

  .rack-header {
    padding: 32px 14px 22px;
  }

  .rack-header h1 {
    font-size: 1.3rem;
  }

  .btn-back {
    padding: 6px 12px;
    font-size: 0.74rem;
  }

  .page-cover .cover-title h2 {
    font-size: 1.1rem;
  }

  .reader-toolbar .tool-btn {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 380px) {
  .rack-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 8px 22px;
  }
  .rack-grid.cols-3,
  .rack-grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .rack-grid.has-featured .magazine-card.featured {
    grid-column: span 2;
    grid-row: span 2;
  }

  .reader-toolbar .tool-btn {
    width: 30px;
    height: 30px;
  }
}

/* ========================================
   Utility: Smooth page transitions (legacy)
   ======================================== */

.page.slide-out-left {
  opacity: 0;
  transform: translateX(-100%);
}

.page.slide-in-right {
  opacity: 1;
  transform: translateX(0);
}

.page.slide-out-right {
  opacity: 0;
  transform: translateX(100%);
}

.page.slide-in-left {
  opacity: 1;
  transform: translateX(0);
}

.page.fade-out {
  opacity: 0;
}

.page.fade-in {
  opacity: 1;
}