/* TERESA — DRY WORK (js/dialogue-scenes/scene-teresa-drill.js). Room 304,
   seven in the morning: a table pulled off the wall, a window on the
   tracks. The revolver seen from behind — six chambers — and the brass
   she poured on the table. No live rounds; the result is never in doubt,
   only the time is. */
#tzDrill {
  position: fixed; inset: 0; z-index: 1000040;
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
  color: #EBE6D8; overflow: hidden; user-select: none;
  /* the author's art (assets/images/scenes/teresa/revolver/, sources in src/):
     room 304's table, worn planks under the lamp on the left */
  background:
    radial-gradient(ellipse 90% 80% at 45% 50%, transparent 35%, rgba(8, 5, 3, 0.62) 100%),
    linear-gradient(rgba(10, 6, 3, 0.22), rgba(10, 6, 3, 0.22)),
    url('../assets/images/scenes/teresa/revolver/table_wood.jpg') center / cover no-repeat,
    #1a120c;
  opacity: 0; transition: opacity .5s ease;
}
#tzDrill.tzd-in { opacity: 1; }
/* the plates the words sit on: gunmetal, a scratched rim, an engraved line inside */
#tzDrill .tzd-stamp, #tzDrill .tzd-say, #tzDrill .tzd-meters > div, #tzDrill .tzd-act, #tzDrill .tzd-result {
  background: linear-gradient(180deg, #3d3f43 0%, #2a2c30 55%, #222428 100%);
  border: 1px solid #77736b; border-radius: 4px;
  box-shadow: inset 0 0 0 3px #26282c, inset 0 0 0 4px rgba(200, 196, 186, 0.35), 0 4px 10px rgba(0, 0, 0, 0.55);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}
#tzDrill .tzd-head {
  position: absolute; top: 4.5%; left: 0; right: 0; text-align: center;
}
#tzDrill .tzd-stamp {
  display: inline-block; letter-spacing: 4px; font-size: 12px; color: #d9d2c3;
  padding: 7px 16px; margin-bottom: 6px;
}
#tzDrill .tzd-say { display: table; margin: 0 auto; font-size: 19px; letter-spacing: .5px; color: #EBE6D8; min-height: 1.4em; padding: 7px 18px; }
#tzDrill .tzd-meters {
  position: absolute; top: 4.5%; right: 4%; text-align: center; font-size: 12px; letter-spacing: 2px; color: #b9ad9a;
}
#tzDrill .tzd-meters > div { padding: 8px 16px 6px; min-width: 96px; }
#tzDrill .tzd-meters b { display: block; font-size: 26px; letter-spacing: 1px; color: #EBE6D8; font-weight: normal; border-top: 1px solid rgba(200, 196, 186, 0.35); margin-top: 3px; padding-top: 2px; }
#tzDrill .tzd-ammo.tzd-lit b { color: #e0c48a; text-shadow: 0 0 12px rgba(224, 196, 138, 0.55); }

/* ── the gun, from behind: the frame plate, the cylinder in it ── */
#tzDrill .tzd-gun {
  position: absolute; left: 50%; top: 48%; width: 560px; height: 340px;
  transform: translate(-50%, -50%);
}
/* the frame window the cylinder sits in */
#tzDrill .tzd-frame {
  position: absolute; left: 150px; top: 20px; width: 380px; height: 300px;
  background: url('../assets/images/scenes/teresa/revolver/plate.webp') center / contain no-repeat;
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.6));
}
#tzDrill .tzd-cyl {
  position: absolute; left: 212px; top: 42px; width: 256px; height: 261px;
  background: url('../assets/images/scenes/teresa/revolver/cylinder_empty.webp') center / 100% 100% no-repeat;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.65));
  transition: transform .45s cubic-bezier(.3, .7, .2, 1);
}
#tzDrill.tzd-open .tzd-cyl { transform: translateX(-200px) rotate(-12deg); }
#tzDrill .tzd-pin { display: none; }
/* a chamber: the hole is in the picture; this is where a round goes */
#tzDrill .tzd-ch {
  position: absolute; width: 22.4%; height: 22%; border-radius: 50%;
  transform: translate(-50%, -50%);
}
#tzDrill .tzd-ch::after {               /* the round seated in it: its case head */
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: url('../assets/images/scenes/teresa/revolver/casehead.webp') center / 100% 100% no-repeat;
  opacity: 0; transform: scale(.6); transition: opacity .15s ease, transform .15s ease;
}
#tzDrill .tzd-ch.tzd-full::after { opacity: 1; transform: scale(1); }
#tzDrill .tzd-ch.tzd-crooked::after { opacity: 1; transform: translate(5px, -4px) scale(1.04) rotate(18deg); filter: brightness(1.15) drop-shadow(-2px 3px 2px rgba(0, 0, 0, 0.8)); }
#tzDrill .tzd-ch.tzd-next { box-shadow: 0 0 0 2px rgba(224, 196, 138, 0.75), 0 0 14px rgba(224, 196, 138, 0.45); }

/* ── the brass she poured ── */
#tzDrill .tzd-brass {
  position: absolute; left: 50%; bottom: 13%; width: 860px; height: 90px; transform: translateX(-50%);
}
#tzDrill .tzd-round {
  position: absolute; width: 74px; height: 30px; padding: 0; border: 0; cursor: pointer;
  background: url('../assets/images/scenes/teresa/revolver/round.webp') center / contain no-repeat;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.6));
  transition: opacity .18s ease, transform .18s ease;
}
#tzDrill .tzd-round:hover { filter: brightness(1.2) drop-shadow(0 4px 4px rgba(0, 0, 0, 0.6)); }
#tzDrill .tzd-round.tzd-gone { opacity: 0; transform: translateY(-30px) scale(.7); pointer-events: none; }
#tzDrill.tzd-feeding .tzd-round { filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 3px rgba(224, 196, 138, 0.55)); }

