/* ============================================================
   DESK MODE v1 — Papers Please 책상형 고정 화면 (데스크톱 전용)
   styles.css 뒤에 로드되어 1024px 이상에서만 레이아웃을 재구성한다.
   DOM 구조·ID는 그대로 유지하므로 game.js 로직과 모바일/태블릿
   레이아웃(<=1023px)에는 영향이 없다.
   ============================================================ */
.desk-tray { display: none; }

@media (min-width: 1024px) {
  html, body { height: 100%; overflow: hidden; }

  .app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  /* 상단부 압축 — 책상에 세로 공간을 넘긴다 */
  .topbar { flex: 0 0 auto; padding: 5px 14px 9px; }
  .topbar h1 { font-size: 15px; }
  .topbar .eyebrow { font-size: 6px; }
  .directive-bar { flex: 0 0 auto; }

  .screen { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .screen.hidden { display: none; }

  /* ---- 심사실: 위 창구 / 아래 책상 ---- */
  .work-screen {
    display: flex;
    flex-direction: column;
    position: relative;
    gap: 0;
    padding: 0;
    overflow: hidden;
    /* 책상 표면: 잉크빛 철제 책상 + 스캔 라인 */
    background:
      linear-gradient(rgba(255,255,255,.02) 50%, transparent 50%) 0 0 / 100% 4px,
      conic-gradient(#151b18 25%, #101411 0) 0 0 / 8px 8px,
      #101411;
  }
  .work-screen.hidden { display: none; }

  .operations-bar,
  .inspector-status { flex: 0 0 auto; margin: 0; }
  .mobile-workspace-nav { display: none; }

  /* ---- 창구(부스): 왼쪽 장면, 오른쪽 교신 로그 ---- */
  .terminal-panel {
    flex: 0 0 auto;
    height: 40%;
    min-height: 280px;
    margin: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "heading   heading"
      "scene     chat"
      "telemetry questions";
    transform: none;
    box-shadow: 0 6px 0 #05070596, 0 8px 0 #000;
    z-index: 5;
  }
  .terminal-panel .panel-heading { grid-area: heading; }
  .terminal-panel .inspection-scene {
    grid-area: scene;
    min-height: 0;
    height: 100%;
    max-height: none;
  }
  .terminal-panel .packet-telemetry { grid-area: telemetry; }
  .terminal-panel .chat-log {
    grid-area: chat;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow-y: auto;
    border-left: 2px solid #111715;
  }
  .terminal-panel .question-row {
    grid-area: questions;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;
  }

  /* ---- 책상 위 서류(문서 창) ---- */
  .work-screen > .profile-panel,
  .work-screen > .desk-window {
    position: absolute;
    margin: 0;
    max-height: 56%;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 6px 7px 0 rgba(4, 6, 4, .78), 12px 13px 0 rgba(0, 0, 0, .38);
  }
  .work-screen > .evidence-panel.desk-emptied { display: none; }

  /* 신원철: 압축 — 잠긴 지표는 숨기고 열린 것만 보인다 */
  .work-screen > .profile-panel {
    left: 12px;
    top: 48%;
    width: 288px;
    transform: rotate(-.5deg);
    z-index: 30;
  }
  .work-screen > .profile-panel .metric-row.locked { display: none; }
  /* 초상 썸네일 크기는 evidence-visual.css의 PORTRAIT PASS가 관리한다 */

  /* 낱장 문서 창 공통 */
  .desk-window {
    border: 3px solid #3b3729;
    outline: 2px solid #0b0d09;
    background:
      conic-gradient(rgba(0, 0, 0, .05) 25%, transparent 0) 0 0 / 6px 6px,
      var(--paper);
    color: var(--ink);
    image-rendering: pixelated;
  }
  .work-screen > .profile-panel { outline: 2px solid #0b0d09; }
  .desk-window-title {
    position: sticky;
    top: 0;
    z-index: 30;
    display: block;
    padding: 6px 10px;
    color: var(--cream);
    background: var(--ink);
    border-bottom: 2px solid #55503f;
    font: 900 10px/1 Consolas, "Malgun Gothic", monospace;
    letter-spacing: .18em;
    text-transform: uppercase;
    box-shadow: inset 0 -2px #000, inset 0 2px rgba(255, 255, 255, .12);
    cursor: grab;
    user-select: none;
  }
  .desk-window.machine-doc { background: var(--machine); color: var(--cream); border-color: #0d1210; }
  .desk-window.machine-doc .desk-window-title { background: #0d1210; }

  .desk-window[data-desk-doc="rules"] { left: 306px; top: 48%; width: 322px; transform: rotate(.4deg); z-index: 31; }
  .desk-window[data-desk-doc="rules"] .manual-panel { margin: 8px; }
  .desk-window[data-desk-doc="tools"] { left: 1010px; top: 48%; width: 240px; transform: rotate(-.3deg); z-index: 32; }
  .desk-window[data-desk-doc="tools"] .test-list { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 7px; }
  .desk-window[data-desk-doc="evidence"] { left: 634px; top: 49%; width: 368px; transform: rotate(-.2deg); z-index: 33; }
  .desk-window[data-desk-doc="evidence"] .evidence-log { min-height: 66px; max-height: 150px; }
  .desk-window[data-desk-doc="analysis"] { left: 396px; top: 52%; width: 470px; transform: rotate(.3deg); z-index: 36; }
  .desk-window[data-desk-doc="analysis"] .evidence-workspace { margin: 0; border: 0; }
  .desk-doc > .panel-heading {
    position: sticky;
    top: 0;
    z-index: 30;
    cursor: grab;
    user-select: none;
  }
  body.desk-dragging,
  body.desk-dragging .desk-doc > .panel-heading { cursor: grabbing; }
  .desk-doc.doc-stowed { display: none; }

  /* ---- 판정 도장 받침대: 책상 오른쪽 아래 고정 ---- */
  .work-screen > .decision-panel {
    position: absolute;
    right: 14px;
    bottom: 12px;
    width: 348px;
    min-height: 0;
    margin: 0;
    padding: 9px 11px 11px;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    z-index: 45;
    box-shadow: 7px 8px 0 rgba(4, 6, 4, .8), 13px 14px 0 rgba(0, 0, 0, .4);
  }
  .work-screen > .decision-panel .network-state {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .work-screen > .decision-panel > div:not(.network-state):not(.decision-buttons) { display: none; }
  .work-screen > .decision-panel .decision-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    padding-top: 24px;
  }
  .work-screen > .decision-panel .decision {
    min-width: 0;
    min-height: 58px;
    padding: 22px 6px 8px;
    font-size: 11px;
  }
  .mobile-decision-toggle { display: none; }

  /* ---- 부스 장면: 세로 공간을 그대로 채운다 ---- */
  .terminal-panel .inspection-scene {
    flex: none;
    background-position: center 38%;
  }

  /* ---- 서류 보관대(트레이) ---- */
  .desk-tray {
    position: absolute;
    left: 14px;
    bottom: 12px;
    display: flex;
    gap: 6px;
    z-index: 60;
  }
  .desk-tray button {
    min-height: 34px;
    padding: 6px 12px;
    color: var(--ink);
    border: 2px solid var(--ink);
    background: var(--paper);
    box-shadow: 3px 4px 0 rgba(5, 7, 5, .6);
    font: 800 10px/1.2 "Malgun Gothic", sans-serif;
    cursor: pointer;
  }
  .desk-tray button::before {
    content: "▣ ";
    color: var(--stamp);
  }
  .desk-tray button.stowed {
    color: #7a7462;
    background: #8f886f;
    box-shadow: 1px 2px 0 rgba(5, 7, 5, .6);
    transform: translateY(2px);
  }
  .desk-tray button.stowed::before { content: "▢ "; }
}
