/* ============================================
   DETEKTIF DIGITAL — STYLE.CSS
   Gim Edukasi: Sistem Kerja Software & Hardware
   Detective Case File Redesign
   ============================================ */

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== FONT LOKAL ===== */
@font-face {
  font-family: 'MonoCustom';
  src: url("assets/font/' Mono Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
}
@font-face {
  font-family: 'MonoCustom';
  src: url("assets/font/' Mono Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: 'MonoCustom';
  src: url("assets/font/' Mono Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}

:root {
  /* Detective Analog Colors */
  --bg-page: #1a1a1a;
  /* Colors */
  --bg-cork: #b28859;
  --bg-desk: #5c3a21;
  --manila-folder: #f4d388;
  --manila-dark: #d5b565;
  --paper-white: #fdfbf7;
  --paper-note: #ffeb99;
  --primary: #8b2626;
  --primary-hover: #6a1a1a;
  --secondary: #2b3a42;
  --secondary-hover: #1f2b32;
  --accent: #5e6b54;
  --stamp-red: #d32f2f;
  --stamp-green: #388e3c;
  --text-dark: #222222;
  --text-medium: #444444;
  --text-light: #777777;
  --border-color: #333333;

  /* Typography */
  --font-ui: 'MonoCustom', sans-serif;
  --font-type: 'MonoCustom', monospace;

  /* Borders & Shadows */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 16px;

  --shadow-flat: 0 4px 0 var(--border-color);
  --shadow-drop: 4px 4px 10px rgba(0, 0, 0, 0.4);
  --shadow-paper: 2px 2px 8px rgba(0, 0, 0, 0.2);

  /* Transitions */
  --t-fast: 0.1s ease;
  --t-normal: 0.3s ease;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  background-color: var(--bg-page);
  font-family: var(--font-ui);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.type-text {
  font-family: var(--font-type);
}

/* ===== GAME CONTAINER ===== */
.game-container {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100dvh, calc(100vw * 9 / 16));
  max-width: 1280px;
  max-height: 720px;
  overflow: hidden;
  background-color: #000;
  font-size: clamp(10px, 1.4vw, 16px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

body.is-mobile {
  align-items: stretch;
  justify-content: stretch;
}

body.is-mobile .game-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  box-shadow: none;
  border-radius: 0;
}

body.is-mobile-portrait .game-container {
  width: 100vw;
  height: 100dvh;
  transform: none;
}

body.is-mobile .global-controls {
  top: auto;
  right: auto;
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: calc(10px + env(safe-area-inset-left));
}

/* Base backgrounds for different screens */
.detective-theme .screen-title,
.detective-theme .screen-intro,
.detective-theme .screen-victory,
.detective-theme .screen-gameover {
  background: var(--bg-desk);
  background-image: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0px, rgba(0, 0, 0, 0.05) 2px, transparent 2px, transparent 20px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.05) 0px, rgba(0, 0, 0, 0.05) 2px, transparent 2px, transparent 20px);
}

.desk-surface {
  background: var(--bg-desk);
  background-image: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0px, rgba(0, 0, 0, 0.05) 2px, transparent 2px, transparent 20px);
}

.corkboard-area {
  background: var(--bg-cork);
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.1) 20%, transparent 20%);
  background-size: 10px 10px;
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.screen.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
}

#screenLoading.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #060913; /* Solid dark background for terminal booting */
  opacity: 1;
}

#screenLoadingChapter.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-desk);
  background-image: radial-gradient(circle, rgba(6, 9, 19, 0.45) 0%, rgba(6, 9, 19, 0.95) 100%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0px, rgba(0, 0, 0, 0.05) 2px, transparent 2px, transparent 20px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.05) 0px, rgba(0, 0, 0, 0.05) 2px, transparent 2px, transparent 20px);
  opacity: 1;
}

.fade-out {
  opacity: 0;
  pointer-events: none;
}

.screen.fade-out {
  display: flex;
  flex-direction: column;
  opacity: 0;
}

/* ===== COMPONENTS ===== */

/* Manila Folder Styling */
.case-folder {
  position: relative;
  max-width: 600px;
  width: 90%;
  margin: auto;
}

.folder-tab {
  display: inline-block;
  background-color: var(--manila-dark);
  padding: 10px 30px;
  border-radius: 8px 8px 0 0;
  font-family: var(--font-type);
  font-weight: bold;
  font-size: 1.2em;
  color: var(--text-dark);
  margin-left: 20px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-bottom: none;
  box-shadow: 2px -2px 5px rgba(0, 0, 0, 0.1);
}

.folder-body {
  background-color: var(--manila-folder);
  padding: 40px;
  border-radius: 4px;
  box-shadow: var(--shadow-drop);
  border: 1px solid rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
}

.folder-divider {
  width: 100%;
  border: none;
  border-top: 2px dashed rgba(0, 0, 0, 0.2);
  margin: 20px 0;
}

/* Paper Note Styling */
.note-paper {
  background-color: var(--paper-white);
  padding: 40px;
  box-shadow: var(--shadow-paper);
  position: relative;
  max-width: 500px;
  width: 90%;
  margin: auto;
  border-radius: 2px;
  transform: rotate(-1deg);
  max-height: 85vh;
  overflow-y: auto;
}

.paper-clip {
  position: absolute;
  top: -15px;
  left: 30px;
  width: 20px;
  height: 50px;
  border: 3px solid #888;
  border-radius: 10px;
  z-index: 2;
  box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  background: transparent;
}

.paper-clip::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 3px;
  width: 8px;
  height: 30px;
  border: 3px solid #888;
  border-radius: 10px;
  border-bottom: none;
}

/* Sticky Note Styling */
.sticky-note {
  background-color: var(--paper-note);
  padding: 20px;
  box-shadow: var(--shadow-paper);
  position: relative;
  border-radius: 0 0 20px 0;
}

/* Stamp Texts */
.stamp-rejected {
  color: var(--stamp-red);
  border: 4px solid var(--stamp-red);
  padding: 10px;
  display: inline-block;
  transform: rotate(-5deg);
  border-radius: 8px;
  font-weight: bold;
}

