/* ==========================================================================
   《从“玩起来很爽”出发：游戏创意课》 响应式阅读样式表 (Mobile-First)
   作者：吉泽秀雄 (Hideo Yoshizawa)
   ========================================================================== */

:root {
  --primary: #0088cc;
  --primary-dark: #005f99;
  --primary-light: #e6f6ff;
  --primary-soft: #f0f9ff;
  --accent: #ff6b35;
  --accent-light: #fff3ee;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--text-main);
  background-color: var(--bg-page);
  line-height: 1.85;
  letter-spacing: 0.015em;
  padding-bottom: 4rem;
}

/* Sticky Top Navigation Bar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.book-brand {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary-dark);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-brand:hover {
  color: var(--primary);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.nav-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  padding: 0.4rem 1.8rem 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23005f99' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  max-width: 210px;
}

.btn-toc {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s;
}

.btn-toc:hover {
  background: var(--primary-dark);
}

/* Main Reading Container */
.container {
  max-width: 840px;
  margin: 1.75rem auto;
  padding: 0 1.25rem;
}

.reader-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  padding: 2.5rem 2.75rem;
}

/* Chapter Banner */
.chapter-banner {
  background: linear-gradient(135deg, #0088cc 0%, #005f99 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 2rem 2rem;
  margin-bottom: 2.25rem;
  position: relative;
  overflow: hidden;
}

.chapter-label {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.chapter-banner h1 {
  font-size: 1.75rem;
  line-height: 1.35;
  font-weight: 800;
  margin: 0;
}

.chapter-banner .chapter-sub {
  margin-top: 0.6rem;
  font-size: 0.95rem;
  opacity: 0.9;
}

/* Headings */
h2.section-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin: 2.75rem 0 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 3px solid var(--primary);
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  line-height: 1.4;
}

h2.section-title .sec-num {
  background: var(--primary);
  color: #fff;
  font-size: 0.9rem;
  padding: 0.15rem 0.6rem;
  border-radius: 6px;
  flex-shrink: 0;
}

h3.sub-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin: 2rem 0 0.9rem;
  padding: 0.45rem 0.9rem;
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.45;
}

h4.mini-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 1.5rem 0 0.6rem;
}

/* Paragraphs & Inline Emphasis */
p {
  margin-bottom: 1.15rem;
  text-align: justify;
  word-break: break-word;
}

.hl {
  color: var(--primary-dark);
  font-weight: 700;
  background: linear-gradient(transparent 62%, #bae6fd 62%);
  padding: 0 2px;
}

.lead-quote {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}

ul.book-list, ol.book-list {
  margin: 0.85rem 0 1.25rem 1.5rem;
}

ul.book-list li, ol.book-list li {
  margin-bottom: 0.45rem;
}

/* Figures & Embedded Localized Images */
figure.book-fig {
  margin: 1.6rem auto;
  text-align: center;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  box-shadow: var(--shadow-sm);
}

figure.book-fig img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 6px;
  cursor: zoom-in;
}

figure.book-fig figcaption {
  margin-top: 0.6rem;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.fig-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.fig-grid-2 figure.book-fig {
  margin: 0;
}

/* Special Callout Boxes: Exercise, Summary, Column, Sticky Notes */
.exercise-box {
  background: #fffbeb;
  border: 2px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 1.4rem 1.5rem;
  margin: 1.8rem 0;
}

.exercise-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.08rem;
  color: #b45309;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed #fcd34d;
}

.exercise-badge {
  background: #f59e0b;
  color: #fff;
  font-size: 0.8rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

.summary-box {
  background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px solid #38bdf8;
  border-radius: var(--radius-md);
  padding: 1.5rem 1.65rem;
  margin: 2.25rem 0;
}

.summary-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0369a1;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.summary-box ul {
  margin-left: 1.25rem;
}

.summary-box li {
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #0c4a6e;
}

.column-box {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-top: 4px solid #475569;
  border-radius: var(--radius-md);
  padding: 1.5rem 1.65rem;
  margin: 2.25rem 0;
}

.column-label {
  display: inline-block;
  background: #334155;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.column-box h3 {
  font-size: 1.2rem;
  color: #1e293b;
  margin-bottom: 0.9rem;
}

/* Chapter 9 Case Study Cards */
.case-eval-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.25rem 0 1.75rem;
}

.eval-card {
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.35rem;
  border-left: 5px solid var(--primary);
  background: #f8fafc;
}

