/* ── BROWSER DETECTIVE — the daylight case file ──────────────────
   Paper & ink: warm desk-paper background, manila folders,
   typewriter headings (Special Elite), IBM Plex Mono body,
   red rubber stamps, evidence in light-mode browser windows.      */

:root {
  --desk:   #e7dfc9;              /* desk / page background        */
  --paper:  #faf6ea;              /* card paper                    */
  --manila: #f0e3bd;              /* folder paper                  */
  --line:   #d9cfb4;              /* paper borders                 */
  --ink:    #2b2620;              /* main text                     */
  --ink2:   #5f574a;              /* secondary text                */
  --faint:  #948a76;              /* tertiary text                 */
  --red:    #c0392f;              /* stamps / accuse               */
  --amber:  #a3721c;              /* case-file ochre               */
  --blue:   #1a56a0;              /* history-link blue             */
  --green:  #257a4e;              /* solved / cleared              */
  --shadow: 0 1px 2px rgba(74,62,38,0.18), 0 6px 18px rgba(74,62,38,0.10);
  --font-display: 'Special Elite', 'Courier New', monospace;
  --font-body:    'IBM Plex Mono', 'Courier New', monospace;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes stampIn {
  0%   { transform: scale(2.4) rotate(-14deg); opacity: 0; }
  60%  { transform: scale(0.94) rotate(3deg);  opacity: 1; }
  100% { transform: scale(1) rotate(-4deg);    opacity: 1; }
}
@keyframes unfold {
  from { opacity: 0; transform: translateY(-8px) scaleY(0.96); }
  to   { opacity: 1; transform: translateY(0) scaleY(1); }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(120,100,60,0.07) 31px 32px),
    radial-gradient(ellipse 120% 80% at 50% -20%, #f3edda 0%, transparent 55%),
    var(--desk);
}

/* ── Screens ─────────────────────────────────────────────────── */
.bd-wrapper {
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 50px);
  padding: 24px 14px 70px;
}
.screen { display: none; width: 100%; }
.screen.active { display: flex; justify-content: center; align-items: flex-start; }

.hidden { display: none !important; }

/* ── Buttons ─────────────────────────────────────────────────── */
.bd-btn-primary {
  background: var(--ink);
  border: none;
  color: var(--paper);
  padding: 13px 32px;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 2px;
  cursor: pointer;
  border-radius: 3px;
  box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s;
}
.bd-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 3px 6px rgba(74,62,38,0.25), 0 8px 22px rgba(74,62,38,0.14); }

.bd-btn-ghost {
  background: transparent;
  border: 1.5px solid #b5a888;
  color: var(--ink2);
  padding: 9px 14px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  border-radius: 3px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.bd-btn-ghost:hover { border-color: var(--ink); color: var(--ink); background: rgba(43,38,32,0.04); }

/* ── Menu / case board ───────────────────────────────────────── */
.bd-menu {
  width: 100%;
  max-width: 740px;
  text-align: center;
  animation: fadeUp 0.5s ease;
}

.bd-classified {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 7px;
  color: var(--red);
  border: 2px solid var(--red);
  border-radius: 2px;
  padding: 6px 18px 4px;
  margin-bottom: 22px;
  transform: rotate(-2deg);
  opacity: 0.85;
}

.bd-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 9vw, 70px);
  font-weight: 400;
  margin: 0;
  color: var(--ink);
  line-height: 0.95;
  text-shadow: 2px 2px 0 rgba(163,114,28,0.18);
}

.bd-tagline {
  color: var(--ink2);
  font-size: 15px;
  margin: 18px auto 28px;
  max-width: 500px;
  line-height: 1.75;
}

.bd-rank-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}
.bd-rank-pts { font-size: 12.5px; color: var(--ink2); letter-spacing: 1px; font-weight: 600; }

.bd-case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px;
  text-align: left;
}

.bd-folder {
  position: relative;
  display: block;
  width: 100%;
  background: linear-gradient(178deg, var(--manila) 0%, #ecdfb6 100%);
  border: 1px solid #d3c294;
  border-top: 3px solid #c9b684;
  border-radius: 2px 8px 4px 4px;
  padding: 32px 14px 14px;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
  animation: fadeUp 0.4s ease both;
  transition: transform 0.12s, box-shadow 0.15s;
}
.bd-folder:hover {
  transform: translateY(-3px) rotate(-0.4deg);
  box-shadow: 0 4px 8px rgba(74,62,38,0.2), 0 12px 28px rgba(74,62,38,0.14);
}
.bd-folder::before {  /* folder tab */
  content: "";
  position: absolute;
  top: -3px; left: 12px;
  width: 62px; height: 9px;
  background: #c9b684;
  border-radius: 4px 4px 0 0;
}

.bd-folder-no {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--faint);
  letter-spacing: 3px;
  margin-bottom: 6px;
}
.bd-folder-title {
  display: block;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
  line-height: 1.25;
  margin-bottom: 10px;
}
.bd-folder-meta { display: flex; gap: 8px; align-items: center; }
.bd-folder-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--red);
  border: 1px solid rgba(192,57,47,0.5);
  padding: 2px 7px 1px;
  border-radius: 2px;
  background: rgba(192,57,47,0.06);
}
.bd-folder-suspects { font-size: 10px; font-weight: 600; letter-spacing: 2px; color: var(--faint); }

