/* ============================================================================
   Coinbase Magazine Style - Global Styles
   ============================================================================ */

:root {
  --primary-blue: #0052FF;
  --secondary-blue: #0052FF;
  --text-dark: #1a1a1a;
  --text-light: #666666;
  --bg-white: #ffffff;
  --bg-light: #f8f9fa;
  --border-color: #e0e0e0;
  --container: 1180px;
  --sidebar-width: 280px;
  --transition: 0.3s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  color: var(--text-dark);
  background-color: var(--bg-white);
  line-height: 1.6;
}

a {
  color: var(--primary-blue);
  text-decoration: none;
  transition: color var(--transition);
  word-break: break-word;
  overflow-wrap: break-word;
}

a:hover {
  color: #0037cc;
}

/* Prevent text rotation on any element */
* {
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Text wrapping and overflow */
h1, h2, h3, h4, h5, h6 {
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

p, span, li {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Prevent white-space: nowrap issues */
span {
  white-space: normal !important;
  display: inline;
}

/* Ensure no vertical text layout */
label, button, .btn, a {
  writing-mode: horizontal-tb !important;
  white-space: normal !important;
  word-break: break-word;
}

/* Mobile text elements */
@media (max-width: 768px) {
  .chapter-link,
  .tab-link,
  .handbook-nav-item,
  .question-bubble,
  .annotation-item,
  .faq-trigger,
  .btn,
  button {
    word-break: break-word;
    overflow-wrap: break-word;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .bubble-text,
  .question-bubble span,
  .faq-question,
  .annotation-label,
  .handbook-text {
    display: block;
    word-break: break-word;
    overflow-wrap: break-word;
  }
}

/* ============================================================================
   Container & Layout
   ============================================================================ */

:root {
  --container: 1180px;
}

.container {
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
}

@media (max-width: 768px) {
  .container {
    width: min(100% - 16px, var(--container));
  }
}

@media (max-width: 375px) {
  .container {
    width: min(100% - 12px, var(--container));
  }
}

/* ============================================================================
   Magazine Shell Layout
   ============================================================================ */

.magazine-shell {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-white);
  width: 100%;
  overflow-x: hidden;
}

/* Sidebar Navigation */
.sidebar-index {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: #2a2a2a;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 40px 24px;
  z-index: 100;
}

@media (max-width: 768px) {
  .sidebar-index {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    border: none !important;
    position: absolute !important;
    left: -9999px !important;
  }
}

.nav-header {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #999999;
  margin-bottom: 32px;
}

.nav-label {
  display: inline;
  color: #999999;
}

.nav-divider {
  margin: 0 4px;
  color: #999999;
}

.chapter-list {
  list-style: none;
}

.chapter-link {
  display: block;
  padding: 12px 0;
  font-size: 13px;
  color: #b0b0b0;
  border-left: 2px solid transparent;
  padding-left: 12px;
  transition: all var(--transition);
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

.chapter-link:hover {
  color: #ffffff;
  border-left-color: var(--primary-blue);
}

.chapter-link.active {
  color: #ffffff;
  border-left-color: var(--primary-blue);
  font-weight: 600;
}

/* Mobile Tabs (Hidden on Desktop) */
.mobile-chapter-tabs {
  display: none;
  width: 100%;
  background-color: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 99;
  overflow: hidden;
}

.tabs-container {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.tab-link {
  flex-shrink: 0;
  padding: 14px 14px;
  font-size: 12px;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  min-width: auto;
  display: inline-block;
  text-align: center;
}

.tab-link:hover {
  color: var(--primary-blue);
}

.tab-link.active {
  color: var(--primary-blue);
  border-bottom-color: var(--primary-blue);
  font-weight: 600;
}

/* Content Area */
.content-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  background-color: var(--bg-white);
  width: 100%;
}

@media (max-width: 768px) {
  .content-area {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

/* ============================================================================
   Chapter Section Styles
   ============================================================================ */

.chapter-section {
  padding: 80px 0;
  border-bottom: 1px solid var(--border-color);
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
}

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

.chapter-section h2 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 48px;
  color: var(--text-dark);
}

/* ============================================================================
   Cover Section
   ============================================================================ */

.cover-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.cover-left {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cover-header {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-light);
}

.cover-year {
  font-weight: 700;
  color: var(--primary-blue);
}

.cover-left h1 {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-dark);
}

.cover-intro {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-light);
}

.cover-buttons {
  display: flex;
  gap: 16px;
}

.btn {
  padding: 14px 28px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  text-align: center;
  display: inline-block;
}

.btn-primary {
  background-color: var(--primary-blue);
  color: white;
}

.btn-primary:hover {
  background-color: #0037cc;
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: var(--bg-light);
  color: var(--primary-blue);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: #f0f0f0;
  border-color: var(--primary-blue);
}

.cover-hint {
  font-size: 13px;
  color: var(--text-light);
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.cover-right {
  display: flex;
  justify-content: center;
}

.cover-image-box {
  position: relative;
  width: 100%;
  line-height: 0;
  overflow: visible;
}

.cover-image-box img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  width: 100%;
}

.cover-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.label-tag {
  font-size: 12px;
  padding: 6px 12px;
  background-color: var(--bg-light);
  color: var(--text-light);
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* ============================================================================
   Annotated Image Section
   ============================================================================ */

.annotated-image-wrapper {
  display: grid;
  grid-template-columns: 120px 1fr 200px;
  gap: 40px;
  align-items: center;
}

.annotation-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.annotation-item {
  padding: 12px 16px;
  border-radius: 4px;
  background-color: transparent;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}

.annotation-item:hover {
  background-color: var(--bg-light);
  border-left-color: var(--primary-blue);
}

.annotation-item.active {
  background-color: var(--bg-light);
  border-left-color: var(--primary-blue);
}

.annotation-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

.annotation-center {
  position: relative;
}

.annotation-image-container {
  line-height: 0;
  margin-bottom: 20px;
  overflow: visible;
}

.annotation-image-container img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  width: 100%;
  display: block;
}

.annotation-text {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.8;
  display: none;
}

.annotation-text.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.annotation-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.annotation-feature {
  padding: 12px;
  background-color: var(--bg-light);
  border-radius: 4px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feature-icon {
  color: var(--primary-blue);
  font-weight: bold;
}

.feature-text {
  color: var(--text-dark);
}

/* ============================================================================
   Flipcard Section
   ============================================================================ */

.flipcard-container {
  background-color: var(--bg-light);
  padding: 40px;
  border-radius: 8px;
}

.flipcard-wrapper {
  margin-bottom: 32px;
}

.flipcard {
  display: none;
}

.flipcard.active {
  display: block;
  animation: slideIn 0.4s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.flipcard-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}

.flipcard-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-dark);
}

.flipcard-desc {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 16px;
  line-height: 1.8;
}

.flipcard-image {
  line-height: 0;
  overflow: visible;
  border-radius: 4px;
}

.flipcard-image img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  width: 100%;
  display: block;
}

.flipcard-highlights {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.highlight {
  font-size: 13px;
  padding: 6px 12px;
  background-color: rgba(0, 82, 255, 0.08);
  color: var(--primary-blue);
  border-radius: 4px;
}

.flipcard-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 24px;
}

.flipcard-btn {
  padding: 8px 16px;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-dark);
  cursor: pointer;
  transition: all var(--transition);
}

