@import url("https://fonts.googleapis.com/css2?family=Black+Ops+One&family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --cream: #f5ead4;
  --gold: #e4ad4f;
  --amber: #ffca68;
  --ink: #100d0d;
  --panel: rgba(13, 11, 13, .9);
  --line: rgba(242, 205, 139, .38);
  --red: #9e3d35;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  color: var(--cream);
  background: #090707;
  font-family: "Inter", sans-serif;
}
button, a { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.novel {
  position: relative;
  width: 100vw;
  height: 100svh;
  min-height: 620px;
  overflow: hidden;
  isolation: isolate;
}

.scene-image {
  position: absolute;
  z-index: -5;
  inset: -3%;
  width: 106%;
  height: 106%;
  object-fit: cover;
  object-position: center 42%;
  filter: saturate(.88) contrast(1.05) brightness(.8);
  transition: opacity .42s ease, transform 9s linear, object-position .5s ease;
  transform: scale(1.02);
}
.novel.scene-enter .scene-image { transform: scale(1.08); }
.scene-color {
  position: absolute;
  z-index: -4;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(16, 14, 17, .73), transparent 44%, rgba(66, 34, 15, .24)),
    linear-gradient(0deg, rgba(5, 5, 8, .85), transparent 55%);
  mix-blend-mode: multiply;
}
.scene-vignette {
  position: absolute;
  z-index: -3;
  inset: 0;
  box-shadow: inset 0 0 180px 50px rgba(0, 0, 0, .72);
  pointer-events: none;
}
.film-grain {
  position: absolute;
  z-index: 20;
  inset: -50%;
  opacity: .06;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .18s steps(2) infinite;
}

.game-header {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  min-height: 74px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 7, 8, .9), rgba(8, 7, 8, .54));
  backdrop-filter: blur(10px);
}
.mini-brand { display: flex; align-items: center; gap: 10px; width: max-content; font-family: "Black Ops One", sans-serif; font-size: 14px; letter-spacing: 1px; }
.mini-brand img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.mini-brand b { color: var(--gold); }
.episode-title { display: grid; text-align: center; }
.episode-title span { color: var(--gold); font-size: 9px; font-weight: 800; letter-spacing: 3px; }
.episode-title strong { margin-top: 3px; font-size: 11px; letter-spacing: 1px; }
.header-actions { display: flex; justify-content: flex-end; gap: 7px; }
.header-actions button,
.menu-card button,
.menu-card a,
.ending-actions button,
.ending-actions a {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  color: var(--cream);
  background: rgba(22, 18, 20, .82);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
}
.header-actions button:hover,
.menu-card button:hover,
.menu-card a:hover { border-color: var(--gold); color: var(--amber); }

