* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #171c18;
  color: #f1e8d2;
  font-family: Georgia, serif;
}

.game-container {
  width: min(90%, 700px);
  margin: 8vh auto;
  padding: 35px;
  background: #28352b;
  border: 2px solid #a98c58;
  border-radius: 12px;
  text-align: center;
}

h1 {
  font-size: clamp(28px, 5vw, 48px);
}

.subtitle {
  font-style: italic;
  color: #c8b48c;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 30px;
}

button {
  padding: 14px 20px;
  background: #b9a06d;
  color: #171c18;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
}

button:hover {
  background: #dbc594;
}

input {
  display: block;
  width: 100%;
  padding: 14px;
  margin: 15px 0;
  background: #f4eddd;
  border: 1px solid #a98c58;
  border-radius: 5px;
  font-size: 16px;
}

.backBtn {
  background: #68766b;
  margin-top: 10px;
}

#lobbyRoomCode {
  font-size: 32px;
  letter-spacing: 5px;
  color: #e9c979;
}

#memberList {
  margin: 20px 0;
}

.member {
  padding: 12px;
  margin: 8px 0;
  background: #364639;
  border-radius: 5px;
}

#statusMessage {
  color: #e9c979;
  margin-top: 20px;
}

#resumeBtn {
  display: block;
  width: 100%;
  margin-top: 15px;

  background: #596d5c;
  color: #f1e8d2;

  border: 1px solid #a98c58;
}

#resumeBtn:hover {
  background: #718675;
}

/* ======================================
   DETECTIVE AGENCY RADIO
====================================== */

.agency-radio {
  width: 100%;
  margin-top: 30px;
  border: 2px solid #a98c58;
  border-radius: 10px;
  overflow: hidden;
  background: #1c2921;
  text-align: left;
}

.radio-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 16px 20px;
  border-radius: 0;

  background: #a98c58;
  color: #171c18;

  font-size: 17px;
  font-weight: bold;
  letter-spacing: 1px;
}

.radio-header:hover {
  background: #c3a773;
}

.radio-content {
  padding: 15px;
}

.radio-content.collapsed {
  display: none;
}

