/* ==========================================================================
   SWISS EXPERIMENTAL TYPOGRAPHY & KINETIC GRAPHIC SYSTEM
   MONOCHROME MONUMENTAL PROTOCOL // FOR WHOM THE BELL TOLLS
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;400;600;900&family=JetBrains+Mono:wght@300;400;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #030305;
  --black: #000000;
  --white: #ffffff;
  --neutral-100: rgba(255, 255, 255, 0.96);
  --neutral-400: rgba(255, 255, 255, 0.62);
  --neutral-700: rgba(255, 255, 255, 0.28);
  --neutral-900: rgba(255, 255, 255, 0.08);
  --grid-line: rgba(255, 255, 255, 0.04);
  --panel: rgba(5, 5, 8, 0.88);
  --line: rgba(255, 255, 255, 0.18);
  --line-heavy: rgba(255, 255, 255, 0.85);
  --danger: #ffffff;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--white);
  font-family: var(--font-sans);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  user-select: none;
}

/* 瑞士国际排版工程背景与微型网格系统 */
body {
  background-image: 
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  position: relative;
}

/* 胶片噪点及微弱半色调质感层 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.25;
  background-image: radial-gradient(rgba(255,255,255,0.15) 1px, transparent 0);
  background-size: 3px 3px;
}

/* 四角坐标标尺与印刷套印十字 (Registration Marks) */
body::before {
  content: "+ ARCHIVE.DOSSIER [HEAVEN-04] // BELL.TOLL\A+ AXIS-REF: 00.94.22 // EDITORIAL PROJECTION";
  white-space: pre-wrap;
  position: fixed;
  top: 20px;
  left: 24px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  font-weight: 400;
  color: var(--neutral-700);
  line-height: 1.5;
  pointer-events: none;
  z-index: 50;
}

button, input, select {
  font: inherit;
  border-radius: 0;
}

.hidden, .screen:not(.active) {
  display: none !important;
}

#canvas-container {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* ================= 屏幕与对话框排版 ================= */
.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.screen.overlay {
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: grayscale(100%) contrast(120%);
}

.dialog {
  width: min(560px, calc(100% - 48px));
  padding: 44px 40px;
  border: 1px solid var(--line);
  background: var(--panel);
  position: relative;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04);
}

.dialog::before {
  content: "SEC.DOSSIER // CONFIDENTIAL";
  position: absolute;
  top: -9px;
  left: 18px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  background: var(--bg);
  padding: 0 6px;
  color: var(--neutral-400);
}

/* 首页超大非对称无衬线标题 */
#game-title {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 0.95;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.muted {
  color: var(--neutral-400);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 28px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 24px 0 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--neutral-400);
}

input, select {
  min-height: 48px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--white);
  padding: 8px 0;
  font-size: 1.05rem;
  font-family: var(--font-sans);
  font-weight: 300;
  outline: none;
  transition: border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

input:focus, select:focus {
  border-bottom-color: var(--white);
}

.button {
  min-height: 44px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--white);
  padding: 10px 22px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  transition: all 0.15s ease;
}

.button:hover:not(:disabled) {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
}

.button:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  border-color: var(--neutral-900);
}

.primary {
  border-color: var(--white);
  background: var(--white);
  color: var(--black);
}

.primary:hover:not(:disabled) {
  background: transparent;
  color: var(--white);
}

.danger {
  border-color: var(--white);
}

.danger:hover:not(:disabled) {
  background: var(--white);
  color: var(--black);
}

.ghost {
  border-color: transparent;
  color: var(--neutral-400);
}

.ghost:hover:not(:disabled) {
  background: var(--neutral-900);
  color: var(--white);
  border-color: transparent;
}

.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 14px;
}

.error {
  min-height: 24px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--white);
}

/* 开场白 */
#intro-screen {
  cursor: pointer;
  padding: 12vw 8vw;
  text-align: left;
  align-items: flex-start;
  justify-content: space-between;
}

