/* ============ CAMP — horror UI ============ */
@import url('https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #050505; }
body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: #cfc8bd;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
#game-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#ui { position: fixed; inset: 0; pointer-events: none; }
.screen {
  position: absolute; inset: 0; display: none;
  pointer-events: auto;
  background: radial-gradient(ellipse at 50% 30%, #17130f 0%, #070605 70%, #020202 100%);
  flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; z-index: 10;
}
.screen.active { display: flex; animation: fadeIn .5s ease; }
.screen.translucent { background: rgba(3, 3, 3, .82); backdrop-filter: blur(4px); }
.screen-hud { background: transparent; pointer-events: none; z-index: 5; }
.screen-hud > * { pointer-events: none; }
.screen-hud .mc-buttons, .screen-hud .joystick, .screen-hud .killer-hud .ability, .screen-hud button { pointer-events: auto; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.hidden { display: none !important; }

/* ============ SPLASH / LOADING — poster art ============ */
#screen-splash { padding: 0; background: #000; overflow: hidden; z-index: 60; }
.splash-art {
  position: absolute; inset: 0;
  background: url('/img/splash.jpg') center 20% / cover no-repeat #000;
  animation: splashZoom 14s ease-out forwards;
}
@keyframes splashZoom { from { transform: scale(1.08); } to { transform: scale(1); } }
.splash-art::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.25) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,.82) 100%);
}
.splash-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 max(24px, calc(50% - 360px)) 40px;
  z-index: 1;
}
.splash-title {
  font-family: 'Permanent Marker', cursive;
  font-size: clamp(44px, 9vw, 84px); letter-spacing: .12em; line-height: 1;
  color: #c93524; text-shadow: 0 0 34px rgba(160, 20, 10, .8), 0 3px 0 #000;
}
.splash-sub { color: #8a8378; letter-spacing: .38em; font-size: 11px; margin: 10px 0 22px; }
.splash-bar { height: 8px; }
.splash-status { margin-top: 12px; color: #6d675c; font-size: 11px; letter-spacing: .3em; animation: pulse 2s infinite; }

/* ============ MAIN MENU — painted night scene ============ */
#screen-menu { padding: 0; background: #000; overflow: hidden; }

/* fixed-aspect stage: the painted scene is the design canvas (1672×941);
   real interactive buttons are positioned over their painted counterparts */
.menu-stage {
  position: absolute; left: 50%; top: 50%;
  width: 1672px; height: 941px;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center;
  background: url('/img/menu-bg.jpg') center / 100% 100% no-repeat #000;
  display: block;
  border-radius: 2px;
  box-shadow: 0 0 120px 60px #000;   /* blend contain letterboxing into the scene */
}

.mm-play, .mm-dark {
  position: absolute; left: 122px; width: 462px;
  display: flex; align-items: center; gap: 22px;
  font-family: 'Permanent Marker', 'Comic Sans MS', cursive;
  color: #e8e2d4; text-align: left;
  cursor: pointer; border: none; outline: none;
  transition: filter .15s ease, transform .15s ease, box-shadow .15s ease;
}

/* red PLAY ONLINE — glowing blood-red slab */
.mm-play {
  top: 410px; height: 98px; padding: 0 34px;
  background: linear-gradient(180deg, #b3241a 0%, #7e130b 55%, #4a0803 100%);
  border: 2px solid #d8452f;
  box-shadow: 0 0 30px rgba(220, 40, 20, .45), inset 0 0 22px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,120,100,.35);
  font-size: 40px; letter-spacing: 3px;
  text-shadow: 0 2px 6px #000;
}
.mm-tri {
  width: 0; height: 0; flex-shrink: 0;
  border-top: 17px solid transparent; border-bottom: 17px solid transparent;
  border-left: 28px solid #fff;
  filter: drop-shadow(0 0 6px rgba(255,255,255,.6));
}
.mm-play:hover, .mm-play:focus-visible {
  filter: brightness(1.22);
  box-shadow: 0 0 46px rgba(255, 60, 30, .75), inset 0 0 22px rgba(0,0,0,.4);
  transform: translateX(4px);
}

/* dark stone-textured menu buttons */
.mm-dark {
  height: 74px; padding: 0 30px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,0) 30%),
    linear-gradient(180deg, #423c32 0%, #2a251e 45%, #14100b 100%);
  border: 1px solid #5a5344;
  box-shadow: inset 0 2px 6px rgba(255,255,255,.08), inset 0 -8px 14px rgba(0,0,0,.65), 0 4px 10px rgba(0,0,0,.6);
  font-size: 27px; letter-spacing: 3px;
  text-shadow: 0 2px 4px #000;
}
.mm-ico { width: 30px; height: 30px; flex-shrink: 0; color: #ded7c6; filter: drop-shadow(0 1px 2px #000); }
.mm-dark:hover, .mm-dark:focus-visible {
  filter: brightness(1.28);
  border-color: #b9ab84;
  transform: translateX(6px);
}
.mm-dark:active { transform: translateX(6px) scale(.98); }

/* mobile / narrow: reflowed layout (grid, backdrop hides the painted buttons) */
.menu-mobile { display: none; position: absolute; inset: 0; background: #000 url('/img/menu-bg.jpg') center 30% / cover no-repeat; }
.menu-mobile::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.94) 0%, rgba(0,0,0,.88) 46%, rgba(0,0,0,.35) 78%, rgba(0,0,0,.15) 100%),
              linear-gradient(180deg, rgba(0,0,0,.5) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,.75) 100%);
}
.mm-logo { position: absolute; left: 5%; top: 4%; width: min(64%, 380px); z-index: 1; }
.mm-col {
  position: absolute; left: 5%; right: 5%; top: 38%; bottom: 11%;
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px;
  align-content: center; z-index: 1;
}
.menu-mobile .mm-play, .menu-mobile .mm-dark { position: relative; left: 0; top: 0 !important; width: 100%; }
.menu-mobile .mm-play { grid-column: 1 / -1; height: 52px; font-size: 24px; }
.menu-mobile .mm-dark { height: 46px; font-size: 17px; gap: 10px; padding: 0 14px; }
.menu-mobile .mm-ico { width: 20px; height: 20px; }
.menu-mobile .btn-install { grid-column: 1 / -1; position: relative; height: 38px; font-size: 12px; }
.mm-footer { position: absolute; left: 5%; right: 5%; bottom: 3.5%; display: flex; gap: 10px; align-items: center; justify-content: center; z-index: 1; font-family: 'Permanent Marker', cursive; letter-spacing: 3px; font-size: 13px; color: #cfc8bd; text-shadow: 0 2px 4px #000; }
.mm-footer i { color: #6d675c; font-style: normal; font-size: 8px; }
.mm-red { color: #c93524; }

@media (max-width: 860px), (orientation: portrait) {
  .menu-stage { display: none; }
  .menu-mobile { display: block; }
}

.btn {
  pointer-events: auto; cursor: pointer;
  background: linear-gradient(180deg, #241f19, #161310);
  border: 1px solid #3d372e; color: #cfc8bd;
  font-size: 15px; letter-spacing: .14em; padding: 13px 26px;
  font-family: inherit; text-transform: uppercase;
  transition: all .18s ease; position: relative;
}
.btn:hover, .btn:focus-visible { border-color: #8f2f23; color: #fff; background: linear-gradient(180deg, #2e2019, #1a130f); }
.btn:active { transform: translateY(1px); }
.btn-primary { border-color: #7a2a20; background: linear-gradient(180deg, #3a1712, #210d0a); color: #e8ddd0; }
.btn-primary:hover { background: linear-gradient(180deg, #4d1d16, #2a100c); border-color: #b23a2a; }
.btn-danger { border-color: #5a1a1a; color: #c98181; }
.btn-ghost { background: transparent; border-color: #2c2822; color: #8a8378; }
.btn-ghost:hover { color: #d8d2c4; }

.screen-title { font-size: clamp(22px, 4vw, 34px); letter-spacing: .3em; margin-bottom: 28px; color: #b9b1a2; text-transform: uppercase; }
.panel {
  background: rgba(12, 10, 8, .92); border: 1px solid #332d25;
  padding: 26px; max-width: 460px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
}
.hint { color: #6d675c; font-size: 12px; line-height: 1.6; }
.row-end { display: flex; gap: 12px; margin-top: 26px; justify-content: flex-end; max-width: 460px; width: 100%; }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.field > span { font-size: 11px; letter-spacing: .2em; color: #8a8378; }
.field input, .field select {
  background: #0d0b09; border: 1px solid #3d372e; color: #e2dcd0;
  padding: 11px 13px; font-size: 15px; font-family: inherit; outline: none;
}
.field input:focus, .field select:focus { border-color: #8f2f23; }
.field input[type=range] { padding: 0; accent-color: #8f2f23; }
.field.toggle { flex-direction: row; align-items: center; justify-content: space-between; }
.field.toggle input { width: 20px; height: 20px; accent-color: #8f2f23; }

/* profile */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 4px; }
.stat-cell { background: #0d0b09; border: 1px solid #2c2822; padding: 12px; }
.stat-cell b { display: block; font-size: 22px; color: #d8d2c4; }
.stat-cell span { font-size: 10px; letter-spacing: .2em; color: #6d675c; }

/* character select */
.char-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 640px; }
.char-card {
  background: #0d0b09; border: 1px solid #2c2822; cursor: pointer;
  padding: 14px; text-align: center; transition: border-color .15s;
}
.char-card:hover { border-color: #6d675c; }
.char-card.selected { border-color: #b23a2a; box-shadow: 0 0 24px rgba(143,47,35,.25) inset; }
.char-card canvas { width: 100%; height: 110px; display: block; background: linear-gradient(180deg, #14100d, #060504); }
.char-card b { display: block; margin-top: 8px; font-size: 12px; letter-spacing: .16em; color: #cfc8bd; }

/* play */
.play-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; max-width: 760px; width: 100%; }
.play-grid .panel { max-width: none; }
.code-input { display: flex; gap: 8px; margin: 14px 0 18px; justify-content: center; }
.code-input input {
  width: 46px; height: 56px; text-align: center; font-size: 26px; text-transform: uppercase;
  background: #0d0b09; border: 1px solid #3d372e; color: #e8ddd0; outline: none; font-family: inherit;
}
.code-input input:focus { border-color: #b23a2a; }
.conn-status { margin-top: 18px; color: #8f6d4f; font-size: 13px; min-height: 20px; letter-spacing: .08em; }
.conn-status.err { color: #c96d5f; }

/* lobby */
.lobby-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 620px; }
.lobby-code { text-align: center; margin-bottom: 24px; }
.code-big { font-size: 54px; letter-spacing: .5em; color: #e8ddd0; margin: 6px 0 8px; font-weight: 700; text-shadow: 0 0 30px rgba(178,58,42,.35); }
.lobby-players { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; width: 100%; margin-bottom: 24px; }
.lobby-p { background: #0d0b09; border: 1px solid #2c2822; padding: 14px; display: flex; align-items: center; gap: 10px; }
.lobby-p .dot { width: 9px; height: 9px; border-radius: 50%; background: #4a4; box-shadow: 0 0 8px #4a4; flex-shrink: 0; }
.lobby-p.off .dot { background: #a33; box-shadow: 0 0 8px #a33; }
.lobby-p .nm { flex: 1; font-size: 13px; color: #d8d2c4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-p .rdy { font-size: 10px; letter-spacing: .15em; color: #6d675c; }
.lobby-p .rdy.on { color: #7ba05a; }
.lobby-p.host::after { content: "HOST"; font-size: 9px; color: #8f6d4f; margin-left: 4px; }
.lobby-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* loading */
.loading-inner { text-align: center; width: min(480px, 86vw); }
.loading-title { letter-spacing: .35em; font-size: 18px; color: #b9b1a2; margin-bottom: 26px; animation: pulse 2.4s infinite; }
@keyframes pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
.loading-bar { height: 6px; background: #17130f; border: 1px solid #2c2822; }
.loading-bar div { height: 100%; width: 0%; background: linear-gradient(90deg, #5a1d15, #b23a2a); transition: width .3s; }
#loading-tip { margin-top: 20px; }

/* ============ HUD ============ */
.hud-top { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 0; right: 0; display: flex; justify-content: center; gap: 24px; align-items: baseline; }
.hud-timer { font-size: 26px; font-weight: 700; letter-spacing: .2em; color: #d8d2c4; text-shadow: 0 0 12px #000, 0 0 3px #000; }
.hud-timer.low { color: #c9503c; animation: pulse 1s infinite; }
.hud-objcount { font-size: 12px; letter-spacing: .2em; color: #93897a; text-shadow: 0 0 8px #000; }
.hud-objectives {
  position: absolute; left: 14px; top: 64px; width: 240px;
  font-size: 11px; letter-spacing: .06em; line-height: 1.5;
  text-shadow: 0 1px 3px #000; pointer-events: none;
}
.hud-objectives .obj { color: #8d867a; margin-bottom: 5px; padding-left: 16px; position: relative; }
.hud-objectives .obj::before { content: "○"; position: absolute; left: 0; color: #6d675c; }
.hud-objectives .obj.done { color: #5f7a4a; text-decoration: line-through; }
.hud-objectives .obj.done::before { content: "●"; color: #5f7a4a; }
.hud-objectives .obj .prog { color: #b9b1a2; }

.interact-prompt {
  position: absolute; left: 50%; top: 58%; transform: translateX(-50%);
  background: rgba(5,4,3,.75); border: 1px solid #4a4336; padding: 10px 20px;
  font-size: 13px; letter-spacing: .1em; color: #e2dcd0; white-space: nowrap;
}
.interact-prompt b { color: #c9813c; }
.hud-toast {
  position: absolute; left: 50%; top: 66%; transform: translateX(-50%);
  font-size: 14px; color: #d8c9a8; letter-spacing: .08em; text-shadow: 0 0 10px #000;
  animation: toastIn .3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.hud-bottom { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: flex-end; }
.hud-bars { display: flex; flex-direction: column; gap: 6px; width: 150px; }
.bar { height: 7px; background: rgba(10,8,6,.8); border: 1px solid #3a342b; position: relative; }
.bar div { height: 100%; background: #8f8262; width: 100%; transition: width .2s; }
.bar.battery div { background: #b0913c; }
.bar.stamina div { background: #5f7a4a; }
.bar span { position: absolute; left: 4px; top: -14px; font-size: 8px; letter-spacing: .25em; color: #77705f; }
.hud-inventory { display: flex; gap: 8px; }
.inv-slot {
  width: 46px; height: 46px; background: rgba(10,8,6,.8); border: 1px solid #3a342b;
  display: flex; align-items: center; justify-content: center; font-size: 20px; position: relative;
}
.inv-slot .cnt { position: absolute; right: 2px; bottom: 1px; font-size: 10px; color: #b9b1a2; }
.inv-slot.glow { border-color: #b23a2a; box-shadow: 0 0 12px rgba(178,58,42,.5); }

/* killer hud */
.killer-hud { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; }
.ability {
  background: rgba(10,6,5,.85); border: 1px solid #4d201a; padding: 10px 14px; width: 170px;
  cursor: pointer; position: relative; overflow: hidden; transition: border-color .15s;
}
.ability:hover { border-color: #b23a2a; }
.ability b { display: block; font-size: 12px; letter-spacing: .2em; color: #d8a294; }
.ability span { font-size: 10px; color: #77705f; }
.ability .cd { position: absolute; left: 0; bottom: 0; height: 3px; background: #b23a2a; width: 0%; }
.ability.cooling { opacity: .55; }

/* mobile controls */
.mobile-controls { position: absolute; inset: 0; pointer-events: none; }
.joystick {
  position: absolute; left: 26px; bottom: calc(80px + env(safe-area-inset-bottom));
  width: 130px; height: 130px; border-radius: 50%;
  border: 2px solid rgba(160,150,130,.25); background: rgba(10,8,6,.25);
  pointer-events: auto; touch-action: none;
}
.joy-knob {
  position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; border-radius: 50%;
  background: rgba(190,180,160,.35); border: 2px solid rgba(220,210,190,.4);
  transform: translate(-50%, -50%);
}
.touch-look { position: absolute; right: 0; top: 0; width: 55%; height: 65%; pointer-events: auto; touch-action: none; }
.mc-buttons { position: absolute; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, 64px); gap: 10px; }
.mc-btn {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(15,12,9,.65); border: 1px solid rgba(160,150,130,.35);
  color: #cfc8bd; font-size: 11px; letter-spacing: .08em; font-family: inherit;
  touch-action: none; pointer-events: auto;
}
.mc-btn.pressed { background: rgba(143,47,35,.5); border-color: #b23a2a; }
.mc-btn.active { border-color: #b0913c; color: #e8d8a0; }

/* death */
.death-overlay {
  position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(60,5,5,.45), rgba(0,0,0,.92));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  animation: fadeIn 1.2s ease;
}
.death-overlay h2 { font-size: 42px; letter-spacing: .4em; color: #a03428; text-shadow: 0 0 40px #500; }

/* objective modal (keypad, cables, notes, order) */
.obj-modal {
  position: absolute; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; pointer-events: auto; z-index: 20;
}
.obj-modal-box {
  background: #100d0a; border: 1px solid #4a4336; padding: 26px; max-width: 400px; width: 90%;
  box-shadow: 0 30px 80px #000;
}
.obj-modal-box h3 { letter-spacing: .2em; margin-bottom: 14px; font-size: 15px; color: #d8d2c4; }
.obj-modal-box p { font-size: 13px; color: #9a927f; line-height: 1.7; }
.obj-modal-box .note-paper {
  background: linear-gradient(180deg, #d8cfae, #c4b98e); color: #3a2f1c; padding: 18px;
  font-family: Georgia, serif; font-size: 15px; line-height: 1.6; transform: rotate(-1deg);
  box-shadow: 0 8px 30px rgba(0,0,0,.6);
}
.obj-modal-box .close-btn { margin-top: 18px; width: 100%; }
.keypad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.keypad-grid button { height: 52px; font-size: 18px; }
.keypad-display {
  background: #060504; border: 1px solid #3a342b; color: #b0913c; font-size: 24px;
  letter-spacing: .4em; text-align: center; padding: 10px; margin-bottom: 12px; font-family: monospace;
}
.cable-row { display: flex; justify-content: space-between; margin: 10px 0; gap: 12px; }
.cable-node { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #333; cursor: pointer; }
.cable-node.sel { box-shadow: 0 0 14px #fff; border-color: #fff; }
.cable-node.linked { opacity: .9; }
.cable-status { text-align: center; margin-top: 12px; }

/* end screen */
.end-banner { font-size: clamp(40px, 9vw, 84px); font-weight: 800; letter-spacing: .25em; margin-bottom: 8px; }
.end-banner.win { color: #7ba05a; text-shadow: 0 0 50px rgba(123,160,90,.4); }
.end-banner.lose { color: #a03428; text-shadow: 0 0 50px rgba(160,52,40,.4); }
.end-reason { color: #93897a; letter-spacing: .15em; margin-bottom: 30px; font-size: 14px; }
.end-stats { width: min(560px, 92vw); border-top: 1px solid #2c2822; }
.end-row { display: grid; grid-template-columns: 40px 1fr 90px 90px 110px; gap: 8px; padding: 10px 6px; border-bottom: 1px solid #1d1913; font-size: 12px; align-items: center; }
.end-row.head { color: #6d675c; font-size: 10px; letter-spacing: .2em; }
.end-row .role-killer { color: #c9503c; }
.end-row .role-survivor { color: #7ba05a; }
.end-row.dead-tag { opacity: .5; }

/* settings extras */
.settings-panel { max-height: 76vh; overflow-y: auto; }
.fps-counter { position: fixed; right: 8px; top: 8px; color: #7ba05a; font-size: 12px; z-index: 50; font-family: monospace; }
.howto-panel p { margin-bottom: 14px; line-height: 1.7; font-size: 13px; color: #a8a091; }
.howto-panel .keys { color: #6d675c; font-size: 11px; letter-spacing: .1em; line-height: 2; }

/* intro cinematic */
#intro-lines { max-width: 700px; text-align: center; padding: 20px; }
#intro-lines .line {
  font-size: clamp(16px, 3vw, 24px); letter-spacing: .12em; color: #b9b1a2;
  margin: 18px 0; opacity: 0; transition: opacity 1.4s ease; line-height: 1.8;
}
#intro-lines .line.show { opacity: 1; }
.intro-skip { position: absolute; right: 26px; bottom: 26px; }

@media (max-width: 700px) {
  .char-grid { grid-template-columns: repeat(2, 1fr); }
  .hud-objectives { width: 170px; font-size: 9px; top: 56px; }
  .killer-hud { transform: translateY(-50%) scale(.85); right: 8px; }
  .mc-buttons { grid-template-columns: repeat(3, 56px); gap: 8px; }
  .mc-btn { width: 56px; height: 56px; }
  .joystick { width: 112px; height: 112px; }
  .end-row { grid-template-columns: 30px 1fr 60px 60px 90px; font-size: 10px; }
}

/* ============ ROTATE DEVICE OVERLAY ============ */
.rotate-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(ellipse at center, #14100c 0%, #020202 80%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; text-align: center; padding: 30px;
}
.rotate-overlay h2 { letter-spacing: .3em; color: #cfc8bd; font-size: 18px; }
.rotate-phone { position: relative; width: 90px; height: 150px; }
.rotate-icon { font-size: 84px; line-height: 150px; animation: rotatePhone 2.4s ease-in-out infinite; }
.rotate-arrow { position: absolute; right: -34px; top: 50%; transform: translateY(-50%); font-size: 44px; color: #c93524; animation: rotateArrow 2.4s ease-in-out infinite; }
@keyframes rotatePhone { 0%, 20% { transform: rotate(0); } 55%, 80% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@keyframes rotateArrow { 0%, 20% { opacity: .2; } 55%, 80% { opacity: 1; } }

/* ============ MIC BUTTON ============ */
.mc-btn.mic-on { border-color: #7ba05a; color: #b8d89a; background: rgba(60, 90, 40, .55); }
.mc-btn.mic-off { border-color: #8f2f23; color: #c98181; opacity: .75; }
#screen-hud .mc-btn { pointer-events: auto; }

/* speaking indicator (desktop) */
.mic-badge {
  position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%);
  font-size: 11px; letter-spacing: .25em; color: #b8d89a; text-shadow: 0 0 8px #000;
  z-index: 6; pointer-events: none;
}

/* ============ RESPONSIVE SIZING — phones & small tablets (landscape) ============ */
@media (max-height: 560px) {
  .hud-objectives { width: 190px; font-size: 9px; top: 46px; }
  .hud-timer { font-size: 19px; }
  .hud-objcount { font-size: 9px; }
  .interact-prompt { font-size: 11px; padding: 8px 14px; }
  .hud-bars { width: 110px; }
  .inv-slot { width: 36px; height: 36px; font-size: 15px; }
  .killer-hud { transform: translateY(-50%) scale(.78); right: 6px; }
  .ability { width: 140px; padding: 7px 10px; }
  .joystick { width: 96px; height: 96px; bottom: calc(52px + env(safe-area-inset-bottom)); }
  .joy-knob { width: 42px; height: 42px; }
  .mc-buttons { grid-template-columns: repeat(4, 46px); gap: 7px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); }
  .mc-btn { width: 46px; height: 46px; font-size: 9px; }
  .splash-title { font-size: 40px; }
}
@media (max-height: 420px) {
  .hud-objectives { width: 160px; font-size: 8px; top: 40px; left: 8px; }
  .hud-timer { font-size: 16px; }
  .mm-play { font-size: 30px; height: 76px; }
  .mm-dark { font-size: 20px; height: 58px; }
}

/* mobile LANDSCAPE phones: tighter grid so everything fits without scrolling */
@media (max-height: 480px) and (orientation: landscape) {
  .mm-col { top: 46%; bottom: 9%; gap: 6px; }
  .menu-mobile .mm-play { height: 42px; font-size: 19px; }
  .menu-mobile .mm-dark { height: 36px; font-size: 13px; }
  .menu-mobile .mm-ico { width: 15px; height: 15px; }
  .mm-logo { top: 6%; width: min(46%, 300px); }
  .mm-footer { font-size: 10px; letter-spacing: 2px; }
  .menu-mobile .btn-install { height: 30px; font-size: 10px; }
}

.obj-diff { color: #b0913c; font-size: 9px; letter-spacing: 2px; }

/* ============ CINEMATIC LAYER (vignette + film grain) ============ */
#cinematic-layer { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.cine-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 42%, rgba(0,0,0,.34) 78%, rgba(0,0,0,.72) 100%);
}
.cine-grain {
  position: absolute; inset: -100px; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  animation: grainShift .5s steps(4) infinite;
}
@keyframes grainShift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-38px, 22px); }
  50% { transform: translate(24px, -44px); }
  75% { transform: translate(-14px, -30px); }
  100% { transform: translate(30px, 40px); }
}