.bd-folder-stamp {
  position: absolute;
  top: 10px; right: 11px;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 2px;
  padding: 3px 9px 1px;
  border: 2px solid;
  border-radius: 3px;
  transform: rotate(4deg);
  background: rgba(250,246,234,0.55);
}
.st-open   { color: var(--faint); border-color: #bfb294; }
.st-solved { color: var(--green); border-color: var(--green); }
.st-cold   { color: var(--red);   border-color: var(--red); }
.bd-folder-solved { opacity: 0.85; }

/* ── Play header ─────────────────────────────────────────────── */
.bd-play {
  width: 100%;
  max-width: 840px;
  animation: fadeUp 0.35s ease;
}

.bd-play-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.bd-case-label {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--amber);
  letter-spacing: 3px;
}
.bd-score-label { font-size: 12.5px; font-weight: 600; color: var(--ink2); letter-spacing: 2px; }
.bd-score-label span { color: var(--amber); }

/* ── Case brief ──────────────────────────────────────────────── */
.bd-brief {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 5px solid var(--red);
  border-radius: 3px;
  padding: 18px 22px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.bd-brief-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.bd-brief-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--red);
  border: 1px solid rgba(192,57,47,0.5);
  padding: 3px 9px 2px;
  border-radius: 2px;
  background: rgba(192,57,47,0.06);
}
.bd-brief-conf {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--faint);
}
.bd-brief-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 5vw, 34px);
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 10px;
  line-height: 1.1;
}
.bd-brief-text {
  font-size: 15.5px;
  line-height: 1.85;
  color: #423b31;
  margin: 0 0 14px;
}
.bd-brief-q {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--red);
  border-top: 1px dashed #cfc3a4;
  padding-top: 13px;
}

/* ── Suspects ────────────────────────────────────────────────── */
.bd-suspects {
  display: grid;
  grid-template-columns: repeat(var(--n, 3), 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.bd-suspect {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 4px solid var(--sc, var(--line));
  border-radius: 5px;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: fadeUp 0.45s ease both;
}

.bd-mugshot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 96px;
  background:
    repeating-linear-gradient(180deg, #eef0f2 0 15px, #dde1e6 15px 17px);
  border-bottom: 1px solid var(--line);
}
.bd-mug-emoji { font-size: 48px; }

.bd-pick-badge {
  position: absolute;
  top: 7px; left: 7px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--paper);
  background: var(--ink);
  padding: 3px 7px 2px;
  border-radius: 2px;
}

.bd-placard {
  background: var(--sc-bg, transparent);
  border-bottom: 1px solid var(--line);
  padding: 11px 14px 10px;
}
.bd-suspect-name {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink);
  line-height: 1.15;
}
.bd-suspect-role {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--sc, var(--ink2));
  letter-spacing: 0.5px;
  margin-top: 4px;
  text-transform: uppercase;
}

.bd-btn-accuse {
  margin: 13px 13px 13px;
  background: transparent;
  border: 2px solid var(--red);
  color: var(--red);
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 3px;
  padding: 9px 0 7px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.bd-btn-accuse:hover:not(:disabled) { background: var(--red); color: var(--paper); }
.bd-btn-accuse:disabled { opacity: 0.35; cursor: not-allowed; }

.bd-verdict-stamp {
  align-self: center;
  margin: 13px 0 15px;
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 4px;
  border: 3px double;
  border-radius: 3px;
  padding: 5px 15px 3px;
  animation: stampIn 0.45s ease both;
}
.vs-guilty  { color: var(--red);   border-color: var(--red); }
.vs-cleared { color: var(--green); border-color: var(--green); animation-delay: 0.15s; }

.bd-suspect-guilty  { border-color: var(--red); box-shadow: 0 0 0 2px rgba(192,57,47,0.25), var(--shadow); }
.bd-suspect-cleared { opacity: 0.6; }

/* ── Records / domain chips ──────────────────────────────────── */
.bd-records { margin-bottom: 18px; }

.bd-records-label {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 11px;
}
.bd-records-title {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--ink);
}
.bd-records-hint { font-size: 12.5px; color: var(--ink2); letter-spacing: 0.3px; }
.bd-records-hint b { color: var(--red); font-weight: 700; }