.radio-messages {
  height: 280px;
  overflow-y: auto;
  padding: 12px;

  background: #26362b;
  border-radius: 6px;

  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-empty {
  text-align: center;
  color: #c8b48c;
  font-style: italic;
}

.radio-message {
  max-width: 85%;
  padding: 10px 13px;

  background: #405344;
  border-radius: 10px;

  overflow-wrap: anywhere;
}

.radio-message.mine {
  align-self: flex-end;
  background: #756a49;
}

.radio-message.other {
  align-self: flex-start;
}

.radio-sender {
  font-size: 12px;
  font-weight: bold;
  color: #e9c979;
  margin-bottom: 5px;
}

.radio-text {
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.radio-time {
  margin-top: 5px;
  font-size: 10px;
  opacity: 0.7;
  text-align: right;
}

.radio-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.radio-form input {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.radio-form button {
  flex-shrink: 0;
  padding: 12px 15px;
}

#radioStatus {
  font-size: 12px;
  color: #e9c979;
  text-align: center;
  margin-bottom: 0;
}


/* ======================================
   INVESTIGATION HEADQUARTERS
====================================== */

.investigation-header {
  text-align: center;
  margin-bottom: 30px;
}

.case-number {
  font-size: 12px;
  letter-spacing: 3px;
  color: #d4b56f;
  margin-bottom: 10px;
}

.investigation-header h2 {
  font-size: clamp(24px, 5vw, 38px);
  line-height: 1.2;
  margin-bottom: 10px;
}

.investigation-subtitle {
  font-style: italic;
  color: #c8b48c;
}

.round-indicator {
  display: flex;
  flex-direction: column;
  gap: 8px;

  padding: 15px;
  margin-top: 25px;

  background: #1c2921;
  border: 1px solid #a98c58;
  border-radius: 8px;
}

.round-indicator span {
  font-size: 11px;
  letter-spacing: 2px;
  color: #d4b56f;
}

.round-indicator strong {
  font-size: 16px;
}

/* DASHBOARD */

.investigation-dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  margin: 25px 0;
}

.investigation-card {
  min-width: 0;
  min-height: 155px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;

  padding: 20px 15px;

  background: #344639;
  border: 1px solid #a98c58;
  border-radius: 10px;

  color: #f1e8d2;
  text-align: center;

  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.investigation-card:hover {
  background: #455a49;
  transform: translateY(-2px);
}

.card-icon {
  font-size: 30px;
}

.card-title {
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 1px;
}

.card-description {
  font-size: 12px;
  line-height: 1.5;
  opacity: 0.8;
}

/* PANEL VIEWER */

.investigation-panel {
  margin-top: 25px;
  padding: 20px;

  background: #1c2921;
  border: 1px solid #a98c58;
  border-radius: 10px;
}

.investigation-panel[hidden] {
  display: none;
}

.panel-back {
  margin-bottom: 20px;
  font-size: 13px;
}

#investigationPanelTitle {
  margin-bottom: 20px;
  text-align: center;
}

/* ======================================
   CASE FILE ARCHIVE
====================================== */

.case-archive {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.archive-section-title {
  margin: 25px 0 10px;
  font-size: 15px;
  color: #d4b56f;
  letter-spacing: 1px;
  text-align: left;
}

.case-file-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;

  padding: 16px;

  background: #344639;
  color: #f1e8d2;

  border: 1px solid #a98c58;
  border-radius: 8px;

  text-align: left;
  cursor: pointer;
}

.case-file-button:hover {
  background: #455a49;
}

.case-file-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.case-file-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.case-file-details {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.case-file-name {
  font-size: 14px;
  font-weight: bold;
  overflow-wrap: anywhere;
}

.case-file-status {
  font-size: 11px;
  letter-spacing: 1px;
  opacity: 0.8;
}

/* ======================================
   FULL-SCREEN EVIDENCE VIEWER
====================================== */

.evidence-viewer {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  flex-direction: column;

  background: #17221b;
  color: #f1e8d2;
}

.evidence-viewer[hidden] {
  display: none;
}

.evidence-viewer-header {
  display: flex;
  align-items: center;
  gap: 15px;

  padding: 12px 18px;
  border-bottom: 1px solid #a98c58;
}

.evidence-viewer-header button {
  flex-shrink: 0;
}

.evidence-viewer-heading {
  min-width: 0;
}

.evidence-viewer-heading span {
  font-size: 10px;
  color: #d4b56f;
  letter-spacing: 2px;
}

.evidence-viewer-heading h3 {
  font-size: 16px;
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.evidence-image-area {
  flex: 1;
  min-height: 0;
  overflow: auto;

  display: flex;
  align-items: flex-start;
  justify-content: center;

  padding: 20px;
  background: #111912;
}

#evidenceImage {
  display: block;
  width: auto;
  height: auto;

  max-width: 100%;
  max-height: none;

  object-fit: contain;
  user-select: none;
}

.evidence-viewer-controls {
  flex-shrink: 0;
  padding: 12px 18px;

  border-top: 1px solid #a98c58;
  background: #17221b;
}

.evidence-page-controls,
.evidence-zoom-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.evidence-page-controls {
  margin-bottom: 10px;
}

.evidence-viewer-controls button {
  padding: 9px 12px;
  font-size: 12px;
}

.evidence-viewer-controls button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#evidencePageCount,
#evidenceZoomLevel {
  font-size: 12px;
  min-width: 45px;
  text-align: center;
}

/* ======================================
   DETECTIVE ORIENTATION
====================================== */

.orientation-area {
  margin: 30px 0;
  padding: 20px;

  background: #1c2921;
  border: 1px solid #a98c58;
  border-radius: 12px;

  text-align: center;
}

.sealed-case-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;

  padding: 25px 10px;
  animation: folderArrival 0.6s ease-out;
}

.sealed-folder-icon {
  font-size: 70px;
  animation: folderFloat 3s ease-in-out infinite;
}

.orientation-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: #d4b56f;
}

.sealed-case-file h3,
.orientation-files h3 {
  font-size: 22px;
  line-height: 1.3;
}

.orientation-description {
  font-size: 14px;
  line-height: 1.7;
  max-width: 350px;
}

