/* Alibi phone: a game controller. Your dossier, your evidence, your vote. */
body.phone { min-height: 100dvh; background: radial-gradient(120% 70% at 50% 0%, #142126, #05090a 70%) fixed, #05090a; overscroll-behavior: none; }
body.phone::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: 0.06; 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");
}
.phone .label { font-size: 11px; letter-spacing: 0.26em; }

/* Game button: angled corners and brass brackets, same family as the TV. */
.pbtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  height: var(--control-h); padding: 0 26px; border: 0; cursor: pointer;
  color: var(--candle); background: linear-gradient(180deg, rgba(26, 38, 42, 0.95), rgba(10, 16, 18, 0.98));
  font: 600 14px var(--body); letter-spacing: 0.2em; text-transform: uppercase;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.pbtn::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(var(--brass), var(--brass)) top left / 24px 1.5px no-repeat,
              linear-gradient(var(--brass), var(--brass)) top left / 1.5px 24px no-repeat,
              linear-gradient(var(--brass), var(--brass)) bottom right / 24px 1.5px no-repeat,
              linear-gradient(var(--brass), var(--brass)) bottom right / 1.5px 24px no-repeat;
  box-shadow: inset 0 0 0 1px rgba(226, 184, 119, 0.25);
}
.pbtn.primary { color: #15110b; background: linear-gradient(180deg, #f6ead2, #d8c6a2); }
.pbtn.primary::before { background: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5); }
.pbtn:active { transform: translateY(1px); filter: brightness(0.92); }
.pbtn:disabled { opacity: 0.35; }
.pbtn.wide { width: 100%; }

