/* ============ RASHŌMON GALGAME · STYLE ============ */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #08080a;
  color: #e8dcc4;
  font-family: 'Noto Serif JP', 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  user-select: none;
  cursor: default;
}
body[data-lang="en"] {
  font-family: 'Special Elite', 'Courier Prime', 'Courier New', 'Noto Serif SC', serif;
}

#game {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #08080a;
}

/* === film flicker on title screen === */
body[data-screen="title-screen"] #title-screen {
  animation: filmFlicker 0.18s steps(2) infinite;
}
@keyframes filmFlicker {
  0%, 100% { filter: brightness(1) contrast(1); }
  47%      { filter: brightness(0.97) contrast(1.02); }
  53%      { filter: brightness(1.04) contrast(0.98); }
}

/* === custom crosshair cursor in dialogue mode === */
body[data-screen="dialogue-screen"] { cursor: crosshair; }
body[data-screen="dialogue-screen"] button,
body[data-screen="dialogue-screen"] .choice-btn,
body[data-screen="dialogue-screen"] .lang-toggle { cursor: pointer; }

/* === dialogue box top edge: thin gold film-strip line === */
#dialogue-box::before {
  content: '';
  position: absolute;
  left: 80px; right: 80px; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245,200,66,0.4), transparent);
}

/* === chapter card four-corner brackets (film leader feel) === */
.chapter-card-en::before,
.chapter-card-en::after,
.chapter-card-cn::before,
.chapter-card-cn::after {
  content: '';
  position: absolute;
  width: 28px; height: 28px;
  border: 2px solid #d6c8a8;
}
.chapter-card-en { position: relative; }
.chapter-card-cn { position: relative; }
.chapter-card-en::before { top: -16px; left: -16px;  border-right: none;  border-bottom: none; }
.chapter-card-en::after  { top: -16px; right: -16px; border-left: none;   border-bottom: none; }
.chapter-card-cn::before { bottom: -16px; left: -16px;  border-right: none; border-top: none; }
.chapter-card-cn::after  { bottom: -16px; right: -16px; border-left: none;  border-top: none; }

/* === ABOUT button on credits === */
.about-link {
  display: inline-block;
  margin-top: 30px;
  font-family: 'Special Elite', monospace;
  font-size: 12px;
  letter-spacing: 4px;
  color: #c79e3f;
  text-decoration: none;
  border-bottom: 1px dashed #6a5535;
  padding-bottom: 4px;
  transition: all 0.2s ease;
}
.about-link:hover { color: #d6c8a8; border-color: #d6c8a8; }

/* ===== film grain ===== */
#grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 996;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image:
    radial-gradient(rgba(255,255,255,0.45) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,0.5) 1px, transparent 1px);
  background-size: 3px 3px, 5px 5px;
  background-position: 0 0, 1px 2px;
  animation: grainShift 0.45s steps(4) infinite;
}
@keyframes grainShift {
  0%   { transform: translate(0,0); }
  25%  { transform: translate(-1px,1px); }
  50%  { transform: translate(1px,-1px); }
  75%  { transform: translate(-2px,-2px); }
  100% { transform: translate(2px,2px); }
}

/* faint scanlines */
#scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 995;
  opacity: 0.08;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.6) 3px,
    rgba(0,0,0,0) 4px
  );
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 994;
  box-shadow: inset 0 0 220px 70px rgba(0,0,0,0.92);
}

/* ===== global lang toggle ===== */
.lang-toggle.global-lang {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 1000;
  background: transparent;
  border: 1px solid #6a5535;
  color: #bfb098;
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: 4px;
  cursor: pointer;
  font-family: 'Impact', 'Arial Black', sans-serif;
  transition: all 0.2s ease;
  min-width: 56px;
}
.lang-toggle.global-lang:hover {
  background: #d6c8a8;
  color: #0a0807;
  border-color: #d6c8a8;
  letter-spacing: 6px;
}