.eval-card.tendency {
  border-left-color: #ef4444;
  background: #fef2f2;
}

.eval-card.countermeasure {
  border-left-color: #10b981;
  background: #ecfdf5;
}

.eval-card.point {
  border-left-color: #f59e0b;
  background: #fffbeb;
}

.eval-tag {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  color: #fff;
  background: var(--primary);
}

.eval-card.tendency .eval-tag { background: #dc2626; }
.eval-card.countermeasure .eval-tag { background: #059669; }
.eval-card.point .eval-tag { background: #d97706; }

/* Sticky Note Translation Grid (Chapter 8) */
.sticky-board {
  background: #fefce8;
  border: 1px dashed #eab308;
  border-radius: var(--radius-md);
  padding: 1.1rem;
  margin: 1rem 0 1.6rem;
}

.sticky-board-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #854d0e;
  margin-bottom: 0.75rem;
}

.sticky-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 0.65rem;
}

.sticky-note {
  background: #fef08a;
  color: #1e293b;
  padding: 0.65rem 0.75rem;
  border-radius: 4px;
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.08);
  font-size: 0.86rem;
  line-height: 1.45;
  font-weight: 600;
  border-left: 3px solid #eab308;
}

.sticky-note.pink {
  background: #fce7f3;
  border-left-color: #ec4899;
}

.sticky-note.blue {
  background: #e0f2fe;
  border-left-color: #0284c7;
}

/* Responsive Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

table.book-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 520px;
}

table.book-table th,
table.book-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  vertical-align: top;
}

table.book-table th {
  background: var(--primary-dark);
  color: #ffffff;
  font-weight: 700;
  white-space: nowrap;
}

table.book-table tr:nth-child(even) td {
  background: #f8fafc;
}

/* TOC Index Page Styling */
.hero-card {
  display: flex;
  gap: 2rem;
  align-items: center;
  background: linear-gradient(135deg, #0f172a 0%, #0369a1 100%);
  color: #ffffff;
  padding: 2.25rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.hero-cover {
  width: 190px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.hero-meta h1 {
  font-size: 1.85rem;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.hero-meta .orig-title {
  font-size: 0.95rem;
  opacity: 0.82;
  margin-bottom: 1rem;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.hero-badge {
  background: rgba(255, 255, 255, 0.16);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
}

.toc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.toc-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.toc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #7dd3fc;
}

.toc-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.toc-card-head a {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--primary-dark);
  text-decoration: none;
}

.toc-card-head a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.toc-sublist {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.toc-sublist a {
  color: #475569;
  text-decoration: none;
}

.toc-sublist a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Prev / Next Chapter Pagination */
.chapter-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-color);
}

.pager-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.9rem 1.15rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  background: #f8fafc;
  transition: all 0.15s;
}

.pager-link:hover {
  background: var(--primary-soft);
  border-color: #7dd3fc;
}

.pager-link.next {
  text-align: right;
}

.pager-dir {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.pager-title {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 0.95rem;
}

/* Lightbox Modal for Mobile & Desktop Image Zoom */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  cursor: zoom-out;
}

.lightbox-overlay.active {
  display: flex;
}

.lightbox-overlay img {
  max-width: 96vw;
  max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  background: #fff;
}

/* Mobile Responsive Adaptations */
@media (max-width: 768px) {
  html {
    font-size: 15.5px;
  }

  .header-inner {
    padding: 0.6rem 0.9rem;
  }

  .book-brand span.brand-full {
    display: none;
  }

  .container {
    margin: 0.85rem auto;
    padding: 0 0.65rem;
  }

  .reader-card {
    padding: 1.35rem 1.1rem;
    border-radius: var(--radius-md);
  }

  .chapter-banner {
    padding: 1.35rem 1.2rem;
    margin-bottom: 1.5rem;
  }

  .chapter-banner h1 {
    font-size: 1.35rem;
  }

  h2.section-title {
    font-size: 1.2rem;
    margin: 2rem 0 1rem;
  }

  h3.sub-title {
    font-size: 1.05rem;
    padding: 0.4rem 0.75rem;
  }

  figure.book-fig {
    padding: 0.5rem;
    margin: 1.2rem auto;
  }

  .fig-grid-2 {
    grid-template-columns: 1fr;
  }

  .hero-card {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem 1.2rem;
  }

  .hero-cover {
    width: 145px;
  }

  .hero-badges {
    justify-content: center;
  }

  .chapter-pager {
    flex-direction: column;
  }

  .pager-link.next {
    text-align: left;
  }
}