.stamp-success {
  color: var(--stamp-green);
  border: 4px solid var(--stamp-green);
  padding: 10px;
  display: inline-block;
  transform: rotate(3deg);
  border-radius: 8px;
  font-weight: bold;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 15px 35px;
  border: none;
  font-family: var(--font-type);
  font-size: 1.3em;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform var(--t-fast), filter var(--t-fast);
  user-select: none;
  background-color: transparent;
  background-image: url('assets/img/bg-btn.svg');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--text-dark);
  box-shadow: none;
  letter-spacing: 1px;
}

.btn:active {
  transform: scale(0.95);
  filter: brightness(0.9);
}

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

.btn-stamp {
  background-image: none;
  background-color: transparent;
  color: var(--primary);
  border: 4px solid var(--primary);
  box-shadow: 2px 2px 0 var(--primary);
  border-radius: 6px;
}

.btn-stamp:active {
  box-shadow: 0 0 0 var(--primary);
}

.btn-back {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-family: var(--font-type);
  font-size: 0.85em;
  font-weight: bold;
  letter-spacing: 1.5px;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: 4px;
  margin-right: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-back:hover {
  background: var(--manila-folder);
  color: var(--text-dark);
  border-color: var(--manila-dark);
  transform: translateX(-3px);
  box-shadow: 0 4px 10px rgba(244, 211, 136, 0.35);
  text-decoration: none;
}

.btn-back:active {
  transform: scale(0.95) translateX(-3px);
}

/* Sound Toggle */
.sound-toggle {
  position: absolute;
  top: 15px;
  right: 20px;
  z-index: 100;
  background: transparent;
  border: none;
  font-size: 2em;
  cursor: pointer;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
}

/* ===== TITLE SCREEN ===== */
.main-menu-btn {
  background-image: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
  border: none !important;
  padding: 10px 0 !important;
  justify-content: flex-start !important;
  letter-spacing: 2px;
}
.main-menu-btn:hover {
  transform: translateX(10px) !important;
  text-decoration: underline;
}

.title-badge {
  font-size: 3.5em;
  margin-bottom: 10px;
}

.title-text {
  font-size: 2.8em;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.15;
}

.title-subtitle {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--text-medium);
  margin-bottom: 10px;
}

.title-desc {
  font-size: 1.1em;
  color: var(--text-dark);
  line-height: 1.5;
  margin-bottom: 30px;
}

/* ===== INTRO SCREEN ===== */
.intro-avatar {
  width: 80px;
  height: 80px;
  background-image: url('assets/img/avatar.svg');
  background-size: cover;
  border-radius: 50%;
  border: 2px solid var(--text-dark);
  margin-bottom: 15px;
}

.intro-title {
  font-size: 1.8em;
  margin-bottom: 10px;
}

.intro-pemantik {
  font-size: 1.1em;
  font-weight: bold;
  margin-bottom: 15px;
}

.intro-text {
  font-size: 1em;
  line-height: 1.5;
  margin-bottom: 15px;
}

.alert-text {
  color: var(--primary);
  font-weight: bold;
}

/* ===== CASE BOARD (MENU) ===== */
.board-header {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) rotate(-1.5deg);
  background-color: var(--paper-note);
  color: var(--text-dark);
  padding: 16px 35px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
  z-index: 10;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.board-header::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(1deg);
  width: 100px;
  height: 22px;
  background-color: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(1px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  border-left: 1px dashed rgba(0, 0, 0, 0.05);
  border-right: 1px dashed rgba(0, 0, 0, 0.05);
  z-index: 2;
}

.board-title {
  font-family: var(--font-type);
  font-size: 1.5em;
  font-weight: 800;
  letter-spacing: 1.5px;
  margin-bottom: 5px;
  text-align: center;
  border-bottom: 2px dashed rgba(0,0,0,0.15);
  padding-bottom: 5px;
  color: var(--primary);
  text-transform: uppercase;
}

.board-stars {
  font-size: 1.1em;
  font-weight: bold;
  color: #d32f2f;
  font-family: var(--font-type);
}

.corkboard-area {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 40px;
  padding: 40px;
}

#screenBoard .corkboard-area {
  padding-top: 7.5em;
}

.case-file {
  width: 140px;
  background-color: var(--paper-white);
  padding: 10px 10px 20px 10px;
  box-shadow: var(--shadow-paper);
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
  z-index: 3;
}

.case-file:hover {
  transform: scale(1.05) rotate(2deg);
  z-index: 4;
}

.case-file:active {
  transform: scale(0.95);
}

/* Rotate each polaroid slightly differently */
#btnCase1 {
  transform: rotate(-3deg);
  margin-top: -40px;
}

#btnCase2 {
  transform: rotate(2deg);
  margin-top: 40px;
}

#btnCase3 {
  transform: rotate(-1deg);
  margin-top: -20px;
}

#btnCase4 {
  transform: rotate(4deg);
  margin-top: 30px;
}

#btnCase5 {
  transform: rotate(-2deg);
  margin-top: -50px;
}

.case-file.locked {
  filter: grayscale(100%) opacity(0.7);
  pointer-events: none;
}

.case-thumb {
  width: 100%;
  height: 90px;
  object-fit: cover;
  background-color: #ddd;
  border: 1px solid #ccc;
  margin-bottom: 10px;
}

.case-info {
  text-align: center;
}

.case-no {
  font-family: var(--font-type);
  font-size: 0.9em;
  font-weight: bold;
  color: var(--primary);
}

.case-name {
  font-size: 0.85em;
  font-weight: bold;
  margin: 5px 0;
}

.case-stars {
  font-size: 1em;
  color: #f5a623;
  letter-spacing: 2px;
}

/* Pins */
.pin {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.5), 2px 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 5;
}

.red-pin {
  background-color: #d32f2f;
}

.blue-pin {
  background-color: #1976d2;
}

.green-pin {
  background-color: #388e3c;
}

.yellow-pin {
  background-color: #fbc02d;
}

.small-pin {
  top: 10px;
  width: 8px;
  height: 8px;
}

/* Board Strings */
.board-strings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* ===== HUD ===== */
.evidence-hud {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  background: linear-gradient(135deg, rgba(20, 24, 33, 0.92), rgba(28, 34, 46, 0.95));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--paper-white);
  border-bottom: 3px solid var(--manila-dark);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  z-index: 5;
  flex-shrink: 0;
  transition: border-color 0.3s ease;
}