/* ===== screens ===== */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
}
.screen.leaving {
  opacity: 0;
  pointer-events: none;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============ TITLE SCREEN ============ */
#title-screen {
  background:
    radial-gradient(ellipse at 50% 35%, #2a1810 0%, #1a0e08 35%, #08080a 80%);
  padding: 60px 30px;
}

/* film strips top/bottom */
.film-strip {
  position: absolute;
  left: 0; right: 0;
  height: 26px;
  background: #08080a;
  display: flex;
  justify-content: space-between;
  padding: 5px 16px;
  z-index: 5;
}
.film-strip.top    { top: 0;    border-bottom: 2px solid #1a1410; }
.film-strip.bottom { bottom: 0; border-top:    2px solid #1a1410; }
.film-strip span {
  display: block;
  width: 32px;
  height: 16px;
  background: #1a0a0a;
  border: 1px solid #2a1410;
}

.title-poster {
  text-align: center;
  position: relative;
  z-index: 6;
}

.title-tag {
  font-size: 11px;
  letter-spacing: 6px;
  color: #9a8466;
  margin-bottom: 30px;
  font-weight: 300;
}

.title-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  min-height: 280px;
}
.title-art-mia {
  position: absolute;
  right: -10px;
  bottom: -20px;
  width: 240px;
  height: 320px;
  opacity: 0.85;
  filter: drop-shadow(0 0 20px rgba(245,200,66,0.15));
  z-index: 1;
}
.title-art-mia svg { width: 100%; height: 100%; }

.title-main {
  position: relative;
  z-index: 2;
  font-family: 'Impact', 'Haettenschweiler', 'Arial Black', sans-serif;
  font-size: 156px;
  line-height: 0.82;
  letter-spacing: 2px;
  font-weight: 900;
  font-style: italic;
  transform: skew(-4deg);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.title-pulp, .title-fiction {
  display: block;
  color: #d6c8a8;
  text-shadow:
    0 0 1px #d6c8a8,
    4px 4px 0 #8a6a32,
    8px 8px 0 #a82b1f,
    14px 14px 40px rgba(245,200,66,0.25);
}
.title-fiction {
  margin-top: -14px;
}

.title-sub {
  font-size: 30px;
  letter-spacing: 18px;
  color: #c79e3f;
  margin-left: 18px;
  margin-top: 18px;
  margin-bottom: 24px;
  font-weight: 400;
  font-family: 'ZCOOL QingKe HuangYou', 'ZCOOL XiaoWei', serif;
}

.title-quote {
  font-style: italic;
  color: #6a5535;
  font-size: 13px;
  letter-spacing: 2px;
  margin-bottom: 24px;
}

.title-starring {
  margin-top: 6px;
  margin-bottom: 6px;
}
.title-starring-label {
  font-size: 10px;
  letter-spacing: 8px;
  color: #6a5535;
  margin-bottom: 8px;
}
.title-starring-list {
  font-size: 12px;
  letter-spacing: 2px;
  color: #9a8466;
  font-weight: 500;
}

.title-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 28px;
  z-index: 6;
}

.menu-btn {
  background: transparent;
  border: 1px solid #6a5535;
  color: #bfb098;
  padding: 12px 52px;
  font-size: 14px;
  letter-spacing: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-weight: 400;
  position: relative;
}
body[data-lang="en"] .menu-btn {
  letter-spacing: 4px;
  font-family: 'Impact', sans-serif;
}
.menu-btn.primary {
  background: linear-gradient(135deg, rgba(245,200,66,0.1) 0%, transparent 100%);
}
.menu-btn:hover {
  background: #d6c8a8;
  color: #0a0807;
  border-color: #d6c8a8;
  letter-spacing: 8px;
  box-shadow: 0 0 30px rgba(245,200,66,0.4);
}

.title-foot {
  position: absolute;
  bottom: 36px;
  font-size: 10px;
  letter-spacing: 12px;
  color: #3a2f20;
  z-index: 6;
}

/* ============ ROUTE SCREEN ============ */
#route-screen {
  background:
    radial-gradient(ellipse at 50% 30%, #14110d 0%, #08080a 90%);
  padding: 70px 40px 60px;
}

.route-header {
  text-align: center;
  margin-bottom: 36px;
}
.route-tag {
  font-size: 10px;
  letter-spacing: 10px;
  color: #6a5535;
  margin-bottom: 14px;
}
.route-header h2 {
  font-size: 32px;
  letter-spacing: 8px;
  color: #d6c8a8;
  font-style: italic;
  margin-bottom: 12px;
  font-family: 'Impact', sans-serif;
}
.route-header p {
  color: #8a7654;
  font-size: 13px;
  letter-spacing: 1px;
}

.route-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: 1240px;
  width: 100%;
}

.route-card {
  background:
    linear-gradient(180deg, #1a1410 0%, #0c0906 100%);
  border: 1px solid #3a2f20;
  padding: 26px 22px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}
.route-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, #d6c8a8 50%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s;
}
.route-card:hover:not(.locked)::before { opacity: 1; }
.route-card:hover:not(.locked) {
  border-color: #d6c8a8;
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(245,200,66,0.18);
}
.route-card.locked {
  cursor: not-allowed;
  opacity: 0.42;
  filter: grayscale(1) blur(0.4px);
}

.route-num {
  font-family: 'Impact', sans-serif;
  font-size: 30px;
  color: #6a5535;
  letter-spacing: 4px;
  margin-bottom: 10px;
  text-align: left;
  border-bottom: 1px solid #2a2010;
  padding-bottom: 10px;
}
.route-portrait {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin: 18px 0 14px;
  height: 110px;
  position: relative;
}
.route-portrait.dual { gap: 8px; }
.route-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background-size: cover;
  background-position: center top;
  border: 2px solid #3a2f20;
  box-shadow: 0 0 0 1px #1a1410, 0 8px 22px rgba(0,0,0,0.6);
  transition: all 0.3s ease;
}
.route-img.secondary { width: 80px; height: 80px; opacity: 0.85; }
.route-img.redacted {
  background:
    repeating-linear-gradient(45deg, #1a1010 0 8px, #050202 8px 16px);
}
.route-card:hover:not(.locked) .route-img {
  border-color: #d6c8a8;
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px #d6c8a8, 0 12px 32px rgba(245,200,66,0.25);
}

.route-title {
  font-family: 'Impact', sans-serif;
  font-size: 17px;
  letter-spacing: 2px;
  color: #d6c8a8;
  margin-bottom: 6px;
}
.route-subtitle {
  font-size: 14px;
  letter-spacing: 5px;
  color: #bfb098;
  margin-bottom: 14px;
  font-weight: 600;
}
.route-desc {
  font-size: 12px;
  line-height: 1.85;
  color: #9a8466;
  letter-spacing: 0.5px;
}

.route-stamp {
  position: absolute;
  top: 14px; right: 12px;
  display: none;
}
.route-card.completed .route-stamp { display: block; }
.cleared-stamp {
  display: inline-block;
  background: #d6c8a8;
  color: #0a0807;
  font-size: 9px;
  letter-spacing: 2px;
  padding: 3px 9px;
  font-weight: bold;
  font-family: 'Impact', sans-serif;
  transform: rotate(-8deg);
  border: 2px solid #8a6a32;
}

.back-btn {
  position: absolute;
  bottom: 28px;
  left: 32px;
  background: transparent;
  border: 1px solid #3a2f20;
  color: #6a5535;
  padding: 8px 22px;
  font-size: 12px;
  letter-spacing: 3px;
  cursor: pointer;
  font-family: inherit;
}
.back-btn:hover { border-color: #d6c8a8; color: #d6c8a8; }

/* ============ DIALOGUE SCREEN ============ */
#dialogue-screen { background: #000; }

#bg-layer {
  position: absolute;
  inset: 0;
  transition: background 1s ease;
  background: #1a1410;
}

/* ----- scene backgrounds: real generated image + tint overlay ----- */
#bg-layer[class^="bg-"]::before {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  background-image: var(--bg-img);
  background-size: cover;
  background-position: center;
  z-index: 0;
}
#bg-layer[class^="bg-"]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-tint, transparent);
  z-index: 1;
}
#bg-layer.bg-diner          { --bg-img: url('assets/bg/diner.png');           --bg-tint: radial-gradient(ellipse at 30% 35%, rgba(255,200,100,0.18) 0%, transparent 50%), linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.4) 100%); }
#bg-layer.bg-car-day        { --bg-img: url('assets/bg/car-day.png');         --bg-tint: linear-gradient(180deg, rgba(20,30,50,0.15) 0%, rgba(0,0,0,0.45) 100%); }
#bg-layer.bg-car-night      { --bg-img: url('assets/bg/car-day.png');         --bg-tint: linear-gradient(180deg, rgba(10,20,40,0.55) 0%, rgba(0,0,0,0.7) 100%); }
#bg-layer.bg-apartment      { --bg-img: url('assets/bg/apartment.png');       --bg-tint: radial-gradient(ellipse at 50% 30%, rgba(180,140,60,0.18) 0%, transparent 55%), linear-gradient(180deg, rgba(20,15,5,0.2) 0%, rgba(0,0,0,0.5) 100%); }
#bg-layer.bg-jackrabbit     { --bg-img: url('assets/bg/jackrabbit.png');      --bg-tint: radial-gradient(circle at 25% 50%, rgba(255,42,109,0.18) 0%, transparent 35%), radial-gradient(circle at 75% 50%, rgba(77,77,255,0.15) 0%, transparent 35%), linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.55) 100%); }
#bg-layer.bg-mia-house      { --bg-img: url('assets/bg/mia-house.png');       --bg-tint: radial-gradient(ellipse at 50% 40%, rgba(180,80,140,0.18) 0%, transparent 55%), linear-gradient(180deg, rgba(20,10,15,0.15) 0%, rgba(0,0,0,0.5) 100%); }
#bg-layer.bg-living-room-72 { --bg-img: url('assets/bg/living-room-72.png');  --bg-tint: radial-gradient(ellipse at 50% 40%, rgba(220,180,100,0.15) 0%, transparent 55%), linear-gradient(180deg, rgba(20,15,5,0.18) 0%, rgba(0,0,0,0.5) 100%); }
#bg-layer.bg-boxing         { --bg-img: url('assets/bg/boxing.png');          --bg-tint: radial-gradient(circle at 50% 25%, rgba(255,240,180,0.2) 0%, transparent 30%), radial-gradient(circle at 50% 60%, rgba(192,57,43,0.18) 0%, transparent 50%), linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.55) 100%); }
#bg-layer.bg-motel          { --bg-img: url('assets/bg/motel.png');           --bg-tint: linear-gradient(180deg, rgba(20,15,5,0.2) 0%, rgba(0,0,0,0.5) 100%); }
#bg-layer.bg-pawnshop       { --bg-img: url('assets/bg/pawnshop.png');        --bg-tint: radial-gradient(ellipse at 50% 50%, rgba(140,60,20,0.18) 0%, transparent 65%), linear-gradient(180deg, rgba(20,10,5,0.2) 0%, rgba(0,0,0,0.6) 100%); }
#bg-layer.bg-basement       { --bg-img: url('assets/bg/pawnshop.png');        --bg-tint: radial-gradient(circle at 30% 30%, rgba(192,57,43,0.25) 0%, transparent 35%), linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.85) 100%); }
#bg-layer.bg-jimmy          { --bg-img: url('assets/bg/diner.png');           --bg-tint: radial-gradient(ellipse at 50% 40%, rgba(220,180,100,0.15) 0%, transparent 55%), linear-gradient(180deg, rgba(20,15,5,0.2) 0%, rgba(0,0,0,0.5) 100%); }
#bg-layer.bg-blood          { background: radial-gradient(circle at 50% 50%, #a82b1f 0%, #500 60%, #200 100%); }
#bg-layer.bg-dawn           { --bg-img: url('assets/bg/dawn.png');            --bg-tint: linear-gradient(180deg, rgba(245,200,66,0.05) 0%, rgba(0,0,0,0.2) 100%); }
#bg-layer.bg-cocktail-bar   { --bg-img: url('assets/bg/cocktail-bar.png');    --bg-tint: radial-gradient(ellipse at 50% 60%, rgba(140,60,30,0.18) 0%, transparent 60%), linear-gradient(180deg, rgba(20,5,5,0.18) 0%, rgba(0,0,0,0.55) 100%); }
#bg-layer.bg-locker-room    { --bg-img: url('assets/bg/locker-room.png');     --bg-tint: linear-gradient(180deg, rgba(10,15,15,0.25) 0%, rgba(0,0,0,0.6) 100%); }
#bg-layer.bg-lance-house    { --bg-img: url('assets/bg/lance-house.png');     --bg-tint: radial-gradient(ellipse at 30% 40%, rgba(110,180,80,0.15) 0%, transparent 55%), radial-gradient(ellipse at 75% 65%, rgba(255,140,40,0.12) 0%, transparent 50%), linear-gradient(180deg, rgba(15,10,5,0.2) 0%, rgba(0,0,0,0.5) 100%); }
#bg-layer.bg-jimmie-house   { --bg-img: url('assets/bg/jimmie-house.png');    --bg-tint: radial-gradient(ellipse at 50% 40%, rgba(220,180,100,0.12) 0%, transparent 55%), linear-gradient(180deg, rgba(20,15,8,0.18) 0%, rgba(0,0,0,0.45) 100%); }

