@charset "UTF-8";
:root {
  color-scheme: dark;
  --paper: #eee8d9;
  --ink: #171717;
  --muted: #bbb7af;
  --red: #bf392c;
  --line: #ffffff25;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  color: var(--paper);
  background: var(--ink);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100dvh;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}
button,
summary {
  cursor: pointer;
}
button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #242424;
  color: var(--paper);
  padding: 10px 16px;
  font-weight: 700;
}
button:hover {
  background: #39342e;
}
button:disabled {
  opacity: 0.42;
  cursor: default;
}
a {
  color: inherit;
  text-decoration: none;
}
input,
select {
  min-height: 46px;
  border: 1px solid #ffffff40;
  background: #171717;
  color: var(--paper);
  border-radius: 2px;
  padding: 11px 12px;
  min-width: 0;
  width: 100%;
}
input::placeholder {
  color: #aaa59b;
}
input:focus-visible,
button:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid #f1c393;
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.city {
  position: fixed;
  inset: 0;
  background: url("/mafia/assets/noir-city.png") center/cover;
  z-index: -3;
}
.city:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #1119 0%, transparent 75%);
}
.grain {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(0deg, #1115, transparent 55%);
}
.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 5vw;
  border-bottom: 1px solid #ffffff21;
  background: #15151545;
}
.brand {
  font-family: Arial, sans-serif;
  font-size: 17px;
  letter-spacing: 2px;
  font-weight: 900;
}
.brand span {
  font-weight: 400;
  color: #bfbab0;
  margin-left: 8px;
  font-size: 12px;
}
#connection {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 2px;
  color: #d1c7b6;
}
.entry {
  min-height: calc(100dvh - 76px);
  padding: 5vh 7vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  max-width: 650px;
}
.edition,
.eyebrow {
  font-family: Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #c4b6a6;
}
.title h1 {
  font-size: clamp(68px, 8vw, 120px);
  line-height: 0.94;
  letter-spacing: -8px;
  margin: 20px 0 24px;
  font-weight: 900;
}
.title h1 > span:first-child {
  font-size: 0.37em;
  letter-spacing: 1px;
}
.title .dot {
  color: #d64b37;
}
.title-rule {
  height: 3px;
  width: 47px;
  background: #c54531;
}
.entry-controls {
  width: min(100%, 360px);
  display: grid;
  gap: 12px;
}
.entry-controls > label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}
.primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.primary:hover {
  background: #d44b3b;
}
.mode {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 20px;
  min-height: 60px;
  padding: 14px 20px;
}
.join-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.join-line input {
  text-transform: uppercase;
  letter-spacing: 3px;
}
details {
  background: #181818ed;
  border: 1px solid var(--line);
  padding: 0 16px;
}
summary {
  list-style: none;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}