.status-panel {
  position: absolute;
  z-index: 8;
  top: 92px;
  left: 28px;
  width: 228px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(10, 8, 10, .75);
  backdrop-filter: blur(8px);
}
.status-panel[hidden] { display: none; }
.work-status {
  border-color: rgba(241, 181, 68, .45);
  background: rgba(20, 13, 8, .82);
}
.work-status div { grid-template-columns: 74px 1fr 18px; }
.work-status i b { background: linear-gradient(90deg, #c56225, #ffd36c); }
.work-status strong { color: #ffd36c; }
.status-panel div {
  display: grid;
  grid-template-columns: 74px 1fr 18px;
  align-items: center;
  gap: 8px;
  margin: 7px 0;
  color: #c5b8aa;
  font-family: monospace;
  font-size: 8px;
}
.status-panel i { height: 5px; overflow: hidden; background: #332823; }
.status-panel i b { display: block; width: 20%; height: 100%; background: linear-gradient(90deg, #9e4d37, var(--amber)); transition: width .3s; }
.status-panel strong { color: var(--amber); }

.progress-track {
  position: absolute;
  z-index: 8;
  top: 92px;
  right: 28px;
  width: 220px;
  height: 28px;
  padding: 5px;
  border: 1px solid var(--line);
  background: rgba(10, 8, 10, .75);
}
.progress-track i { display: block; width: 7.69%; height: 100%; background: linear-gradient(90deg, #8d3a31, var(--gold)); transition: width .5s; }
.progress-track span { position: absolute; inset: 0; display: grid; place-items: center; font-family: monospace; font-size: 8px; font-weight: bold; text-shadow: 1px 1px #000; }

.inventory {
  position: absolute;
  z-index: 8;
  top: 130px;
  right: 28px;
  width: 220px;
  padding: 10px 12px;
  border: 1px solid rgba(242, 205, 139, .2);
  background: rgba(10, 8, 10, .68);
  backdrop-filter: blur(7px);
}
.inventory > span { color: var(--gold); font-size: 8px; font-weight: 800; letter-spacing: 2px; }
#inventoryItems { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
#inventoryItems b,
#inventoryItems em { padding: 4px 6px; color: #d8c8b6; background: #2b2020; font-size: 7px; font-style: normal; }

.dialogue-panel {
  position: absolute;
  z-index: 10;
  right: clamp(20px, 5vw, 80px);
  bottom: clamp(20px, 5vh, 55px);
  left: clamp(20px, 5vw, 80px);
  min-height: 205px;
  padding: 22px 30px 20px;
  border: 1px solid rgba(255, 216, 145, .5);
  border-left: 5px solid var(--gold);
  background:
    linear-gradient(110deg, rgba(12, 9, 11, .96), rgba(22, 16, 17, .88)),
    var(--panel);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .5);
  backdrop-filter: blur(12px);
}
.speaker-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.speaker-row strong { color: var(--amber); font-family: "Black Ops One", sans-serif; font-size: 17px; letter-spacing: 1px; }
.speaker-row span { color: #8d7d72; font-family: monospace; font-size: 8px; letter-spacing: 1px; }
#dialogueText { max-width: 1000px; min-height: 64px; margin: 17px 0 10px; color: #f0e6d8; font-size: clamp(19px, 2.1vw, 27px); line-height: 1.7; text-shadow: 1px 2px #000; }
.continue-button {
  position: absolute;
  right: 22px;
  bottom: 17px;
  border: 0;
  color: var(--gold);
  background: transparent;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
}
kbd { margin-left: 8px; padding: 3px 6px; border: 1px solid #75614d; color: #b4a18d; background: #211a19; font-family: monospace; font-size: 8px; }

.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 15px; }
.choice-button {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  min-height: 55px;
  padding: 8px 12px;
  border: 1px solid #645044;
  color: #e9ddce;
  background: rgba(42, 31, 29, .9);
  text-align: left;
}
.choice-button:hover { border-color: var(--amber); background: rgba(87, 52, 36, .94); transform: translateY(-1px); }
.choice-button b { color: var(--amber); font-family: "Black Ops One", sans-serif; font-size: 16px; }
.choice-button span { font-size: 14px; font-weight: 700; }
.choice-button small { display: block; margin-top: 3px; color: #aa9788; font-size: 11px; font-weight: 400; }

.title-screen,
.menu-overlay,
.ending-screen {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  background:
    radial-gradient(circle at 65% 25%, rgba(224, 154, 70, .16), transparent 35%),
    linear-gradient(90deg, rgba(9, 7, 8, .98), rgba(9, 7, 8, .64));
  backdrop-filter: blur(3px);
}
.title-card,
.ending-card {
  width: min(720px, 92vw);
  text-align: center;
}
.title-card > p:first-child,
.ending-card > p:first-child { margin: 0 0 14px; color: var(--gold); font-size: 9px; font-weight: 800; letter-spacing: 4px; }
h1 {
  margin: 0;
  color: #f7ede0;
  font-family: "Black Ops One", sans-serif;
  font-size: clamp(48px, 8vw, 105px);
  font-weight: 400;
  line-height: .8;
  letter-spacing: -2px;
  text-shadow: 0 7px 0 #291915, 0 0 45px rgba(226, 154, 72, .18);
}
h1 span { color: var(--gold); }
.title-card h2 { margin: 20px 0 12px; color: #d3c2b1; font-size: clamp(14px, 2vw, 22px); font-weight: 500; }
.title-rule { display: flex; align-items: center; gap: 12px; margin: 18px auto; color: var(--amber); font-family: monospace; font-size: 9px; letter-spacing: 3px; }
.title-rule i { flex: 1; height: 1px; background: var(--line); }
.title-copy { max-width: 610px; margin: 0 auto; color: #b8a99d; line-height: 1.7; }
.episode-three-teaser {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  align-items: center;
  gap: 4px 12px;
  width: fit-content;
  margin: 17px auto 0;
  padding: 10px 16px;
  border: 1px solid #855225;
  background: linear-gradient(110deg, rgba(74, 38, 21, .92), rgba(22, 16, 17, .94));
  box-shadow: 0 0 28px rgba(224, 154, 70, .12);
}
.episode-three-teaser span {
  color: var(--gold);
  font-family: monospace;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 3px;
}
.episode-three-teaser strong {
  color: #f6eadc;
  font-size: 10px;
  letter-spacing: 2px;
}
.episode-three-teaser b {
  grid-column: 1 / -1;
  color: var(--amber);
  font-family: "Black Ops One", sans-serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 2px;
}
.ending-teaser { margin-top: 16px; }
.title-actions,
.ending-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 25px 0 14px; }
.title-actions button,
.ending-actions button,
.ending-actions a {
  min-width: 180px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid #8b725b;
  color: var(--cream);
  background: rgba(27, 21, 21, .9);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
}
.title-actions .primary,
.ending-actions .primary { border-color: #f2c16e; color: #24150d; background: linear-gradient(135deg, #f3c16d, #bd7234); }
.title-card > small,
.ending-card > small { color: #75675f; font-family: monospace; font-size: 8px; letter-spacing: 2px; }
.responsibility-note { position: absolute; bottom: 18px; color: #8e8179; font-size: 8px; letter-spacing: 1px; }

.menu-overlay { background: rgba(7, 6, 7, .88); backdrop-filter: blur(12px); }
.menu-card {
  display: grid;
  gap: 9px;
  width: min(390px, 90vw);
  padding: 30px;
  border: 1px solid var(--line);
  background: #171214;
  text-align: center;
}
.menu-card p { margin: 0; color: var(--gold); font-size: 9px; letter-spacing: 4px; }
.menu-card h2 { margin: 0 0 12px; font-family: "Black Ops One", sans-serif; font-weight: 400; }
.menu-card button,
.menu-card a { display: grid; place-items: center; width: 100%; min-height: 46px; }
.menu-card small { margin-top: 8px; color: #756b65; font-size: 8px; line-height: 1.5; }

.ending-screen { background: linear-gradient(90deg, rgba(9, 7, 8, .97), rgba(9, 7, 8, .75)); }
.ending-card h2 { margin: 0; color: var(--amber); font-family: "Black Ops One", sans-serif; font-size: clamp(34px, 6vw, 70px); font-weight: 400; line-height: .95; }
.ending-card blockquote { margin: 25px auto; padding: 20px; border-block: 1px solid var(--line); color: #e2d7cb; font-size: clamp(16px, 2vw, 22px); line-height: 1.6; }
.ending-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.ending-stats span { padding: 7px 10px; border: 1px solid #55443b; color: #c5b4a6; background: #211a1a; font-family: monospace; font-size: 8px; }
.ending-stats .work-result { border-color: #a96431; color: #ffd36c; background: #2b1b11; }

@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(2%, -1%); }
  50% { transform: translate(-1%, 2%); }
  75% { transform: translate(1%, 1%); }
}

@media (max-width: 800px) {
  body { overflow: auto; }
  .novel { min-height: 760px; }
  .game-header { grid-template-columns: 1fr auto; padding: 8px 12px; }
  .episode-title { display: none; }
  .mini-brand { font-size: 11px; }
  .mini-brand img { width: 36px; height: 36px; }
  .header-actions button { padding-inline: 8px; font-size: 7px; }
  .status-panel { top: 70px; left: 10px; width: 180px; padding: 8px; }
  .progress-track { top: 70px; right: 10px; width: 150px; }
  .inventory { top: 108px; right: 10px; width: 150px; }
  .dialogue-panel { right: 10px; bottom: 10px; left: 10px; min-height: 220px; padding: 18px 17px 52px; }
  .speaker-row { align-items: flex-start; flex-direction: column; gap: 5px; }
  #dialogueText { font-size: 19px; }
  .choices { grid-template-columns: 1fr; max-height: 260px; overflow-y: auto; }
  .title-screen { padding: 20px; }
  .responsibility-note { width: calc(100% - 30px); text-align: center; }
}

@media (max-width: 480px) {
  .mini-brand span { display: none; }
  #fullscreenButton { display: none; }
  .game-header { display: flex; justify-content: flex-start; }
  .header-actions {
    position: absolute;
    top: 5px;
    right: max(5px, calc(100vw - 425px));
    flex-direction: column;
    gap: 3px;
    width: 70px;
  }
  .header-actions button { width: 70px; min-height: 28px; padding-inline: 4px; font-size: 6px; }
  .status-panel { width: 164px; }
  .status-panel div { grid-template-columns: 66px 1fr 14px; }
  .inventory { display: none; }
  .scene-image { object-position: center center; }
  .dialogue-panel { min-height: 250px; }
  .title-screen {
    padding-inline: 16px;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .title-card,
  .ending-card {
    width: calc(100vw - 32px);
    min-width: 0;
    max-width: calc(100vw - 32px);
  }
  h1 { font-size: clamp(38px, 11vw, 44px); }
  .title-card h2 { font-size: 14px; }
  .title-copy { width: 100%; max-width: 100%; overflow-wrap: anywhere; font-size: 12px; }
  .episode-three-teaser {
    grid-template-columns: 1fr;
    width: 100%;
    padding: 9px 12px;
  }
  .episode-three-teaser b { grid-column: auto; }
  .title-rule { gap: 8px; font-size: 8px; letter-spacing: 2px; }
  .title-actions button { width: 100%; }
  .responsibility-note { right: 15px; left: 15px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