.confidential-stamp {
  padding: 8px 18px;

  border: 2px solid #b85c4a;
  color: #d57b69;

  font-size: 16px;
  font-weight: bold;
  letter-spacing: 3px;

  transform: rotate(-8deg);
}

.orientation-files {
  animation: folderArrival 0.4s ease-out;
}

.orientation-files[hidden],
.sealed-case-file[hidden] {
  display: none;
}

#orientationFileList {
  display: flex;
  flex-direction: column;
  gap: 12px;

  margin: 25px 0;
}

.orientation-file-button {
  display: flex;
  align-items: center;
  gap: 15px;

  width: 100%;
  padding: 16px;

  background: #344639;
  border: 1px solid #a98c58;
  border-radius: 8px;

  color: #f1e8d2;
  text-align: left;
  cursor: pointer;
}

.orientation-file-button:hover {
  background: #455a49;
}

.orientation-file-icon {
  font-size: 25px;
}

.orientation-file-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.orientation-file-text strong {
  font-size: 14px;
}

.orientation-file-text small {
  font-size: 11px;
  opacity: 0.75;
}

@keyframes folderArrival {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes folderFloat {
  0%, 100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

/* ======================================
   CLASSIFIED FILE CODE ENTRY
====================================== */

.secret-code-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 20px;
  background: rgba(0, 0, 0, 0.88);
}

.secret-code-modal[hidden] {
  display: none;
}

.secret-code-box {
  width: min(100%, 430px);
  padding: 30px 24px;

  background: #1c2921;
  border: 2px solid #a98c58;
  border-radius: 12px;

  color: #f1e8d2;
  text-align: center;
}

.secret-code-box h3 {
  margin: 12px 0;
  color: #d4b56f;
  letter-spacing: 2px;
}

.secret-code-box p {
  font-size: 14px;
  line-height: 1.6;
}

#secretCodeForm {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}

#secretCodeInput {
  width: 150px;
  padding: 14px;

  background: #111912;
  border: 1px solid #a98c58;
  border-radius: 6px;

  color: #f1e8d2;
  font-size: 25px;
  letter-spacing: 8px;
  text-align: center;
}

#secretCodeMessage {
  min-height: 20px;
  color: #d57b69;
}

#closeSecretCodeModal {
  margin-top: 15px;
}

/* ======================================
   OFFICIAL THEORY SUBMISSION
====================================== */

.theory-submission {
  width: 100%;
  max-width: 650px;
  margin: 0 auto;
  padding: 15px 0;
  color: #f1e8d2;
}

.theory-submission h4 {
  color: #d4b56f;
  font-size: 18px;
  letter-spacing: 1px;
  margin-bottom: 15px;
}

.theory-question {
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 25px;
}

#theorySubmissionForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#theorySubmissionForm label {
  color: #d4b56f;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
  text-align: left;
}

#theorySuspect,
#theoryExplanation {
  width: 100%;
  box-sizing: border-box;
  padding: 13px;

  background: #17221b;
  border: 1px solid #a98c58;
  border-radius: 7px;

  color: #f1e8d2;
  font: inherit;
}

#theoryExplanation {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

#theorySubmissionForm button {
  margin-top: 15px;
  padding: 15px;
}

.theory-notice {
  padding: 20px;
  background: #344639;
  border: 1px solid #a98c58;
  border-radius: 8px;
  line-height: 1.7;
}

.theory-status {
  min-height: 20px;
  font-size: 13px;
  color: #d4b56f;
}

/* Ensure hidden dashboard stays hidden */
.investigation-dashboard[hidden] {
  display: none;
}

/* ==== PHASE 16 — FINAL CASE REVEAL ==== */

.final-case-panel {
  margin: 25px 0;
  padding: 22px;
  background: #19251d;
  border: 2px solid #a98c58;
  border-radius: 12px;
  color: #f1e8d2;
  text-align: center;
}

.final-case-panel[hidden],
#sealedFinalReport[hidden],
#revealedFinalReport[hidden],
#revealTruthBtn[hidden],
#awaitingRevealMessage[hidden] {
  display: none;
}

.final-folder-icon {
  font-size: 65px;
  margin: 12px 0;
}

.final-eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  color: #d4b56f;
}

.sealed-final-report h3,
.revealed-final-report h3 {
  margin: 18px 0;
  font-size: clamp(23px, 5vw, 34px);
  color: #f1e8d2;
  line-height: 1.25;
}