#intro-text {
  max-width: 960px;
  font-size: clamp(1.4rem, 2.6vw, 2.4rem);
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: -0.5px;
  border-left: 2px solid var(--white);
  padding-left: 28px;
  white-space: pre-wrap;
}

#skip-intro {
  position: absolute;
  right: 28px;
  top: 24px;
}

#intro-progress {
  position: absolute;
  bottom: 28px;
  left: 28px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--neutral-700);
}

/* ================= 游戏运行 HUD 与交互体系 ================= */
.status-bar {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  min-height: 48px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 28px;
  background: rgba(3, 3, 5, 0.85);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.status-bar span {
  display: inline-flex;
  gap: 6px;
  color: var(--neutral-400);
}

.status-bar b {
  color: var(--white);
  font-weight: 700;
}

/* 侧边信息档案面板 */
.side-panel {
  position: fixed;
  z-index: 10;
  top: 68px;
  left: 24px;
  width: 250px;
  max-height: 48vh;
  overflow: auto;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  scrollbar-width: none;
}
.side-panel::-webkit-scrollbar { display: none; }

.side-panel h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--neutral-700);
  border-bottom: 1px solid var(--neutral-900);
  padding-bottom: 4px;
  margin: 14px 0 8px;
}
.side-panel h3:first-child { margin-top: 0; }

.side-panel p {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--neutral-400);
  margin: 5px 0;
}
.side-panel p b { color: var(--white); }

#event-log {
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1.6;
  color: var(--neutral-400);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#event-log div {
  border-left: 1px solid var(--line);
  padding-left: 8px;
}

/* 私密结果告示板 */
.notice {
  position: fixed;
  z-index: 15;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(600px, 90vw);
  padding: 12px 24px;
  background: var(--black);
  border: 1px solid var(--white);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
}

/* 动作操作导航栏 */
.actions {
  position: fixed;
  z-index: 10;
  right: 24px;
  bottom: 236px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.actions label {
  margin: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.actions select {
  min-height: 36px;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  border: 1px solid var(--line);
  background: var(--black);
}

/* 3D 风格卡牌面板 */
.hand-panel {
  position: fixed;
  z-index: 10;
  left: 24px;
  right: 24px;
  bottom: 20px;
  height: 200px;
  display: grid;
  grid-template-columns: 1.8fr 1.2fr;
  gap: 16px;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.hand-panel h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--neutral-400);
  margin-bottom: 10px;
}

.hand {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 4px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.card {
  flex: 0 0 102px;
  height: 136px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--black);
  color: var(--white);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.15s ease;
}

.card::before {
  content: "+";
  position: absolute;
  top: 4px;
  right: 6px;
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--neutral-700);
}

.card:hover {
  border-color: var(--white);
}

.card.selected {
  outline: 1px solid var(--white);
  border-color: var(--white);
  transform: translateY(-8px);
  background: rgba(255, 255, 255, 0.08);
}

.card b {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.25;
}

.card small {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--neutral-400);
  line-height: 1.4;
  word-break: break-all;
}

/* 目标弹窗 */
#target-list {
  display: grid;
  gap: 8px;
  margin: 20px 0;
}

/* 移动端自适应 */
@media (max-width: 840px) {
  body::before { display: none; }
  .status-bar {
    justify-content: flex-start;
    overflow-x: auto;
    font-size: 10px;
    padding: 0 12px;
    gap: 14px;
  }
  .side-panel {
    top: 54px;
    left: 8px;
    width: 140px;
    max-height: 25vh;
    padding: 10px;
  }
  .actions {
    right: 8px;
    left: 8px;
    bottom: 236px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .actions label {
    grid-column: 1 / -1;
  }
  .hand-panel {
    left: 8px;
    right: 8px;
    bottom: 8px;
    height: 220px;
    grid-template-columns: 1fr;
  }
  .card {
    flex: 0 0 84px;
    height: 114px;
    padding: 6px;
  }
  .card b { font-size: 11px; }
  .card small { font-size: 8px; }
}