.hud-mission {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  font-size: 1.1em;
}

.hud-mission .type-text {
  font-family: var(--font-type);
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #f5f5f7;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.hud-mission-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.progress-bar-bg {
  width: 180px;
  height: 12px;
  background-color: rgba(0, 0, 0, 0.45);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  margin-left: 20px;
  display: inline-block;
  vertical-align: middle;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #d32f2f 0%, #f5a623 100%);
  box-shadow: 0 0 10px rgba(245, 166, 35, 0.5);
  border-radius: 6px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Garis diagonal animasi berputar */
.progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(45deg, 
    rgba(255, 255, 255, 0.15) 25%, 
    transparent 25%, 
    transparent 50%, 
    rgba(255, 255, 255, 0.15) 50%, 
    rgba(255, 255, 255, 0.15) 75%, 
    transparent 75%, 
    transparent
  );
  background-size: 15px 15px;
  animation: progress-bar-stripes 1.2s linear infinite;
}

@keyframes progress-bar-stripes {
  0% { background-position: 0 0; }
  100% { background-position: 15px 0; }
}

.hud-lives {
  display: flex;
  gap: 8px;
  margin-left: auto;
  align-items: center;
}

.heart {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.3s ease;
}

.heart:hover {
  transform: scale(1.15);
}

.heart.lost {
  animation: heart-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.heart.empty {
  opacity: 0.25;
  filter: grayscale(100%) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* ===== PLAY AREA (Desk) ===== */
.play-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 15px;
  position: relative;
  z-index: 2;
  overflow-y: auto;
  overflow-x: hidden;
}

#screenMaterial .play-area {
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}

.narrator-panel {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%) rotate(-1deg);
  max-width: 300px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  background-color: var(--paper-note);
  border-radius: 2px 2px 15px 2px;
  box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

.narrator-panel::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: #d32f2f;
  border-radius: 50%;
  box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.5), 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.narrator-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background-color: #fff;
  overflow: hidden;
  border: 2px solid var(--text-dark);
  flex-shrink: 0;
}

.narrator-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.narrator-text {
  font-size: 0.9em;
  color: var(--text-dark);
  flex: 1;
  line-height: 1.4;
  font-family: var(--font-type);
}

.narrator-name {
  font-weight: bold;
  color: var(--primary);
  display: block;
  margin-bottom: 3px;
  font-family: var(--font-ui);
}

/* Hint Box / Evidence Label */
.hint-box {
  background-color: var(--paper-note);
  padding: 10px 20px;
  box-shadow: var(--shadow-paper);
  border-left: 5px solid var(--accent);
  font-family: var(--font-type);
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: center;
  max-width: 800px;
}

/* Evidences Shelf */
.shelf-container {
  margin-top: auto;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 8px 15px;
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.section-label {
  color: var(--paper-white);
  font-family: var(--font-type);
  font-size: 0.85em;
  margin-bottom: 6px;
  display: flex;
  justify-content: center;
}

.item-shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* Evidence Cards (Polaroids) */
.item-card {
  width: 90px;
  background-color: var(--paper-white);
  padding: 8px 8px 15px 8px;
  box-shadow: var(--shadow-paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform var(--t-fast);
  user-select: none;
}

.item-card:hover:not(.placed) {
  transform: translateY(-5px) scale(1.05);
}

.item-card.selected {
  outline: 3px solid var(--primary);
  transform: scale(1.1);
  z-index: 10;
}

.item-card.correct {
  animation: correct-pop 0.4s ease;
  background-color: #e8f5e9;
  pointer-events: none;
}

.item-card.wrong {
  animation: shake 0.4s ease;
  background-color: #ffebee;
  border: 1px solid var(--stamp-red);
}

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

/* Custom Main Menu Buttons */
.main-menu-btn {
  background-color: transparent !important;
  border: none !important;
  color: #fff !important;
  font-size: 1.8em !important;
  font-family: var(--font-type);
  text-align: left !important;
  justify-content: flex-start !important;
  padding: 10px 20px !important;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease !important;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
  box-shadow: none !important;
  cursor: pointer;
  letter-spacing: 2px;
}

/* Hover Animation: Slide right and glow */
.main-menu-btn:hover {
  transform: translateX(15px) !important;
  color: #f5a623 !important;
  text-shadow: 2px 2px 10px rgba(0,0,0,0.9), 0 0 15px rgba(245, 166, 35, 0.5);
}

/* Click Animation: Shrink and flash */
.main-menu-btn:active {
  transform: translateX(20px) scale(0.95) !important;
  filter: brightness(1.5);
}

/* Add a cool left border on hover */
.main-menu-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 4px;
  background-color: #f5a623;
  opacity: 0;
  transition: all 0.3s ease;
}

.main-menu-btn:hover::before {
  opacity: 1;
}

/* Panel Menu Buttons (Dark version of main menu btn for overlays) */
.panel-btn {
  background-color: transparent !important;
  border: none !important;
  color: var(--text-dark) !important;
  font-size: 1.25em !important;
  font-family: var(--font-type);
  text-align: center !important;
  justify-content: center !important;
  padding: 10px !important;
  position: relative;
  transition: all 0.3s ease !important;
  box-shadow: none !important;
  cursor: pointer;
  font-weight: bold;
  white-space: normal;
  line-height: 1.3;
}

.panel-btn:hover {
  transform: translateX(10px) !important;
  color: var(--primary) !important;
}

.panel-btn:active {
  transform: translateX(15px) scale(0.95) !important;
}

.panel-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 4px;
  background-color: var(--primary);
  opacity: 0;
  transition: all 0.3s ease;
}

.panel-btn:hover::before {
  opacity: 1;
}

.item-card.placed {
  opacity: 0.5;
  transform: scale(0.9);
  pointer-events: none;
}

.item-card-icon {
  width: 100%;
  height: 60px;
  background-color: #eee;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-card-icon img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  filter: sepia(0.3);
}

.item-card-label {
  font-family: var(--font-type);
  font-size: 0.75em;
  font-weight: bold;
  text-align: center;
}

.item-card-desc {
  display: none;
}

/* Hide description to keep polaroid clean */