summary::-webkit-details-marker {
  display: none;
}
details > button {
  width: 100%;
  margin: 12px 0 16px;
}
.settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.settings label {
  font-size: 12px;
  display: grid;
  gap: 6px;
}
.wide {
  grid-column: 1/-1;
}
body.playing .city {
  filter: brightness(0.18) saturate(0.35);
  transition: filter 1s;
}
body.night .city {
  filter: brightness(0.1) saturate(0.1);
}
.game {
  max-width: 1500px;
  margin: auto;
  padding: 28px 4vw;
}
.game-heading {
  display: flex;
  align-items: center;
  gap: 25px;
  margin-bottom: 24px;
}
.game-heading h1 {
  font-size: 34px;
  margin: 5px 0;
  letter-spacing: -1px;
}
.clock {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-left: auto;
}
.clock span {
  color: var(--muted);
  font-size: 12px;
}
.clock strong {
  font-family: Georgia, serif;
  font-variant-numeric: tabular-nums;
  font-size: 44px;
  font-weight: 400;
}
#copy-code {
  letter-spacing: 3px;
  font-family: monospace;
  color: #e2b59b;
}
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(290px, 1fr);
  gap: 28px;
}
.table-area {
  min-width: 0;
}
.table-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}
.roster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 174px));
  justify-content: start;
  gap: 10px;
  padding: 20px 0;
}
.person {
  position: relative;
  overflow: hidden;
  text-align: left;
  padding: 0;
  min-width: 0;
  border: 1px solid #ffffff25;
  background: #282723;
}
.portrait {
  display: block;
  height: 105px;
  background: linear-gradient(150deg, #887962, #37342e);
  position: relative;
  overflow: hidden;
}
.portrait:before {
  content: "";
  position: absolute;
  width: 34px;
  height: 39px;
  left: calc(50% - 17px);
  top: 26px;
  background: #171717;
  border-radius: 42% 48% 45% 45%;
}
.portrait:after {
  content: "";
  position: absolute;
  width: 85px;
  height: 70px;
  left: calc(50% - 42px);
  top: 59px;
  background: #171717;
  clip-path: polygon(24% 0, 43% 6%, 50% 27%, 57% 6%, 76% 0, 100% 100%, 0 100%);
}
.person:nth-child(3n) .portrait:before {
  border-radius: 48% 48% 16% 16%;
  height: 51px;
  top: 18px;
}
.person:nth-child(3n + 1) .portrait:before {
  box-shadow: 0 -5px 0 3px #171717;
}
.person:nth-child(2n) .portrait {
  background: linear-gradient(130deg, #7b8078, #393d3a);
}
.person .seat {
  position: absolute;
  top: 8px;
  left: 9px;
  font-family: Georgia, serif;
  font-size: 17px;
  color: #e8dac3;
}
.person .person-name {
  display: block;
  padding: 10px 9px 3px;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person small {
  display: block;
  padding: 0 9px 10px;
  font-size: 10px;
  color: #c0b7a9;
}
.person.dead {
  opacity: 0.45;
}
.person.dead .portrait:after {
  transform: rotate(17deg) translateY(10px);
}
.person.self {
  border-color: #e3c6a6;
}
.person.selected {
  outline: 2px solid #cb5342;
  outline-offset: 1px;
}
.person.ally small {
  color: #f6a89d;
}
.action-dock {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
#my-status {
  font-size: 13px;
  color: #d2c8bb;
}
.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.role-panel {
  border-left: 3px solid #c74b37;
  background: #171717;
  padding: 20px;
  margin: 15px 0;
}
.role-panel h2 {
  font-size: 28px;
  margin: 12px 0;
}
.role-panel p {
  color: #d3c2ad;
  font-size: 13px;
}
.ledger {
  margin-top: 26px;
}
.ledger h2,
.chat-panel h2 {
  font-size: 15px;
  margin: 0;
}
.ledger h2 {
  margin-bottom: 15px;
}
.event {
  border-top: 1px solid var(--line);
  padding: 12px 0;
  font-size: 12px;
  line-height: 1.8;
  color: #c7c0b5;
}
.event strong {
  color: var(--paper);
  display: block;
  font-size: 13px;
}
.ballots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.ballots span {
  border: 1px solid var(--line);
  padding: 3px 6px;
  font-size: 11px;
}
.chat-panel {
  min-width: 0;
  height: min(640px, calc(100dvh - 220px));
  min-height: 330px;
  display: flex;
  flex-direction: column;
  background: #1e1e1cf2;
  border: 1px solid var(--line);
}
.chat-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.chat-panel select {
  width: auto;
  min-height: 40px;
  font-size: 12px;
  padding: 8px;
}
.messages {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px 16px;
  min-height: 140px;
}
.empty-messages {
  max-width: 220px;
  margin: auto;
  padding: 18px 0;
  color: #929b9d;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}
.message {
  margin: 0 0 17px;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.message strong {
  display: block;
  font-size: 11px;
  color: #bea78f;
  margin-bottom: 3px;
}
.message.mine {
  border-left: 2px solid #ac4c3e;
  padding-left: 10px;
}
.message .message-time {
  font-size: 9px;
  margin-left: 8px;
  color: #aaa49a;
}
.chat-panel form {
  display: flex;
  padding: 10px;
  gap: 8px;
  border-top: 1px solid var(--line);
}
.chat-panel form input {
  background: #131313;
  font-size: 14px;
}
.chat-panel form button {
  background: var(--red);
  font-size: 22px;
  min-width: 46px;
}
.chat-panel[data-silent="true"] form {
  opacity: 0.45;
}
#notice {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 28px);
  background: #eee8d9;
  color: #222;
  padding: 0;
  z-index: 30;
  font-size: 14px;
  box-shadow: 0 5px 30px #0006;
}
#notice:not(:empty) {
  padding: 13px 20px;
}
.loading {
  position: fixed;
  inset: 0;
  background: #141414ed;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 25px;
}
.loading-silhouette {
  width: 150px;
  height: 190px;
  background: url("/mafia/assets/silhouettes.png") 0 0 / 300% 200%;
  mask-image: linear-gradient(#000 65%, transparent);
}
.loading-line {
  height: 2px;
  width: 100px;
  background: #bb3d2f;
  animation: breathe 1s infinite alternate;
}
.cinematic {
  position: fixed;
  inset: 76px 0 0;
  z-index: 20;
  pointer-events: none;
  background: linear-gradient(110deg, #111f, #26100ef2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  animation: scene 4s both;
}
.cinematic strong {
  font-size: clamp(44px, 9vw, 100px);
  letter-spacing: -4px;
}
#cinematic-day {
  letter-spacing: 6px;
  color: #c39374;
  font-size: 12px;
}
.cinematic > span:last-child {
  font-size: 24px;
}
.cinematic.execution:before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 44%,
    #bc382b38 44%,
    #bc382b38 48%,
    transparent 48%
  );
  animation: slash 0.65s 0.5s both;
}
.cinematic.execution strong {
  animation: fall 0.7s 1s both;
}
dialog {
  max-width: calc(100vw - 30px);
  width: 360px;
  border: 1px solid #766757;
  background: #20201e;
  color: var(--paper);
  padding: 24px;
}
dialog::backdrop {
  background: #000a;
}
.dialog-close {
  float: right;
  border: 0;
  background: none;
  font-size: 24px;
  margin: -12px -12px 0 0;
}
#player-actions {
  display: grid;
  gap: 10px;
}
#player-actions p {
  font-size: 13px;
  color: var(--muted);
}
@keyframes breathe {
  to {
    transform: scaleX(0.3);
    opacity: 0.4;
  }
}
@keyframes scene {
  0% {
    opacity: 0;
    transform: translateY(15px);
  }
  12%,
  75% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}