.flipcard-btn:hover:not(:disabled) {
  background-color: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

.flipcard-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.flipcard-counter {
  font-size: 13px;
  color: var(--text-light);
  min-width: 60px;
  text-align: center;
}

/* ============================================================================
   Security Handbook Section
   ============================================================================ */

.security-handbook-wrapper {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
}

.handbook-sidebar {
  background-color: var(--bg-light);
  padding: 24px;
  border-radius: 8px;
  height: fit-content;
  position: sticky;
  top: 100px;
}

.handbook-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.handbook-nav-item {
  padding: 12px 16px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
  cursor: pointer;
}

.handbook-nav-item:hover {
  background-color: rgba(0, 82, 255, 0.08);
}

.handbook-nav-item.active {
  background-color: var(--primary-blue);
  color: white;
}

.handbook-icon {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.6;
}

.handbook-nav-item.active .handbook-icon {
  opacity: 1;
}

.handbook-text {
  font-size: 13px;
  font-weight: 600;
}

.handbook-content {
  padding: 32px;
  background-color: var(--bg-light);
  border-radius: 8px;
}

.handbook-panel {
  display: none;
}

.handbook-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.handbook-panel h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-dark);
}

.safety-desc {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 20px;
  line-height: 1.8;
}

.safety-image {
  margin: 24px 0;
  line-height: 0;
  overflow: visible;
  border-radius: 4px;
}