/* ── the one button that is the next motion ── */
#tzDrill .tzd-act {
  position: absolute; left: 50%; bottom: 4.5%; transform: translateX(-50%);
  font-family: inherit; font-size: 15px; letter-spacing: 3px; color: #EBE6D8;
  padding: 10px 28px; cursor: pointer; border-color: #c4a87a;
}
#tzDrill .tzd-act:hover { filter: brightness(1.2); }
#tzDrill .tzd-act[disabled] { opacity: .35; cursor: default; border-color: #8E7F7F; }

/* ── EYES ON THE DOOR: the gun is in the dark, the door is the picture ── */
#tzDrill .tzd-door {
  /* the door of 304, full height, his eyes on it: the room's dark eats its sides */
  position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease; pointer-events: none;
  background:
    linear-gradient(90deg, #05060a calc(50% - 21vh), rgba(5, 6, 10, 0) calc(50% - 9vh), rgba(5, 6, 10, 0) calc(50% + 9vh), #05060a calc(50% + 21vh)),
    linear-gradient(180deg, rgba(5, 6, 10, 0) 62%, rgba(5, 6, 10, 0.92) 78%),
    url('../assets/images/scenes/teresa/revolver/door_304.jpg') center 0 / auto 78% no-repeat,
    #05060a;
}
#tzDrill.tzd-blind .tzd-door { opacity: 1; }
#tzDrill.tzd-blind .tzd-gun { filter: blur(7px) brightness(.35); top: 88%; transform: translate(-50%, -50%) scale(.48); }
#tzDrill.tzd-blind .tzd-brass { filter: brightness(.42); bottom: 9%; }
#tzDrill.tzd-shake .tzd-gun { animation: tzdShake .32s ease; }
@keyframes tzdShake {
  0%, 100% { margin-left: 0; } 25% { margin-left: -6px; } 60% { margin-left: 5px; }
}

/* ── COUNT: his count, said out loud ── */
#tzDrill .tzd-count {
  position: absolute; left: 50%; top: 22%; transform: translateX(-50%);
  font-size: 44px; letter-spacing: 8px; color: #e0c48a; opacity: 0;
}
#tzDrill .tzd-count.tzd-pop { animation: tzdPop .7s ease forwards; }
@keyframes tzdPop {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  25% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -10px); }
}

/* the time, when the cylinder closes */
#tzDrill .tzd-result {
  position: absolute; left: 50%; top: 14%; transform: translateX(-50%);
  font-size: 16px; letter-spacing: 3px; color: #e0c48a; opacity: 0; transition: opacity .4s ease;
  white-space: nowrap; padding: 7px 18px;
}
#tzDrill .tzd-result.tzd-on { opacity: 1; }

/* ── AT THE WALL: a water stain the size of a coin, the front sight on it ── */
#tzWall {
  position: fixed; inset: 0; z-index: 1000040; overflow: hidden; cursor: crosshair;
  background:
    radial-gradient(ellipse 50% 60% at 15% 20%, rgba(200, 210, 214, 0.18), transparent 60%),
    linear-gradient(180deg, #b9ad97 0%, #a99d86 60%, #8f846f 100%);
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
  opacity: 0; transition: opacity .5s ease;
}
#tzWall.tzw-in { opacity: 1; }
#tzWall::before {                       /* tired wallpaper */
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, rgba(90, 70, 50, 0.06) 0 2px, transparent 2px 46px);
}
#tzWall .tzw-stain {
  position: absolute; left: 54%; top: 38%; width: 34px; height: 30px; border-radius: 48% 52% 45% 55%;
  background: radial-gradient(ellipse at 45% 45%, rgba(110, 88, 52, 0.15) 0%, rgba(110, 88, 52, 0.35) 60%, rgba(90, 70, 40, 0.55) 72%, transparent 78%);
}
#tzWall .tzw-sight {                    /* the front sight, breathing */
  position: absolute; left: 50%; top: 40%; width: 0; height: 0;
  animation: tzwSway 3.4s ease-in-out infinite;
}
#tzWall .tzw-sight::before {
  content: ''; position: absolute; left: -6px; top: 0; width: 12px; height: 7vh; border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, #16171a, #050506);
}
#tzWall .tzw-sight::after {             /* the barrel under it */
  content: ''; position: absolute; left: -46px; top: 6.5vh; width: 92px; height: 70vh; border-radius: 22px 22px 0 0;
  background: linear-gradient(180deg, #23262b, #0b0c0e);
}
@keyframes tzwSway {
  0%, 100% { transform: translate(-6px, 4px); }
  50% { transform: translate(84px, -10px); }
}
#tzWall.tzw-steady .tzw-sight { animation-duration: 6s; }
#tzWall .tzw-say {
  position: absolute; left: 0; right: 0; top: 7%; text-align: center; font-size: 18px; color: #2b2420; letter-spacing: .5px;
}
#tzWall.tzw-fired { animation: tzwChest .5s ease; }
@keyframes tzwChest { 0% { transform: scale(1); } 30% { transform: scale(1.012); } 100% { transform: scale(1); } }