/* letterbox bars */
.letterbox {
  position: absolute;
  left: 0; right: 0;
  height: 7%;
  background: #000;
  z-index: 5;
}
.letterbox.top    { top: 0; }
.letterbox.bottom { bottom: 0; }

#sprite-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* character portrait cards */
.sprite {
  position: absolute;
  bottom: 32%;
  width: 200px;
  text-align: center;
  opacity: 0;
  transition: all 0.5s ease;
  pointer-events: none;
}
.sprite.left  { left:  10%; transform: translateY(20px); }
.sprite.right { right: 10%; transform: translateY(20px); }
.sprite.visible { opacity: 1; transform: translateY(0); }

.sprite-frame {
  width: 200px;
  height: 200px;
  margin: 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(245,200,66,0.15) 0%, transparent 60%),
    linear-gradient(135deg, #1a0a0a 0%, #2a1410 100%);
  border: 3px solid #3a2f20;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.4s ease;
  box-shadow:
    0 0 0 1px #1a1410,
    0 12px 30px rgba(0,0,0,0.7);
  overflow: hidden;
}
.sprite-portrait {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;   /* keep head consistently in upper third */
  transform: scale(1.08);        /* slight zoom so faces fill the frame */
  transform-origin: 50% 30%;
  opacity: 0;
  transition: opacity 0.5s ease;
  filter: contrast(1.05) saturate(1.05);
}
.sprite-portrait.loaded { opacity: 1; }
.sprite-portrait.failed { opacity: 0; }
/* placeholder shown until image loads — no emoji at all */
.sprite-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(245,200,66,0.08) 0%, transparent 60%),
    linear-gradient(135deg, #1a0a0a 0%, #2a1410 100%);
  z-index: -1;
}
/* hidden UI mode */
body.ui-hidden #dialogue-box,
body.ui-hidden #dialogue-controls,
body.ui-hidden .letterbox { opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.sprite-frame::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(245,200,66,0.15);
  pointer-events: none;
}
.sprite.speaking .sprite-frame {
  border-color: #d6c8a8;
  box-shadow:
    0 0 0 1px #d6c8a8,
    0 0 50px rgba(245,200,66,0.45),
    0 12px 30px rgba(0,0,0,0.7);
  transform: scale(1.05);
}
.sprite-emoji {
  font-size: 110px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6));
}
.sprite-name {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 3px;
  color: #9a8466;
  font-family: 'Impact', sans-serif;
  text-transform: uppercase;
}
.sprite.speaking .sprite-name { color: #d6c8a8; }

/* speaker-specific frame tints */
.sprite[data-speaker="vincent"]   .sprite-frame { border-color: #a82b1f; }
.sprite[data-speaker="vincent"].speaking .sprite-frame { border-color: #e6735a; box-shadow: 0 0 50px rgba(230,115,90,0.5), 0 12px 30px rgba(0,0,0,0.7); }
.sprite[data-speaker="jules"]     .sprite-frame { border-color: #8e44ad; }
.sprite[data-speaker="jules"].speaking .sprite-frame { border-color: #b674d4; box-shadow: 0 0 50px rgba(182,116,212,0.5), 0 12px 30px rgba(0,0,0,0.7); }
.sprite[data-speaker="mia"]       .sprite-frame { border-color: #ff2a6d; }
.sprite[data-speaker="mia"].speaking .sprite-frame { border-color: #ff6b9a; box-shadow: 0 0 50px rgba(255,107,154,0.5), 0 12px 30px rgba(0,0,0,0.7); }
.sprite[data-speaker="butch"]     .sprite-frame { border-color: #d6c8a8; }
.sprite[data-speaker="marsellus"] .sprite-frame { border-color: #5a7da5; }
.sprite[data-speaker="wolf"]      .sprite-frame { border-color: #d0d0d0; }
.sprite[data-speaker="lance"]     .sprite-frame { border-color: #16a085; }

#chapter-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.92);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.0s ease;
}
#chapter-card.show {
  opacity: 1;
  pointer-events: auto;
}
@keyframes chapterIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
.chapter-card-tag {
  font-size: 11px;
  letter-spacing: 12px;
  color: #6a5535;
  margin-bottom: 18px;
}
.chapter-card-en {
  font-family: 'Impact', sans-serif;
  font-size: 72px;
  letter-spacing: 8px;
  color: #d6c8a8;
  font-style: italic;
  text-shadow:
    4px 4px 0 #8a6a32,
    8px 8px 30px rgba(0,0,0,0.8);
  margin-bottom: 14px;
  text-align: center;
  max-width: 80vw;
}
.chapter-card-cn {
  font-size: 24px;
  letter-spacing: 14px;
  color: #bfb098;
  margin-bottom: 28px;
  text-align: center;
  font-family: 'ZCOOL QingKe HuangYou', 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
  font-weight: 400;
}
.chapter-card-line {
  width: 0;
  height: 2px;
  background: #d6c8a8;
  animation: lineGrow 0.9s 0.4s forwards;
}
@keyframes lineGrow {
  from { width: 0; }
  to   { width: 220px; }
}

#dialogue-box {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30%;
  background:
    linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.96) 30%);
  padding: 30px 90px 70px 90px;
  z-index: 10;
}

#speaker-name {
  display: inline-block;
  padding: 8px 20px;
  border-left: 4px solid #d6c8a8;
  background: linear-gradient(90deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 100%);
  font-size: 13px;
  letter-spacing: 5px;
  color: #d6c8a8;
  margin-bottom: 18px;
  font-weight: 700;
  min-height: 30px;
  min-width: 120px;
  font-family: 'Impact', sans-serif;
}
#speaker-name.empty { opacity: 0; }
#speaker-name.vincent   { border-color: #a82b1f; color: #e6735a; }
#speaker-name.jules     { border-color: #8e44ad; color: #b674d4; }
#speaker-name.mia       { border-color: #ff2a6d; color: #ff6b9a; }
#speaker-name.butch     { border-color: #d6c8a8; color: #d6c8a8; }
#speaker-name.marsellus { border-color: #2c3e50; color: #5a7da5; }
#speaker-name.wolf      { border-color: #95a5a6; color: #d0d0d0; }
#speaker-name.pumpkin   { border-color: #e67e22; color: #f39c12; }
#speaker-name.honey     { border-color: #f39c12; color: #ffd573; }
#speaker-name.lance     { border-color: #16a085; color: #48c9b0; }
#speaker-name.jody      { border-color: #6c3483; color: #af7ac5; }
#speaker-name.fabienne  { border-color: #d35400; color: #f0a060; }
#speaker-name.koons     { border-color: #7f8c8d; color: #b0b0b0; }
#speaker-name.brett     { border-color: #7d6608; color: #e6c700; }
#speaker-name.roger     { border-color: #2980b9; color: #5dade2; }
#speaker-name.marvin    { border-color: #5d6d7e; color: #aab7b8; }
#speaker-name.jimmy     { border-color: #784212; color: #b9770e; }
#speaker-name.esmarelda { border-color: #6e2c00; color: #ba4a00; }
#speaker-name.maynard   { border-color: #4a235a; color: #884ea0; }
#speaker-name.zed       { border-color: #1b2631; color: #515a5a; }

#dialogue-text {
  font-size: 22px;
  line-height: 1.65;
  color: #f5e8c8;
  letter-spacing: 1.2px;
  min-height: 36px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.9), 0 0 1px rgba(245,200,66,0.05);
  font-weight: 400;
  font-family: 'Ma Shan Zheng', 'Noto Serif JP', 'Noto Serif SC', serif;
}
#dialogue-text-sub {
  font-size: 12.5px;
  line-height: 1.45;
  color: #9a7e4a;
  letter-spacing: 0.8px;
  margin-top: 4px;
  font-family: 'Special Elite', 'Courier Prime', 'Courier New', monospace;
  font-weight: 400;
  opacity: 0.7;
  min-height: 18px;
  padding-top: 0;
}
/* swap when language is English: English big typewriter, Chinese sub serif */
body[data-lang="en"] #dialogue-text {
  font-size: 19px;
  letter-spacing: 0.5px;
  font-family: 'Special Elite', 'Courier Prime', 'Courier New', monospace;
  font-weight: 400;
}
body[data-lang="en"] #dialogue-text-sub {
  letter-spacing: 1.8px;
  font-family: 'ZCOOL XiaoWei', 'Noto Serif SC', 'Songti SC', serif;
  font-style: italic;
}