.sealed-final-report > p {
  line-height: 1.7;
}

.final-stamp,
.case-closed-stamp {
  display: inline-block;
  margin: 24px auto;
  padding: 10px 18px;
  border: 3px solid #b85c4a;
  color: #d57b69;
  font-weight: bold;
  letter-spacing: 2px;
  transform: rotate(-5deg);
}

#revealTruthBtn {
  display: block;
  width: min(100%, 320px);
  margin: 15px auto;
  padding: 16px;
  background: #b69a65;
  color: #17221b;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}

#revealTruthBtn:disabled {
  opacity: .5;
  cursor: wait;
}

#awaitingRevealMessage {
  color: #d4b56f;
  font-style: italic;
}

.revealed-final-report {
  animation: caseReveal .8s ease-out;
}

.reveal-chapter {
  margin: 22px 0;
  padding: 20px;
  background: #26372c;
  border-left: 3px solid #a98c58;
  border-radius: 6px;
  text-align: left;
}

.reveal-chapter h4 {
  margin: 0 0 12px;
  color: #d4b56f;
  letter-spacing: 1px;
}

.reveal-chapter p {
  line-height: 1.8;
  margin: 10px 0;
}

#agencyVerdict {
  margin: 22px 0;
}

.verdict-result {
  padding: 20px;
  border: 1px solid #a98c58;
  border-radius: 8px;
  background: #344639;
  text-align: left;
  overflow-wrap: anywhere;
}

.verdict-result h4 {
  color: #d4b56f;
}

.verdict-result p {
  line-height: 1.7;
}

.case-closed-stamp {
  font-size: 24px;
  border-color: #d4b56f;
  color: #d4b56f;
}

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


/* ======================================
   PHASE 18 — DETECTIVE NOTEBOOK
====================================== */

.detective-notebook {
  background: #e8d8b3;
  color: #49351f;
  border: 2px solid #8b6a43;
  border-radius: 10px;
  padding: 22px;
  box-shadow: inset 0 0 25px rgba(90, 65, 35, .12);
}

.notebook-header {
  text-align: center;
  border-bottom: 2px solid #b9a17b;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.notebook-eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: bold;
}

.notebook-header h3 {
  font-size: clamp(22px, 5vw, 30px);
  margin: 12px 0;
  color: #49351f;
}

.notebook-header p {
  color: #78552d;
}

.notebook-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.notebook-tabs button {
  flex: 1 1 100px;
  padding: 11px 8px;
  border: 1px solid #a98b5b;
  border-radius: 6px 6px 0 0;
  background: #d0bb91;
  color: #49351f;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
}

.notebook-tabs button.active {
  background: #f7edcf;
  border-bottom-color: #f7edcf;
}

.notebook-editor {
  box-sizing: border-box;
  width: 100%;
  min-height: 330px;
  padding: 18px;
  border: 1px solid #c8b58d;
  border-radius: 4px;
  resize: vertical;
  color: #49351f;
  font-size: 15px;
  line-height: 30px;
  font-family: Georgia, serif;
  background-color: #f7edcf;
  background-image:
    repeating-linear-gradient(
      transparent,
      transparent 29px,
      rgba(111, 133, 151, .25) 29px,
      rgba(111, 133, 151, .25) 30px
    );
}

.notebook-editor:focus {
  outline: 2px solid #a98b5b;
  outline-offset: 2px;
}

.notebook-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  font-size: 11px;
  font-weight: bold;
  color: #78552d;
}


/* ======================================
   PHASE 20 — SUSPECT BOARD
====================================== */

.suspect-board {
  padding: 22px;
  border: 9px solid #49301c;
  border-radius: 6px;
  background:
    radial-gradient(
      circle at 30% 30%,
      rgba(255,255,255,.10),
      transparent 55%
    ),
    repeating-linear-gradient(
      35deg,
      #986b42 0px,
      #986b42 3px,
      #8d6039 4px,
      #a4774c 7px
    );
  box-shadow:
    inset 0 0 25px rgba(30, 15, 5, .3),
    0 8px 20px rgba(0, 0, 0, .2);
}

