/* Omertà. One building on one street, after dark: every player's camera is a lit window with a brass nameplate.
   Alibi's family (Bodoni Moda, Hanken Grotesk, candle ivory, brass, angled controls; oxblood only for the mafia),
   moved from the lake to the city: soot and brick, lamplight by day, moonlight at night. */
body.omerta {
  --mortar: rgba(236, 228, 212, 0.035);
  --pick: var(--brass);
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(240, 194, 122, 0.09), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 25px, var(--mortar) 25px 26px),
    var(--soot);
  background-attachment: fixed;
  transition: background-color 2s ease;
}
body.omerta.night { background-color: var(--night); }
body.omerta::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Wordmark: the painted logotype (art/logo-omerta), Bodoni-style italic with the grave accent in brass. */
.m-logo { margin: 0; line-height: 0; }
.m-logo img { width: clamp(260px, 30vw, 440px); height: auto; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.85)); }
.m-logo-img.sm { width: 112px; height: auto; display: block; }

/* The join screen is the landing page now: see landing.css. */
.m-fine { color: var(--fog); font-size: 13.5px; line-height: 1.5; margin: 22px 0 0; }

/* ---------- the game shell ---------- */
.m-game { height: 100dvh; display: grid; grid-template-rows: auto 1fr auto auto; position: relative; }
.m-hud {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  border-bottom: 1px solid rgba(226, 184, 119, 0.12);
  background: linear-gradient(180deg, rgba(8, 6, 5, 0.96), rgba(8, 6, 5, 0.7));
}
.m-hud-l { display: flex; align-items: baseline; gap: 16px; min-width: 0; }
.m-chap { font: 600 11px var(--body); letter-spacing: 0.26em; text-transform: uppercase; color: var(--brass); white-space: nowrap; }
.m-clock { font: 400 34px/1 var(--display); font-variant-numeric: lining-nums tabular-nums; min-width: 3ch; text-align: center; }
.m-clock.low { color: var(--lamp); }
.m-hud-r { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.m-icon, .m-code, .m-skip, .m-sound-on {
  height: 40px; min-width: 40px; display: inline-grid; place-items: center; padding: 0 10px; cursor: pointer;
  border: 1px solid rgba(226, 184, 119, 0.25); background: rgba(10, 8, 7, 0.8); color: var(--candle);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
.m-icon .icon { width: 19px; height: 19px; }
.m-icon.off { color: #e0948a; border-color: rgba(163, 58, 53, 0.5); }
.m-code { display: inline-flex; gap: 8px; align-items: baseline; }
.m-code b { font: 700 16px var(--typed); letter-spacing: 0.2em; }
.m-skip, .m-sound-on { font: 600 11px var(--body); letter-spacing: 0.2em; text-transform: uppercase; }
.m-sound-on { background: var(--candle); color: #15110b; border-color: var(--candle); animation: pip 1.6s ease-in-out infinite; }

/* ---------- the wall behind the windows: the painted brick by day, by night, and washed red if the mafia win ---------- */
.m-wall { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.m-wall i { position: absolute; inset: 0; background-position: center; background-size: cover; background-repeat: no-repeat; opacity: 0; transition: opacity 2.4s ease; }
.m-wall .w-day { background-image: url(art/bg-wall-day.webp); opacity: 1; }
.m-wall .w-night { background-image: url(art/bg-wall-night.webp); }
.night .m-wall .w-night { opacity: 1; }
.red-end .m-wall .w-red { background-image: url(art/bg-wall-red.webp); opacity: 1; }   /* loads only when the mafia win */
.m-wall::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 45%, rgba(8, 6, 5, 0.15), rgba(8, 6, 5, 0.7)); }
.m-game > :not(.m-wall) { position: relative; z-index: 1; }
.m-game > .m-chapter, .m-game > .overlay { position: fixed; z-index: 25; }
.m-game > .overlay { z-index: 20; }
.m-game > .m-notice { position: absolute; z-index: 4; }

/* ---------- the building ---------- */
.m-facade {
  --tw: 220px; --gap: 10px;
  position: relative; min-height: 0; overflow: auto; padding: 14px 16px;
  display: flex; flex-wrap: wrap; align-content: safe center; justify-content: safe center; gap: var(--gap);
}
.win { position: relative; width: var(--tw); padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; display: grid; cursor: default; }
.win:disabled { opacity: 1; }
/* The painted surround (art/window-frame, 1600x1440). Its opening, measured from the art: x 319 to 1280, y 462 to
   1048, about 1.64:1. The glass sits a hair larger than that, under the frame's wooden edge. Re-measure if redrawn. */
.win-art { position: relative; display: block; aspect-ratio: 1600 / 1440; }
.win-frame { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; -webkit-user-drag: none; }
.win-art::before {   /* the glow for speaking and picking, behind the stone */
  content: ""; position: absolute; inset: 14% 9% 20%; z-index: 0; opacity: 0;
  box-shadow: 0 0 50px 6px var(--glow, rgba(240, 194, 122, 0.45)); transition: opacity 0.3s ease;
}
.win-glass { position: absolute; left: 19.6%; top: 31.7%; width: 60.8%; height: 41.5%; z-index: 1; overflow: hidden; background: #050505; }
.win-glass > i { position: absolute; inset: 0; background-position: center; background-size: cover; background-repeat: no-repeat; opacity: 0; transition: opacity 0.7s ease var(--delay, 0s); }
.g-lit { background-image: url(art/window-lit.webp); opacity: 1 !important; }
.g-red { background-image: url(art/window-red.webp); }
.g-dark { background-image: url(art/window-dark.webp); z-index: 2; }
.g-board { background-image: url(art/window-boarded.webp); z-index: 3; }
.win .feed { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.5s ease; }
.win.video .feed { opacity: 1; }
.win.me .feed { transform: scaleX(-1); }
.win-mono { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; transition: opacity 0.4s ease; }
.win-mono .portrait { width: 22%; font-size: calc(var(--tw) * 0.08); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5); }
.win.video .win-mono { opacity: 0; }
/* Lights out: the shut night glass fades in over the camera, each window on its own delay (stagger() in omerta.js). */
.win.dark .g-dark { opacity: 1; }
/* The mafia's windows at night, for each other only: the red blind, and their cameras washed red. */
.win.red .g-red { opacity: 1; }
.win.red .win-mono { opacity: 0; }
.win.red .feed { filter: sepia(0.5) hue-rotate(-30deg) saturate(1.4) brightness(0.85); }
.win.red { --glow: rgba(163, 58, 53, 0.55); }
.win.red .win-art::before { opacity: 0.8; }
.win.dead .g-board { opacity: 1; }
.win.speaking .win-art::before { opacity: 1; }
.win.pick { cursor: pointer; }
.m-facade.act-kill, .m-facade.act-vote { --pick: var(--oxblood-ink); }
.win.pick:hover .win-art::before, .win.pick:focus-visible .win-art::before { --glow: color-mix(in srgb, var(--pick) 45%, transparent); opacity: 0.7; }
.win.chosen .win-art::before, .win.confirmed .win-art::before { --glow: color-mix(in srgb, var(--pick) 70%, transparent); opacity: 1; }
.win.chosen .win-glass, .win.confirmed .win-glass { outline: 3px solid var(--pick); outline-offset: -3px; }
.win:focus-visible { outline: none; }

/* The nameplate, under the sill. */
.plate { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 12%; margin-top: calc(var(--tw) * -0.07); min-height: 22px; }
.plate b { flex: 0 0 auto; max-width: 72%; font: 500 17px/1.1 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9); }   /* the name keeps its room; the status gives way */
.plate small { min-width: 0; font: 600 10px var(--body); letter-spacing: 0.2em; text-transform: uppercase; color: var(--brass); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9); }
.win.dead .plate b { color: var(--fog); text-decoration: line-through; text-decoration-color: rgba(163, 58, 53, 0.7); text-decoration-thickness: 1px; }
.win.dead .plate small { color: #c78a82; }
.win-mark:not(:empty), .win-tally:not(:empty) {
  position: absolute; z-index: 3; left: 22%; top: 33.5%; padding: 4px 7px; max-width: 56%;
  font: 700 9.5px var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: #fff; background: var(--oxblood-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.win-tally:not(:empty) { left: auto; right: 22%; display: flex; gap: 7px; align-items: center; }
.win-tally b { font: 400 16px/1 var(--display); letter-spacing: 0; }
.win-tally span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.1em; }

/* ---------- notices, captions, chapter cards ---------- */
.m-notice {
  position: absolute; left: 50%; bottom: 14px; z-index: 4; transform: translateX(-50%);
  width: min(620px, calc(100% - 32px)); padding: 26px 30px; text-align: center; display: grid; gap: 10px; justify-items: center;
  background: linear-gradient(180deg, rgba(11, 9, 8, 0.94), rgba(11, 9, 8, 0.88)); border: 1px solid rgba(226, 184, 119, 0.25);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7); animation: ovIn 0.6s ease both; pointer-events: none;
}
.m-notice h2 { margin: 0; font: italic 400 clamp(32px, 5vw, 48px)/1.05 var(--display); }
.m-notice h2.mafia { color: #e0948a; }
.m-notice h2.town { color: var(--solved); }
.m-notice p { margin: 0; color: var(--fog); font-size: 16px; line-height: 1.5; }
.m-notice.n-night { top: 50%; bottom: auto; transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgba(4, 6, 9, 0.9), rgba(4, 6, 9, 0.6) 60%, transparent); border: 0; box-shadow: none; clip-path: none; padding: 48px 60px; }
.m-notice.n-night h2 { color: var(--moon); }
.m-notice.n-dawn, .m-notice.n-verdict { animation-delay: 1.4s; }

.m-caption {
  min-height: 0; padding: 0 24px; text-align: center; font: italic 400 clamp(18px, 2.2vw, 24px)/1.4 var(--display);
  color: rgba(236, 228, 212, 0.9); opacity: 0; transition: opacity 0.4s ease;
}
.m-caption.in { opacity: 1; padding: 6px 24px 10px; }
.m-bar {
  display: grid; justify-items: center; gap: 10px; padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(226, 184, 119, 0.12); background: linear-gradient(0deg, rgba(8, 6, 5, 0.98), rgba(8, 6, 5, 0.8));
}
.m-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: min(560px, 100%); }
.m-row .pbtn { flex: 1 1 200px; }
.m-row .accuse { flex: 1; width: 100%; }
.m-say { margin: 0; color: var(--fog); text-align: center; font-size: 15px; line-height: 1.5; max-width: 40em; }
.m-say b { color: var(--candle); font-weight: 600; }
.m-say.small { font-size: 13px; }
.m-wait { margin: 0; flex: 1 1 200px; display: grid; place-items: center; color: var(--fog); font-size: 14px; }
.m-bar .linkish { margin-top: 0; }
.accuse.brass { background: linear-gradient(rgba(184, 146, 90, 0.18), rgba(184, 146, 90, 0.18)), #0d0b0a; color: var(--candle); }
.accuse.brass::before { background: var(--brass); }

.m-chapter {
  position: fixed; inset: 0; z-index: 25; pointer-events: none; display: grid; place-content: center; text-align: center; gap: 14px;
  background: radial-gradient(60% 50% at 50% 50%, rgba(0, 0, 0, 0.75), transparent 75%);
}
.m-chapter h2 { margin: 0; font: italic 400 clamp(56px, 10vw, 120px)/0.95 var(--display); }
.m-chapter.in { animation: chapter 2.8s ease both; }
@keyframes chapter { 0% { opacity: 0; transform: scale(1.04); } 18%, 70% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.night .m-chapter h2 { color: var(--moon); }

.m-result { display: grid; justify-items: center; gap: 4px; text-align: center; }
.m-result h2 { margin: 0; font: italic 400 clamp(34px, 5vw, 52px)/1 var(--display); }
.m-result h2.mafia { color: #e0948a; }
.m-result h2.town { color: var(--solved); }

/* ---------- the role card ---------- */
.m-card { display: grid; place-items: center; background: radial-gradient(110% 70% at 50% 0%, #1d1512, var(--soot) 70%); }
.night .m-card { background: radial-gradient(110% 70% at 50% 0%, #10161d, var(--night) 70%); }
.m-card .hold { position: relative; bottom: auto; margin-top: 28px; }
.m-envelope { width: min(340px, 82vw); height: auto; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.7)); }
.m-card .ov-center > .label { margin-top: 4px; }
.m-role {
  width: min(460px, 100%); display: grid; gap: 14px; padding: 28px 26px 24px; margin: auto;
  background: linear-gradient(180deg, rgba(26, 18, 16, 0.96), rgba(11, 9, 8, 0.98)); border: 1px solid rgba(226, 184, 119, 0.2);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
}
.m-role h2 { margin: 0; font: italic 400 48px/1 var(--display); }
.m-role-art { margin: -28px -26px 0; aspect-ratio: 4 / 3; overflow: hidden; position: relative; }
.m-role-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 72%; display: block; }
.m-role-art::after { content: ""; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, rgba(11, 9, 8, 0.98)); }
.m-role.mafia h2 { color: #e0948a; }
.m-found { display: grid; gap: 6px; padding: 14px 16px; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(226, 184, 119, 0.14); }
.m-found p { margin: 0; font: 15px/1.5 var(--typed); }

/* ---------- phones ---------- */
@media (max-width: 700px) {
  .m-hud { grid-template-columns: 1fr auto; padding-left: 14px; padding-right: 14px; }
  .m-hud-l .m-logo-img { display: none; }
  .m-clock { grid-column: 2; grid-row: 1; font-size: 28px; }
  .m-hud-r { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
  .m-facade { align-content: flex-start; padding: 14px 12px; }
  .plate b { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .m-chapter.in { animation: none; opacity: 1; }
  .m-sound-on { animation: none; }
  .win-glass > i, .win .feed, .m-wall i { transition: none; }
}

/* ---------- How to Play (howto.js): seven steps drawn with the game's own pieces ---------- */
.ht {
  --ht-win: 150px;
  position: fixed; inset: 0; z-index: 28; display: grid; grid-template-rows: auto 1fr auto;
  background: radial-gradient(110% 80% at 50% 0%, #1d1512, var(--soot) 72%);
  padding: calc(12px + env(safe-area-inset-top)) 0 calc(14px + env(safe-area-inset-bottom));
  animation: ovIn 0.4s ease both;
}
.ht-top { display: flex; align-items: center; justify-content: space-between; padding: 0 18px; }
.ht-pager { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; min-height: 0; }
.ht-pager::-webkit-scrollbar { display: none; }
.ht-step {
  flex: 0 0 100%; scroll-snap-align: center; overflow-y: auto; padding: 8px 24px 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px;
}
.ht-step h2 { margin: 0; font: italic 400 clamp(34px, 5vw, 50px)/1.05 var(--display); }
.ht-step p { margin: 0; max-width: 34em; color: rgba(236, 228, 212, 0.86); font-size: 16.5px; line-height: 1.6; }
.ht-art { display: grid; place-items: center; min-height: 200px; margin-bottom: 10px; }
.ht-envelope { width: min(320px, 70vw); filter: drop-shadow(0 26px 34px rgba(0, 0, 0, 0.7)); }
.ht-row { display: flex; gap: 6px; justify-content: center; }
.ht-row .win { pointer-events: none; }
.ht-row .win-mono .portrait { font-size: 15px; }
.ht-row .win-tally:not(:empty) { font-size: 8px; padding: 3px 5px; }
.ht-row .win-tally b { font-size: 12px; }
.ht-vote { --pick: var(--oxblood-ink); }
.ht-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(520px, 88vw); }
.ht-side { margin: 0; aspect-ratio: 4 / 3; display: grid; align-items: end; background: center / cover; border: 1px solid rgba(226, 184, 119, 0.2); }
.ht-side.day { background-image: linear-gradient(transparent 30%, rgba(8, 6, 5, 0.9)), url(art/bg-wall-day.webp); }
.ht-side.red { background-image: linear-gradient(transparent 30%, rgba(8, 6, 5, 0.9)), url(art/bg-wall-red.webp); }
.ht-side figcaption { padding: 12px 14px; display: grid; gap: 4px; text-align: left; font: italic 17px/1.3 var(--display); }
.ht-roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: min(880px, 92vw); }
.ht-roles figure { margin: 0; display: grid; align-content: start; gap: 10px; text-align: left; }
.ht-roles img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border: 1px solid rgba(226, 184, 119, 0.2); }
.ht-roles figcaption { display: grid; gap: 4px; color: rgba(236, 228, 212, 0.82); font-size: 14px; line-height: 1.45; }
.ht-roles b { font: italic 500 22px var(--display); color: var(--candle); }
.ht-nav { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 8px 18px 0; }
.ht-nav .pbtn { min-width: 132px; white-space: nowrap; }
.ht-dots { display: flex; gap: 8px; }
.ht-dots i { width: 20px; height: 2px; background: rgba(226, 184, 119, 0.22); transition: background 0.3s; }
.ht-dots i.on { background: var(--brass); }
.m-links { display: flex; gap: 22px; justify-content: center; }
.m-howlink { display: block; margin: 14px 0 0; padding: 0; }
.m-role .linkish { justify-self: center; margin-top: 2px; }
@media (max-width: 700px) {
  .ht { --ht-win: 104px; }
  .ht-art { min-height: 150px; }
  .ht-step p { font-size: 15.5px; }
  .ht-roles { grid-template-columns: 1fr 1fr; }
  .ht-roles img { aspect-ratio: 5 / 4; }
  .ht-nav { gap: 12px; }
  .ht-nav .pbtn { min-width: 108px; padding: 0 14px; }
  .ht-dots { gap: 5px; }
  .ht-dots i { width: 10px; }
}
.ht-step.wide .ht-art { order: 3; margin: 12px 0 0; }   /* The Roles: the title above the cards */