.safety-image img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  width: 100%;
  display: block;
}

.safety-tips {
  background-color: rgba(0, 82, 255, 0.06);
  padding: 16px;
  border-radius: 4px;
  margin: 16px 0;
}

.safety-tips h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.safety-tips ul {
  list-style: none;
  font-size: 13px;
  color: var(--text-light);
}

.safety-tips li {
  padding: 4px 0;
  padding-left: 20px;
  position: relative;
}

.safety-tips li:before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--primary-blue);
  font-weight: bold;
}

.safety-hint {
  font-size: 13px;
  color: #d84315;
  margin-top: 12px;
  padding: 8px 0;
}

/* ============================================================================
   Scenario Theater Section
   ============================================================================ */

.scenario-theater-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: flex-start;
}

.scenario-questions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.question-bubble {
  padding: 16px 20px;
  background-color: var(--bg-light);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 3px solid transparent;
}

.question-bubble:hover {
  background-color: #f0f0f0;
  border-left-color: var(--primary-blue);
}

.question-bubble.active {
  background-color: var(--primary-blue);
  color: white;
  border-left-color: var(--primary-blue);
}

.bubble-icon {
  font-size: 16px;
  font-weight: 700;
  opacity: 0.6;
}

.question-bubble.active .bubble-icon {
  opacity: 1;
}

.bubble-text {
  font-size: 14px;
  font-weight: 600;
}

.scenario-answers {
  background-color: var(--bg-light);
  padding: 32px;
  border-radius: 8px;
  min-height: 300px;
}

.answer-panel {
  display: none;
}

.answer-panel.active {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

.answer-icon {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-blue);
  min-width: 24px;
}

.answer-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-dark);
}

.answer-content p {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.8;
}

/* ============================================================================
   Bento Grid Section
   ============================================================================ */

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

.bento-item {
  background-color: var(--bg-light);
  border-radius: 8px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--transition);
  min-height: 280px;
}

.bento-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 24px rgba(0, 82, 255, 0.12);
}

.bento-content h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.bento-content p {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.6;
}

.bento-image {
  margin-top: 16px;
  line-height: 0;
  overflow: visible;
  border-radius: 4px;
}

.bento-image img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  width: 100%;
  display: block;
}

/* ============================================================================
   Gallery Showcase Section
   ============================================================================ */

.gallery-showcase {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 32px;
  align-items: flex-start;
}

.gallery-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gallery-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 100px;
}

.gallery-thumbnail {
  width: 120px;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  line-height: 0;
}

.gallery-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.gallery-thumbnail:hover {
  border-color: var(--border-color);
}

.gallery-thumbnail.active {
  border-color: var(--primary-blue);
}

.gallery-preview {
  background-color: var(--bg-light);
  padding: 40px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 500px;
}

.preview-image-wrapper {
  position: relative;
  width: 100%;
  line-height: 0;
  overflow: visible;
}

.preview-image {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  width: 100%;
  display: block;
}

/* ============================================================================
   Confirm Checklist Section
   ============================================================================ */