.next-indicator {
  position: absolute;
  bottom: 26px;
  right: 90px;
  color: #d6c8a8;
  font-size: 14px;
  animation: nextBounce 1.2s ease infinite;
  opacity: 0;
}
.next-indicator.show { opacity: 1; }
@keyframes nextBounce {
  0%, 100% { transform: translateY(0);  opacity: 0.4; }
  50%      { transform: translateY(4px); opacity: 1;   }
}

/* ===== choice overlay ===== */
#choice-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(2px);
  z-index: 30;
}
#choice-overlay.show {
  display: flex;
  animation: fadeIn 0.4s ease;
}
.choice-prompt {
  font-size: 13px;
  letter-spacing: 10px;
  color: #d6c8a8;
  margin-bottom: 32px;
  font-style: italic;
  font-family: 'Impact', sans-serif;
}
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 60%;
  max-width: 720px;
}
.choice-btn {
  background:
    linear-gradient(90deg, rgba(20,15,10,0.95) 0%, rgba(30,20,12,0.85) 100%);
  border: 1px solid #6a5535;
  border-left: 3px solid #6a5535;
  color: #bfb098;
  padding: 18px 32px 18px 50px;
  font-size: 16px;
  letter-spacing: 1.2px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  text-align: left;
  position: relative;
}
.choice-btn::before {
  content: '▸';
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: #6a5535;
  transition: all 0.2s ease;
}
.choice-btn:hover {
  background: linear-gradient(90deg, #d6c8a8 0%, #c79e3f 100%);
  border-color: #d6c8a8;
  border-left-width: 6px;
  color: #0a0807;
  padding-left: 60px;
  letter-spacing: 1.5px;
}
.choice-btn:hover::before {
  color: #0a0807;
  left: 30px;
}

#dialogue-controls {
  position: absolute;
  bottom: calc(7% + 14px);
  right: 18px;
  display: flex;
  gap: 5px;
  z-index: 20;
  background: rgba(0,0,0,0.72);
  padding: 6px 8px;
  border: 1px solid #2a2010;
  border-radius: 2px;
}
#dialogue-controls button {
  background: transparent;
  border: 1px solid #3a2f20;
  color: #6a5535;
  padding: 5px 9px;
  font-size: 10px;
  letter-spacing: 1.5px;
  cursor: pointer;
  font-family: 'Impact', sans-serif;
  min-width: 52px;
  white-space: nowrap;
  transition: all 0.15s ease;
}
#dialogue-controls button:hover,
#dialogue-controls button.on {
  border-color: #d6c8a8;
  color: #d6c8a8;
  background: rgba(245,200,66,0.05);
}
#dialogue-controls button.on {
  background: rgba(245,200,66,0.15);
}

/* ===== route end card ===== */
#route-end-card {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.96);
  z-index: 60;
  padding: 40px;
}
#route-end-card.show {
  display: flex;
  animation: fadeIn 1.1s ease;
}
.route-end-tag {
  font-size: 12px;
  letter-spacing: 12px;
  color: #6a5535;
  margin-bottom: 18px;
}
.route-end-title {
  font-family: 'Impact', sans-serif;
  font-size: 60px;
  letter-spacing: 8px;
  color: #d6c8a8;
  font-style: italic;
  margin-bottom: 28px;
  text-align: center;
  text-shadow: 4px 4px 0 #8a6a32;
}
.route-end-desc {
  color: #bfb098;
  font-size: 14px;
  letter-spacing: 1.5px;
  margin-bottom: 44px;
  max-width: 620px;
  text-align: center;
  line-height: 2;
  white-space: pre-line;
}