.suspect-board-heading {
  text-align: center;
  margin-bottom: 24px;
  color: #f8e7c2;
  text-shadow: 1px 2px 3px #392312;
}

.suspect-board-heading p {
  font-size: 10px;
  letter-spacing: 2px;
}

.suspect-board-heading h3 {
  font-size: clamp(22px, 5vw, 32px);
  margin: 8px 0;
  color: #fff1ce;
}

.suspect-board-heading span {
  font-size: 11px;
  letter-spacing: 1px;
}

.suspect-board-grid {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.suspect-board-card {
  position: relative;
  min-width: 0;
  padding: 12px 10px 16px;
  border: 0;
  background: #eee2c4;
  color: #38291c;
  cursor: pointer;
  text-align: center;
  box-shadow: 3px 5px 9px rgba(36, 19, 8, .4);
  transition:
    transform .2s ease,
    box-shadow .2s ease;
}

.suspect-board-card:nth-child(odd) {
  transform: rotate(-2deg);
}

.suspect-board-card:nth-child(even) {
  transform: rotate(2deg);
}

.suspect-board-card:hover,
.suspect-board-card:focus-visible {
  transform: rotate(0deg) translateY(-5px);
  box-shadow: 5px 9px 14px rgba(36, 19, 8, .45);
  z-index: 2;
}

.suspect-board-card img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: top;
  border: 1px solid #b8a582;
  background: #c7b69a;
}

.suspect-pin {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #a62d23;
  border: 2px solid #641b16;
  box-shadow: 1px 3px 3px rgba(0,0,0,.4);
  transform: translateX(-50%);
  z-index: 2;
}

.suspect-number {
  display: block;
  margin-top: 12px;
  font-size: 9px;
  letter-spacing: 1px;
  color: #745d40;
}

.suspect-board-card strong {
  display: block;
  margin: 6px 0;
  font-family: Georgia, serif;
  font-size: clamp(13px, 2vw, 19px);
}

.suspect-role {
  display: block;
  font-size: 11px;
  color: #6d5438;
}

@media (max-width: 700px) {
  .suspect-board {
    padding: 14px;
    border-width: 6px;
  }

  .suspect-board-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .suspect-board-card {
    padding: 8px 7px 12px;
  }
}

@media (max-width: 380px) {
  .suspect-board-grid {
    gap: 12px;
  }

  .suspect-board-card strong {
    font-size: 13px;
  }
}


/* MOBILE */

@media (max-width: 600px) {

  .game-container {
    width: 95%;
    padding: 20px;
    margin: 4vh auto;
  }

  .radio-messages {
    height: 240px;
  }

  .radio-message {
    max-width: 95%;
  }

  .radio-form button {
    padding: 10px;
    font-size: 13px;
  }

  .investigation-dashboard {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .investigation-card {
    min-height: 95px;
    padding: 15px;
  }

  .card-icon {
    font-size: 26px;
  }

  .card-title {
    font-size: 14px;
  }

  .card-description {
    font-size: 11px;
  }

  .investigation-panel {
    padding: 15px;
  }

  .evidence-viewer-header {
    padding: 10px;
  }

  .evidence-viewer-heading h3 {
    font-size: 13px;
  }

  .evidence-image-area {
    padding: 10px;
  }

  .evidence-viewer-controls {
    padding: 10px;
  }

  .evidence-viewer-controls button {
    padding: 8px 10px;
    font-size: 11px;
  }

   .orientation-area {
    padding: 12px;
  }

  .sealed-case-file {
    padding: 20px 5px;
  }

  .sealed-folder-icon {
    font-size: 55px;
  }

  .sealed-case-file h3 {
    font-size: 19px;
  }

  .orientation-file-button {
    padding: 13px;
  }

  .secret-code-box {
    padding: 24px 16px;
  }

  .theory-submission {
    padding: 10px 0;
  }

  .theory-question {
    font-size: 14px;
  }

  .final-case-panel {
    padding: 15px;
  }

  .reveal-chapter {
    padding: 15px;
  }

  .detective-notebook {
    padding: 14px;
  }

  .notebook-tabs button {
    font-size: 10px;
    padding: 10px 5px;
  }

  .notebook-editor {
    min-height: 270px;
    padding: 12px;
    font-size: 14px;
  }

}