.confirm-checklist {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.confirm-item {
  position: relative;
}

.confirm-checkbox {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.confirm-label {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background-color: var(--bg-light);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}

.confirm-checkbox:checked + .confirm-label {
  background-color: rgba(0, 82, 255, 0.06);
  border-left-color: var(--primary-blue);
}

.confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  font-weight: bold;
  color: transparent;
  font-size: 12px;
  transition: all var(--transition);
}

.confirm-checkbox:checked + .confirm-label .confirm-icon {
  background-color: var(--primary-blue);
  border-color: var(--primary-blue);
  color: white;
}

.confirm-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.confirm-detail {
  font-size: 12px;
  color: var(--text-light);
}

.confirm-message {
  background-color: rgba(0, 82, 255, 0.08);
  padding: 16px 20px;
  border-radius: 4px;
  color: var(--primary-blue);
  font-size: 14px;
  text-align: center;
  animation: slideDown 0.4s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================
   FAQ Section
   ============================================================================ */

.faq-cards {
  display: grid;
  gap: 12px;
}

.faq-card {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.faq-trigger {
  width: 100%;
  padding: 20px;
  background-color: var(--bg-light);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  font-size: 14px;
}

.faq-card.active .faq-trigger {
  background-color: var(--primary-blue);
  color: white;
}

.faq-trigger:hover {
  background-color: #efefef;
}

.faq-card.active .faq-trigger:hover {
  background-color: #0037cc;
}

.faq-number {
  font-weight: 700;
  font-size: 12px;
  opacity: 0.6;
  flex-shrink: 0;
}

.faq-card.active .faq-number {
  opacity: 1;
}

.faq-question {
  flex: 1;
  font-weight: 600;
  color: inherit;
}

.faq-toggle {
  font-size: 18px;
  font-weight: 700;
  opacity: 0.6;
  transition: transform var(--transition);
  flex-shrink: 0;
}

.faq-card.active .faq-toggle {
  transform: rotate(45deg);
  opacity: 1;
}

.faq-panel {
  display: none;
  padding: 20px;
  background-color: var(--bg-white);
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.8;
  border-top: 1px solid var(--border-color);
}

.faq-card.active .faq-panel {
  display: block;
  animation: slideDown 0.3s ease;
}

/* ============================================================================
   Footer Section
   ============================================================================ */

.magazine-footer {
  background-color: var(--text-dark);
  color: white;
  padding: 60px 0 40px;
  margin-top: 80px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

.footer-brand h3,
.footer-nav h4,
.footer-info h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

.footer-brand p,
.footer-nav a,
.footer-info p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.8;
}

.footer-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-nav a {
  transition: color var(--transition);
}

.footer-nav a:hover {
  color: white;
}

.footer-copyright {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 16px;
}

/* ============================================================================
   Back to Top Button
   ============================================================================ */

.back-to-top {
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: 48px;
  height: 48px;
  background-color: var(--primary-blue);
  color: white;
  border-radius: 4px;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 98;
  box-shadow: 0 4px 12px rgba(0, 82, 255, 0.24);
}

.back-to-top:hover {
  background-color: #0037cc;
  transform: translateY(-4px);
}

/* ============================================================================
   Image Preview Modal
   ============================================================================ */

.modal-preview {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 32px;
  color: white;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  transform: scale(1.1);
}

.modal-image {
  max-width: 90vw;
  max-height: 90vh;
  line-height: 0;
  overflow: visible;
}

.modal-image img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  display: block;
  width: auto;
  height: auto;
}

/* ============================================================================
   Image Standards
   ============================================================================ */

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.image-box,
.chapter-media,
.story-media,
.gallery-item,
.annotation-image-container,
.flipcard-image,
.safety-image,
.bento-image,
.cover-image-box {
  overflow: visible;
  line-height: 0;
}

.image-box img,
.chapter-media img,
.story-media img,
.gallery-item img,
.annotation-image-container img,
.flipcard-image img,
.safety-image img,
.bento-image img,
.cover-image-box img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

/* Tablets (768px) */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0;
  }

  .magazine-shell {
    flex-direction: column;
  }

  .sidebar-index {
    display: none !important;
  }

  .mobile-chapter-tabs {
    display: block;
  }

  .content-area {
    margin-left: 0 !important;
  }

  .chapter-section {
    padding: 36px 0;
  }

  .chapter-section .container {
    padding: 0 14px;
  }

  .chapter-section h2 {
    font-size: 20px;
    line-height: 1.4;
    margin-bottom: 20px;
    word-break: break-word;
  }

  /* Cover */
  .cover-wrapper {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .cover-left h1 {
    font-size: 32px;
    line-height: 1.3;
    word-break: break-word;
  }

  .cover-intro {
    font-size: 15px;
    line-height: 1.7;
  }

  .cover-buttons {
    flex-direction: column;
    gap: 10px;
  }

  .btn {
    padding: 12px 24px;
    font-size: 14px;
    width: 100%;
    text-align: center;
  }

  .cover-hint {
    font-size: 12px;
  }

  .cover-right {
    width: 100%;
    max-width: 100%;
  }

  .cover-image-box {
    min-height: 280px;
  }

  .cover-labels {
    gap: 8px;
  }

  .label-tag {
    font-size: 11px;
    padding: 5px 10px;
  }

  /* Annotated Image */
  .annotated-image-wrapper {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .annotation-left {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
  }

  .annotation-item {
    flex-shrink: 0;
    padding: 8px 10px;
    font-size: 12px;
  }

  .annotation-label {
    font-size: 12px;
    white-space: nowrap;
  }

  .annotation-center {
    width: 100%;
  }

  .annotation-image-container {
    min-height: 240px;
    margin-bottom: 16px;
  }

  .annotation-text {
    font-size: 13px;
    line-height: 1.7;
  }

  .annotation-right {
    gap: 10px;
  }

  .annotation-feature {
    padding: 10px;
    font-size: 12px;
  }

  /* Flipcard */
  .flipcard-container {
    padding: 24px;
  }

  .flipcard-content {
    grid-template-columns: 1fr;
    gap: 16px;
    min-height: auto;
  }

  .flipcard-image {
    min-height: 200px;
  }

  .flipcard-title {
    font-size: 20px;
    line-height: 1.3;
  }

  .flipcard-desc {
    font-size: 13px;
    line-height: 1.7;
  }

  .flipcard-nav {
    flex-wrap: wrap;
    gap: 12px;
  }

  .flipcard-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .flipcard-counter {
    font-size: 12px;
    min-width: 50px;
  }

  /* Security Handbook */
  .security-handbook-wrapper {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .handbook-sidebar {
    position: relative;
    top: 0;
    padding: 0;
    background-color: transparent;
  }

  .handbook-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
  }

  .handbook-nav-item {
    flex-shrink: 0;
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .handbook-icon {
    font-size: 10px;
  }

  .handbook-text {
    font-size: 11px;
  }

  .handbook-content {
    padding: 16px;
    border-radius: 6px;
  }

  .handbook-panel h3 {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .safety-desc {
    font-size: 13px;
    margin-bottom: 16px;
  }

  .safety-image {
    min-height: 220px;
    margin: 14px 0;
  }

  .safety-tips {
    padding: 12px;
    margin: 12px 0;
  }

  .safety-tips h4 {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .safety-tips li {
    font-size: 12px;
    padding: 3px 0;
  }

  .safety-hint {
    font-size: 12px;
  }

  /* Scenario */
  .scenario-theater-wrapper {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .scenario-questions {
    gap: 8px;
  }

  .question-bubble {
    padding: 12px 14px;
    font-size: 13px;
    gap: 10px;
  }

  .bubble-text {
    word-break: break-word;
    font-size: 13px;
  }

  .scenario-answers {
    min-height: auto;
    padding: 16px;
  }

  .answer-content h3 {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .answer-content p {
    font-size: 13px;
    line-height: 1.7;
  }

  /* Bento Grid */
  .bento-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .bento-item {
    min-height: auto;
    padding: 20px;
  }

  .bento-content h3 {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .bento-content p {
    font-size: 12px;
    line-height: 1.6;
  }

  /* Gallery */
  .gallery-showcase {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .gallery-sidebar {
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .gallery-thumbnail {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
  }

  .gallery-preview {
    min-height: 320px;
    padding: 16px;
  }

  /* Confirm Checklist */
  .confirm-label {
    padding: 12px 14px;
    gap: 12px;
  }

  .confirm-text {
    font-size: 13px;
  }

  .confirm-detail {
    font-size: 11px;
  }

  .confirm-message {
    padding: 12px 14px;
    font-size: 12px;
  }

  /* FAQ */
  .faq-trigger {
    padding: 14px;
    font-size: 13px;
    gap: 10px;
  }

  .faq-number {
    font-size: 11px;
  }

  .faq-question {
    word-break: break-word;
    font-size: 13px;
  }

  .faq-panel {
    padding: 14px;
    font-size: 12px;
    line-height: 1.7;
  }

  /* Footer */
  .footer-content {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .footer-brand h3,
  .footer-nav h4,
  .footer-info h4 {
    font-size: 14px;
    margin-bottom: 10px;
  }

  .footer-brand p,
  .footer-nav a,
  .footer-info p {
    font-size: 12px;
  }

  .footer-nav ul {
    gap: 6px;
  }

  .footer-copyright {
    font-size: 11px;
    margin-top: 12px;
  }

  /* Back to Top */
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
}

/* Mobile (375px - 414px) */
@media (max-width: 375px) {
  .container {
    width: min(100% - 12px, var(--container));
    padding: 0 10px;
  }

  .chapter-section {
    padding: 32px 0;
  }

  .chapter-section .container {
    padding: 0 10px;
  }

  .chapter-section h2 {
    font-size: 18px;
    line-height: 1.4;
    margin-bottom: 18px;
    word-break: break-word;
  }

  .cover-header {
    font-size: 11px;
    letter-spacing: 0.5px;
  }

  .cover-year {
    font-size: 11px;
  }

  .cover-left h1 {
    font-size: 26px;
    line-height: 1.3;
    word-break: break-word;
  }

  .cover-intro {
    font-size: 13px;
    line-height: 1.7;
  }

  .cover-buttons {
    flex-direction: column;
    gap: 10px;
  }

  .btn {
    padding: 11px 20px;
    font-size: 12px;
    width: 100%;
  }

  .cover-hint {
    font-size: 11px;
    line-height: 1.6;
  }

  .cover-image-box {
    min-height: 240px;
  }

  /* Annotated Image */
  .annotation-left {
    gap: 6px;
  }

  .annotation-image-container {
    min-height: 200px;
  }

  .annotation-item {
    padding: 7px 8px;
    font-size: 11px;
  }

  .annotation-label {
    font-size: 11px;
    white-space: nowrap;
  }

  .annotation-text {
    font-size: 12px;
    line-height: 1.6;
  }

  .annotation-feature {
    padding: 8px;
    font-size: 11px;
    gap: 6px;
  }

  .feature-icon {
    font-size: 12px;
  }

  /* Flipcard */
  .flipcard-container {
    padding: 16px;
  }

  .flipcard-title {
    font-size: 18px;
    line-height: 1.3;
    margin-bottom: 8px;
  }

  .flipcard-desc {
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 12px;
  }

  .flipcard-highlights {
    gap: 8px;
  }

  .highlight {
    font-size: 11px;
    padding: 5px 8px;
  }

  .flipcard-image {
    min-height: 180px;
  }

  .flipcard-nav {
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
  }

  .flipcard-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  .flipcard-counter {
    font-size: 11px;
    min-width: 45px;
  }

  /* Handbook */
  .handbook-nav {
    gap: 4px;
  }

  .handbook-nav-item {
    padding: 6px 8px;
    font-size: 11px;
    gap: 6px;
  }

  .handbook-icon {
    font-size: 9px;
    min-width: 16px;
  }

  .handbook-text {
    font-size: 10px;
    white-space: nowrap;
  }

  .handbook-content {
    padding: 14px;
    border-radius: 4px;
  }

  .handbook-panel h3 {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .safety-desc {
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 12px;
  }

  .safety-tips {
    padding: 10px;
    margin: 10px 0;
  }

  .safety-tips h4 {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .safety-tips li {
    font-size: 11px;
    padding: 2px 0;
  }

  .safety-hint {
    font-size: 11px;
    margin-top: 8px;
  }

  .safety-image {
    min-height: 180px;
    margin: 10px 0;
  }

  /* Scenario */
  .scenario-questions {
    gap: 6px;
  }

  .question-bubble {
    padding: 10px 12px;
    font-size: 12px;
    gap: 8px;
  }

  .bubble-icon {
    font-size: 14px;
    flex-shrink: 0;
  }

  .bubble-text {
    word-break: break-word;
    font-size: 12px;
    line-height: 1.4;
  }

  .scenario-answers {
    padding: 14px;
    min-height: auto;
  }

  .answer-icon {
    font-size: 18px;
    min-width: 20px;
  }

  .answer-content h3 {
    font-size: 15px;
    margin-bottom: 8px;
  }

  .answer-content p {
    font-size: 12px;
    line-height: 1.6;
  }

  /* Bento Grid */
  .bento-item {
    padding: 16px;
    min-height: auto;
  }

  .bento-content h3 {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .bento-content p {
    font-size: 11px;
    line-height: 1.5;
  }

  /* Gallery */
  .gallery-sidebar {
    gap: 5px;
  }

  .gallery-thumbnail {
    width: 65px;
    height: 65px;
    flex-shrink: 0;
  }

  .gallery-preview {
    padding: 12px;
    min-height: 280px;
  }

  /* Confirm Checklist */
  .confirm-item {
    position: relative;
  }

  .confirm-label {
    padding: 10px 12px;
    gap: 10px;
  }

  .confirm-icon {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  .confirm-text {
    font-size: 12px;
    font-weight: 600;
  }

  .confirm-detail {
    font-size: 10px;
    line-height: 1.4;
  }

  .confirm-message {
    padding: 10px 12px;
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
  }

  /* FAQ */
  .faq-trigger {
    padding: 12px;
    font-size: 12px;
    gap: 8px;
  }

  .faq-number {
    font-size: 10px;
    min-width: 24px;
  }

  .faq-question {
    word-break: break-word;
    font-size: 12px;
    line-height: 1.4;
  }

  .faq-toggle {
    font-size: 16px;
    min-width: 20px;
    text-align: right;
  }

  .faq-panel {
    padding: 12px;
    font-size: 11px;
    line-height: 1.6;
  }

  /* Footer */
  .footer-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .footer-brand h3,
  .footer-nav h4,
  .footer-info h4 {
    font-size: 13px;
    margin-bottom: 8px;
  }

  .footer-brand p,
  .footer-nav a,
  .footer-info p {
    font-size: 11px;
    line-height: 1.6;
  }

  .footer-nav ul {
    gap: 4px;
  }

  .footer-copyright {
    font-size: 10px;
    margin-top: 8px;
  }

  /* Modal */
  .modal-preview {
    padding: 16px;
  }

  .modal-close {
    font-size: 24px;
    width: 36px;
    height: 36px;
    top: 8px;
    right: 8px;
  }

  .modal-image {
    max-width: 95vw;
    max-height: 85vh;
  }

  .modal-image img {
    max-height: 85vh;
  }
}

/* Ultra Small Devices (320px) */
@media (max-width: 320px) {
  .chapter-section h2 {
    font-size: 16px;
  }

  .cover-left h1 {
    font-size: 20px;
  }

  .btn {
    padding: 10px 16px;
    font-size: 11px;
  }

  .annotation-item {
    padding: 6px 6px;
    font-size: 10px;
  }

  .question-bubble {
    padding: 8px 10px;
    font-size: 11px;
  }

  .faq-trigger {
    padding: 10px;
    font-size: 11px;
  }

  .confirm-label {
    padding: 8px 10px;
  }
}

/* 💪 Strongest Mobile Fix - Override Everything */
@media (max-width: 768px) {
  body {
    width: 100vw !important;
    overflow-x: hidden !important;
  }

  .magazine-shell {
    width: 100vw !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    flex-direction: column !important;
  }

  .sidebar-index {
    position: absolute !important;
    left: -999vw !important;
    width: 0 !important;
    visibility: hidden !important;
    display: none !important;
    z-index: -1 !important;
  }

  .content-area {
    width: 100vw !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    flex: 1 !important;
  }

  .chapter-section {
    width: 100% !important;
  }
}

/* Print Styles */
@media print {
  .sidebar-index,
  .mobile-chapter-tabs,
  .back-to-top,
  .flipcard-nav {
    display: none;
  }

  .content-area {
    margin-left: 0;
  }

  .chapter-section {
    page-break-after: avoid;
  }
}