/* Target Zones (Manila Folders) */
.game-board {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.targets-row {
  display: flex;
  gap: 30px;
  justify-content: center;
  width: 100%;
}

.target-zone {
  flex: 1;
  max-width: 300px;
  min-height: 200px;
  background-color: var(--manila-folder);
  border: 1px solid var(--manila-dark);
  box-shadow: var(--shadow-paper);
  border-radius: 0 8px 8px 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px;
  transition: all var(--t-normal);
  cursor: pointer;
}

.target-zone::before {
  content: '';
  position: absolute;
  top: -20px;
  left: -1px;
  width: 120px;
  height: 20px;
  background-color: var(--manila-folder);
  border: 1px solid var(--manila-dark);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.target-zone.accepting {
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
  outline: 2px dashed #fff;
}

.target-zone.completed::after {
  content: 'CASE CLOSED';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  font-family: var(--font-type);
  font-size: 1.5em;
  color: var(--stamp-green);
  border: 3px solid var(--stamp-green);
  padding: 5px 10px;
  border-radius: 5px;
  opacity: 0.8;
  pointer-events: none;
  z-index: 10;
}

.target-zone-header {
  font-family: var(--font-type);
  font-weight: bold;
  font-size: 1.1em;
  border-bottom: 2px solid var(--manila-dark);
  padding-bottom: 5px;
  margin-bottom: 10px;
}

.target-zone-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.target-zone-placeholder {
  font-family: var(--font-type);
  font-size: 0.9em;
  color: rgba(0, 0, 0, 0.4);
  font-style: italic;
  margin: auto;
}

/* IPO Flow Stations (Notes connected by arrows) */
.ipo-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  width: 100%;
}

.ipo-arrow {
  font-size: 2em;
  color: rgba(255, 255, 255, 0.5);
}

.ipo-station {
  width: 120px;
  min-height: 110px;
  background-color: var(--paper-note);
  box-shadow: var(--shadow-paper);
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.ipo-station.accepting {
  outline: 2px dashed #fff;
}

.ipo-station.completed {
  opacity: 0.9;
}

.ipo-station-label {
  font-family: var(--font-type);
  font-weight: bold;
  font-size: 0.8em;
  border-bottom: 1px solid #ccc;
  width: 100%;
  text-align: center;
  margin-bottom: 5px;
}

.ipo-station-number {
  font-size: 1.2em;
  font-weight: bold;
  color: rgba(0, 0, 0, 0.2);
  margin: auto;
}

.ipo-station-content {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
}

/* Pyramid layers (styled as stacked file boxes or dossiers) */
.mission3-layout {
  display: flex;
  gap: 40px;
  width: 100%;
  justify-content: center;
  align-items: center;
}

.pyramid-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  flex: 1;
  max-width: 400px;
}

.pyramid-layer {
  background-color: var(--manila-folder);
  border: 1px solid var(--manila-dark);
  box-shadow: var(--shadow-paper);
  padding: 8px;
  text-align: center;
  min-height: 50px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pyramid-layer-3 {
  width: 60%;
}

.pyramid-layer-2 {
  width: 80%;
}

.pyramid-layer-1 {
  width: 100%;
}

.pyramid-layer.locked {
  filter: grayscale(100%);
  opacity: 0.5;
  pointer-events: none;
}

.pyramid-layer.accepting {
  outline: 2px dashed #fff;
}

.pyramid-layer.completed {
  background-color: #e0d0a0;
}

.pyramid-label {
  font-family: var(--font-type);
  font-weight: bold;
}

.computer-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 150px;
}

.computer-screen {
  width: 100%;
  aspect-ratio: 4/3;
  background-color: #111;
  border: 8px solid #ddd;
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.computer-screen.on {
  background-color: #e8f5e9;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.screen-off-text {
  color: #555;
  font-family: var(--font-type);
  font-size: 0.8em;
}

.computer-stand {
  width: 30px;
  height: 20px;
  background-color: #aaa;
}

.computer-base {
  width: 80px;
  height: 10px;
  background-color: #ccc;
  border-radius: 2px;
}

/* Music Notes Anim */
.music-notes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.music-note {
  position: absolute;
  font-size: 1.5em;
  opacity: 0;
  animation: floatUp 2s ease-in forwards;
}

@keyframes floatUp {
  0% {
    transform: translateY(0);
    opacity: 1;
  }

  100% {
    transform: translateY(-50px);
    opacity: 0;
  }
}

/* ===== OVERLAYS ===== */
.mission-brief {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 20;
}

.mission-brief.active {
  display: flex;
}

.manila-folder.mission-brief-card {
  width: 650px;
  max-width: 95%;
}

.brief-content {
  padding: 90px 45px 75px 45px;
}

.mission-brief-title {
  font-size: 1.5em;
  text-align: center;
  margin-bottom: 15px;
}

.mission-brief-desc {
  font-size: 1.1em;
  line-height: 1.5;
  margin-bottom: 20px;
}

.transition-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 30;
  text-align: center;
}

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

#creditOverlay {
  background:
    linear-gradient(180deg, rgba(8, 10, 18, 0.82), rgba(8, 10, 18, 0.7)),
    url('assets/img/bgCorkboard.jpg') center center / cover no-repeat;
}

#creditOverlay .credits-container {
  width: min(92vw, 740px);
  height: min(88dvh, 760px);
  padding: 22px;
  box-sizing: border-box;
}

#creditOverlay .credits-metadata {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  text-align: left;
}

#creditOverlay .credits-social-row {
  justify-content: flex-start;
}

.game-dialog-overlay {
  z-index: 10050;
  padding: 20px;
}

.game-dialog-card {
  width: min(92vw, 620px);
  padding: 38px 34px 30px;
  text-align: center;
}

.game-dialog-title {
  font-size: 1.7em;
  margin-bottom: 16px;
  color: var(--stamp-red);
}

.game-dialog-text {
  font-size: 1.05em;
  line-height: 1.55;
  margin-bottom: 22px;
  color: var(--text-dark);
  white-space: pre-line;
}

.game-dialog-actions {
  display: flex;
  gap: 14px;
  width: 100%;
}

.game-dialog-actions .btn {
  flex: 1;
  min-width: 0;
}

.transition-emoji {
  font-size: 4em;
  margin-bottom: 20px;
}

