/* ════════════════════════════════════════
   시간의 도서관 — style.css
   작성: 리팩토링 버전 (Unified Living Newspaper)
════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Nanum+Myeongjo:wght@400;700;800&display=swap');

:root {
  /* Dark Theme (Default) */
  --bg-app: #080808;
  --bg-screen: #0d0d0d;
  --bg-shelf: #111;
  --bg-item: #181818;
  --bg-panel: #0a0a0a;
  
  --text-main: #e8e0d0;
  --text-dim: #666;
  --text-muted: #333;
  --text-accent: #c8b89a;
  
  --accent: #c8a96e;
  --border-light: #222;
  --border-dim: #1a1a1a;
  --border-item: #252525;

  --paper-bg: #ede3ce;
  --paper-text: #1a1a1a;
  --item-filter: grayscale(100%) brightness(0.55);

  /* Font Scale */
  --f-scale: 1;
}

.theme-sepia {
  /* Sepia Theme (Light) - Elegant "Modern Archive" Style */
  --bg-app: #fafafa;
  --bg-screen: #fcfcfc;
  --bg-shelf: #f4f3ef;
  --bg-item: #fdfdfd;
  --bg-panel: #ffffff;
  
  --text-main: #2d2621;
  --text-dim: #7a7065;
  --text-muted: #b5ada3;
  --text-accent: #8c7355;
  
  --accent: #a68b67;
  --border-light: #ececea;
  --border-dim: #e5e3de;
  --border-item: #e1ddd5;

  /* Newspaper/Parchment */
  --paper-bg: #fffefe;
  --paper-text: #1a1a1a;
  --item-filter: sepia(0.2) contrast(0.95) brightness(1.0);
}

.theme-joseon {
  /* Joseon Theme - Traditional Hanji & Ink Style */
  --bg-app: #12100e;        /* Deep wood/ink */
  --bg-screen: #1a1714;
  --bg-shelf: #24201c;
  --bg-item: #2d2824;
  --bg-panel: #1a1714;
  
  --text-main: #d9d0c1;
  --text-dim: #8b7e6d;
  --text-muted: #5d5244;
  --text-accent: #c4b396;
  
  --accent: #b22222;        /* Seal Red */
  --border-light: #3d342c;
  --border-dim: #2d261f;
  --border-item: #42382e;

  /* Records / Jobo / Memorial */
  --paper-bg-url: url('../assets/images/hanji_texture.png');
  --paper-bg: #f4ecd8;
  --paper-text: #1a1a1a;
  --item-filter: sepia(0.2) contrast(1.1) brightness(1.0);
  --seal-url: url('../assets/images/royal_seal.png');
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-app);
  color: var(--text-main);
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

/* Joseon Theme Specifics */
.theme-joseon body {
  background-image: 
    radial-gradient(circle at 2px 2px, rgba(255,255,255,0.02) 1px, transparent 0),
    linear-gradient(to right, rgba(255,255,255,0.01) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.01) 1px, transparent 1px);
  background-size: 40px 40px, 100px 100px, 100px 100px;
}

.screen { display: none; }
.screen.active { display: flex; }

/* ════════════════════════════
   도서관 (Library)
════════════════════════════ */
#screen-library {
  flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg-screen); padding: 40px 20px;
}
.library-title    { font-size: calc(11px * var(--f-scale)); letter-spacing: 8px; color: var(--text-muted); margin-bottom: 8px; }
.library-subtitle { font-size: calc(28px * var(--f-scale)); color: var(--text-accent); margin-bottom: 6px; letter-spacing: 2px; }
.library-desc     { font-size: calc(11px * var(--f-scale)); color: var(--text-muted); margin-bottom: 60px; letter-spacing: 3px; }

.shelf { width: 100%; max-width: 860px; margin-bottom: 40px; }
.shelf-label { font-size: calc(10px * var(--f-scale)); color: var(--text-muted); letter-spacing: 4px; margin-bottom: 12px; padding-left: 4px; }
.shelf-row {
  display: flex; gap: 14px; padding: 20px 16px 28px;
  background: var(--bg-shelf); border-top: 3px solid var(--border-light);
  border-bottom: 6px solid var(--bg-app); flex-wrap: wrap;
}

.newspaper-item {
  width: 110px; height: 155px; background: var(--bg-item);
  border: 1px solid var(--border-item); cursor: pointer; position: relative;
  transition: transform 0.25s, box-shadow 0.25s, filter 0.25s;
  filter: var(--item-filter);
  display: flex; flex-direction: column; padding: 8px 7px; overflow: hidden;
}
.newspaper-item:hover {
  transform: translateY(-10px) rotate(-1.5deg);
  box-shadow: 0 16px 40px rgba(0,0,0,0.9);
  filter: grayscale(60%) brightness(0.85);
}
.newspaper-item.solved { 
  filter: grayscale(0%) brightness(1); 
  border-color: var(--accent); 
  box-shadow: 0 0 30px rgba(166,139,103,0.3);
}

