:root {
  --red: #e3122d;
  --paper: #f4f1e8;
  --display: "Avenir Next Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --jp: "Hiragino Mincho ProN", "Hiragino Sans", "Yu Mincho", "Yu Gothic", "MS Mincho", serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; background: #000; }
body {
  color: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  background: #000 radial-gradient(circle at 50% 45%, #2a0610 0, #000 65%) fixed;
}
#stage {
  position: relative; width: 100%; max-width: 480px;
  height: 100vh; height: 100dvh; margin: 0 auto; overflow: hidden;
  touch-action: none; background: #050507;
  box-shadow: 0 0 80px rgba(227, 18, 45, .25);
}
#cv { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: block; }
#ui {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px calc(env(safe-area-inset-bottom, 0px) + 20px);
  pointer-events: none;
}
#ui button { pointer-events: auto; }
.spacer { flex: 1; }
#mute {
  position: absolute; z-index: 5; top: calc(env(safe-area-inset-top, 0px) + 10px); right: 12px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .25); background: rgba(0, 0, 0, .45);
  color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
}

/* ---------- Titre ---------- */
.title-wrap { text-align: center; margin-top: 3vh; }
.jp-small { font-family: var(--jp); color: var(--red); font-size: 20px; letter-spacing: .5em; font-weight: 700; text-shadow: 0 0 12px rgba(227, 18, 45, .6); padding-left: .5em; }
.title {
  font-family: var(--display); font-weight: 900; font-style: italic;
  font-size: clamp(54px, 18vw, 86px); line-height: .95; letter-spacing: 2px; color: #fff;
  text-shadow: 4px 4px 0 var(--red), 8px 8px 0 #000; margin-top: 6px;
}
.subtitle {
  display: inline-block; margin-top: 12px; background: #000; border: 2px solid #fff; padding: 6px 12px;
  font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: 3px; text-transform: uppercase;
  transform: skew(-8deg);
}
.menu { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.tiny { font-size: 12px; color: #bbb; text-align: center; letter-spacing: .5px; text-shadow: 0 1px 2px #000; }

/* ---------- Boutons ---------- */
.btn {
  font-family: var(--display); font-weight: 900; font-size: 21px; letter-spacing: 1.5px; text-transform: uppercase;
  padding: 15px 26px; min-width: 230px; background: var(--paper); color: #000;
  border: 3px solid #000; border-radius: 0; box-shadow: 5px 5px 0 var(--red);
  transform: skew(-7deg); cursor: pointer; -webkit-appearance: none; appearance: none;
}
.btn:active { transform: skew(-7deg) translate(3px, 3px); box-shadow: 2px 2px 0 var(--red); }
.btn.ghost { background: #000; color: #fff; border-color: #fff; box-shadow: 4px 4px 0 #444; font-size: 17px; }
.btn.big { font-size: 18px; letter-spacing: 1px; padding: 16px 18px; white-space: nowrap; min-width: 0; animation: pulse 1s ease-in-out infinite; }

/* ---------- Planches manga ---------- */
.dots { text-align: center; font-size: 10px; letter-spacing: 6px; color: #555; padding-right: 40px; padding-left: 40px; }
.dots .on { color: var(--red); }
.caption {
  align-self: stretch; background: var(--paper); color: #111; border: 3px solid #000;
  box-shadow: 5px 5px 0 var(--red); padding: 12px 14px;
  font-family: Georgia, "Times New Roman", serif; font-size: 17px; line-height: 1.4;
}
.caption b { color: var(--red); }
.caption .k { font-family: var(--jp); font-weight: 900; color: var(--red); }
.caption.in { animation: slideIn .35s ease-out both; }
.bubble {
  position: relative; align-self: center; max-width: 90%;
  background: #fff; color: #000; border: 3px solid #000; border-radius: 28px;
  padding: 14px 18px; font-weight: 700; font-size: 18px; line-height: 1.35; text-align: center;
  margin-top: 18px;
}
.bubble::before {
  content: ""; position: absolute; left: calc(50% - 14px); top: -23px;
  border-left: 14px solid transparent; border-right: 14px solid transparent; border-bottom: 22px solid #000;
}
.bubble::after {
  content: ""; position: absolute; left: calc(50% - 9px); top: -15px;
  border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 16px solid #fff;
}
.bubble.scroll { font-family: Georgia, serif; font-style: italic; font-weight: 400; background: #efe3c8; border-radius: 6px; }
.bubble.scroll::after { border-bottom-color: #efe3c8; }
.bubble.in { animation: bubbleIn .35s .25s ease-out both; }
.sfx {
  font-family: var(--jp); font-weight: 900; font-size: 54px; color: var(--red);
  -webkit-text-stroke: 2px #fff; text-shadow: 4px 4px 0 #000;
  transform: rotate(-8deg); align-self: flex-end; margin-right: 6px;
  animation: shakey .12s infinite;
}
.sfx-big {
  font-family: var(--jp); font-weight: 900; font-size: clamp(52px, 16vw, 80px); text-align: center;
  color: var(--red); -webkit-text-stroke: 3px #000; transform: rotate(-6deg); animation: shakey .12s infinite;
}
.sfx-big.cool { color: #fff; text-shadow: 6px 6px 0 var(--red); animation: popIn .45s ease-out both; }
.hint {
  text-align: center; font-family: var(--display); font-weight: 800; letter-spacing: 2px; font-size: 14px;
  text-transform: uppercase; color: #fff; text-shadow: 0 1px 3px #000; animation: blink 1.2s infinite;
}

/* ---------- Chapitres ---------- */
.chap-head { text-align: center; margin-top: 3vh; }
.chap-num { font-family: var(--jp); color: var(--red); font-size: 22px; letter-spacing: .4em; font-weight: 700; padding-left: .4em; }
.chap-lbl { font-family: var(--display); font-weight: 800; letter-spacing: 5px; font-size: 15px; color: #ccc; margin-top: 4px; }
.chap-title {
  font-family: var(--display); font-weight: 900; font-style: italic; font-size: clamp(42px, 13vw, 60px);
  text-transform: uppercase; line-height: 1; text-shadow: 3px 3px 0 var(--red), 6px 6px 0 #000; margin-top: 4px;
}

/* ---------- Jeux ---------- */
.hud { display: flex; justify-content: space-between; align-items: flex-start; padding-right: 50px; }
.hud-k {
  font-family: var(--display); font-weight: 900; letter-spacing: 2px; font-size: 14px; color: var(--red);
  background: #000; padding: 2px 8px; border: 1px solid var(--red); display: inline-block;
}
.hud-v { font-family: var(--display); font-weight: 900; font-size: 40px; line-height: 1.05; text-shadow: 3px 3px 0 #000; }
.hud-v small { font-size: 20px; color: #aaa; }
.hud-v .on { color: var(--red); }
.hud-v .off { color: #333; }
.lives { font-size: 24px; letter-spacing: 4px; color: #333; padding-top: 2px; }
.lives .on { color: var(--red); text-shadow: 0 0 8px rgba(227, 18, 45, .8); }
.msg {
  align-self: center; text-align: center; background: rgba(0, 0, 0, .78); border: 2px solid #fff;
  padding: 12px 18px; font-size: 18px; font-weight: 700; min-width: 72%; max-width: 94%; line-height: 1.35; margin-bottom: 3vh;
}
.msg small { font-weight: 400; color: #ccc; }
.msg .now { color: var(--red); font-family: var(--display); font-size: 30px; letter-spacing: 2px; }
.msg .ms { font-family: var(--display); font-size: 34px; color: #ffd23f; }
.banner {
  align-self: center; text-align: center; font-family: var(--display); font-weight: 900; font-style: italic;
  font-size: clamp(32px, 10vw, 46px); text-transform: uppercase; background: var(--red); color: #fff;
  padding: 6px 20px; box-shadow: 5px 5px 0 #000; border: 3px solid #fff;
  transform: skew(-8deg) rotate(-3deg); animation: bannerIn .5s ease-out both;
}
.banner.small { font-size: 30px; }
.seal-name { text-align: center; font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: 2px; margin-top: 8px; text-shadow: 2px 2px 0 #000; }
.box {
  align-self: center; text-align: center; background: var(--paper); color: #111; border: 3px solid #000;
  box-shadow: 6px 6px 0 var(--red); padding: 20px 16px; max-width: 92%; pointer-events: auto;
}
.box p { margin: 14px 0 18px; font-size: 17px; line-height: 1.4; }

/* ---------- Carte finale ---------- */
.card {
  background: var(--paper); color: #111; border: 4px solid #000; box-shadow: 7px 7px 0 var(--red);
  padding: 14px 14px 18px; text-align: center; pointer-events: auto; max-height: 64vh; overflow: auto;
  -webkit-overflow-scrolling: touch; animation: cardIn .7s ease-out both;
}
.card .jp { font-family: var(--jp); color: var(--red); font-weight: 900; font-size: 24px; letter-spacing: .12em; }
.card h1 { font-family: var(--display); font-weight: 900; font-style: italic; font-size: 24px; line-height: 1; text-transform: uppercase; margin: 6px 0 4px; }
.card h1 span { display: block; font-size: clamp(42px, 13vw, 60px); color: #000; text-shadow: 3px 3px 0 var(--red); margin-top: 2px; }
.card p { font-size: 15px; line-height: 1.35; margin: 6px 0; }
@media (max-height: 700px) {
  .card { padding: 10px 12px 14px; }
  .card .jp { font-size: 20px; }
  .card h1 { font-size: 20px; }
  .card h1 span { font-size: 42px; }
  .card p { font-size: 14px; }
  .gift { font-size: 17px; padding: 8px 12px; }
  .card .btn { margin-top: 8px; padding: 10px 16px; }
}
.card .small { font-size: 14px; color: #333; }
.gift {
  display: inline-block; background: #000; color: #fff; font-family: var(--display); font-weight: 900;
  font-size: 19px; letter-spacing: 1px; text-transform: uppercase; padding: 10px 14px; margin: 4px 0;
  transform: skew(-6deg); border: 2px solid var(--red); box-shadow: 4px 4px 0 var(--red);
}
.card .btn { margin-top: 12px; min-width: 170px; font-size: 17px; padding: 12px 18px; }

#err { position: absolute; z-index: 9; left: 8px; right: 8px; bottom: 8px; background: #300; color: #fff; font: 12px monospace; padding: 6px; white-space: pre-wrap; }

@keyframes blink { 50% { opacity: .25; } }
@keyframes pulse { 50% { transform: skew(-7deg) scale(1.06); } }
@keyframes slideIn { from { transform: translateY(-16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bubbleIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bannerIn { from { transform: skew(-8deg) rotate(-3deg) scale(2.2); opacity: 0; } to { transform: skew(-8deg) rotate(-3deg) scale(1); opacity: 1; } }
@keyframes popIn { from { transform: rotate(-6deg) scale(2.4); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }
@keyframes cardIn { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shakey {
  0% { translate: 0 0; } 25% { translate: -3px 2px; } 50% { translate: 3px -2px; } 75% { translate: -2px -3px; } 100% { translate: 0 0; }
}