.custom-panel-bg, .manila-folder {
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.transition-title {
  font-size: 2.5em;
  margin-bottom: 15px;
}

.transition-text {
  font-size: 1.2em;
  color: #fff;
  max-width: 600px;
  margin-bottom: 30px;
}

.knowledge-toast {
  position: absolute;
  bottom: -140px;
  right: 20px;
  z-index: 80;
  width: min(92vw, 420px);
  padding: 14px 16px 13px;
  background: rgba(253, 251, 247, 0.96);
  border: 1px solid rgba(51, 51, 51, 0.16);
  border-left: 6px solid var(--accent);
  border-radius: 4px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform: translateY(6px);
  box-sizing: border-box;
  pointer-events: none;
}

.knowledge-toast.show {
  bottom: 20px;
  transform: translateY(0);
}

body.is-mobile .knowledge-toast {
  right: 12px;
  left: 12px;
  bottom: -180px;
  width: auto;
  max-width: none;
}

body.is-mobile .knowledge-toast.show {
  bottom: calc(12px + env(safe-area-inset-bottom));
}

.knowledge-toast-title {
  display: block;
  font-weight: bold;
  margin: 0 0 6px;
  color: var(--primary);
  font-family: var(--font-ui);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.knowledge-toast-text {
  font-size: 0.92em;
  line-height: 1.45;
  color: var(--text-dark);
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Victory / Game Over Details */
.victory-stamp {
  font-family: var(--font-type);
  font-size: 3em;
  color: var(--stamp-green);
  border: 5px solid var(--stamp-green);
  padding: 10px 20px;
  transform: rotate(-10deg);
  margin-bottom: 20px;
  opacity: 0;
  animation: stamp-down 0.5s 0.5s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.victory-stars {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 2.5em;
  color: #f5a623;
}

.victory-title {
  font-size: 2em;
  margin-bottom: 15px;
}

.victory-text {
  font-size: 1.1em;
  margin-bottom: 30px;
  max-width: 80%;
}

/* Animations */
@keyframes heart-pop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.5);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes correct-pop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.3);
    filter: brightness(1.2);
  }

  100% {
    transform: scale(1);
  }
}

/* ===== SPLASH SCREEN ===== */
@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

.cursor-blink {
  animation: blink 1s infinite;
}

/* ===== MATERIAL DOCUMENT ===== */
.material-document {
  background-color: var(--paper-white);
  max-width: 700px;
  width: 90%;
  padding: 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border-radius: 2px;
  position: relative;
  transform: rotate(1deg);
  max-height: 85vh;
  overflow-y: auto;
}

.material-document::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 15px;
  height: 15px;
  background-color: #555;
  border-radius: 50%;
  box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.5), 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.confidential-stamp {
  position: absolute;
  top: 20px;
  right: -20px;
  color: #d32f2f;
  border: 4px solid #d32f2f;
  padding: 5px 15px;
  font-family: 'Courier New', Courier, monospace;
  font-weight: bold;
  font-size: 1.5em;
  transform: rotate(15deg);
  opacity: 0.7;
  letter-spacing: 2px;
  pointer-events: none;
}

/* ===== GLOBAL CONTROLS ===== */
.global-controls {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: none;
  gap: 10px;
  z-index: 1000;
}

.control-btn {
  background: var(--paper-white);
  border: 2px solid var(--text-dark);
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, background 0.2s;
  touch-action: manipulation;
}

.control-btn:hover {
  transform: scale(1.1);
  background: #eee;
}

.control-btn.muted {
  background: #f6d7d7;
  border-color: #8b2626;
}

.control-btn.muted img {
  opacity: 0.45;
  filter: grayscale(1);
}

.control-btn.active {
  background: #f4e2b7;
  border-color: #8b2626;
}

.control-btn:active {
  transform: scale(0.95);
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px) rotate(-5deg);
  }

  75% {
    transform: translateX(5px) rotate(5deg);
  }
}

@keyframes stamp-down {
  0% {
    transform: scale(3) rotate(-10deg);
    opacity: 0;
  }

  100% {
    transform: scale(1) rotate(-10deg);
    opacity: 1;
  }
}

/* ===== LOADING SCREEN ===== */
.loading-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.3;
  z-index: 1;
}

.loading-logo img {
  height: 170px;
  animation: pulse-slow 2s infinite;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes pulse-slow {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Sparkles & Confetti (kept simple) */
.sparkle {
  position: absolute;
  width: 2px;
  height: 2px;
  z-index: 50;
  pointer-events: none;
}

.sparkle-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  opacity: 1;
  animation: sparkleAnim 0.7s forwards;
}

@keyframes sparkleAnim {
  0% {
    transform: scale(0) translateY(0);
    opacity: 1;
  }

  100% {
    transform: scale(1.5) translateY(-50px);
    opacity: 0;
  }
}

/* ===== RESPONSIVE IMAGE CONTAINERS ===== */
.responsive-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  margin: auto;
}

.responsive-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.blink-text {
  animation: blink-slow 1.5s infinite;
}

