/* ── ROOM ENVIRONMENT ─────────────────────────────────────── */

.room-wall {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #090a0d;
  z-index: 0;
}

.room-wall::before {
  content: "";
  position: absolute;
  inset: -4%;
  background:
    linear-gradient(180deg, rgba(6, 8, 12, 0.16) 0%, rgba(6, 8, 12, 0.24) 100%),
    url("../background.png") center center / cover no-repeat;
  filter: blur(12px) saturate(0.92) brightness(0.72);
  transform: scale(1.08);
}

.room-wall::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 28%, rgba(255, 239, 205, 0.08) 0%, transparent 52%),
    linear-gradient(180deg, rgba(5, 7, 10, 0.08) 0%, rgba(5, 7, 10, 0.18) 100%);
}

.room-light {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse 58% 46% at 48% 16%, rgba(255, 226, 178, 0.12) 0%, transparent 68%),
    radial-gradient(ellipse 38% 42% at 78% 18%, rgba(255, 214, 150, 0.05) 0%, transparent 58%);
}

.room-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(ellipse 78% 72% at 50% 44%, transparent 48%, rgba(0, 0, 0, 0.24) 100%);
}

/* ── BOARD VIEWPORT ──────────────────────────────────────── */

.board-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 2;
  cursor: grab;
  touch-action: none;
}

.board-viewport:active { cursor: grabbing; }

.board {
  position: absolute;
  width: 1800px;
  height: 1150px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  will-change: transform;
}

/* ── WOODEN FRAME ────────────────────────────────────────── */

.board-frame {
  position: absolute;
  inset: -18px;
  border-radius: 6px;
  z-index: 0;
  /* layered wood grain */
  background:
    linear-gradient(180deg,
      var(--frame-light) 0%,
      var(--frame) 15%,
      var(--frame-dark) 50%,
      var(--frame) 85%,
      var(--frame-light) 100%
    );
  box-shadow:
    /* outer shadow */
    0 20px 60px rgba(0,0,0,0.7),
    0 5px 20px rgba(0,0,0,0.5),
    /* inner edge highlight */
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.3);
}

/* wood grain lines */
.board-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background:
    repeating-linear-gradient(
      92deg,
      transparent 0px,
      transparent 8px,
      rgba(0,0,0,0.06) 8px,
      rgba(0,0,0,0.06) 9px,
      transparent 9px,
      transparent 20px
    ),
    repeating-linear-gradient(
      88deg,
      transparent 0px,
      transparent 15px,
      rgba(255,255,255,0.03) 15px,
      rgba(255,255,255,0.03) 16px,
      transparent 16px,
      transparent 35px
    );
}

/* inner frame bevel */
.board-frame::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 3px;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.5),
    inset 0 -1px 2px rgba(255,255,255,0.05);
}

/* ── CORK SURFACE ────────────────────────────────────────── */

.board-cork {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  z-index: 1;
  overflow: hidden;

  /* layered cork texture */
  background:
    /* speckle noise */
    radial-gradient(circle 1px at 20% 30%, rgba(0,0,0,0.15) 0.5px, transparent 1px),
    radial-gradient(circle 1px at 60% 70%, rgba(0,0,0,0.1) 0.5px, transparent 1px),
    radial-gradient(circle 1px at 80% 20%, rgba(0,0,0,0.12) 0.5px, transparent 1px),
    radial-gradient(circle 1px at 40% 80%, rgba(0,0,0,0.08) 0.5px, transparent 1px),
    /* large variation */
    radial-gradient(ellipse at 30% 40%, rgba(196, 160, 100, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 60%, rgba(160, 130, 80, 0.25) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 20%, rgba(210, 175, 110, 0.2) 0%, transparent 40%),
    /* fine cork grain */
    repeating-conic-gradient(
      rgba(180, 145, 85, 0.06) 0% 25%,
      transparent 0% 50%
    ) 0 0 / 3px 3px,
    /* base cork color */
    linear-gradient(175deg, #c4a060 0%, #b89050 30%, #a8804a 70%, #9a7040 100%);

  box-shadow:
    inset 0 0 80px rgba(0,0,0,0.35),
    inset 0 0 20px rgba(0,0,0,0.15);
}

/* subtle cork fiber overlay */
.board-cork::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      17deg,
      transparent 0px,
      transparent 2px,
      rgba(255,255,255,0.02) 2px,
      rgba(255,255,255,0.02) 3px,
      transparent 3px,
      transparent 7px
    ),
    repeating-linear-gradient(
      -25deg,
      transparent 0px,
      transparent 3px,
      rgba(0,0,0,0.03) 3px,
      rgba(0,0,0,0.03) 4px,
      transparent 4px,
      transparent 9px
    );
  z-index: 0;
}

/* warm light falloff on cork */
.board-cork::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 70% at 40% 35%, rgba(255,230,170,0.08) 0%, transparent 60%);
  z-index: 0;
  pointer-events: none;
}

/* ── LAYERS ──────────────────────────────────────────────── */

.string-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: visible;
  pointer-events: none;
}

.evidence-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
}

/* ── EVIDENCE CARD BASE ──────────────────────────────────── */

.evidence-card {
  position: absolute;
  cursor: pointer;
  outline: none;
  transition:
    transform 0.35s cubic-bezier(0.23, 1, 0.32, 1),
    opacity 0.3s ease,
    box-shadow 0.35s ease;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.evidence-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 243, 205, 0.7), var(--shadow);
}

.evidence-card:hover {
  z-index: 10;
}

/* ── PUSHPIN ─────────────────────────────────────────────── */

.pin {
  position: absolute;
  top: -4px;
  left: calc(50% - 8px);
  z-index: 5;
  width: 16px;
  height: 16px;
}

.pin-head {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e85555 0%, var(--pin-red) 40%, #8b1a1a 100%);
  box-shadow:
    0 1px 3px rgba(0,0,0,0.5),
    inset 0 1px 2px rgba(255,255,255,0.3);
  position: relative;
  z-index: 2;
}

/* pin highlight */
.pin-head::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 3px;
  background: rgba(255,255,255,0.45);
  border-radius: 50%;
  top: 3px;
  left: 4px;
}

.pin-shadow {
  width: 14px;
  height: 6px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.35) 0%, transparent 70%);
  border-radius: 50%;
  position: absolute;
  top: 14px;
  left: 1px;
  z-index: 1;
}

/* ── EVIDENCE TITLE ──────────────────────────────────────── */

.evidence-title {
  font-family: var(--font-case);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin-bottom: 6px;
  opacity: 0.7;
}

/* ── BOARD CONTROLS ──────────────────────────────────────── */

.board-controls {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ctrl-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(20,20,24,0.85);
  backdrop-filter: blur(5px);
  color: #ccc;
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ctrl-btn:hover {
  background: rgba(40,40,48,0.95);
  color: #fff;
}

/* ── BOARD HINT ──────────────────────────────────────────── */

.board-hint {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  font-family: var(--font-case);
  font-size: 0.82rem;
  color: rgba(220, 210, 190, 0.6);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.5s ease;
}

.hint-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--string);
  animation: hint-pulse 2s ease-in-out infinite;
}

.scene.motion-lite .ctrl-btn {
  backdrop-filter: blur(3px);
}

.scene.motion-reduced .ctrl-btn {
  backdrop-filter: none;
}

.scene.motion-reduced .hint-dot {
  animation: none;
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}

.board-hint.hidden { opacity: 0; pointer-events: none; }