/* ===== flash overlay ===== */
#flash-overlay {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
}
#flash-overlay.flash      { animation: flashOnce 0.3s ease; }
#flash-overlay.flash-red  { animation: flashRed  0.55s ease; }
@keyframes flashOnce {
  0%, 100% { opacity: 0; }
  10%      { opacity: 0.92; }
}
@keyframes flashRed {
  0%, 100% { opacity: 0; background: #fff; }
  10%      { opacity: 0.92; background: #fff; }
  40%      { opacity: 0.7;  background: #a82b1f; }
  100%     { opacity: 0; }
}

#dialogue-screen.shake {
  animation: shake 0.32s ease;
}
@keyframes shake {
  0%, 100% { transform: translate(0,0); }
  20%      { transform: translate(-7px, 4px); }
  40%      { transform: translate(6px, -5px); }
  60%      { transform: translate(-4px, 3px); }
  80%      { transform: translate(5px, -2px); }
}

/* ============ CREDITS SCREEN ============ */
#credits-screen {
  background: radial-gradient(ellipse at center, #1a1410 0%, #08080a 80%);
  padding: 80px 40px 40px;
  overflow-y: auto;
}
.credits-content {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.credits-content h2 {
  font-family: 'Impact', sans-serif;
  font-size: 38px;
  letter-spacing: 6px;
  color: #d6c8a8;
  font-style: italic;
  margin-bottom: 14px;
}
.credits-tagline {
  color: #8a7654;
  font-size: 14px;
  letter-spacing: 2px;
  margin-bottom: 44px;
  white-space: pre-line;
}
.credits-block {
  margin-bottom: 36px;
}
.credits-block h3 {
  font-size: 14px;
  letter-spacing: 8px;
  color: #d6c8a8;
  margin-bottom: 16px;
  font-weight: 400;
  font-family: 'Impact', sans-serif;
}
.credits-block p {
  font-size: 14px;
  line-height: 2;
  color: #bfb098;
  letter-spacing: 1px;
  white-space: pre-line;
}
#credits-screen .menu-btn { margin-top: 20px; }

/* ============ OVERLAYS (backlog / save / load / config) ============ */
.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(4px);
  z-index: 200;
}
.overlay.show { display: flex; animation: fadeIn 0.35s ease; }
.overlay-frame {
  width: min(1100px, 92vw);
  max-height: 86vh;
  background:
    linear-gradient(180deg, #1a1410 0%, #0c0906 100%);
  border: 1px solid #3a2f20;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 80px rgba(0,0,0,0.8);
}
.overlay-frame.small { width: min(560px, 92vw); }
.overlay-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 26px;
  border-bottom: 1px solid #3a2f20;
}
.overlay-tag {
  font-family: 'Impact', sans-serif;
  font-size: 16px;
  letter-spacing: 8px;
  color: #d6c8a8;
}
.overlay-close {
  background: transparent;
  border: 1px solid #3a2f20;
  color: #6a5535;
  padding: 4px 12px;
  font-size: 14px;
  cursor: pointer;
  font-family: 'Impact', sans-serif;
}
.overlay-close:hover { border-color: #d6c8a8; color: #d6c8a8; }
.overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 26px;
}
.overlay-body::-webkit-scrollbar { width: 8px; }
.overlay-body::-webkit-scrollbar-track { background: #0c0906; }
.overlay-body::-webkit-scrollbar-thumb { background: #3a2f20; }
.overlay-body::-webkit-scrollbar-thumb:hover { background: #d6c8a8; }
.overlay-foot {
  padding: 12px 26px;
  font-size: 11px;
  letter-spacing: 2px;
  color: #6a5535;
  border-top: 1px solid #3a2f20;
  text-align: center;
}

/* backlog */
.backlog-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  padding: 12px 8px;
  border-bottom: 1px solid #1a1410;
  align-items: start;
}
.bl-name {
  font-family: 'Impact', sans-serif;
  font-size: 12px;
  letter-spacing: 2px;
  color: #6a5535;
  padding-top: 3px;
  text-align: right;
  border-right: 2px solid #3a2f20;
  padding-right: 10px;
}
.bl-name.vincent { color: #e6735a; border-color: #a82b1f; }
.bl-name.jules   { color: #b674d4; border-color: #8e44ad; }
.bl-name.mia     { color: #ff6b9a; border-color: #ff2a6d; }
.bl-name.butch   { color: #d6c8a8; border-color: #d6c8a8; }
.bl-name.marsellus { color: #5a7da5; border-color: #2c3e50; }
.bl-name.wolf    { color: #d0d0d0; border-color: #95a5a6; }
.bl-text {
  font-size: 14px;
  line-height: 1.75;
  color: #bfb098;
  letter-spacing: 0.4px;
}
.bl-name:empty + .bl-text { color: #8a7654; font-style: italic; }

/* save / load slot grid */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.slot-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  padding: 10px;
  background: rgba(20,15,10,0.7);
  border: 1px solid #3a2f20;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 100px;
}
.slot-card.quick { border-color: #c79e3f; }
.slot-card.quick .slot-num { color: #d6c8a8; }
.slot-card:hover {
  border-color: #d6c8a8;
  background: rgba(40,30,15,0.7);
}
.slot-card.empty .slot-text { color: #4a3f30; font-style: italic; }
.slot-thumb {
  width: 140px;
  height: 88px;
  background-size: cover;
  background-position: center;
  background-color: #1a0a0a;
  border: 1px solid #2a2010;
}
.slot-thumb.empty {
  background:
    repeating-linear-gradient(45deg, #1a1010 0 6px, #0a0606 6px 12px);
}
.slot-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.slot-num {
  font-family: 'Impact', sans-serif;
  font-size: 13px;
  letter-spacing: 3px;
  color: #bfb098;
  margin-bottom: 4px;
}
.slot-chapter {
  font-family: 'Impact', sans-serif;
  font-size: 12px;
  letter-spacing: 2px;
  color: #c79e3f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-chapter-cn {
  font-size: 11px;
  letter-spacing: 3px;
  color: #8a7654;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-text {
  font-size: 12px;
  color: #9a8466;
  line-height: 1.5;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.slot-date {
  margin-top: auto;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: #6a5535;
  font-family: 'Impact', sans-serif;
}

/* config */
.config-body { padding: 24px 30px; }
.cfg-row {
  display: grid;
  grid-template-columns: 180px 1fr 80px;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.cfg-row label {
  font-size: 12px;
  letter-spacing: 1.5px;
  color: #c79e3f;
  font-family: 'Impact', sans-serif;
}
.cfg-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #3a2f20;
  outline: none;
  cursor: pointer;
}
.cfg-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  background: #d6c8a8;
  cursor: pointer;
  border-radius: 0;
}
.cfg-row input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  background: #d6c8a8;
  cursor: pointer;
  border: 0;
  border-radius: 0;
}
.cfg-row select {
  background: #1a1410;
  border: 1px solid #3a2f20;
  color: #bfb098;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 1px;
  grid-column: 2 / span 2;
}
.cfg-row span { font-size: 12px; color: #bfb098; font-family: 'Impact', sans-serif; letter-spacing: 1px; text-align: right; }
.cfg-mini {
  background: transparent;
  border: 1px solid #6a5535;
  color: #c79e3f;
  padding: 5px 12px;
  font-size: 11px;
  letter-spacing: 2px;
  cursor: pointer;
  font-family: 'Impact', sans-serif;
  grid-column: 2 / span 2;
  justify-self: start;
}
.cfg-mini:hover { border-color: #d6c8a8; color: #d6c8a8; }

/* toast */
#toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.92);
  border: 1px solid #d6c8a8;
  color: #d6c8a8;
  padding: 12px 30px;
  font-size: 13px;
  letter-spacing: 3px;
  font-family: 'Impact', sans-serif;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ PAUSE HINT (rubber-band tension) ============ */
#pause-hint {
  position: absolute;
  bottom: calc(7% + 110px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  letter-spacing: 12px;
  color: #d6c8a8;
  font-family: 'Impact', sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
  z-index: 12;
  text-shadow: 0 0 30px rgba(245,200,66,0.5);
}
#pause-hint.show {
  opacity: 0.7;
  animation: pauseBreath 1.5s ease-in-out infinite;
}
@keyframes pauseBreath {
  0%, 100% { opacity: 0.45; letter-spacing: 12px; }
  50% { opacity: 0.85; letter-spacing: 22px; }
}

/* ============ QTE OVERLAY ============ */
.qte-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(6px);
  z-index: 300;
  padding: 40px;
  user-select: none;
}
.qte-overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}
.qte-prompt {
  font-family: 'Impact', sans-serif;
  font-size: 22px;
  letter-spacing: 6px;
  color: #d6c8a8;
  margin-bottom: 30px;
  text-align: center;
  text-shadow: 0 0 30px rgba(245,200,66,0.5);
}
.qte-timer {
  width: min(520px, 70%);
  height: 5px;
  background: #2a1410;
  border: 1px solid #6a5535;
  margin-top: 30px;
  position: relative;
}
.qte-timer-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #d6c8a8, #a82b1f);
  width: 100%;
}
.qte-timer-host { display: flex; justify-content: center; }

/* TAP */
.qte-tap-wrap { position: relative; }
.qte-tap-btn {
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, #a82b1f 0%, #4a1010 70%, #1a0808 100%);
  border: 4px solid #d6c8a8;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.1s;
  box-shadow: 0 0 60px rgba(245,200,66,0.4);
  user-select: none;
}
.qte-tap-btn.hit { animation: tapPulse 0.18s; }
@keyframes tapPulse {
  0% { transform: scale(1); }
  40% { transform: scale(0.94); }
  100% { transform: scale(1); }
}
.qte-tap-ring {
  position: absolute; inset: -10px;
  border-radius: 50%;
  border: 2px dashed rgba(245,200,66,0.3);
  animation: spin 4s linear infinite;
}
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.qte-tap-count {
  font-family: 'Impact', sans-serif;
  font-size: 32px;
  color: #fff;
  letter-spacing: 4px;
  text-shadow: 2px 2px 0 #500;
}

/* SWIPE */
.qte-swipe-wrap {
  position: relative;
  width: min(720px, 86vw);
  height: 380px;
  background:
    radial-gradient(circle at center, rgba(192,57,43,0.15) 0%, transparent 60%),
    repeating-linear-gradient(45deg, rgba(50,30,20,0.2) 0 6px, transparent 6px 12px),
    #0a0606;
  border: 2px solid #6a5535;
  cursor: crosshair;
  overflow: hidden;
}
.qte-swipe-trail { position: absolute; inset: 0; pointer-events: none; }
.qte-slash-mark {
  position: absolute;
  width: 240px; height: 4px;
  background: linear-gradient(90deg, transparent, #d6c8a8, #a82b1f, transparent);
  transform-origin: left center;
  margin-left: -10px; margin-top: -2px;
  animation: slashFade 0.6s forwards;
  filter: blur(0.5px);
}
@keyframes slashFade {
  0% { opacity: 1; transform: rotate(var(--a, 0deg)) scaleX(1.2); }
  100% { opacity: 0; transform: rotate(var(--a, 0deg)) scaleX(0.8); }
}
.qte-swipe-count {
  position: absolute;
  top: 18px; right: 24px;
  font-family: 'Impact', sans-serif;
  font-size: 38px;
  letter-spacing: 4px;
  color: #d6c8a8;
  text-shadow: 2px 2px 0 #500;
  pointer-events: none;
}
.qte-swipe-hint {
  position: absolute;
  bottom: 18px; left: 0; right: 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 6px;
  color: #6a5535;
  pointer-events: none;
}

/* DRAG */
.qte-drag-wrap {
  position: relative;
  width: min(520px, 86vw);
  height: 460px;
  background: radial-gradient(ellipse at top, rgba(192,57,43,0.15), transparent 60%), #0a0606;
  border: 2px solid #6a5535;
}
.qte-drag-target {
  position: absolute;
  top: 14%; left: 50%;
  transform: translateX(-50%);
  width: 130px; height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(192,57,43,0.6), rgba(60,10,10,0.3));
  border: 3px dashed #a82b1f;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Impact', sans-serif;
  font-size: 14px;
  letter-spacing: 2px;
  color: #d6c8a8;
  text-shadow: 0 0 12px #a82b1f;
  text-align: center;
  padding: 8px;
  animation: targetPulse 1.1s ease-in-out infinite;
}
@keyframes targetPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,0.6); }
  50% { box-shadow: 0 0 0 18px rgba(192,57,43,0); }
}
.qte-drag-target.hit {
  background: #d6c8a8;
  border-color: #d6c8a8;
  color: #0a0807;
  animation: targetHit 0.5s ease;
}
@keyframes targetHit {
  0% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.4); }
  100% { transform: translateX(-50%) scale(1.1); }
}
.qte-drag-token {
  position: absolute;
  width: 120px; height: 60px;
  background: linear-gradient(135deg, #c0c0c0, #6a5535);
  border: 2px solid #d6c8a8;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Impact', sans-serif;
  font-size: 16px;
  letter-spacing: 2px;
  color: #0a0807;
  cursor: grab;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  transform: translate(-50%, -50%);
  user-select: none;
  touch-action: none;
}
.qte-drag-token.dragging { cursor: grabbing; box-shadow: 0 8px 30px rgba(245,200,66,0.5); }

/* READ */
.qte-read-wrap {
  width: min(740px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.qte-read-phrase {
  padding: 14px 22px;
  background: rgba(20,15,10,0.7);
  border-left: 3px solid #3a2f20;
  color: #6a5535;
  font-size: 16px;
  line-height: 1.6;
  cursor: pointer;
  transition: all 0.2s ease;
  font-style: italic;
}
.qte-read-phrase.pending { pointer-events: auto; }
.qte-read-phrase.active {
  color: #d6c8a8;
  border-left-color: #d6c8a8;
  background: linear-gradient(90deg, rgba(245,200,66,0.1) 0%, transparent 100%);
  box-shadow: 0 0 20px rgba(245,200,66,0.2);
  animation: readPulse 1.3s ease-in-out infinite;
}
@keyframes readPulse {
  0%, 100% { background-color: rgba(245,200,66,0.06); }
  50% { background-color: rgba(245,200,66,0.16); }
}
.qte-read-phrase.done {
  color: #bfb098;
  border-left-color: #8a6a32;
  text-decoration: line-through;
  opacity: 0.55;
}
.qte-read-phrase.miss { background: rgba(192,57,43,0.4); }

/* STEPS */
.qte-steps-wrap {
  width: min(520px, 86vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.qte-steps-count {
  font-family: 'Impact', sans-serif;
  font-size: 36px;
  letter-spacing: 4px;
  color: #d6c8a8;
}
.qte-steps-line {
  font-size: 16px;
  color: #bfb098;
  line-height: 1.6;
  text-align: center;
  min-height: 48px;
  max-width: 460px;
  font-style: italic;
}
.qte-steps-track {
  display: flex;
  gap: 12px;
}
.qte-step-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #2a1410;
  border: 2px solid #6a5535;
  transition: all 0.4s ease;
}
.qte-step-dot.on {
  background: #a82b1f;
  border-color: #d6c8a8;
  box-shadow: 0 0 20px rgba(245,200,66,0.6);
}
.qte-step-btn {
  background: linear-gradient(135deg, #a82b1f 0%, #4a1010 100%);
  border: 2px solid #d6c8a8;
  color: #d6c8a8;
  padding: 14px 56px;
  font-family: 'Impact', sans-serif;
  font-size: 18px;
  letter-spacing: 6px;
  cursor: pointer;
  margin-top: 18px;
  transition: all 0.2s ease;
}
.qte-step-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #d6c8a8 0%, #a82b1f 100%);
  color: #0a0807;
}
.qte-step-btn:disabled { opacity: 0.5; cursor: default; }

/* STANDOFF */
.qte-standoff {
  width: min(520px, 86vw);
  height: 280px;
  background:
    radial-gradient(circle, rgba(245,200,66,0.05) 0%, transparent 70%),
    #08080a;
  border: 2px solid #3a2f20;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s;
}
.qte-standoff.strike-now {
  background: radial-gradient(circle, #a82b1f 0%, #4a1010 70%, #08080a 100%);
  border-color: #d6c8a8;
  animation: strikeFlash 0.2s linear 3;
}
@keyframes strikeFlash {
  0%, 100% { background-color: #a82b1f; }
  50% { background-color: #d6c8a8; }
}
.qte-standoff-text {
  font-family: 'Impact', sans-serif;
  font-size: 50px;
  letter-spacing: 12px;
  color: #6a5535;
  text-shadow: 4px 4px 0 #200;
}
.qte-standoff.strike-now .qte-standoff-text {
  color: #fff;
  text-shadow: 6px 6px 0 #500, 0 0 30px #fff;
}

/* DODGE */
.qte-dodge {
  width: min(520px, 86vw);
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #6a5535;
  cursor: pointer;
}
.qte-dodge-light {
  width: 200px; height: 200px;
  border-radius: 50%;
  background: #44ff66;
  box-shadow: 0 0 60px #44ff66;
  transition: all 0.2s ease;
}
.qte-dodge-light.danger {
  background: #a82b1f;
  box-shadow: 0 0 80px #ff3030;
  animation: dangerPulse 0.3s ease-in-out infinite;
}
.qte-dodge-light.safe {
  background: #44ff66;
  box-shadow: 0 0 60px #44ff66;
}
@keyframes dangerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* RHYTHM */
.qte-rhythm {
  width: min(520px, 86vw);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.qte-rhythm-track {
  width: 100%;
  height: 80px;
  background: rgba(20,15,10,0.7);
  border: 1px solid #3a2f20;
  position: relative;
  overflow: hidden;
}
.qte-beat {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #d6c8a8;
  box-shadow: 0 0 14px #d6c8a8;
  animation: beatTravel 1s linear forwards;
}
@keyframes beatTravel {
  from { left: 100%; }
  to { left: -10%; }
}
.qte-rhythm-btn {
  width: 130px; height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, #a82b1f, #4a1010);
  border: 3px solid #d6c8a8;
  color: #d6c8a8;
  font-size: 40px;
  cursor: pointer;
  transition: transform 0.08s;
}
.qte-rhythm-btn.hit { transform: scale(0.9); background: radial-gradient(circle, #44ff66, #1a4a1a); }
.qte-rhythm-btn.miss { background: radial-gradient(circle, #6a5535, #2a1410); }
.qte-rhythm-hits {
  font-family: 'Impact', sans-serif;
  font-size: 22px;
  color: #d6c8a8;
  letter-spacing: 3px;
}

/* ============ STAT TOAST ============ */
#stat-toast {
  position: fixed;
  top: 26%;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 250;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
  pointer-events: none;
}
#stat-toast.show {
  opacity: 1;
  transform: translateX(0);
}
.stat-line {
  font-family: 'Impact', sans-serif;
  font-size: 14px;
  letter-spacing: 3px;
  padding: 6px 14px;
  background: rgba(0,0,0,0.85);
  border-left: 3px solid #d6c8a8;
}
.stat-line.pos { color: #44ff66; border-left-color: #44ff66; }
.stat-line.neg { color: #ff5050; border-left-color: #a82b1f; }

/* ============ OPTION EFFECTS BADGES ============ */
.opt-fx-row {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-family: 'Impact', sans-serif;
}
.opt-fx {
  font-size: 10px;
  letter-spacing: 1px;
  padding: 1px 6px;
  border: 1px solid;
  opacity: 0.85;
}
.opt-fx.pos { color: #44ff66; border-color: #44ff66; }
.opt-fx.neg { color: #ff5050; border-color: #a82b1f; }
.choice-btn:hover .opt-fx { opacity: 1; }

.choice-hidden-hint {
  text-align: center;
  font-size: 11px;
  letter-spacing: 4px;
  color: #6a5535;
  font-style: italic;
  padding: 8px 0;
}
.choice-btn.hidden-opt {
  border-color: #a82b1f;
  border-left-color: #a82b1f;
  background: linear-gradient(90deg, rgba(60,10,10,0.95) 0%, rgba(20,15,10,0.95) 100%);
  animation: hiddenAppear 0.5s ease;
}
@keyframes hiddenAppear {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}
.choice-timer-bar {
  margin-top: 14px;
  width: 200px;
  height: 3px;
  background: #2a1410;
  margin-left: auto; margin-right: auto;
}
.choice-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #d6c8a8, #a82b1f);
}

/* ============ CG GALLERY ============ */
#gallery-overlay .overlay-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 24px;
}
.cg-card {
  position: relative;
  background: #0a0606;
  border: 1px solid #3a2f20;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cg-card:hover:not(.locked) { border-color: #d6c8a8; transform: translateY(-3px); }
.cg-card.locked { cursor: default; opacity: 0.4; filter: grayscale(1); }
.cg-thumb {
  width: 100%;
  aspect-ratio: 16/10;
  background-size: cover;
  background-position: center;
}
.cg-thumb.empty {
  background: repeating-linear-gradient(45deg, #1a1010 0 6px, #050202 6px 12px);
}
.cg-name {
  padding: 10px 12px;
  font-family: 'Impact', sans-serif;
  font-size: 12px;
  letter-spacing: 2px;
  color: #bfb098;
  text-align: center;
}
.cg-card.locked .cg-name { color: #6a5535; }

#cg-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.97);
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px;
}
#cg-viewer.show { display: flex; animation: fadeIn 0.4s ease; }
#cg-viewer img {
  max-width: 92vw;
  max-height: 78vh;
  object-fit: contain;
  border: 2px solid #d6c8a8;
  box-shadow: 0 0 60px rgba(245,200,66,0.3);
}
.cg-viewer-name {
  margin-top: 20px;
  font-family: 'Impact', sans-serif;
  font-size: 18px;
  letter-spacing: 6px;
  color: #d6c8a8;
}
.cg-close {
  position: absolute;
  top: 26px; right: 30px;
  background: transparent;
  border: 1px solid #d6c8a8;
  color: #d6c8a8;
  width: 44px; height: 44px;
  font-size: 20px;
  cursor: pointer;
  font-family: 'Impact', sans-serif;
}

/* ============ INVENTORY ============ */
#inv-overlay .overlay-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.inv-empty {
  text-align: center;
  font-size: 13px;
  letter-spacing: 3px;
  color: #6a5535;
  padding: 40px;
  font-style: italic;
}
.inv-card {
  padding: 14px 18px;
  border: 1px solid #3a2f20;
  border-left: 4px solid #d6c8a8;
  background: rgba(20,15,10,0.85);
}
.inv-name {
  font-family: 'Impact', sans-serif;
  font-size: 15px;
  letter-spacing: 3px;
  color: #d6c8a8;
  margin-bottom: 6px;
}
.inv-desc {
  font-size: 12px;
  line-height: 1.7;
  color: #bfb098;
  font-style: italic;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .title-main { font-size: 110px; }
  .title-art-mia { width: 180px; height: 240px; right: -20px; }
  .route-cards { grid-template-columns: repeat(2, 1fr); }
}

/* tablet */
@media (max-width: 900px) {
  #dialogue-box { padding: 20px 30px 60px; }
  .sprite { width: 150px; bottom: 30%; }
  .sprite.left { left: 4%; }
  .sprite.right { right: 4%; }
  .sprite-frame { width: 150px; height: 150px; }
  .sprite-name { font-size: 10px; letter-spacing: 2px; margin-top: 8px; }
  .chapter-card-en { font-size: 50px; letter-spacing: 4px; }
  #dialogue-controls { flex-wrap: wrap; max-width: 70%; }
}

/* phone */
@media (max-width: 720px) {
  .lang-toggle.global-lang { top: 10px; right: 10px; padding: 5px 10px; font-size: 11px; }
  .film-strip { display: none; }
  .title-main { font-size: 64px; letter-spacing: 1px; }
  .title-pulp, .title-fiction { text-shadow: 3px 3px 0 #8a6a32, 6px 6px 0 #a82b1f; }
  .title-sub { font-size: 16px; letter-spacing: 10px; }
  .title-art-mia { display: none; }
  .title-art { min-height: 200px; }
  .title-tag, .title-quote { font-size: 10px; letter-spacing: 3px; padding: 0 16px; text-align: center; }
  .title-starring { display: none; }
  .menu-btn { padding: 10px 32px; font-size: 13px; letter-spacing: 4px; }
  .title-foot { font-size: 9px; letter-spacing: 6px; bottom: 14px; }

  .route-header h2 { font-size: 22px; letter-spacing: 4px; }
  .route-header p { font-size: 11px; padding: 0 16px; }
  .route-cards { grid-template-columns: 1fr 1fr; gap: 10px; max-width: 100%; }
  .route-card { padding: 14px 10px; min-height: 220px; }
  .route-num { font-size: 18px; }
  .route-img { width: 64px; height: 64px; }
  .route-img.secondary { width: 48px; height: 48px; }
  .route-portrait { height: 76px; margin: 10px 0 8px; }
  .route-title { font-size: 13px; letter-spacing: 1px; }
  .route-subtitle { font-size: 11px; letter-spacing: 3px; }
  .route-desc { font-size: 10px; line-height: 1.6; }
  .back-btn { bottom: 16px; left: 16px; font-size: 10px; padding: 6px 12px; }

  .letterbox { height: 4%; }
  #dialogue-box {
    padding: 16px 16px 70px;
    height: 38%;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.95) 18%);
  }
  #dialogue-text { font-size: 15px; line-height: 1.7; min-height: 60px; }
  body[data-lang="en"] #dialogue-text { font-size: 14px; }
  #speaker-name { font-size: 11px; letter-spacing: 2px; padding: 5px 12px; min-width: 80px; margin-bottom: 10px; }

  .sprite { width: 110px; bottom: 38%; }
  .sprite.left { left: 2%; }
  .sprite.right { right: 2%; }
  .sprite-frame { width: 110px; height: 110px; border-width: 2px; }
  .sprite-name { font-size: 9px; letter-spacing: 1.5px; margin-top: 6px; }

  #dialogue-controls {
    bottom: 8px;
    right: 8px;
    left: 8px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 4px;
    gap: 4px;
  }
  #dialogue-controls button {
    padding: 4px 6px;
    font-size: 9px;
    letter-spacing: 1px;
    min-width: 44px;
  }
  /* on phone, hide some less-essential buttons by default */
  #dialogue-controls button[data-ctrl="config"],
  #dialogue-controls button[data-ctrl="hide"] { display: none; }

  .next-indicator { right: 16px; bottom: 60px; }

  .choice-prompt { font-size: 11px; letter-spacing: 4px; margin-bottom: 16px; }
  .choice-list { width: 92%; gap: 10px; }
  .choice-btn { padding: 12px 20px 12px 36px; font-size: 13px; }
  .choice-btn::before { left: 14px; }

  .chapter-card-en { font-size: 32px; letter-spacing: 3px; }
  .chapter-card-cn { font-size: 14px; letter-spacing: 6px; padding: 0 16px; text-align: center; }
  .chapter-card-tag { font-size: 9px; letter-spacing: 6px; }

  .route-end-title { font-size: 30px; letter-spacing: 4px; }
  .route-end-desc { font-size: 12px; padding: 0 20px; }

  /* overlays scale */
  .overlay-frame { width: 96vw; max-height: 92vh; }
  .overlay-head { padding: 12px 16px; }
  .overlay-tag { font-size: 12px; letter-spacing: 4px; }
  .overlay-body { padding: 12px 16px; }

  .backlog-row { grid-template-columns: 90px 1fr; gap: 10px; padding: 8px 4px; }
  .bl-name { font-size: 10px; letter-spacing: 1px; padding-right: 6px; }
  .bl-text { font-size: 12px; line-height: 1.6; }

  .slot-grid { grid-template-columns: 1fr; gap: 8px; }
  .slot-card { grid-template-columns: 88px 1fr; gap: 8px; padding: 6px; min-height: 76px; }
  .slot-thumb { width: 88px; height: 56px; }
  .slot-num { font-size: 11px; letter-spacing: 2px; }
  .slot-chapter { font-size: 10px; }
  .slot-chapter-cn { font-size: 9px; }
  .slot-text { font-size: 10px; }
  .slot-date { font-size: 9px; }

  .cfg-row { grid-template-columns: 1fr; gap: 8px; margin-bottom: 16px; }
  .cfg-row label { font-size: 11px; }
  .cfg-row span { text-align: left; font-size: 11px; }
  .cfg-mini { font-size: 10px; padding: 4px 10px; }
}

/* very small phone */
@media (max-width: 380px) {
  .title-main { font-size: 50px; }
  .title-sub { font-size: 14px; letter-spacing: 8px; }
  .menu-btn { padding: 8px 24px; font-size: 11px; letter-spacing: 3px; }
  #dialogue-text { font-size: 14px; }
  .sprite { width: 90px; }
  .sprite-frame { width: 90px; height: 90px; }
  .route-cards { grid-template-columns: 1fr; }
}

/* Kanji watermark — absolute so it does not push the English title sideways.
   Each theme.css can override color/size/opacity. */
.kanji-bg {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 0 !important;
  pointer-events: none !important;
  white-space: nowrap !important;
  line-height: 1 !important;
  max-width: 90vw !important;
  overflow: hidden !important;
}



/* ========== MOBILE NATIVE LAYOUT (added 2026-05) ========== */

@media (hover: none) and (pointer: coarse) {
  .menu-btn, .choice-btn, button, .route-card,
  [data-action], [data-ctrl] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .menu-btn, .choice-btn, button { min-height: 44px; }
  .lang-toggle.global-lang { min-height: 36px; min-width: 52px; }
  .menu-btn, .choice-btn, #dialogue-controls button {
    -webkit-user-select: none; user-select: none;
  }
}

@media (max-width: 540px) {
  body, html { overflow-x: hidden; }
  .lang-toggle.global-lang {
    top: 8px !important; right: 8px !important;
    padding: 4px 10px !important; font-size: 11px !important;
    z-index: 1100 !important;
  }

  /* Title screen — vertical stack, full-width buttons */
  #title-screen {
    overflow-y: auto;
    padding: 32px 16px 60px !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
  }
  .title-poster {
    width: 100% !important;
    max-width: none !important;
    padding: 16px 8px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px;
  }
  .title-tag { font-size: 10px !important; letter-spacing: 5px !important; padding: 4px 0 !important; margin: 0 0 4px 0 !important; }
  .title-art { min-height: 120px !important; margin: 0 !important; }
  .title-main, .title-line1, .title-line2 {
    font-size: 44px !important;
    line-height: 1 !important;
    letter-spacing: 1px !important;
  }
  .title-sub { font-size: 14px !important; letter-spacing: 8px !important; margin-top: 8px !important; }
  .kanji-bg { font-size: 180px !important; opacity: 0.06 !important; max-width: 100vw !important; }
  .title-quote { font-size: 13px !important; padding: 6px 16px !important; line-height: 1.5 !important; }
  .title-starring-label { font-size: 9px !important; letter-spacing: 3px !important; }
  .title-starring { font-size: 10px !important; letter-spacing: 1px !important; padding: 0 8px !important; line-height: 1.6 !important; }

  .title-menu {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 320px !important;
    margin: 16px auto 0 !important;
  }
  .menu-btn {
    width: 100% !important;
    padding: 12px 14px !important;
    font-size: 14px !important;
    letter-spacing: 3px !important;
    border-radius: 0 !important;
  }
  .title-foot {
    position: static !important;
    margin-top: 24px !important;
    font-size: 9px !important;
    letter-spacing: 4px !important;
    text-align: center;
    width: 100%;
  }

  /* Route screen — vertical list, not grid */
  #route-screen { padding: 60px 12px 80px !important; overflow-y: auto; }
  .route-header { padding: 0 8px 16px !important; }
  .route-header h2, .route-heading { font-size: 18px !important; letter-spacing: 3px !important; }
  .route-tag { font-size: 10px !important; letter-spacing: 4px !important; }
  .route-header p, .route-intro {
    font-size: 12px !important; line-height: 1.7 !important;
    letter-spacing: 0 !important; column-count: 1 !important;
    text-indent: 0 !important; padding: 0 8px !important;
  }
  .route-cards {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 0 4px !important;
    max-width: 100% !important;
  }
  .route-card {
    display: grid !important;
    grid-template-columns: 64px 1fr !important;
    gap: 12px !important;
    align-items: center !important;
    min-height: 96px !important;
    padding: 12px !important;
    text-align: left !important;
  }
  .route-card .route-num {
    grid-row: 1 / span 3;
    font-size: 22px !important;
    align-self: center;
    text-align: center;
  }
  .route-img, .route-portrait {
    width: 56px !important; height: 56px !important;
    grid-row: 1 / span 3;
    margin: 0 !important;
  }
  .route-card .route-title { font-size: 14px !important; letter-spacing: 1px !important; line-height: 1.3 !important; margin: 0 !important; }
  .route-card .route-subtitle { font-size: 10px !important; letter-spacing: 2px !important; line-height: 1.4 !important; margin: 2px 0 0 0 !important; }
  .route-card .route-desc {
    font-size: 11px !important; line-height: 1.5 !important;
    margin-top: 4px !important;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .back-btn { bottom: 12px !important; left: 12px !important; font-size: 11px !important; padding: 8px 14px !important; }
  .cleared-stamp { font-size: 11px !important; padding: 2px 8px !important; }

  /* Dialogue screen — bigger text box */
  #dialogue-box {
    height: 46% !important;
    padding: 20px 16px 70px !important;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.92) 14%) !important;
  }
  #dialogue-text {
    font-size: 17px !important;
    line-height: 1.65 !important;
    min-height: 80px !important;
  }
  #dialogue-text-sub { font-size: 12px !important; line-height: 1.5 !important; }
  body[data-lang="en"] #dialogue-text { font-size: 16px !important; }
  #speaker-name {
    font-size: 12px !important;
    padding: 5px 14px !important;
    min-width: 80px !important;
    margin-bottom: 8px !important;
  }
  .sprite { width: 96px !important; bottom: 48% !important; }
  .sprite.left { left: 4% !important; }
  .sprite.right { right: 4% !important; }
  .sprite-frame { width: 96px !important; height: 96px !important; border-width: 2px !important; }
  .sprite-name { font-size: 9px !important; letter-spacing: 1px !important; }

  #dialogue-controls {
    bottom: 6px !important; left: 6px !important; right: 6px !important;
    flex-wrap: wrap !important; justify-content: center !important;
    gap: 4px !important; padding: 4px !important;
  }
  #dialogue-controls button {
    padding: 6px 8px !important; font-size: 10px !important;
    min-width: 44px !important; min-height: 32px !important;
    letter-spacing: 1px !important;
  }
  #dialogue-controls button[data-ctrl="config"],
  #dialogue-controls button[data-ctrl="hide"],
  #dialogue-controls button[data-ctrl="quicksave"],
  #dialogue-controls button[data-ctrl="quickload"] { display: none !important; }

  #choice-overlay { padding: 24px 16px !important; }
  .choice-prompt, #choice-prompt { font-size: 12px !important; letter-spacing: 4px !important; margin-bottom: 18px !important; }
  .choice-list { width: 100% !important; max-width: 360px !important; gap: 10px !important; }
  .choice-btn {
    width: 100% !important;
    padding: 14px 18px !important;
    font-size: 14px !important;
    letter-spacing: 1px !important;
    line-height: 1.4 !important;
    text-align: left !important;
  }
  .choice-btn::before { display: none !important; }

  .chapter-card-en { font-size: 28px !important; letter-spacing: 2px !important; }
  .chapter-card-cn { font-size: 14px !important; letter-spacing: 4px !important; padding: 0 16px !important; text-align: center; }
  .chapter-card-tag { font-size: 9px !important; letter-spacing: 5px !important; }
  .route-end-title, .route-end-tag { font-size: 22px !important; letter-spacing: 3px !important; }
  .route-end-desc { font-size: 13px !important; line-height: 1.6 !important; padding: 0 16px !important; }
  #btn-route-return { width: 80% !important; max-width: 280px !important; padding: 14px 16px !important; font-size: 14px !important; }

  .overlay-frame { width: 96vw !important; max-height: 90vh !important; }
  .overlay-head { padding: 10px 14px !important; }
  .overlay-tag { font-size: 11px !important; letter-spacing: 3px !important; }
  .overlay-body { padding: 10px 12px !important; }
  .backlog-row { grid-template-columns: 80px 1fr !important; gap: 8px !important; padding: 8px 4px !important; }
  .bl-name { font-size: 10px !important; letter-spacing: 1px !important; }
  .bl-text { font-size: 12px !important; line-height: 1.5 !important; }
  .slot-grid { grid-template-columns: 1fr !important; gap: 6px !important; }
  .slot-card { grid-template-columns: 80px 1fr !important; gap: 8px !important; padding: 6px !important; min-height: 68px !important; }
  .slot-thumb { width: 80px !important; height: 50px !important; }

  #gallery-grid, #inv-grid { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .cg-card, .inv-card { padding: 6px !important; }
  .cg-thumb { height: 80px !important; }
  .cg-name, .inv-name { font-size: 10px !important; }

  .cfg-row { grid-template-columns: 1fr !important; gap: 6px !important; margin-bottom: 14px !important; }
  .cfg-row label { font-size: 12px !important; }

  .letterbox { display: none !important; }
}

@media (max-height: 480px) and (orientation: landscape) {
  #title-screen { padding: 8px !important; }
  .title-poster { transform: scale(0.78); transform-origin: center; }
  .title-menu { flex-direction: row !important; flex-wrap: wrap !important; gap: 4px !important; max-width: none !important; justify-content: center; }
  .menu-btn { padding: 6px 12px !important; font-size: 11px !important; width: auto !important; min-height: 32px !important; }
  .kanji-bg { display: none !important; }
  .title-foot { display: none !important; }

  #dialogue-box { height: 50% !important; padding: 8px 14px 36px !important; }
  #dialogue-text { font-size: 13px !important; line-height: 1.5 !important; min-height: 36px !important; }
  .sprite { display: none !important; }
  #dialogue-controls { bottom: 4px !important; }
}
/* ========== END MOBILE NATIVE LAYOUT ========== */