@keyframes blink-slow {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

/* Fix title badge dimensions so logo doesn't blow up */
.title-badge {
  width: 150px;
  height: 150px;
  margin: 0 auto 20px auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

#titleLogoContainer img {
  animation: pulse-slow 2s infinite;
}

/* Fix text overflow for uncropped SVGs */
.custom-panel-bg {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.custom-panel-bg > * {
  max-width: 320px !important;
  width: 100%;
}
.custom-panel-bg h2 {
  text-align: center;
}

.confetti-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  opacity: 0;
  animation: fall linear forwards;
}

@keyframes fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Disable scrollbar visual appearance inside the game container */
.game-container *::-webkit-scrollbar {
  display: none;
}
.game-container * {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

/* ===== NEW ANIMATION & TRANSITION STYLES ===== */

.corkboard-area {
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.8s ease;
}

.corkboard-area.zoom-active {
  animation: board-dive-zoom 1.5s cubic-bezier(0.25, 1, 0.2, 1) forwards;
  pointer-events: none;
}

/* Magnifier Glass Zoom Overlay */
.magnifier-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 99999;
  display: none;
  background-color: rgba(10, 15, 30, 0);
  transition: background-color 0.8s ease;
}

.magnifier-overlay.active {
  display: block;
  background-color: rgba(6, 9, 19, 0.55);
}

.magnifier-glass {
  position: absolute;
  width: 150px;
  height: 150px;
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0;
  pointer-events: none;
  overflow: visible !important;
}

.magnifier-overlay.active .magnifier-glass {
  animation: magnifier-fly-zoom 1.5s cubic-bezier(0.25, 1, 0.2, 1) forwards;
}

@keyframes magnifier-fly-zoom {
  0% {
    transform: translate(-50%, -50%) scale(0.1) rotate(-45deg);
    opacity: 0;
  }
  25% {
    transform: translate(-50%, -50%) scale(1.15) rotate(15deg);
    opacity: 1;
  }
  30% {
    transform: translate(-50%, -50%) scale(1.0) rotate(5deg);
    opacity: 1;
  }
  /* Scanner sweep/focus wiggles */
  40% {
    transform: translate(-50%, -50%) scale(1.03) rotate(8deg);
  }
  50% {
    transform: translate(-50%, -50%) scale(0.97) rotate(3deg);
  }
  60% {
    transform: translate(-50%, -50%) scale(1.04) rotate(7deg);
  }
  65% {
    transform: translate(-50%, -50%) scale(1.0) rotate(5deg);
    opacity: 1;
  }
  /* Plunge deep dive zoom */
  100% {
    transform: translate(-50%, -50%) scale(18) rotate(25deg);
    opacity: 0;
  }
}

@keyframes board-dive-zoom {
  0% {
    transform: scale(1);
    filter: blur(0);
    opacity: 1;
  }
  25% {
    transform: scale(1.02);
    filter: blur(0);
    opacity: 1;
  }
  /* Wiggle board in sync with magnifier focus */
  40% {
    transform: scale(1.01) translate(1px, -1px);
  }
  50% {
    transform: scale(1.03) translate(-1px, 1px);
  }
  60% {
    transform: scale(1.02) translate(0px, 0px);
  }
  65% {
    transform: scale(1.04);
    filter: blur(0.5px);
    opacity: 1;
  }
  /* Deep dive */
  100% {
    transform: scale(14);
    filter: blur(8px);
    opacity: 0;
  }
}

.magnifier-lens {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 8px solid #c0c0c0; /* silver metal ring */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 25px rgba(255, 255, 255, 0.3);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 70%, rgba(0, 240, 255, 0.15) 100%);
  position: relative;
  overflow: hidden; /* clip scanner lines inside lens */
  backdrop-filter: blur(1px);
}

/* HUD elements inside lens */
.lens-scanner-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background: #00f0ff;
  box-shadow: 0 0 8px #00f0ff, 0 0 15px #00f0ff;
  opacity: 0;
  top: 50%;
  pointer-events: none;
}

.magnifier-overlay.active .lens-scanner-line {
  animation: lens-sweep 1.1s ease-in-out infinite;
}

@keyframes lens-sweep {
  0% { top: 10%; opacity: 0; }
  10%, 90% { opacity: 1; }
  100% { top: 90%; opacity: 0; }
}

.lens-target-box {
  position: absolute;
  inset: 20%;
  border: 1.5px solid rgba(0, 240, 255, 0.35);
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
}

.magnifier-overlay.active .lens-target-box {
  animation: target-pulse 0.7s ease-in-out infinite alternate;
  opacity: 1;
}

@keyframes target-pulse {
  0% { border-color: rgba(0, 240, 255, 0.2); transform: scale(0.95); }
  100% { border-color: rgba(0, 240, 255, 0.85); transform: scale(1.05); }
}

.lens-scan-text {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  font-family: monospace;
  font-size: 8px;
  color: #00f0ff;
  text-shadow: 0 0 5px #00f0ff;
  letter-spacing: 1.5px;
  opacity: 0;
  font-weight: bold;
  pointer-events: none;
}

.magnifier-overlay.active .lens-scan-text {
  animation: blink-fast 0.35s infinite alternate;
  opacity: 0.85;
}

@keyframes blink-fast {
  0% { opacity: 0.25; }
  100% { opacity: 1; }
}

.magnifier-handle {
  position: absolute;
  bottom: -22px;
  right: -22px;
  width: 14px;
  height: 48px;
  background: linear-gradient(90deg, #5c4033, #8b5a2b, #5c4033); /* wooden handle */
  border: 2px solid #a0a0a0;
  border-radius: 4px;
  transform: rotate(-45deg);
  transform-origin: top center;
  box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.4);
}

/* Chapter Loader Scanning Styles */
.case-file-loader {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed var(--primary);
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(139, 38, 38, 0.1);
  overflow: hidden;
}

.case-file-loader .folder-icon {
  font-size: 5.5em;
  animation: folder-pulse 1.5s infinite ease-in-out;
}

.case-file-loader .scanning-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary), 0 0 20px var(--primary);
  animation: scan-vertical 2s infinite ease-in-out;
}

@keyframes scan-vertical {
  0%, 100% { top: 5%; }
  50% { top: 90%; }
}

@keyframes folder-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(255,255,255,0.1)); }
  50% { transform: scale(1.06); filter: drop-shadow(0 0 15px var(--primary)); }
}

/* Radar rotation animation for the circle scanner */
@keyframes rotate-radar {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== NEW ADAPTIVE LAYOUT FOR NARRATOR ===== */
.screen-mission .play-area {
  padding: 10px 20px 10px clamp(220px, 24vw, 320px) !important;
  gap: 8px !important;
  background-size: 112% 112% !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  background-color: #d9d4cb;
}

/* ===== EXAM SCREEN STYLING ===== */
.exam-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px;
  gap: 20px;
  max-width: 800px;
  width: 90%;
  margin: 0 auto;
}

.exam-question-box {
  background: var(--paper-white);
  border: 1px solid var(--manila-dark);
  box-shadow: var(--shadow-paper);
  padding: 25px;
  border-radius: 4px;
  width: 100%;
  text-align: left;
  position: relative;
  min-height: 120px;
}

.exam-question-box::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 30px;
  width: 70px;
  height: 20px;
  background-color: rgba(245, 235, 200, 0.7);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.exam-question-text {
  font-family: var(--font-type);
  font-size: 1.15em;
  line-height: 1.5;
  color: var(--text-dark);
  font-weight: bold;
}

.exam-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  width: 100%;
}