.bd-domains {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bd-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--paper);
  border: 1.5px dashed #b5a888;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(74,62,38,0.12);
  transition: border-color 0.15s, background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.bd-chip:hover:not(:disabled) {
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.bd-chip-open {
  border-style: solid;
  border-color: var(--amber);
  background: #f7edd4;
  cursor: default;
  opacity: 0.45;
}
.bd-chip:disabled { cursor: default; }
.bd-chip-icon { font-size: 15px; }
.bd-chip-domain { letter-spacing: 0.3px; }
.bd-chip-state {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--faint);
  border-left: 1px solid var(--line);
  padding-left: 9px;
}
.bd-chip-open .bd-chip-state { color: var(--amber); }

/* ── In-card browsing history ────────────────────────────────── */
.bd-card-history {
  flex: 1;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.bd-card-dom {
  border-bottom: 1px solid #eae6dc;
  padding-bottom: 6px;
  animation: unfold 0.3s ease both;
  transform-origin: top center;
}
.bd-card-dom:last-child { border-bottom: none; }

.bd-card-dom-head {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--ink2);
  background: #f3efe4;
  border-bottom: 1px solid #eae6dc;
  padding: 8px 14px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bd-log { padding: 10px 14px; }
.bd-log-t {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #9a938a;
  margin-bottom: 5px;
}
.bd-log-q {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--blue);
  word-break: break-word;
}
.bd-log-empty {
  font-size: 13px;
  color: #9a938a;
  font-style: italic;
  padding-top: 14px;
}

/* ── Verdict ─────────────────────────────────────────────────── */
.bd-verdict { text-align: center; }

.bd-stamp {
  display: inline-block;
  font-family: var(--font-display);
  border: 4px double;
  border-radius: 5px;
  padding: 11px 28px 8px;
  font-size: 24px;
  letter-spacing: 5px;
  background: rgba(250,246,234,0.6);
  animation: stampIn 0.45s ease both;
  margin-bottom: 22px;
}
.bd-stamp-correct { border-color: var(--green); color: var(--green); }
.bd-stamp-wrong   { border-color: var(--red);   color: var(--red); }

.bd-notes {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 3px;
  padding: 17px 20px;
  margin-bottom: 14px;
  text-align: left;
  box-shadow: var(--shadow);
  animation: fadeUp 0.4s ease 0.15s both;
}
.bd-notes-label {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--amber);
  margin-bottom: 8px;
}
.bd-notes p {
  margin: 0;
  font-size: 15px;
  line-height: 1.85;
  color: #423b31;
}
.bd-notes-real { border-left-color: var(--blue); animation-delay: 0.3s; }
.bd-notes-real .bd-notes-label { color: var(--blue); }

.bd-verdict-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  animation: fadeUp 0.4s ease 0.4s both;
}

/* ── Result / commendation ───────────────────────────────────── */
.bd-result {
  text-align: center;
  animation: fadeUp 0.5s ease;
  max-width: 480px;
  width: 100%;
  padding-top: 34px;
}
.bd-perf-label {
  font-family: var(--font-display);
  font-size: 12.5px;
  letter-spacing: 5px;
  color: var(--faint);
  margin-bottom: 16px;
}
.bd-rank-emoji { font-size: 54px; }
.bd-rank-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  margin: 10px 0 4px;
}
.bd-score-final { color: var(--ink2); font-size: 14.5px; margin-bottom: 22px; }

.bd-share-grid {
  font-size: 23px;
  letter-spacing: 3px;
  line-height: 1.5;
  margin-bottom: 26px;
  display: grid;
  grid-template-columns: repeat(5, min-content);
  justify-content: center;
  gap: 3px 5px;
}

.bd-result-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 14px;
}
.bd-btn-copy {
  background: var(--paper);
  border: 2px solid var(--amber);
  color: var(--amber);
  padding: 11px 32px;
  border-radius: 3px;
  font-family: var(--font-display);
  font-size: 12.5px;
  cursor: pointer;
  letter-spacing: 3px;
  transition: background 0.2s;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(74,62,38,0.12);
}
.bd-btn-copy:hover { background: #f7edd4; }
.bd-copy-confirm { font-size: 12.5px; font-weight: 600; color: var(--green); letter-spacing: 2px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .bd-suspects { grid-template-columns: 1fr; gap: 12px; }
  .bd-suspect { flex-direction: row; flex-wrap: wrap; align-items: stretch; }
  .bd-mugshot { width: 88px; height: auto; min-height: 88px; border-bottom: none; border-right: 1px solid var(--line); }
  .bd-mug-emoji { font-size: 40px; }
  .bd-placard { flex: 1; border-bottom: none; display: flex; flex-direction: column; justify-content: center; }
  .bd-btn-accuse { flex-basis: calc(100% - 26px); }
  .bd-verdict-stamp { align-self: center; margin: 12px auto 15px; }

  /* On mobile the card lays out as a row (mugshot | placard), so the
     history block wraps to its own full-width line below them. */
  .bd-card-history { flex-basis: 100%; border-top: 1px solid var(--line); }

  .bd-verdict-actions { flex-direction: column; }
}
