:root {
  --ink: #15181c;
  --paper: rgba(248, 245, 235, 0.9);
  --muted: #6f747d;
  --line: rgba(21, 24, 28, 0.16);
  --brick: #8f3f3d;
  --gold: #c99a45;
  --teal: #2f7d77;
  --blue: #385c8a;
  --plum: #6c5578;
  --cream: #f8f2df;
  --shadow: 0 24px 70px rgba(6, 9, 13, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #11151b;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

canvas {
  display: block;
}

.case-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#crime-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #11151b;
}

.intro {
  position: absolute;
  inset: 20px;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(248, 242, 223, 0.94);
  box-shadow: var(--shadow);
  transition:
    opacity 420ms ease,
    transform 420ms ease,
    visibility 420ms ease;
}

.intro.is-hidden {
  visibility: hidden;
  opacity: 0;
  transform: scale(1.025);
  pointer-events: none;
}

.intro-art {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(17, 21, 27, 0.88), rgba(56, 92, 138, 0.64)),
    repeating-linear-gradient(
      115deg,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0.08) 1px,
      transparent 1px,
      transparent 34px
    );
}

.moon {
  position: absolute;
  top: 11%;
  left: 12%;
  width: min(20vw, 190px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #fff8d8, #d9b966 58%, transparent 70%);
  box-shadow: 0 0 70px rgba(255, 234, 160, 0.35);
}

.detective-card {
  position: absolute;
  left: 38%;
  bottom: 7%;
  width: min(30vw, 260px);
  aspect-ratio: 0.72;
  border-radius: 8px;
  background: linear-gradient(180deg, #f0bd94 0 25%, #293546 25% 72%, #1a202b 72%);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.34);
}

.hat {
  position: absolute;
  left: 8%;
  top: 5%;
  width: 84%;
  height: 18%;
  border-radius: 8px 8px 3px 3px;
  background: #202633;
}

.hat::after {
  position: absolute;
  left: -12%;
  right: -12%;
  bottom: -20%;
  height: 28%;
  border-radius: 999px;
  background: #151923;
  content: "";
}

.face {
  position: absolute;
  left: 24%;
  top: 24%;
  width: 52%;
  height: 22%;
  border-radius: 48%;
  background: #f0bd94;
}

.face span {
  position: absolute;
  left: 20%;
  top: 42%;
  width: 60%;
  height: 7px;
  border-radius: 999px;
  background: #15181c;
}

.coat {
  position: absolute;
  left: 24%;
  bottom: 13%;
  width: 52%;
  height: 43%;
  border-radius: 14px 14px 8px 8px;
  background: #8f3f3d;
}

.glass {
  position: absolute;
  right: 2%;
  top: 43%;
  width: 30%;
  aspect-ratio: 1;
  border: 9px solid #d3b15f;
  border-radius: 50%;
}

.glass::after {
  position: absolute;
  right: -58%;
  bottom: -34%;
  width: 58%;
  height: 9px;
  border-radius: 999px;
  background: #d3b15f;
  transform: rotate(42deg);
  content: "";
}

.evidence-photo {
  position: absolute;
  width: min(18vw, 150px);
  aspect-ratio: 0.78;
  border: 8px solid #f8f2df;
  border-bottom-width: 28px;
  border-radius: 4px;
  background:
    radial-gradient(circle at 52% 36%, #c99a45 0 8%, transparent 9%),
    linear-gradient(135deg, #2f7d77, #141a23);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.24);
}

.evidence-photo.one {
  right: 10%;
  top: 17%;
  transform: rotate(8deg);
}

.evidence-photo.two {
  left: 10%;
  bottom: 12%;
  transform: rotate(-7deg);
}

.intro-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(30px, 6vw, 74px);
}

.kicker {
  margin: 0 0 8px;
  color: var(--brick);
  font-size: 0.74rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(4.6rem, 10.8vw, 8.8rem);
  line-height: 0.86;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.18rem, 2vw, 1.8rem);
  line-height: 1.12;
  letter-spacing: 0;
  overflow-wrap: break-word;
}

h3 {
  margin-bottom: 8px;
  font-size: 0.96rem;
}

p,
li,
span {
  overflow-wrap: break-word;
}

p {
  color: var(--muted);
  line-height: 1.58;
}

.primary,
.secondary,
.icon-button,
.tool-button,
.suspect-card,
.case-tab,
.question,
.accuse-choice {
  border-radius: 8px;
  font-weight: 900;
  transition:
    transform 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.primary,
.secondary {
  display: inline-grid;
  min-height: 44px;
  place-items: center;
  padding: 0 18px;
  text-decoration: none;
}

.primary {
  width: fit-content;
  background: var(--brick);
  color: white;
  box-shadow: 0 14px 32px rgba(143, 63, 61, 0.28);
}

.secondary,
.icon-button,
.tool-button,
.suspect-card,
.case-tab,
.question,
.accuse-choice {
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  outline: 1px solid var(--line);
}

button:hover,
a:hover {
  transform: translateY(-1px);
}

.intro-actions,
.case-tabs,
.tool-grid,
.suspect-list,
.question-list,
.accuse-list,
.reward-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar,
.case-file,
.suspect-panel,
.action-panel,
.notebook,
.modal {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
}

.topbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 5;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(270px, 34vw);
  gap: 12px;
  align-items: center;
  padding: 10px;
}

.home-link {
  display: grid;
  min-height: 46px;
  place-items: center;
  border-radius: 8px;
  background: rgba(143, 63, 61, 0.12);
  color: var(--brick);
  font-weight: 950;
  text-decoration: none;
}

.topbar h2 {
  margin-bottom: 0;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.score-strip span {
  display: grid;
  min-height: 46px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.score-strip strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.case-file {
  position: absolute;
  top: 102px;
  left: 16px;
  z-index: 4;
  width: min(390px, calc(100vw - 32px));
  padding: 16px;
}

.case-file p:last-of-type {
  margin-bottom: 14px;
}

.case-tab {
  min-height: 38px;
  padding: 0 12px;
}

.case-tab.is-active {
  background: var(--ink);
  color: white;
}

.suspect-panel {
  position: absolute;
  right: 16px;
  top: 102px;
  z-index: 4;
  width: min(430px, calc(100vw - 32px));
  padding: 14px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.icon-button {
  min-height: 40px;
  padding: 0 12px;
}

.suspect-list {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: 10px;
}

.suspect-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 76px;
  padding: 9px;
  text-align: left;
}

.suspect-card.is-cleared {
  opacity: 0.68;
}

.mini-face,
.portrait {
  position: relative;
  border-radius: 8px;
  background: var(--face-bg, #385c8a);
  overflow: hidden;
}

.mini-face {
  width: 58px;
  height: 58px;
}

.mini-face::before,
.portrait::before {
  position: absolute;
  left: 28%;
  top: 20%;
  width: 44%;
  height: 34%;
  border-radius: 50%;
  background: #efbd94;
  content: "";
}

.mini-face::after,
.portrait::after {
  position: absolute;
  left: 24%;
  bottom: 12%;
  width: 52%;
  height: 40%;
  border-radius: 12px 12px 0 0;
  background: rgba(20, 24, 28, 0.82);
  content: "";
}

.suspect-card strong {
  display: block;
  margin-bottom: 4px;
}

.suspect-card span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.action-panel {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  width: min(620px, calc(100vw - 32px));
  padding: 14px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tool-button {
  min-height: 94px;
  padding: 12px;
  text-align: left;
}

.tool-button strong {
  display: block;
  margin-bottom: 7px;
}

.tool-button span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.34;
}

.tool-button.accuse {
  background: var(--brick);
  color: white;
}

.tool-button.accuse span {
  color: rgba(255, 255, 255, 0.82);
}

.notebook {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 12;
  max-height: calc(100vh - 132px);
  overflow: auto;
  padding: 16px;
  transform: translateY(calc(100% + 28px));
  transition: transform 260ms ease;
}

.notebook.is-open {
  transform: translateY(0);
}

.note-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

ul {
  margin: 0;
  padding-left: 20px;
}

li {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.42;
}

.reward {
  display: grid;
  min-height: 48px;
  place-items: center;
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(201, 154, 69, 0.16);
  color: #6f4e10;
  font-weight: 950;
}

.modal {
  width: min(820px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 20px;
  color: var(--ink);
}

.modal.small {
  width: min(560px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(5, 7, 10, 0.62);
  backdrop-filter: blur(4px);
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-weight: 950;
}

.dialogue-head {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding-right: 38px;
}

.portrait {
  width: 86px;
  height: 86px;
}

.dialogue-stage {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.bubble-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.bubble-row.detective {
  grid-template-columns: minmax(0, 1fr) 54px;
}

.bubble-row.detective .speaker {
  order: 2;
}

.speaker {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-size: 1.2rem;
  font-weight: 950;
}

.speaker.detective {
  background: var(--brick);
}

.bubble {
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  line-height: 1.48;
  outline: 1px solid var(--line);
}

.bubble strong {
  display: block;
  margin-bottom: 4px;
}

.question-list,
.accuse-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.question,
.accuse-choice {
  min-height: 98px;
  padding: 13px;
  text-align: left;
}

.question strong,
.accuse-choice strong {
  display: block;
  margin-bottom: 6px;
}

.question span,
.accuse-choice span {
  color: var(--muted);
  line-height: 1.38;
}

.feedback {
  min-height: 56px;
  margin-top: 14px;
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(47, 125, 119, 0.13);
  color: #1d5853;
  font-weight: 850;
  line-height: 1.45;
}

@media (max-width: 940px) {
  .intro {
    inset: 10px;
    grid-template-columns: 1fr;
  }

  .intro-art {
    min-height: 40vh;
  }

  .intro-copy {
    padding: 24px;
  }

  h1 {
    font-size: clamp(4rem, 17vw, 5.4rem);
  }

  .topbar {
    grid-template-columns: 64px 1fr;
  }

  .score-strip {
    grid-column: 1 / -1;
  }

  .case-file,
  .suspect-panel {
    top: 158px;
  }

  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .case-shell {
    min-height: 100vh;
    height: auto;
    overflow: visible;
    padding: 10px;
  }

  #crime-scene {
    position: fixed;
  }

  .topbar,
  .case-file,
  .suspect-panel,
  .action-panel,
  .notebook {
    position: relative;
    inset: auto;
    width: auto;
    margin-bottom: 10px;
  }

  .topbar {
    grid-template-columns: 58px 1fr;
  }

  .notebook {
    display: none;
    transform: none;
  }

  .notebook.is-open {
    display: block;
  }

  .note-grid,
  .question-list,
  .accuse-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .score-strip,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .dialogue-head {
    grid-template-columns: 64px 1fr;
  }

  .portrait {
    width: 64px;
    height: 64px;
  }

  .bubble-row,
  .bubble-row.detective {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .bubble-row.detective .speaker {
    order: 0;
  }

  .speaker {
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }
}