.btn-exam-option {
  background: var(--manila-folder);
  border: 1px solid var(--manila-dark);
  border-radius: 6px;
  padding: 15px 20px;
  font-family: var(--font-type);
  font-size: 1em;
  font-weight: bold;
  text-align: left;
  cursor: pointer;
  transition: all var(--t-fast);
  color: var(--text-dark);
  box-shadow: var(--shadow-paper);
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-exam-option:hover {
  background: #fdfbf7;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  border-color: var(--primary);
}

.btn-exam-option:active {
  transform: translateY(0);
}

.exam-hud-status {
  margin-left: auto;
  min-width: 170px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  flex-shrink: 0;
}

.exam-timer-chip {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(244, 211, 136, 0.12);
  border: 1px solid rgba(244, 211, 136, 0.35);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  color: var(--paper-white);
}

.exam-timer-label {
  font-family: var(--font-ui);
  font-size: 0.7em;
  letter-spacing: 1.5px;
  color: #e9c76b;
}

.exam-timer-text {
  font-family: var(--font-type);
  font-size: 1.05em;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
}

.exam-timer-chip.warning {
  border-color: rgba(245, 166, 35, 0.85);
  background: rgba(245, 166, 35, 0.12);
}

.exam-timer-chip.danger {
  border-color: rgba(211, 47, 47, 0.95);
  background: rgba(211, 47, 47, 0.14);
  box-shadow: 0 0 0 1px rgba(211, 47, 47, 0.25), inset 0 1px 0 rgba(255,255,255,0.05);
}

.exam-timebar-bg {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(244, 211, 136, 0.22);
  border-radius: 999px;
  overflow: hidden;
}

.exam-timebar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #f4d388, #d5b565);
  border-radius: inherit;
  transition: width 1s linear, background-color 0.2s ease;
}

.exam-timebar-fill.warning {
  background: linear-gradient(90deg, #f5a623, #d97706);
}

.exam-timebar-fill.danger {
  background: linear-gradient(90deg, #ef5350, #b71c1c);
}

.option-letter {
  background: var(--primary);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

/* ===== EXAM NEW QUESTION TYPES ===== */
.btn-exam-option.selected {
  background: #fff9c4 !important; /* soft yellow indicating check */
  border-color: var(--primary) !important;
  box-shadow: 0 0 10px rgba(139, 38, 38, 0.4) !important;
  transform: translateY(-2px);
}

.btn-exam-option.selected .option-letter {
  background: var(--stamp-green) !important;
}

.exam-question-flex {
  display: flex;
  gap: 20px;
  align-items: center;
  width: 100%;
}

.exam-question-image-box {
  width: 95px;
  height: 95px;
  background-color: #fff;
  border: 2.5px solid var(--manila-dark);
  border-radius: 6px;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-paper);
  animation: correct-pop 0.6s ease;
}

.exam-question-image-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.exam-options-grid.matching-layout {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.matching-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 15px;
  border-radius: 6px;
  width: 100%;
  border: 1px solid var(--manila-dark);
  box-shadow: var(--shadow-paper);
}

.matching-left {
  flex: 0 0 48px;
  font-family: var(--font-type);
  font-weight: bold;
  color: var(--text-dark);
  font-size: 0.95em;
  text-transform: uppercase;
}

.matching-select {
  flex: 1 1 0;
  min-width: 0;
  font-family: var(--font-type);
  font-size: 0.92em;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid var(--manila-dark);
  background-color: var(--paper-white);
  color: var(--text-dark);
  outline: none;
  cursor: pointer;
  max-width: 100%;
  font-weight: bold;
}

.matching-select:focus {
  border-color: var(--primary);
  background-color: #fffae0;
}

.btn-submit-answer {
  grid-column: span 2;
  margin-top: 15px;
  width: 100%;
  max-width: 280px;
  align-self: center;
}

/* ===== SCREEN CREDITS ENDING ===== */
.screen-credits-ending {
  position: relative;
  background:
    linear-gradient(180deg, rgba(8, 10, 18, 0.82), rgba(8, 10, 18, 0.7)),
    url('assets/img/bgCorkboard.jpg') center center / cover no-repeat !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  overflow: hidden;
}

.credits-container {
  background: linear-gradient(180deg, rgba(14, 18, 29, 0.92), rgba(14, 18, 29, 0.84));
  border: 1px solid rgba(244, 211, 136, 0.24);
  border-radius: 14px;
  width: min(92vw, 740px);
  height: min(88dvh, 760px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.62);
  color: #fff8eb;
  position: relative;
  overflow: hidden;
  transform-origin: center bottom;
  animation: creditsCardEnter 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.credits-scroll {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 6px 10px 16px;
  gap: 12px;
}

.credits-card-hero {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  padding: 8px 6px 2px;
}

.credits-logo-frame {
  width: 108px;
  height: 108px;
  flex: 0 0 108px;
  border-radius: 18px;
  border: 1px solid rgba(244, 211, 136, 0.28);
  background: rgba(0, 0, 0, 0.22);
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 10px 24px rgba(0,0,0,0.28);
  animation: logoFloat 4.2s ease-in-out infinite;
}

.credits-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
}

.credits-card-copy {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.credits-overline {
  font-family: var(--font-ui);
  font-size: 0.88em;
  letter-spacing: 2px;
  color: #f4d388;
  margin: 0 0 6px;
}

.credits-title {
  font-family: var(--font-ui);
  font-size: clamp(1.8em, 3vw, 2.35em);
  color: #ffe8b2;
  letter-spacing: 2px;
  text-shadow: 0 0 12px rgba(244, 211, 136, 0.18);
  margin: 0 0 6px;
}

.credits-subtitle {
  font-family: var(--font-type);
  font-size: 0.95em;
  color: #e8e2d3;
  margin: 0;
  line-height: 1.5;
}

.credits-agent-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(244, 211, 136, 0.28);
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.credits-agent-label {
  font-family: var(--font-ui);
  font-size: 0.72em;
  letter-spacing: 1.5px;
  color: #e7c77c;
}

.credits-agent-name {
  font-family: var(--font-type);
  font-size: 1em;
  font-weight: 700;
  color: #fff9ee;
}

.credits-divider {
  width: 100%;
  max-width: 420px;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  margin: 8px 0 16px;
}

.credits-list h3 {
  font-family: var(--font-ui);
  font-size: 1.02em;
  color: #f4d388;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 3px;
}

.credits-list p {
  font-family: var(--font-type);
  font-size: 0.9em;
  color: #efe7d9;
  margin-bottom: 15px;
}

.credits-link {
  color: #f4d388;
  text-decoration: underline;
  word-break: break-word;
}

.credits-link:visited {
  color: #e7c77c;
}

.credits-link:hover {
  color: #fff;
}

.credits-metadata {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  text-align: left;
  width: 100%;
  align-items: start;
}

.credits-metadata h3 {
  font-family: var(--font-ui);
  color: #f4d388;
  margin-bottom: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.credits-metadata p {
  margin-bottom: 0;
  line-height: 1.6;
  color: #f2ecdf;
}

.credits-social-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.credits-social-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(244, 211, 136, 0.25);
  background: rgba(0, 0, 0, 0.18);
  color: #f6eedf;
  font-family: var(--font-ui);
  font-size: 0.76em;
  letter-spacing: 1px;
}

.credits-thanks {
  grid-column: 1 / -1;
  font-size: 1.15em;
  font-style: italic;
  color: #f4d388 !important;
  margin-top: 25px;
}

#btnExitCredits,
#btnCreditClose {
  margin-top: 14px;
  width: 100%;
  max-width: 280px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.28);
}

.screen-credits-ending.active .credits-container {
  animation-name: creditsCardEnter, creditsCardPulse;
  animation-duration: 0.8s, 4.5s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1), ease-in-out;
  animation-delay: 0s, 0.8s;
  animation-iteration-count: 1, infinite;
}