/* ---------- join ---------- */
.join-view { min-height: 100dvh; position: relative; }
.join-art { position: absolute; inset: 0 0 auto 0; height: 52dvh; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.join-art svg { width: 100%; height: 100%; display: block; }
.join-art .clouds { animation: drift 90s linear infinite alternate; }
@keyframes drift { from { transform: translateX(-60px); } to { transform: translateX(60px); } }
.join-body { position: relative; z-index: 1; min-height: 100dvh; display: flex; flex-direction: column; justify-content: flex-end; padding: 0 24px calc(28px + env(safe-area-inset-bottom)); max-width: 460px; margin: 0 auto; }
.join-logo { font-size: 104px; text-shadow: 0 8px 40px rgba(0, 0, 0, 0.8); }
.join-sub { margin: 6px 0 34px 4px; }
.join-form { display: grid; gap: 18px; }
.join-form label { display: grid; gap: 9px; }
.join-form input {
  height: var(--control-h); width: 100%;
  border: 1px solid rgba(226, 184, 119, 0.3); border-radius: 0;
  background: rgba(5, 9, 10, 0.7); color: var(--candle);
  font: 500 19px var(--body); padding: 0 16px; outline: none;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.join-form input::placeholder { color: rgba(141, 154, 150, 0.5); }
.join-form input:focus { border-color: var(--brass); background: rgba(10, 17, 19, 0.9); }
#codeInput { font: 700 28px var(--typed); letter-spacing: 0.45em; text-transform: uppercase; }
.join-form .pbtn { margin-top: 8px; width: 100%; }
.form-error { color: #e0948a; margin: 0; font-size: 15px; }
.host-link { margin-top: 26px; color: var(--fog); font-size: 13px; text-align: center; text-underline-offset: 3px; }

/* ---------- shell ---------- */
.game-view { min-height: 100dvh; padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
.ph-head {
  position: sticky; top: 0; z-index: 6;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(180deg, rgba(5, 9, 10, 0.98), rgba(5, 9, 10, 0.88));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226, 184, 119, 0.14);
}
.ph-head .mini { width: 40px; flex: none; border: 1px solid rgba(226, 184, 119, 0.4); }
.ph-logo { font-size: 30px; }
.ph-who { display: grid; line-height: 1.2; min-width: 0; }
.ph-who b { font: 500 19px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-who span { color: var(--fog); font-size: 12.5px; }
.ph-head .hide-btn { margin-left: auto; width: 40px; height: 40px; border: 1px solid rgba(226, 184, 119, 0.25); background: none; color: var(--fog); display: grid; place-items: center; }
.ph-head .hide-btn .icon { width: 20px; height: 20px; }
.ph-head .room { margin-left: auto; text-align: right; display: grid; }
.ph-head .room b { font: 700 18px var(--typed); letter-spacing: 0.18em; }
.ph-status {
  position: sticky; top: calc(61px + env(safe-area-inset-top)); z-index: 5;
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: rgba(10, 17, 19, 0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(226, 184, 119, 0.1);
  font-size: 13.5px; color: var(--fog);
}
.ph-status .pip { width: 7px; height: 7px; border-radius: 50%; background: var(--brass); box-shadow: 0 0 10px var(--brass); animation: pip 1.6s ease-in-out infinite; flex: none; }
@keyframes pip { 50% { opacity: 0.3; } }
.ph-status b { margin-left: auto; font: 400 24px var(--display); color: var(--candle); font-variant-numeric: lining-nums tabular-nums; }
.ph-status b.low { color: var(--brass); }
.ph-status:empty { display: none; }
.ph-body { padding: 18px 16px 24px; }

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 6;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: linear-gradient(180deg, rgba(8, 13, 15, 0.95), rgba(5, 9, 10, 0.99)); backdrop-filter: blur(14px);
  border-top: 1px solid rgba(226, 184, 119, 0.16);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { position: relative; height: 66px; border: 0; background: none; color: rgba(141, 154, 150, 0.8); display: grid; place-items: center; gap: 2px; padding: 8px 0 6px; font: 600 10.5px var(--body); letter-spacing: 0.18em; text-transform: uppercase; }
.tabs .icon { width: 23px; height: 23px; }
.tabs button.on { color: var(--candle); }
.tabs button.on::before { content: ""; position: absolute; top: -1px; left: 28%; right: 28%; height: 2px; background: var(--brass); box-shadow: 0 0 12px var(--brass); }
.tabs .badge { position: absolute; top: 9px; left: calc(50% + 10px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--oxblood-ink); color: #fff; font: 700 10px/17px var(--body); letter-spacing: 0; }

/* ---------- sealed dossier ---------- */
.sealed { display: flex; flex-direction: column; align-items: center; padding-top: 8px; }
.folder { position: relative; width: 100%; max-width: 360px; margin-top: 18px; }
.folder-tab { position: absolute; top: -22px; left: 18px; height: 26px; padding: 5px 16px 0; background: #b89d6c; color: #3a2b18; font: 700 11px var(--typed); letter-spacing: 0.12em; clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 100%, 0 100%); }
.folder-body {
  position: relative; height: 280px; padding: 22px 20px;
  background: linear-gradient(170deg, #d2b987, #b89d6c 60%, #a68a5b);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  color: #2b2012; overflow: hidden;
}
.folder-body::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.025) 0 2px, transparent 2px 5px); }
.folder-label { position: relative; z-index: 1; background: #f1ede3; padding: 12px 14px; width: 70%; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transform: rotate(-1deg); }
.folder-label .label { color: rgba(43, 32, 18, 0.6); font-size: 10px; }
.folder-label b { display: block; font: 700 18px var(--typed); margin-top: 6px; }
.folder-label small { display: block; font: 400 13px var(--typed); margin-top: 2px; color: rgba(43, 32, 18, 0.7); }
.folder-stamp {
  position: absolute; z-index: 1; right: 16px; bottom: 30px; transform: rotate(-12deg);
  border: 3px solid var(--oxblood-ink); color: var(--oxblood-ink); padding: 6px 12px 4px;
  font: 700 20px var(--body); letter-spacing: 0.22em; text-transform: uppercase; opacity: 0.85; mix-blend-mode: multiply;
}
.folder-clip { position: absolute; z-index: 1; left: 22px; bottom: 26px; width: 92px; opacity: 0.9; }
.folder-clip .frame-bust { width: 92px; border: 4px solid #f1ede3; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35); transform: rotate(4deg); }

.hold {
  position: relative; margin-top: 34px; width: 132px; height: 132px; border-radius: 50%; border: 0;
  background: radial-gradient(circle, rgba(26, 38, 42, 0.95) 58%, rgba(10, 16, 18, 1) 60%);
  color: var(--candle); display: grid; place-items: center; touch-action: none; -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.hold svg.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.hold .track { stroke: rgba(226, 184, 119, 0.2); }
.hold .fill { stroke: var(--brass); stroke-dasharray: 377; stroke-dashoffset: 377; filter: drop-shadow(0 0 6px rgba(226, 184, 119, 0.6)); }
.hold.holding .fill { transition: stroke-dashoffset 0.9s linear; stroke-dashoffset: 0; }
.hold span { position: relative; font: 600 11px var(--body); letter-spacing: 0.22em; text-transform: uppercase; text-align: center; line-height: 1.5; }
.hold .icon { width: 26px; height: 26px; display: block; margin: 0 auto 6px; color: var(--brass); }
.hint { color: var(--fog); font-size: 13.5px; text-align: center; margin: 18px 0 0; line-height: 1.5; }

/* ---------- open dossier: swipeable pages ---------- */
.pager { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
.pager::-webkit-scrollbar { display: none; }
.page {
  flex: 0 0 100%; scroll-snap-align: center; min-height: 54dvh;
  background: linear-gradient(180deg, rgba(16, 25, 28, 0.92), rgba(8, 13, 15, 0.95));
  border: 1px solid rgba(226, 184, 119, 0.14); padding: 22px 20px;
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  display: flex; flex-direction: column; gap: 14px;
}
.page-num { margin-top: auto; color: rgba(141, 154, 150, 0.6); font: 600 10px var(--body); letter-spacing: 0.3em; text-transform: uppercase; }
.p-portrait { margin: -22px -20px 4px; position: relative; }
.p-portrait .frame-bust { width: 100%; aspect-ratio: 5 / 4; }
.p-portrait::after { content: ""; position: absolute; inset: 50% 0 0 0; background: linear-gradient(transparent, rgba(8, 13, 15, 0.98)); }
.p-name { font: 400 34px/1.05 var(--display); margin-top: -46px; position: relative; z-index: 1; }
.p-role { color: var(--fog); font-size: 15px; margin-top: -8px; }
.goal { padding: 14px 16px; border-left: 2px solid var(--brass); background: rgba(184, 146, 90, 0.08); }
.goal p { margin: 8px 0 0; line-height: 1.5; font-size: 15.5px; }
.goal.killer { border-left-color: var(--oxblood-ink); background: linear-gradient(90deg, rgba(142, 43, 43, 0.3), rgba(142, 43, 43, 0.08)); }
.goal.killer .label { color: #e0948a; }
.goal.killer p { font: italic 19px/1.4 var(--display); }
.p-big { font: italic 23px/1.45 var(--display); margin: 0; color: var(--candle); }
.p-text { margin: 0; line-height: 1.6; font-size: 16px; color: rgba(236, 228, 212, 0.88); }
.p-note { color: var(--fog); font-size: 13px; line-height: 1.5; margin: 0; }
.p-note.red { color: #e0948a; }
.typed { background: var(--form); color: var(--form-ink); padding: 16px; font: 15px/1.55 var(--typed); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4); transform: rotate(-0.6deg); }
.typed .label { color: var(--oxblood-ink); display: block; margin-bottom: 8px; }
.details { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.details li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 14px; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(226, 184, 119, 0.12); }
.details span { color: var(--fog); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.details b { font: 600 16px var(--body); text-align: right; }
.dots { display: flex; justify-content: center; gap: 8px; margin: 14px 0 4px; }
.dots i { width: 22px; height: 2px; background: rgba(226, 184, 119, 0.22); transition: background 0.3s; }
.dots i.on { background: var(--brass); }
.ready-bar { margin-top: 16px; }
.ready-done { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--brass); font: 600 12px var(--body); letter-spacing: 0.22em; text-transform: uppercase; padding: 14px; }
.ready-done .icon { width: 18px; height: 18px; }

/* ---------- evidence ---------- */
.sec { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.sec::after { content: ""; flex: 1; height: 1px; background: rgba(226, 184, 119, 0.18); }
.notes { display: grid; gap: 16px; padding: 4px 6px 4px; }
.note-card {
  position: relative; background: #f2eee3; color: #22201c; padding: 16px 18px 14px;
  background-image: repeating-linear-gradient(180deg, transparent 0 29px, rgba(80, 130, 170, 0.22) 29px 30px);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.45); transform: rotate(var(--r, -1deg));
}
.note-card::before { content: ""; position: absolute; top: -8px; left: 50%; width: 70px; height: 20px; margin-left: -35px; background: rgba(226, 216, 190, 0.7); transform: rotate(-2deg); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.note-card .tag { font: 700 10px var(--body); letter-spacing: 0.2em; text-transform: uppercase; color: var(--oxblood-ink); }
.note-card p { margin: 6px 0 0; font: 500 25px/1.2 Caveat, cursive; }
.empty { color: var(--fog); font-size: 14.5px; border: 1px dashed rgba(226, 184, 119, 0.22); padding: 20px; text-align: center; margin: 0 0 24px; line-height: 1.5; }
.exhibit { margin-bottom: 30px; }
.exhibit .polaroid-sm { width: 72%; margin: 0 auto -40px; position: relative; z-index: 1; background: #efebe1; padding: 10px 10px 40px; box-shadow: 0 18px 30px rgba(0, 0, 0, 0.5); transform: rotate(-3deg); }
.exhibit .polaroid-sm .photo { aspect-ratio: 1; overflow: hidden; }
.exhibit .polaroid-sm svg { width: 100%; height: 100%; display: block; }
.exhibit .polaroid-sm figcaption { position: absolute; left: 12px; bottom: 9px; font: 500 22px Caveat, cursive; color: #2b2a26; }
.exhibit .doc { font-size: 12.5px; padding: 54px 16px 54px; }

/* ---------- messages ---------- */
.thread { margin-bottom: 22px; }
.thread-head { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid rgba(226, 184, 119, 0.12); }
.thread-head .av { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(180deg, #4a5560, #2a3036); display: grid; place-items: center; font: 600 15px var(--body); color: #dfe4e8; flex: none; }
.thread-head b { display: block; font-weight: 600; font-size: 16px; }
.thread-head small { color: var(--fog); font-size: 12px; }
.bubble { display: inline-block; max-width: 86%; background: #26292b; padding: 12px 16px; border-radius: 20px 20px 20px 6px; font-size: 17px; line-height: 1.4; }
.delivered { color: var(--fog); font-size: 11.5px; margin: 6px 0 0 4px; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 20; overflow: auto;
  background: radial-gradient(110% 70% at 50% 0%, #121e22, #05090a 70%);
  padding: calc(26px + env(safe-area-inset-top)) 20px calc(26px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; animation: ovIn 0.45s ease both;
}
@keyframes ovIn { from { opacity: 0; } to { opacity: 1; } }
.overlay.slim { inset: auto 0 calc(66px + env(safe-area-inset-bottom)) 0; background: none; padding: 12px 16px; animation: none; overflow: visible; }
.ov-center { margin: auto 0; text-align: center; display: grid; gap: 12px; justify-items: center; }
.overlay h2 { font: 400 38px/1.05 var(--display); margin: 0; }
.overlay h2.big { font-style: italic; font-size: 50px; }
.overlay p { color: var(--fog); margin: 0; line-height: 1.55; font-size: 15.5px; max-width: 30em; }
.ov-center.good h2 { color: var(--solved); }
.ov-center.bad h2 { color: #e0948a; }
.guest-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; max-width: 330px; margin-top: 18px; }
.guest-grid div { display: grid; gap: 6px; justify-items: center; font-size: 13px; color: var(--fog); }
.guest-grid .frame-bust { width: 80px; border: 1px solid rgba(226, 184, 119, 0.3); }
.guest-grid .me { color: var(--candle); font-weight: 600; }
.guest-grid .me .frame-bust { border-color: var(--brass); box-shadow: 0 0 16px rgba(226, 184, 119, 0.35); }
.linkish { background: none; border: 0; color: var(--fog); text-decoration: underline; text-underline-offset: 3px; font-size: 13.5px; margin-top: 16px; cursor: pointer; }
.ringer { position: relative; width: 84px; height: 140px; margin-bottom: 18px; border-radius: 18px; border: 2px solid rgba(226, 184, 119, 0.6); animation: ringer 1.8s ease-in-out infinite; }
.ringer::after { content: ""; position: absolute; top: 8px; left: 50%; width: 26px; height: 6px; margin-left: -13px; border-radius: 3px; background: rgba(226, 184, 119, 0.6); }
@keyframes ringer { 0%, 40%, 100% { transform: rotate(0); } 5%, 15%, 25% { transform: rotate(-9deg); } 10%, 20%, 30% { transform: rotate(9deg); } }
.tv-glyph { width: 120px; height: 76px; border: 2px solid rgba(226, 184, 119, 0.6); border-radius: 6px; position: relative; margin-bottom: 18px; }
.tv-glyph::after { content: ""; position: absolute; left: 50%; bottom: -14px; width: 50px; height: 2px; margin-left: -25px; background: rgba(226, 184, 119, 0.6); }

.ov-vote { display: grid; gap: 14px; }
.ov-vote h2 { margin: 4px 0 6px; }
.vote-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vote-opt { position: relative; padding: 0; border: 1px solid rgba(226, 184, 119, 0.18); background: rgba(8, 13, 15, 0.9); text-align: left; overflow: hidden; }
.vote-opt .frame-bust { width: 100%; }
.vote-opt .vo-text { display: grid; padding: 10px 12px 12px; gap: 2px; }
.vote-opt b { font: 400 18px/1.15 var(--display); }
.vote-opt small { color: var(--fog); font-size: 12px; }
.vote-opt.on { border-color: var(--oxblood-ink); box-shadow: 0 0 0 2px var(--oxblood-ink), 0 0 30px rgba(163, 58, 53, 0.35); }
.vote-opt.on::after { content: "Accused"; position: absolute; top: 14px; right: -30px; transform: rotate(35deg); background: var(--oxblood-ink); color: #fff; font: 700 10px var(--body); letter-spacing: 0.2em; text-transform: uppercase; padding: 5px 34px; }
.accuse {
  position: relative; height: 64px; border: 0; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  background: rgba(142, 43, 43, 0.25); color: #f3d6d0; font: 600 14px var(--body); letter-spacing: 0.2em; text-transform: uppercase;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}
.accuse::before { content: ""; position: absolute; inset: 0; background: var(--oxblood-ink); transform: scaleX(0); transform-origin: left; }
.accuse.holding::before { transform: scaleX(1); transition: transform 1s linear; }
.accuse span { position: relative; }
.accuse:disabled { opacity: 0.35; }
.vd-portrait { width: 200px; margin-top: 8px; }
.vd-portrait .frame-bust { width: 200px; background: transparent; }

.toast {
  position: fixed; left: 14px; right: 14px; top: calc(12px + env(safe-area-inset-top)); z-index: 30;
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(180deg, rgba(26, 38, 42, 0.98), rgba(12, 19, 21, 0.98)); color: var(--candle);
  border: 1px solid rgba(226, 184, 119, 0.4);
  padding: 14px 16px; font-size: 14.5px; font-weight: 500;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.toast .icon { width: 20px; height: 20px; color: var(--brass); flex: none; }
.toast.in { animation: toastIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes toastIn { from { transform: translateY(-140%); } to { transform: none; } }