@keyframes slash {
  from {
    transform: translateX(-60%);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes fall {
  to {
    transform: translateY(15px) rotate(-2deg);
    opacity: 0.45;
  }
}
@media (min-width: 1500px) {
  .entry {
    padding-left: 10vw;
    max-width: 800px;
  }
  .title h1 {
    font-size: 130px;
  }
}
@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 18px;
  }
  .game {
    padding: 22px;
  }
  .roster {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .portrait {
    height: 85px;
  }
  .game-heading h1 {
    font-size: 28px;
  }
  .clock strong {
    font-size: 36px;
  }
}
@media (max-width: 640px) {
  .topbar {
    height: 60px;
    padding: 0 20px;
  }
  .brand {
    font-size: 13px;
  }
  .brand span {
    font-size: 10px;
  }
  .city {
    background-position: 63% center;
  }
  .city:after {
    background:
      linear-gradient(90deg, #111d, #1113),
      linear-gradient(0deg, #111c, transparent 75%);
  }
  .entry {
    min-height: calc(100dvh - 60px);
    padding: 35px 25px;
    gap: 30px;
    justify-content: space-between;
  }
  .title h1 {
    font-size: 82px;
    letter-spacing: -5px;
  }
  .entry-controls {
    width: 100%;
  }
  .edition {
    font-size: 9px;
    letter-spacing: 2px;
  }
  .game {
    padding: 18px 16px;
  }
  .game-heading {
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
  }
  .game-heading h1 {
    font-size: 25px;
  }
  .clock {
    gap: 8px;
  }
  .clock strong {
    font-size: 32px;
  }
  #copy-code {
    font-size: 11px;
    padding: 8px;
    min-height: 40px;
  }
  .game-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  .table-area {
    display: contents;
  }
  .table-heading {
    order: 0;
  }
  .roster {
    order: 1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    padding: 0;
  }
  .portrait {
    height: 75px;
  }
  .portrait:before {
    top: 15px;
    width: 29px;
    height: 33px;
    left: calc(50% - 14px);
  }
  .portrait:after {
    top: 44px;
  }
  .person:nth-child(3n) .portrait:before {
    top: 10px;
    height: 44px;
  }
  .person .person-name {
    font-size: 11px;
    padding: 7px 5px 2px;
  }
  .person small {
    font-size: 9px;
    padding: 0 5px 7px;
  }
  .person .seat {
    font-size: 13px;
    top: 5px;
    left: 5px;
  }
  .action-dock {
    order: 2;
    padding: 10px 0;
  }
  .role-panel {
    order: 3;
    margin: 0;
  }
  .chat-panel {
    order: 4;
    height: 370px;
    min-height: 280px;
  }
  .ledger {
    order: 5;
    margin-top: 0;
  }
  .controls button {
    padding: 9px 12px;
    font-size: 12px;
  }
  .cinematic {
    inset: 60px 0 0;
  }
  .cinematic strong {
    letter-spacing: -2px;
  }
}
@media (max-height: 500px) and (min-width: 641px) {
  .topbar {
    height: 52px;
  }
  .entry {
    padding: 25px 6vw;
    display: grid;
    grid-template-columns: 1fr 320px;
    max-width: 100%;
    min-height: calc(100dvh - 52px);
  }
  .title h1 {
    font-size: 80px;
  }
  .game {
    padding-top: 14px;
  }
  .game-heading {
    margin-bottom: 10px;
  }
  .chat-panel {
    height: 310px;
  }
  .cinematic {
    inset: 52px 0 0;
  }
  .game-heading h1 {
    font-size: 24px;
  }
  .clock strong {
    font-size: 28px;
  }
  .roster {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 0;
  }
  .room-rules {
    margin-top: 6px;
  }
  .room-rules summary {
    min-height: 32px;
  }
  .table-heading {
    padding-bottom: 6px;
  }
  .person .person-name {
    font-size: 11px;
    padding: 5px 4px 2px;
  }
  .person small {
    font-size: 9px;
    padding: 0 4px 5px;
  }
  .action-dock {
    padding: 6px 0;
    position: sticky;
    bottom: 0;
    background: #171717f5;
    z-index: 5;
  }
  .chat-panel {
    height: calc(100dvh - 145px);
    min-height: 220px;
  }
  .messages {
    min-height: 60px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
  .cinematic {
    opacity: 1;
  }
  .loading-line {
    opacity: 0.7;
  }
}

.rule-description {
  font-size: 12px;
  line-height: 1.8;
  color: #d2c7b8;
  margin: 10px 0 16px;
}
.room-rules {
  margin-top: 14px;
}
.room-rules summary {
  font-size: 12px;
  min-height: 42px;
}
@media (max-width: 640px) {
  .room-rules {
    order: 0;
    margin: 0;
  }
}

.setting-label {
  display: grid;
  gap: 7px;
  font-size: 12px;
}
.check-setting {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
}
.check-setting input {
  width: 18px;
  min-height: 18px;
  accent-color: #bf392c;
}

.person .portrait,
.person:nth-child(2n) .portrait {
  height: auto;
  aspect-ratio: 1.1;
  background-image: url("/mafia/assets/silhouettes.png");
  background-size: 300% 200%;
  background-position: 0 0;
}
.person .portrait:before,
.person .portrait:after {
  display: none;
}
.person:nth-child(6n + 2) .portrait {
  background-position: 50% 0;
}
.person:nth-child(6n + 3) .portrait {
  background-position: 100% 0;
}
.person:nth-child(6n + 4) .portrait {
  background-position: 0 100%;
}
.person:nth-child(6n + 5) .portrait {
  background-position: 50% 100%;
}
.person:nth-child(6n + 6) .portrait {
  background-position: 100% 100%;
}
.person .seat {
  background: #161616b0;
  padding: 2px 5px;
}
.person.dead .portrait {
  filter: grayscale(1);
}
body.finished .person.dead {
  opacity: 0.85;
}

.cinematic-figure {
  width: 170px;
  aspect-ratio: 1;
  background: url("/mafia/assets/silhouettes.png") 0 0 / 300% 200%;
  mix-blend-mode: luminosity;
  opacity: 0.8;
  mask-image: linear-gradient(#000 60%, transparent);
}
.cinematic.execution[data-eliminated="true"] .cinematic-figure {
  animation: silhouette-fall 1.8s 0.5s ease-in forwards;
}
@keyframes silhouette-fall {
  35% {
    transform: translateX(6px);
    filter: brightness(2);
  }
  100% {
    transform: translate(24px, 65px) rotate(18deg);
    opacity: 0;
  }
}
@media (max-height: 500px) {
  .cinematic-figure {
    width: 95px;
  }
}
.claim-panel {
  margin: 16px 0;
}
.claim-panel summary {
  font-size: 13px;
}
.claim-visibility {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 12px;
}
.claim-panel label {
  font-size: 12px;
  display: grid;
  gap: 5px;
}
.claim-panel form {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
}
@media (max-width: 640px) {
  .claim-panel {
    order: 5;
    margin: 0;
  }
}

/* Silhouette noir controls: shared tokens keep lobby and game consistent. */
@font-face {
  font-family: Pretendard;
  src: url("./fonts/PretendardVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --paper: #eeeae4;
  --ink: #131718;
  --muted: #a9afb0;
  --red: #ad303b;
  --line: #ffffff24;
  font-family: Pretendard, "Apple SD Gothic Neo", sans-serif;
}
body {
  background: #131718;
}
.city {
  position: absolute;
  height: 240px;
  opacity: 0.32;
  background-position: center 45%;
}
.city:after {
  background: linear-gradient(0deg, #131718, transparent);
}
.grain {
  display: none;
}
.topbar {
  height: 76px;
  background: #14181980;
  padding: 0 max(24px, 4vw);
  border-bottom: 1px solid #ffffff20;
}
.brand {
  font-family: inherit;
  font-weight: 800;
  letter-spacing: 1px;
}
.brand span {
  color: #ee6970;
  font-weight: 700;
  font-size: 14px;
}
button {
  border-radius: 6px;
  background: linear-gradient(#2b3032, #232729);
  border-color: #ffffff30;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  min-height: 44px;
  box-shadow: inset 0 1px #ffffff08;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.1s;
}
button:hover {
  background: #343b3d;
  border-color: #ffffff60;
}
button:active:not(:disabled) {
  transform: translateY(1px);
  background: #1d2224;
}
button.primary {
  background: linear-gradient(#b93643, #982631);
  border-color: #d4525c;
  color: #fff5f2;
  box-shadow: inset 0 1px #ffffff20;
}
button.primary:hover {
  background: #c03d48;
}
button.primary:active:not(:disabled) {
  background: #8f2430;
}
button:disabled {
  opacity: 1;
  background: #33383a;
  border-color: #444b4d;
  color: #8b9295;
  box-shadow: none;
}
input,
select {
  font-size: 15px;
  border-radius: 6px;
  min-height: 44px;
  background: #1c2123;
  border-color: #ffffff30;
  color: #eeeae4;
  padding: 10px 12px;
}
input:focus-visible,
button:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid #efc987;
  outline-offset: 3px;
}
.entry {
  max-width: 1440px;
  margin: auto;
  min-height: calc(100dvh - 76px);
  padding: 36px 4vw;
  display: block;
}
.directory-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.directory-heading h1 {
  font-size: 38px;
  letter-spacing: -1.3px;
  margin: 6px 0 0;
  font-weight: 800;
}
.directory-heading .eyebrow {
  font-family: inherit;
  color: #aeb6b7;
  letter-spacing: 2px;
}
.directory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
}
.room-directory {
  min-width: 0;
}
.directory-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}
.directory-toolbar input {
  flex: 1;
}
.directory-toolbar select {
  width: 128px;
}
.room-columns,
.room-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 75px 90px 80px;
  gap: 14px;
  align-items: center;
  text-align: left;
}
.room-columns {
  font-size: 12px;
  color: #aeb6b7;
  background: #ffffff05;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.room-list {
  min-height: 330px;
}
.room-row {
  width: 100%;
  min-height: 72px;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid #ffffff13;
  background: transparent;
  padding: 16px;
  box-shadow: none;
  font-size: 13px;
  font-weight: 400;
}
.room-row span:first-child {
  font-size: 16px;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.room-row span:not(:first-child) {
  color: #c0c6c7;
  font-variant-numeric: tabular-nums;
}
.room-row:hover {
  background: #ffffff06;
}
.room-row[aria-pressed="true"] {
  background: #9f303427;
  box-shadow: inset 3px 0 #d65660;
}
.directory-empty {
  padding: 88px 20px;
  text-align: center;
  font-size: 14px;
  color: #9da6a8;
  line-height: 1.8;
}
.directory-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  gap: 12px;
  font-size: 13px;
  color: #aeb6b7;
}
.entry-controls {
  width: 100%;
  padding: 18px;
  background: #1a1f21;
  border: 1px solid #ffffff16;
  border-radius: 8px;
  gap: 12px;
}
.entry-controls h2 {
  font-size: 23px;
  letter-spacing: -0.5px;
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}
.selected-room-info {
  font-size: 13px;
  color: #acb6b8;
  line-height: 1.65;
  margin: 0 0 8px;
}
.room-preview {
  height: 108px;
  background:
    linear-gradient(0deg, #1a1f21aa, transparent),
    url("./noir-city.png") center 45% / cover;
  border-radius: 4px;
  filter: saturate(0.3);
}
.entry-controls .mode {
  font-size: 15px;
  min-height: 44px;
  padding: 10px 16px;
  order: 5;
}
.entry-controls #resume {
  order: 6;
}
.font-license {
  order: 7;
  text-align: center;
  font-size: 11px;
  color: #9ba3a4;
  padding-top: 4px;
}
.entry-controls details {
  border: 1px solid var(--line);
  padding: 0 12px;
  border-radius: 6px;
  background: #171c1e;
}
.entry-controls summary {
  padding: 14px 0;
  font-size: 14px;
  font-weight: 600;
}
.entry-controls .settings {
  gap: 12px;
}
.entry-controls label {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0;
}
.entry-controls #create {
  width: 100%;
  margin: 10px 0 14px;
}
.join-line {
  grid-template-columns: minmax(0, 1fr) 105px;
}
.join-line input {
  font-size: 13px;
  letter-spacing: 1px;
}
.rule-description {
  color: #adb6b8;
  font-size: 12px;
  line-height: 1.7;
}
.game {
  max-width: 1440px;
  margin: auto;
}
.game-heading h1 {
  letter-spacing: -1px;
}
.chat-panel {
  background: #191f21;
  border-color: #ffffff20;
  border-radius: 8px;
}
.table-area {
  background: #171d1ee8;
}
.roster .player {
  border-radius: 6px;
}
.action-dock {
  background: #1b2325;
}
.clock strong {
  font-variant-numeric: tabular-nums;
  color: #e9c7be;
}
@media (max-width: 900px) {
  .directory-layout {
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 16px;
  }
  .room-columns,
  .room-row {
    grid-template-columns: minmax(0, 1fr) 58px 66px;
    gap: 8px;
  }
  .room-columns span:nth-child(3),
  .room-row span:nth-child(3) {
    display: none;
  }
  .entry {
    padding: 24px;
  }
  .room-row {
    padding: 14px 10px;
  }
  .room-row span:first-child {
    font-size: 14px;
  }
}
@media (max-width: 650px) {
  .topbar {
    height: 64px;
    padding: 0 18px;
    gap: 10px;
  }
  .brand {
    font-size: 14px;
  }
  .entry {
    padding: 24px 18px;
  }
  .directory-heading h1 {
    font-size: 30px;
  }
  .directory-heading {
    margin-bottom: 20px;
  }
  .directory-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .room-list {
    min-height: 160px;
  }
  .directory-empty {
    padding: 40px 10px;
  }
  .room-preview {
    height: 100px;
  }
  .entry-controls {
    padding: 16px;
  }
  .room-columns,
  .room-row {
    grid-template-columns: minmax(0, 1fr) 58px 66px;
  }
  .directory-heading button {
    font-size: 14px;
    padding: 10px 14px;
  }
  .game-heading {
    gap: 10px;
  }
}
.city {
  z-index: 0;
  pointer-events: none;
  opacity: 0.42;
}
.topbar,
main {
  position: relative;
  z-index: 1;
}
.topbar {
  background: linear-gradient(90deg, #131718e8, #13171855);
}

/* Entry navigation: the main menu precedes joining and creation. */
.main-menu {
  min-height: calc(100dvh - 150px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 5vh 3vw;
  max-width: 520px;
}
.main-menu h1 {
  font-size: clamp(76px, 10vw, 136px);
  font-weight: 850;
  letter-spacing: -0.07em;
  line-height: 1.1;
  margin: 16px 0 44px;
}
.main-menu h1 span {
  color: #c8424e;
}
.main-menu-actions {
  display: grid;
  gap: 14px;
  width: min(100%, 320px);
}
.main-menu-actions button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
  padding: 16px 22px;
  font-size: 18px;
  font-weight: 650;
}
.main-menu-actions button span {
  font-size: 22px;
  font-weight: 400;
}
body.menu-home:not(.playing) .city {
  height: 100dvh;
  opacity: 0.65;
  background-position: 65% center;
}
.menu-home:not(.playing) .city:after {
  background:
    linear-gradient(90deg, #131718f0 8%, #13171877 52%, #13171822),
    linear-gradient(0deg, #131718, transparent 40%);
}
.menu-back {
  margin-bottom: 24px;
  background: transparent;
  border-color: transparent;
  padding-left: 0;
  color: #b5bdbf;
  box-shadow: none;
}
.entry[data-screen="join"] #friend-settings {
  display: none;
}
.entry[data-screen="create"] .room-directory,
.entry[data-screen="create"] #open-create,
.entry[data-screen="create"] .room-preview,
.entry[data-screen="create"] #selected-room-title,
.entry[data-screen="create"] #selected-room-info,
.entry[data-screen="create"] #match,
.entry[data-screen="create"] .join-line,
.entry[data-screen="create"] #join-password-label {
  display: none;
}
.entry[data-screen="create"] .directory-layout {
  display: block;
  max-width: 680px;
  margin: 0 auto;
}
.entry[data-screen="create"] .directory-heading {
  max-width: 680px;
  margin: 0 auto 24px;
}
.entry[data-screen="create"] #friend-settings {
  border: 0;
  padding: 0;
  background: none;
}
.entry[data-screen="create"] #friend-settings > summary {
  display: none;
}
.entry[data-screen="create"] .entry-controls {
  padding: 28px;
}
.entry[data-screen="create"] .entry-controls .settings {
  margin-top: 10px;
}
.entry[data-screen="create"] #create {
  margin-bottom: 0;
  min-height: 48px;
}
@media (max-width: 650px) {
  .main-menu {
    min-height: calc(100dvh - 120px);
    padding: 16px 4px;
  }
  .main-menu h1 {
    margin-bottom: 36px;
  }
  .main-menu-actions {
    width: 100%;
    max-width: 320px;
  }
  .entry[data-screen="create"] .entry-controls {
    padding: 18px;
  }
  .menu-back {
    margin-bottom: 16px;
  }
}
@media (max-height: 450px) and (min-width: 651px) {
  .main-menu {
    min-height: 240px;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 300px;
    max-width: none;
    align-items: center;
    column-gap: 40px;
  }
  .main-menu .eyebrow {
    grid-column: 1/-1;
  }
  .main-menu h1 {
    font-size: 76px;
    margin: 0;
  }
  .main-menu-actions {
    grid-column: 2;
  }
}
.settings-heading {
  font-size: 14px;
  font-weight: 650;
  margin: 16px 0 8px;
  color: #ddd9d2;
}
.entry-error {
  margin: 0;
  color: #ffb3b8;
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 12px;
  border-left: 2px solid #d15b66;
  background: #ad303b15;
}
.join-shortcuts {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.join-shortcuts button {
  font-size: 14px;
  min-height: 44px;
}
.join-shortcuts .mode {
  display: flex;
  gap: 18px;
  align-items: center;
}

/* Mobile play prioritizes conversation, independent of participant count. */
.mobile-game-tools,
.mobile-panel-close {
  display: none;
}
#chat-input {
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
  min-height: 44px;
  max-height: 92px;
  resize: none;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  color: var(--paper);
  background: #131719;
  border: 1px solid #ffffff30;
  border-radius: 6px;
}
#chat-input:focus-visible {
  outline: 2px solid #efc987;
  outline-offset: 1px;
}
.new-messages {
  align-self: center;
  min-height: 36px;
  font-size: 12px;
  margin: 4px 0;
}
.chat-panel form {
  flex-shrink: 0;
  align-items: flex-end;
}
@media (max-width: 650px) {
  body.playing {
    overflow: hidden;
  }
  body.playing > .topbar {
    display: none;
  }
  body.playing main {
    position: fixed;
    inset: var(--chat-top, 0px) 0 auto;
    height: var(--chat-viewport, 100dvh);
    overflow: hidden;
  }
  .game {
    height: 100%;
    padding: env(safe-area-inset-top, 0px) 10px 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .game-heading {
    flex-shrink: 0;
    min-height: 52px;
    height: 52px;
    padding: 4px 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 0;
  }
  .game-heading h1 {
    font-size: 20px;
    line-height: 1.2;
    margin: 0;
  }
  .game-heading .eyebrow {
    display: none;
  }
  .clock {
    display: flex;
    gap: 8px;
    align-items: center;
  }
  .clock strong {
    font-size: 24px;
  }
  .clock #day {
    font-size: 12px;
  }
  .game-heading #copy-code {
    font-size: 11px;
    padding: 8px;
    min-height: 36px;
  }
  .mobile-game-tools {
    display: flex;
    flex-shrink: 0;
    padding: 4px 0 8px;
  }
  .mobile-game-tools button {
    width: 100%;
    min-height: 40px;
    font-size: 13px;
  }
  .game-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 0;
    overflow: hidden;
  }
  .chat-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 6px 6px 0 0;
    display: flex;
    flex-direction: column;
  }
  .chat-panel > header {
    padding: 4px 10px;
    min-height: 40px;
    flex-shrink: 0;
  }
  .chat-panel h2 {
    font-size: 14px;
    margin: 0;
  }
  .chat-panel select {
    min-height: 32px;
    padding: 4px 8px;
  }
  .messages {
    min-height: 0;
    padding: 10px 12px;
    flex: 1;
  }
  .message {
    font-size: 15px;
    margin-bottom: 14px;
  }
  .message strong {
    font-size: 12px;
  }
  .chat-panel form {
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
    margin: 0;
  }
  .chat-panel form button {
    min-height: 44px;
    height: 44px;
  }
  .table-area {
    display: none;
  }
  .mobile-actions-open .table-area {
    display: block;
    position: absolute;
    z-index: 5;
    inset: 52px 0 0;
    background: #171d1f;
    overflow: auto;
    padding: 12px 12px max(20px, env(safe-area-inset-bottom));
    border: 1px solid #ffffff30;
    border-radius: 12px 12px 0 0;
    overscroll-behavior: contain;
  }
  .mobile-panel-close {
    display: block;
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 6;
    margin-bottom: 14px;
    background: #343d40;
  }
  .mobile-actions-open .chat-panel {
    visibility: hidden;
  }
  .mobile-actions-open .mobile-game-tools {
    visibility: hidden;
  }
  .chat-typing .game-heading {
    height: 40px;
    min-height: 40px;
  }
  .chat-typing .mobile-game-tools {
    padding: 0 0 4px;
  }
  .chat-typing .mobile-game-tools button {
    min-height: 32px;
    font-size: 12px;
    padding: 5px 10px;
  }
  .chat-typing .chat-panel > header {
    min-height: 32px;
    padding: 0 8px;
  }
  .table-area .action-dock {
    position: static;
  }
  .table-area .roster {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.mobile-panel-session {
  display: none;
}
@media (max-width: 650px) {
  .mobile-panel-session {
    display: flex;
    gap: 8px;
    margin: 0 0 12px;
  }
}

/* The game board stays visible on tablets; only phone-sized screens switch views. */
.submission-mark {
  position: absolute;
  right: 8px;
  top: 7px;
  z-index: 2;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d9c18d;
  color: #1a1d1d;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 2px 8px #0008;
}
#phase-guide,
#chat-toggle,
#sound-toggle {
  min-height: 38px;
  padding: 8px 11px;
  font-size: 12px;
  white-space: nowrap;
}
.chat-collapsed .game-layout {
  grid-template-columns: minmax(0, 1fr) 0;
}
.chat-collapsed .chat-panel {
  min-width: 0;
  overflow: hidden;
  border-width: 0;
  opacity: 0;
  pointer-events: none;
}
.game-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid #e6c68e66;
  border-radius: 8px;
  padding: clamp(24px, 5vw, 48px);
  background:
    linear-gradient(145deg, #252b2cf8, #111516fa),
    url("/mafia/assets/noir-city.png") center / cover;
  box-shadow: 0 24px 80px #000b;
}
.game-dialog::backdrop {
  background: #050708df;
  backdrop-filter: blur(4px);
}
.dialog-kicker {
  color: #ddbd83;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 800;
}
.game-dialog h2 {
  margin: 12px 0;
  font-size: clamp(32px, 7vw, 54px);
  line-height: 1;
}
.game-dialog p,
.briefing-role-copy {
  color: #e5ddd0;
  font-size: 15px;
  line-height: 1.75;
}
.briefing-role-copy {
  border-left: 2px solid #bc493d;
  padding-left: 13px;
  margin: 18px 0 28px;
}
.briefing-silhouette {
  height: 160px;
  margin: 12px -10px 4px auto;
  width: 150px;
  background: url("/mafia/assets/silhouettes.png") 50% 0 / 300% 200%;
  opacity: 0.7;
  mask-image: linear-gradient(#000 55%, transparent);
}
.briefing-dialog button {
  width: 100%;
}
.vote-dialog {
  width: min(480px, calc(100vw - 32px));
}
.vote-dialog-timer {
  margin: 25px 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-top: 1px solid #ffffff25;
  border-bottom: 1px solid #ffffff25;
  padding: 13px 0;
  color: #c8c0b4;
  font-size: 13px;
}
.vote-dialog-timer strong {
  color: #f2d29e;
  font-family: Georgia, serif;
  font-size: 42px;
  font-weight: 400;
}
@media (min-width: 651px) and (max-width: 1100px) {
  body.playing {
    overflow: hidden;
  }
  body.playing main {
    height: calc(100dvh - 76px);
    overflow: hidden;
  }
  .game {
    height: 100%;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
  }
  .game-heading {
    flex: 0 0 auto;
    margin-bottom: 12px;
  }
  .game-heading h1 {
    font-size: 26px;
  }
  .clock strong {
    font-size: 32px;
  }
  .game-layout {
    grid-template-columns: minmax(0, 1fr) minmax(250px, 34%);
    gap: 14px;
    flex: 1;
    min-height: 0;
  }
  .table-area,
  .chat-panel {
    min-height: 0;
    height: auto;
  }
  .table-area {
    overflow: auto;
    padding-right: 6px;
  }
  .chat-panel {
    min-height: 0;
  }
  .roster {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    padding: 12px 0;
  }
  .portrait {
    height: 72px;
  }
  .person .person-name {
    padding: 7px 6px 2px;
    font-size: 11px;
  }
  .person small {
    padding: 0 6px 7px;
  }
  .action-dock {
    position: sticky;
    bottom: 0;
    z-index: 4;
    padding: 10px;
    background: #1b2325;
  }
  .ledger {
    margin-top: 18px;
  }
  .chat-collapsed .game-layout {
    grid-template-columns: minmax(0, 1fr) 0;
  }
}
@media (max-width: 650px) {
  #phase-guide,
  #chat-toggle,
  #sound-toggle {
    min-height: 34px;
    padding: 6px 7px;
    font-size: 10px;
  }
  #phase-guide,
  #sound-toggle {
    display: none;
  }
  .game-heading {
    gap: 5px;
  }
  .chat-collapsed .chat-panel {
    display: none;
  }
  .chat-collapsed .mobile-game-tools {
    display: none;
  }
  .game-dialog {
    padding: 26px 22px;
  }
  .briefing-silhouette {
    height: 100px;
  }
}

/* Review 2026-09-21: game-state information precedes decoration. */
.room-rules summary {
  color: #e8ddca;
}
.person .portrait {
  aspect-ratio: 1.55;
}
.person .person-name {
  color: #fff4e6;
  font-size: 14px;
  font-weight: 800;
}
.person small {
  color: #d4c9ba;
  font-size: 11px;
  font-weight: 700;
}
#mobile-population {
  display: none;
}
@media (max-width: 650px) {
  .mobile-game-tools {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }
  #mobile-population {
    display: block;
    color: #d9c9b6;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  .mobile-game-tools button {
    min-width: 0;
  }
  #mobile-actions[data-urgent="true"] {
    background: linear-gradient(#b93643, #982631);
    border-color: #d4525c;
    color: #fff5f2;
  }
  .table-area .portrait {
    height: auto;
    aspect-ratio: 1.55;
  }
  .table-area .person .person-name {
    font-size: 13px;
  }
}