.screen-credits-ending.active .credits-logo-frame {
  animation: logoFloat 4.2s ease-in-out infinite;
}

.screen-credits-ending.active .credits-agent-chip {
  animation: stampPop 0.8s cubic-bezier(0.16, 1, 0.3, 1) both 0.35s;
}

@keyframes creditsCardEnter {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes creditsCardPulse {
  from {
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.62);
  }
  to {
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.72);
  }
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes stampPop {
  0% {
    opacity: 0;
    transform: scale(0.7) rotate(-6deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.04) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@media (max-width: 900px) {
  body.is-mobile .board-header {
    top: 12px;
    padding: 12px 18px 10px;
  }

  body.is-mobile #screenBoard .corkboard-area {
    padding-top: 5.4em;
    padding-left: 20px;
    padding-right: 20px;
    gap: 24px;
  }

  body.is-mobile .case-file {
    width: 124px;
  }

  body.is-mobile .case-thumb {
    height: 82px;
  }

  body.is-mobile .title-content {
    width: 100% !important;
    height: 100%;
    padding: 18px 14px 24px !important;
    flex-direction: column;
    justify-content: center;
    gap: 22px;
  }

  body.is-mobile .title-left,
  body.is-mobile .title-right {
    width: 100%;
    flex: none;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  body.is-mobile .menu-buttons {
    margin: 0 !important;
    max-width: 340px !important;
    width: 100% !important;
  }

  body.is-mobile .title-badge {
    width: min(72vw, 280px) !important;
    height: min(72vw, 280px) !important;
    margin: 0 auto !important;
  }

  body.is-mobile #screenName .title-content {
    max-width: none !important;
    width: 100% !important;
    padding: 18px 14px !important;
  }

  body.is-mobile .name-panel-bg {
    padding: 64px 20px 72px !important;
  }

  body.is-mobile #inputAgentName {
    width: 100% !important;
    font-size: 1.2em !important;
  }

  body.is-mobile #btnSubmitName {
    width: 100%;
    max-width: 280px;
  }

  body.is-mobile .screen-intro .corkboard-area {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 16px 14px 96px;
  }

  body.is-mobile .screen-intro .narrator-panel {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    max-width: none;
    width: 100%;
    margin: 0;
    transform: none;
  }

  body.is-mobile #btnIntroNext {
    position: static !important;
    bottom: auto !important;
    right: auto !important;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
  }

  body.is-mobile #screenBoard .corkboard-area {
    gap: 18px;
    align-content: flex-start;
    justify-content: center;
    padding: 108px 14px 96px;
    overflow-y: auto;
  }

  body.is-mobile .case-file {
    width: min(44vw, 160px);
    margin-top: 0 !important;
    transform: none !important;
  }

  body.is-mobile .case-file:hover {
    transform: scale(1.02) !important;
  }

  body.is-mobile .board-header {
    width: calc(100vw - 20px);
    max-width: none;
  }

  body.is-mobile .credits-container {
    width: 94vw;
    height: min(90dvh, 820px);
    padding: 16px;
  }

  body.is-mobile .credits-card-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
  }

  body.is-mobile .credits-card-copy {
    text-align: center;
  }

  body.is-mobile .credits-metadata {
    grid-template-columns: 1fr;
  }

  body.is-mobile .credits-social-row {
    justify-content: center;
  }

  body.is-mobile .credits-logo-frame {
    width: 92px;
    height: 92px;
    flex-basis: 92px;
  }

  body.is-mobile .game-dialog-card {
    padding: 28px 20px 22px;
  }

  body.is-mobile .game-dialog-actions {
    flex-direction: column;
  }

  body.is-mobile #screenExam .hud.evidence-hud {
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: flex-start;
  }

  body.is-mobile #screenExam .hud-mission {
    flex: 1 1 100%;
    order: 3;
  }

  body.is-mobile .exam-hud-status {
    margin-left: 0;
    min-width: 140px;
    width: min(100%, 220px);
    order: 2;
  }

  body.is-mobile .exam-timer-chip {
    padding: 7px 10px;
  }

  body.is-mobile .screen-mission .play-area {
    padding: 12px 12px 128px !important;
  }

  body.is-mobile .screen-mission .narrator-panel {
    position: absolute;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    transform: none;
    max-width: none;
    width: auto;
    margin: 0;
  }

  body.is-mobile .screen-mission .narrator-avatar {
    width: 42px;
    height: 42px;
  }

  body.is-mobile #screenMaterial .play-area {
    padding: 12px !important;
  }

  body.is-mobile .material-document {
    width: 100%;
    max-width: none;
    padding: 24px 18px;
    transform: none;
    max-height: calc(100dvh - 120px);
  }
}