/* Joseon 모드에서 도서관 아이콘 한지 질감 및 가독성 강화 */
.theme-joseon .newspaper-item {
  background-image: var(--paper-bg-url);
  background-repeat: repeat;
  background-color: var(--paper-bg);
  filter: none;
  border-color: #3d342c;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.theme-joseon .newspaper-item .np-date { color: #5d5244; border-bottom-color: #c8a96e33; }
.theme-joseon .newspaper-item .np-headline { color: #1a1a1a; font-weight: 800; }
.theme-joseon .newspaper-item .np-status { color: #8b1a1a; border-top-color: #c8a96e33; font-weight: 800; }

.newspaper-item.solved::after {
  content: 'SOLVED'; position: absolute; top: 15px; left: 10px;
  border: 2px solid #8b1a1a; color: #8b1a1a; font-size: 10px; font-weight: 900;
  padding: 2px 6px; transform: rotate(-15deg); letter-spacing: 1px;
  background: rgba(255,255,255,0.1); backdrop-filter: blur(1px);
  z-index: 5; pointer-events: none;
}
.theme-joseon .newspaper-item.solved::after {
  content: ""; /* 조선 테마에선 텍스트 대신 어인 이미지 사용 시도 */
  width: 40px; height: 40px;
  background-image: var(--seal-url);
  background-size: contain;
  background-repeat: no-repeat;
  border: none;
  transform: rotate(-5deg);
  box-shadow: none;
  top: 5px; left: 5px;
}
.newspaper-item.locked { opacity: 0.25; cursor: not-allowed; }

.np-date      { font-size: calc(7px * var(--f-scale)); color: var(--text-dim); letter-spacing: 1px; border-bottom: 1px solid var(--border-item); padding-bottom: 4px; margin-bottom: 5px; }
.np-headline  { font-size: calc(9px * var(--f-scale)); line-height: 1.6; color: var(--text-accent); font-weight: 700; flex: 1; }
.np-status    { font-size: calc(8px * var(--f-scale)); text-align: center; margin-top: 6px; padding: 3px; border-top: 1px solid var(--border-item); color: var(--text-muted); }

/* ════════════════════════════
   살아있는 신문 (기사 + 수사 통합)
════════════════════════════ */
#screen-newspaper { 
  flex-direction: column; align-items: center; background: var(--bg-app); 
  height: 100vh; overflow: hidden;
}

.newspaper-main-container {
  flex: 1; width: 100%; max-width: 900px;
  overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 20px;
}
.newspaper-main-container::-webkit-scrollbar { width: 5px; }
.newspaper-main-container::-webkit-scrollbar-track { background: var(--bg-app); }
.newspaper-main-container::-webkit-scrollbar-thumb { background: var(--border-light); }

/* 신문 양피지 스타일 */
.newspaper-wrap {
  width: 100%; max-width: 700px; background: var(--paper-bg); color: var(--paper-text);
  padding: 36px 40px; position: relative; margin: 0 auto;
  box-shadow: 0 0 80px rgba(0,0,0,0.95), inset 0 0 60px rgba(0,0,0,0.08);
  filter: sepia(35%); animation: paperIn 0.7s ease;
}
/* Joseon 테마에선 세피아 필터 제거하여 한지 질감 선명화 */
.theme-joseon .newspaper-wrap { filter: none; }

/* Joseon Memorial Style (상소문) */
.theme-joseon .newspaper-wrap {
  background-image: var(--paper-bg-url);
  background-repeat: repeat;
  border: 1px solid #c8a96e33;
  /* 상소문 특유의 접힘 그림자 효과 (Vertical Folds) */
  box-shadow: 
    0 10px 40px rgba(0,0,0,0.8),
    inset 0 0 100px rgba(0,0,0,0.05);
  padding-top: 60px;
  padding-bottom: 60px;
  overflow: visible; /* Scroll ends를 보여주기 위해 */
}

.theme-joseon .newspaper-wrap::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none; opacity: 0.6;
  /* 상소문 접힌 자국 연출 */
  background: linear-gradient(to right, 
    transparent 19%, rgba(0,0,0,0.05) 20%, transparent 21%,
    transparent 39%, rgba(0,0,0,0.05) 40%, transparent 41%,
    transparent 59%, rgba(0,0,0,0.05) 60%, transparent 61%,
    transparent 79%, rgba(0,0,0,0.05) 80%, transparent 81%
  );
}

/* 상하단 축(Scroll Ends) 장식 */
.theme-joseon .newspaper-wrap::before {
  content: "";
  position: absolute;
  top: -12px; left: -2%; width: 104%; height: 24px;
  background: linear-gradient(to bottom, #2d1b0e, #4a3423, #2d1b0e);
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.6);
  z-index: 10;
}
@keyframes paperIn {
  from { opacity: 0; transform: scale(0.93) translateY(24px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.np-masthead { text-align: center; border-bottom: 3px double #2a2a2a; border-top: 3px double #2a2a2a; padding: 10px 0; margin-bottom: 18px; }
.np-masthead-name { font-size: calc(34px * var(--f-scale)); font-weight: 800; letter-spacing: 8px; line-height: 1; }
.np-masthead-info { display: flex; justify-content: space-between; font-size: calc(10px * var(--f-scale)); margin-top: 6px; color: #555; letter-spacing: 1px; }
.np-main-headline { font-size: calc(28px * var(--f-scale)); font-weight: 800; text-align: center; line-height: 1.3; margin: 16px 0 8px; border-bottom: 2px solid #2a2a2a; padding-bottom: 14px; letter-spacing: 2px; }
.np-sub-headline  { font-size: calc(13px * var(--f-scale)); text-align: center; color: #555; margin-bottom: 18px; letter-spacing: 1px; }
.np-columns       { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 16px; border-bottom: 1px solid #aaa; padding-bottom: 16px; }
.np-col-body      { font-size: calc(11px * var(--f-scale)); line-height: 2; color: #2a2a2a; }

.clue {
  display: inline; background: rgba(200,169,110,0.18);
  border-bottom: 2px solid #c8a96e; cursor: pointer;
  padding: 1px 2px; transition: background 0.2s;
}
.clue:hover { background: rgba(200,169,110,0.4); }
.clue.found { background: rgba(200,169,110,0.45); color: #7a3a10; font-weight: 700; }

.np-btn {
  background: var(--bg-item); color: var(--text-accent); border: 1px solid var(--border-item);
  padding: 11px 26px; font-family: inherit;
  font-size: 12px; letter-spacing: 2px; cursor: pointer; transition: all 0.2s;
}
.np-btn:hover { background: var(--accent); color: #0a0a0a; border-color: var(--accent); }
.np-btn.primary { background: var(--accent); color: #0a0a0a; border-color: var(--accent); font-weight: 700; }

/* ─────────────────────────────
   현장 수사 일지 (Investigation Notes)
   ───────────────────────────── */
.field-notes-wrap {
  background: #fdf6e3; color: #3b2a1a;
  padding: 40px; margin: 0 auto 40px;
  width: 100%; max-width: 700px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  border-top: 2px dashed #d1c1a1;
  position: relative;
  display: none; 
  animation: slideUp 0.6s ease;
}

/* Joseon Theme Synchronization */
.theme-joseon .field-notes-wrap {
  background-image: var(--paper-bg-url);
  background-repeat: repeat;
  background-color: var(--paper-bg);
  border-top: 2px solid #2d1b0e;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), inset 0 10px 20px rgba(0,0,0,0.05);
}

.field-notes-wrap.active { display: block; }

.field-notes-header {
  font-size: 10px; color: #8b7d62; letter-spacing: 4px;
  border-bottom: 1px solid #e5dcc5; padding-bottom: 15px; margin-bottom: 25px;
  text-align: center; font-weight: 800;
}

#game-log { display: flex; flex-direction: column; gap: 8px; margin-bottom: 30px; }
.log-line { font-size: calc(14px * var(--f-scale)); line-height: 1.8; color: #4a3728; font-family: 'Nanum Myeongjo', serif; }
.log-line.time    { color: #8b7d62; font-size: 11px; margin-top: 15px; border-top: 1px solid #eee; padding-top: 10px; }
.log-line.system  { color: #888; font-style: italic; font-size: 12px; }
.log-line.clue    { color: #a67c00; font-weight: 800; background: rgba(166,124,0,0.05); padding: 4px 8px; border-radius: 2px; }
.log-line.tutorial { color: #5a759c; font-weight: bold; background: rgba(90,117,156,0.1); padding: 6px 10px; border-left: 3px solid #5a759c; margin: 10px 0; border-radius: 4px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); letter-spacing:-0.2px;}

@keyframes tutorialFlash {
  0% { box-shadow: 0 0 0px #5a759c; background: rgba(90,117,156, 0.2); }
  50% { box-shadow: 0 0 10px #5a759c; background: rgba(90,117,156, 0.4); transform: scale(1.05); color: #000; }
  100% { box-shadow: 0 0 0px #5a759c; background: rgba(90,117,156, 0.2); }
}
.tutorial-pulse {
  animation: tutorialFlash 1.5s infinite;
  border-radius: 4px;
  display: inline-block;
}

#game-choices { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.btn-choice {
  background: linear-gradient(90deg, rgba(200, 169, 110, 0.1) 0%, transparent 100%);
  color: var(--paper-text); 
  border: 1px solid rgba(200, 169, 110, 0.3);
  border-left: 3px solid var(--accent);
  padding: 14px 20px; 
  font-size: 14px; 
  text-align: left;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); 
  font-family: inherit; 
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  font-weight: 600;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}
.btn-choice:hover { 
  background: linear-gradient(90deg, rgba(200, 169, 110, 0.2) 0%, rgba(200, 169, 110, 0.05) 100%);
  color: var(--accent); 
  border-color: var(--accent); border-left-width: 5px;
  padding-left: 24px; 
  box-shadow: 0 6px 15px rgba(200, 169, 110, 0.15);
}
.btn-choice::after {
  content: '❖';
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  opacity: 0.2;
  font-size: 20px;
  transition: all 0.3s;
}
.btn-choice:hover::after { opacity: 0.8; transform: translateY(-50%) rotate(90deg); }

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

/* 통합 헤더/스탯 */
.game-header { 
  width: 100%; max-width: 900px; padding: 15px 20px; display: flex; align-items: center; gap: 15px; 
  background: var(--bg-screen); border-bottom: 1px solid var(--border-dim); 
  mask: none !important; -webkit-mask: none !important; /* 브라우저 강제 그라데이션 제거 */
}
.game-stats  { width: 100%; max-width: 900px; padding: 8px 20px; display: none; gap: 20px; background: var(--bg-panel); border-bottom: 1px solid var(--border-dim); }
.game-stats.active { display: flex; }
.stat-item   { font-size: 10px; display: flex; align-items: center; gap: 6px; color: var(--text-dim); }
.stat-value  { color: var(--text-accent); font-weight: 700; }

.game-btn-back { background: var(--bg-app); color: var(--text-dim); border: 1px solid var(--border-item); padding: 5px 12px; font-size: 10px; cursor: pointer; }
.game-btn-back:hover { color: var(--accent); border-color: var(--accent); }

.game-era-badge { font-size: calc(10px * var(--f-scale)); background: var(--accent); color: #080808; padding: 3px 10px; letter-spacing: 2px; font-weight: 800; }
.game-location  { font-size: calc(11px * var(--f-scale)); color: var(--text-dim); flex: 1; }
.game-clues     { font-size: calc(11px * var(--f-scale)); color: var(--accent); letter-spacing: 1px; cursor: pointer; transition: opacity 0.3s; }
.game-clues.disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }

/* 단서 패널 (사이드바) */
.clue-panel {
  width: 250px; background: var(--bg-panel); border-left: 1px solid var(--border-dim);
  padding: 24px 20px; height: 100vh; overflow-y: auto;
  position: absolute; right: -250px; top: 0;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1); z-index: 500;
}

.theme-joseon .clue-panel {
  background-image: var(--paper-bg-url);
  background-repeat: repeat;
  background-color: var(--paper-bg);
  border-left: 1px solid #2d1b0e;
  box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}

.clue-panel.active { right: 0; }
.clue-panel-title { 
  font-size: 9px; color: var(--text-muted); letter-spacing: 5px; 
  border-bottom: 1px solid var(--border-dim); padding-bottom: 10px; margin-bottom: 16px; 
  display: flex; justify-content: space-between; align-items: center;
}
.drawer-close-btn { display: none; } /* PC에선 숨김 */

.clue-item {
  background: var(--bg-item); border: 1px solid var(--border-dim); padding: 10px 12px;
  font-size: 11px; color: var(--text-dim); line-height: 1.7; margin-bottom: 10px;
  opacity: 0; transform: translateY(6px); transition: all 0.5s;
}
.clue-item.visible { opacity: 1; transform: translateY(0); }
.clue-item-title { color: var(--accent); font-weight: 700; font-size: 10px; letter-spacing: 2px; margin-bottom: 4px; }

.mystery-bar-wrap { margin-top: auto; border-top: 1px solid var(--border-dim); padding-top: 16px; }
.mystery-bar-label { font-size: 9px; color: var(--text-muted); letter-spacing: 4px; margin-bottom: 8px; }
.mystery-bar { height: 2px; background: var(--border-dim); }
.mystery-bar-fill { height: 100%; background: var(--accent); transition: width 1s ease; width: 0%; }
.mystery-pct { font-size: 10px; color: var(--accent); text-align: right; margin-top: 6px; }

/* ════════════════════════════
   해결 화면 (Solved)
════════════════════════════ */
#screen-solved {
  flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg-app); padding: 40px 20px;
}
.solved-newspaper {
  width: 100%; max-width: 540px; background: #f0e6d0; color: #1a1a1a;
  padding: 32px 36px; box-shadow: 0 0 100px rgba(200,169,110,0.5);
  animation: solvedIn 1.2s ease forwards;
}
@keyframes solvedIn {
  0%   { opacity: 0; transform: scale(0.88) rotate(-3deg); filter: grayscale(100%) sepia(100%); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); filter: sepia(15%); }
}
.solved-headline { font-size: calc(22px * var(--f-scale)); font-weight: 800; text-align: center; line-height: 1.4; margin: 14px 0; color: #8b1a1a; }
.solved-stamp-wrap { margin: 20px 0; text-align: center; perspective: 1000px; }
.solved-stamp { 
  display: inline-block; 
  width: 120px; height: 120px;
  background-image: var(--seal-url);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transform: rotate(-12deg); 
  animation: stampImpact 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 0;
  filter: drop-shadow(0 0 10px rgba(139, 26, 26, 0.4));
}
/* Sepia 모드시 기존 방식 유지 */
.theme-sepia .solved-stamp {
  width: auto; height: auto; background: none;
  border: 4px double #8b1a1a; color: #8b1a1a; 
  font-size: 20px; font-weight: 900; padding: 6px 24px; 
  letter-spacing: 10px;
}
@keyframes stampImpact {
  0% { transform: scale(5) rotate(20deg); opacity: 0; filter: blur(10px); }
  100% { transform: scale(1) rotate(-12deg); opacity: 1; filter: blur(0); }
}
.solved-clue-item { font-size: calc(12px * var(--f-scale)); line-height: 2; color: #444; padding-left: 12px; border-left: 2px solid #c8a96e; margin-bottom: 6px; }
.shelf-back-btn  { margin-top: 32px; background: transparent; color: var(--accent); border: 1px solid rgba(200,169,110,0.2); padding: 13px 36px; font-size: 12px; letter-spacing: 4px; cursor: pointer; }

/* ════════════════════════════
   시스템 컴포넌트 (Flash, Modal, Overlay)
════════════════════════════ */
.flash { position: fixed; inset: 0; background: #f0e6d0; z-index: 9999; pointer-events: none; opacity: 0; }
.flash.go { animation: flashAnim 0.8s ease forwards; }
@keyframes flashAnim {
  0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; }
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px); z-index: 10000;
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-content { background: var(--bg-screen); border: 1px solid var(--border-item); width: 90%; max-width: 400px; padding: 30px; text-align: center; }
.modal-header { font-size: 11px; letter-spacing: 5px; color: var(--text-muted); border-bottom: 1px solid var(--border-dim); padding-bottom: 15px; margin-bottom: 20px; font-weight: 800; }
.modal-body { font-size: 13px; color: var(--text-accent); line-height: 1.8; margin-bottom: 30px; }
.modal-footer { display: flex; gap: 12px; }
.modal-btn { flex: 1; background: var(--bg-item); color: var(--text-dim); border: 1px solid var(--border-item); padding: 12px; font-size: 11px; cursor: pointer; }
.modal-btn.primary { background: var(--accent); color: #0a0a0a; border-color: var(--accent); font-weight: 800; }

#landing-overlay {
  position: fixed; inset: 0; background: #000; z-index: 8888;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden;
  font-family: 'Noto Serif KR', serif;
}
#landing-overlay.active { display: flex; }

.map-joseon-container {
  position: absolute; inset: 0;
  background-color: #f4ecd8; /* Hanji Base */
  background-image: url('https://www.transparenttextures.com/patterns/papyrus-dark.png');
  opacity: 0; transition: opacity 1.2s ease; /* 1.5s에서 1.2s로 단축하여 강조 */
  z-index: 1; filter: sepia(0.3) contrast(1.05);
}
#landing-overlay.active .map-joseon-container { opacity: 1; }

.joseon-target-seal {
  position: absolute; width: 80px; height: 80px;
  border: 4px double #b22222; opacity: 0;
  top: 42%; left: 50%; /* 연도보다 약간 위로 배치하여 겹침 방지 */
  transform: translate(-50%, -50%) scale(2.5);
  transition: all 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex; align-items: center; justify-content: center;
  color: #b22222; font-weight: bold; z-index: 5;
  background: rgba(178, 34, 34, 0.05);
}
.joseon-target-seal::before {
  content: '時'; /* 시간의 시 (인장) */
  font-size: 32px;
}
.joseon-target-seal.active { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }

.landing-year { 
  font-size: 80px; font-weight: 900; color: #1a1a1a; 
  letter-spacing: 15px; opacity: 0; z-index: 10; position: relative;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}
#landing-overlay.active .landing-year { 
  animation: jInUp 1s 1s forwards; 
}

.landing-date { 
  font-size: 18px; color: #443e38; opacity: 0; z-index: 10; position: relative;
  letter-spacing: 8px; margin-top: -10px;
}
#landing-overlay.active .landing-date { 
  animation: jInUp 1s 1.5s forwards; 
}

.landing-msg { 
  font-size: 13px; color: #b22222; max-width: 400px; text-align: center; 
  line-height: 2; opacity: 0; z-index: 10; position: relative; margin-top: 50px;
  border-top: 1px solid rgba(178, 34, 34, 0.2); padding-top: 20px;
}
#landing-overlay.active .landing-msg { 
  animation: jFadeIn 1.5s 2.5s forwards; 
}

@keyframes jInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes jFadeIn { to { opacity: 1; } }

/* ════════════════════════════
   어드민 패널 (Admin)
════════════════════════════ */
#screen-admin { background: var(--bg-screen); flex-direction: column; padding: 40px 20px; overflow-y: auto; }
.admin-panel { width: 100%; max-width: 900px; margin: 0 auto; background: var(--bg-shelf); border: 1px solid var(--border-light); padding: 30px; }
.admin-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.admin-title { font-size: 14px; letter-spacing: 4px; color: var(--accent); font-weight: 800; }
.admin-field { margin-bottom: 20px; }
.admin-field label { display: block; font-size: 10px; color: var(--text-dim); margin-bottom: 8px; }
.admin-field input, .admin-field textarea { width: 100%; background: var(--bg-item); border: 1px solid var(--border-item); color: var(--text-main); padding: 12px; font-size: 12px; }
.admin-btn { width: 100%; padding: 16px; background: var(--accent); color: #0a0a0a; font-weight: 800; cursor: pointer; border: none; }

/* ════════════════════════════
   모바일 최적화 (Mobile Responsive)
   ───────────────────────────── */
@media (max-width: 768px) {
  /* 1. 도서관 */
  .shelf-row { gap: 10px; justify-content: center; }
  .newspaper-item { width: 130px; height: 180px; }
  .library-subtitle { font-size: 20px; }
  #screen-newspaper, #screen-investigation { background: #1a1a1a; }
  .newspaper-container { padding: 0; width: 100%; }

  /* 2. 신문 본문 */
  .newspaper-wrap { padding: 15px 12px; box-shadow: none; filter: none; width:100%; border-radius:0; }
  .np-masthead-name { font-size: 20px; letter-spacing: 2px; }
  .np-masthead-info { font-size: 8px; }
  .np-main-headline { font-size: 18px; margin: 15px 0; }
  .np-sub-headline { font-size: 10px; text-align: left; }
  .np-columns { display: flex; flex-direction: column; gap: 15px; border-bottom: none; }
  .np-col-body { font-size: 12px; line-height: 1.7; text-align: justify; }
  .np-col-title { font-size: 13px; margin-bottom: 8px; border-bottom: 2px solid #333; }
  
  /* 3. 수사 일지 */
  .field-notes-wrap { padding: 20px 15px; }
  .log-line { font-size: 13px; }
  .btn-choice { font-size: 12px; padding: 14px; }

  /* 4. 헤더 & 스탯 */
  .game-header { gap: 8px; padding: 8px 10px; flex-wrap: wrap; justify-content: space-between; }
  .game-location { 
    font-size: 10px; order: 3; width: 100%; border-top: 1px solid var(--border-dim); 
    padding-top: 8px; margin-top: 5px; opacity: 0.7;
    white-space: normal; overflow: visible; /* 잘림 방지 */
  }
  .game-clues { 
    font-size: 10px; color: #fff; background: var(--accent); padding: 4px 10px; 
    border-radius: 4px; cursor: pointer; flex-shrink: 0;
  }
  .game-era-badge { flex-shrink: 0; }
  .font-controls { margin-left: 0 !important; gap: 2px; }
  .btn-theme-toggle { margin-left: 0 !important; flex: 1; text-align: center; }
  .stat-item .stat-label { display: none; } /* 모바일에서 라벨 숨김 */
  .stat-item::before { content: "● "; font-size: 8px; color: #444; }

  .drawer-close-btn { 
    display: block; font-size: 18px; cursor: pointer; color: #c8a96e; 
    background: transparent; border: none; padding: 0 4px; 
    margin-top: -4px; opacity: 0.6;
  }

  /* ───── 모바일 단서 패널 (상단 상단 드롭다운 방식) ───── */
  .clue-panel {
    width: 100%; position: fixed; top: -100%; left: 0; right: 0; height: auto; max-height: 85vh;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8); border-left: none; border-bottom: 2px solid var(--accent);
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1); z-index: 10000;
    border-radius: 0 0 24px 24px; padding: 30px 20px 40px;
  }
  .clue-panel.active { top: 0; right: auto; } /* right 초기화 */
  
  /* 배경 어둡게 처리 (배경 클릭 시 닫기용) */
  .clue-panel-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    backdrop-filter: blur(2px);
    z-index: 9999; display: none;
  }
  .clue-panel-overlay.active { display: block; }
}

/* ───── 모바일 전용 UI 초기 상태 제거 (HTML 삭제됨) ───── */

/* 폰트 제어 버튼 스타일 */
.font-controls { display: flex; align-items: center; gap: 4px; margin-left: 10px; border-left: 1px solid var(--border-light); padding-left: 10px; }
.font-btn { 
  background: var(--bg-item); color: var(--text-dim); border: 1px solid var(--border-item); 
  width: 28px; height: 28px; border-radius: 4px; font-size: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.font-btn:hover { border-color: var(--accent); color: var(--accent); }
.font-btn.active { background: var(--accent); color: #000; border-color: var(--accent); }

/* ════════════════════════════
   단서 재열람 & 시간 도약 (Re-view & Jump)
   ───────────────────────────── */
.context-modal-content {
  max-width: 500px !important;
  background: var(--bg-item) !important;
  border: 1px solid var(--border-item) !important;
  text-align: left !important;
  box-shadow: 0 0 50px rgba(0,0,0,1), 0 0 20px rgba(200,169,110,0.1);
}

.context-clue-title {
  font-size: 20px;
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.context-clue-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-dim);
}

.context-log-scroll {
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-panel);
  padding: 20px;
  border: 1px solid var(--border-dim);
  margin-bottom: 20px;
}

.context-log-scroll::-webkit-scrollbar { width: 4px; }
.context-log-scroll::-webkit-scrollbar-thumb { background: #333; }

/* 클릭 가능한 해결 단서 */
.solved-clue-item.clickable {
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  background: rgba(255,255,255,0.03);
  margin-bottom: 8px;
}
.solved-clue-item.clickable:hover {
  background: rgba(200,169,110,0.1);
  padding-left: 18px;
  color: var(--accent);
  border-left-color: var(--accent);
}
.solved-clue-item.clickable::after {
  content: ' 🔍 맥락 재열람';
  font-size: 10px;
  float: right;
  opacity: 0.4;
  font-weight: normal;
}

/* 시간 도약 효과 */
@keyframes timeGlitch {
  0% { transform: translate(0); filter: hue-rotate(0deg); }
  25% { transform: translate(-2px, 2px); }
  50% { transform: translate(2px, -2px); filter: contrast(150%); }
  75% { transform: translate(-2px, -2px); }
  100% { transform: translate(0); filter: hue-rotate(0deg); }
}
.time-glitch-active {
  animation: timeGlitch 0.2s infinite;
  pointer-events: none;
}
/* 단서 부족 시 박동 효과 */
.clue-pulse {
  animation: cluePulse 1.5s infinite;
  box-shadow: 0 0 0 0 rgba(200, 169, 110, 0.7);
}
@keyframes cluePulse {
  0%   { transform: scale(1);   box-shadow: 0 0 0 0 rgba(200, 169, 110, 0.7); }
  70%  { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(200, 169, 110, 0); }
  100% { transform: scale(1);   box-shadow: 0 0 0 0 rgba(200, 169, 110, 0); }
}

/* ══════════════════════════════
   소개 페이지 (About)
══════════════════════════════ */
.about-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 40px;
  animation: slideUp 0.8s ease-out;
}

.about-header {
  border-bottom: 2px solid var(--accent);
  padding-bottom: 20px;
}

.about-header-main {
  font-family: serif;
  font-size: calc(28px * var(--f-scale));
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--text-main);
}

.about-header-sub {
  font-size: calc(10px * var(--f-scale));
  letter-spacing: 4px;
  color: var(--accent);
  margin-top: 5px;
}

.about-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.about-section {
  padding: 30px;
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  line-height: 1.8;
  font-size: calc(14px * var(--f-scale));
  color: var(--text-dim);
}

.about-section strong {
  color: var(--text-main);
}

.about-section.warning {
  border-left: 6px solid #c0392b; /* 경고 레드 */
  background: rgba(192, 57, 43, 0.05);
}

.section-title {
  font-size: calc(18px * var(--f-scale));
  margin-bottom: 15px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.about-footer {
  margin-top: 20px;
  margin-bottom: 60px;
  text-align: center;
}

@media (max-width: 768px) {
  .about-container { padding: 40px 20px; gap: 30px; }
  .about-header-main { font-size: calc(24px * var(--f-scale)); }
  .about-section { padding: 20px; }
}
/* ══════════════════════════════
   POV 선택 및 홀로그램 연출
   ───────────────────────────── */
#screen-pov-selection {
  flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(to bottom, #0f0b08, #1a1714); padding: 40px 20px;
}
.pov-header { text-align: center; margin-bottom: 50px; }
.pov-title { font-size: 32px; font-weight: 800; color: var(--text-accent); letter-spacing: 4px; margin-bottom: 12px; }
.pov-subtitle { font-size: 14px; color: var(--text-dim); opacity: 0.8; }

.pov-completion-dots {
  display: flex; gap: 4px; margin-top: 4px;
}
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(178, 34, 34, 0.2); border: 1px solid rgba(178, 34, 34, 0.3);
  transition: all 0.3s ease;
}
.dot.filled {
  background: #b22222; border-color: #b22222;
  box-shadow: 0 0 8px rgba(178, 34, 34, 0.6);
}

.pov-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  width: 100%; max-width: 1000px;
}
@media (max-width: 900px) {
  .pov-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .pov-grid { grid-template-columns: 1fr; }
}

.pov-card {
  background: rgba(255,255,255,0.02); border: 1px solid rgba(200,169,110,0.15);
  padding: 30px 24px; text-align: center; cursor: pointer;
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
}
.pov-card:hover {
  background: rgba(200,169,110,0.08); border-color: var(--accent);
  transform: translateY(-12px); box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.pov-card.solved { border-color: #90b89066; opacity: 0.9; }
.pov-card.solved::before {
  content: "기록 완료"; position: absolute; top: 10px; right: 10px;
  font-size: 9px; color: #90b890; border: 1px solid #90b890; padding: 2px 6px;
}

.pov-role { font-size: 10px; color: var(--accent); letter-spacing: 3px; font-weight: 800; margin-bottom: 20px; opacity: 0.6; }
.pov-name { font-size: 24px; font-weight: 800; color: #fff; margin-bottom: 15px; }
.pov-desc { font-size: 13px; color: var(--text-dim); line-height: 1.8; word-break: keep-all; flex: 1; }

.pov-btn-pick {
  margin-top: 25px; background: transparent; border: 1px solid var(--accent);
  color: var(--accent); padding: 8px 20px; font-size: 11px; cursor: pointer;
  transition: all 0.3s; width: 100%;
}
.pov-card:hover .pov-btn-pick { background: var(--accent); color: #000; }

/* 홀로그램 지도 (Hologram Overlay) */
.hologram-overlay {
  position: fixed; inset: 0; background: #000 !important; z-index: 99999 !important;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden; pointer-events: none;
}
.hologram-overlay.active { display: flex !important; animation: holoFadeIn 0.8s forwards; }

.hologram-relief-map {
  width: 80vw; height: 80vh;
  background-image: url('../assets/images/danjong_bronze.jpg');
  background-color: #2a1b15;
  background-size: cover;
  background-position: center;
  border-radius: 4px;
  position: relative;
  box-shadow: 0 0 100px rgba(166, 124, 64, 0.4), inset 0 0 50px rgba(0,0,0,0.5);
  filter: sepia(0.3) contrast(1.1) brightness(0.7) hue-rotate(-10deg);
  transform: rotateX(25deg) rotateZ(-3deg) scale(0.9);
  perspective: 1000px;
  opacity: 0;
  transition: all 1.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hologram-scene-preview {
  position: absolute; inset: 0;
  background-image: url('../assets/images/danjong_scenic.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.2s ease;
  z-index: 1;
  filter: grayscale(0.5) brightness(0.6);
}

.hologram-info-overlay {
  position: absolute;
  bottom: 25%; left: 10%;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.hologram-info-content {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  border-left: 3px solid var(--accent);
  padding: 15px 25px;
  color: var(--text-accent);
}
.hologram-info-content h3 { font-size: 11px; letter-spacing: 5px; opacity: 0.6; margin-bottom: 5px; }
.hologram-info-content p { font-size: 14px; letter-spacing: 1px; font-weight: 500; }

/* ── Phases ── */
.hologram-text {
  position: absolute; bottom: 10%; left: 50%; transform: translateX(-50%);
  color: #00f0ff; font-family: 'Courier New', Courier, monospace;
  font-size: 14px; letter-spacing: 2px; text-shadow: 0 0 10px rgba(0,240,255,0.7);
  opacity: 0.8; animation: holoFlicker 2s infinite;
}
.hologram-glitch {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,240,255,0.03) 0px, rgba(0,240,255,0.03) 1px, transparent 1px, transparent 2px);
  z-index: 10;
}
@keyframes holoFlicker {
  0%, 19.999%, 22%, 62.999%, 64%, 64.999%, 70%, 100% { opacity: 0.8; }
  20%, 21.999%, 63%, 63.999%, 65%, 69.999% { opacity: 0.2; }
}
@keyframes holoFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hologram-overlay.phase-scenic .hologram-scene-preview { opacity: 0.8; }
.hologram-overlay.phase-sync .hologram-scene-preview { opacity: 0; }
.hologram-overlay.phase-sync .hologram-relief-map { opacity: 1; transform: rotateX(15deg) rotateZ(-1deg) scale(1.05); }
.hologram-overlay.phase-info .hologram-info-overlay { opacity: 1; }

.hologram-glitch {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0%, rgba(0,255,255,0.03) 1px, transparent 2px);
  pointer-events: none; mix-blend-mode: screen;
  z-index: 100;
}

.hologram-text {
  position: absolute; bottom: 10vh; font-family: monospace;
  color: #0ff; font-size: 11px; letter-spacing: 6px;
  text-shadow: 0 0 10px #0ff; animation: holoPulse 2s infinite;
  z-index: 100;
}

@keyframes holoFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes holoPulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* 파라미터 강제 동적 초기화 애니메이션 */
@keyframes statUpdate { 0% { transform: scale(1.1); color: #fff; } 100% { transform: scale(1); } }
.stat-value.updating { animation: statUpdate 0.5s ease; }

/* 시나리오 내 POV 미리보기 (네 개의 시선) */
.np-pov-preview {
  margin: 30px 0;
  padding: 20px;
  background: rgba(139, 26, 26, 0.03);
  border: 1px solid rgba(139, 26, 26, 0.1);
  border-radius: 4px;
}
.np-pov-preview-title {
  font-size: 11px; color: #8b1a1a; letter-spacing: 5px; font-weight: 800;
  text-align: center; margin-bottom: 20px; text-transform: uppercase;
}
.np-pov-preview-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.np-pov-preview-item {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 12px 8px; background: #fff; border: 1px solid #d1c1a1;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.np-pov-preview-role { font-size: 8px; color: #8b7e6d; margin-bottom: 6px; letter-spacing: 1px; }
.np-pov-preview-name { font-size: 14px; font-weight: 800; color: #1a1a1a; margin-bottom: 4px; }
.np-pov-preview-item.solved {
  background: #f0f7f0;
  border-color: #90b890;
  opacity: 0.9;
}
.np-pov-preview-item.solved .np-pov-preview-tag {
  color: #2e7d32;
  border-top-color: #d0e0d0;
}

@media (max-width: 768px) {
  .np-pov-preview-grid { grid-template-columns: 1fr 1fr; }
}

@keyframes bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -5px); }
}
