:root {
  color-scheme: light;
  --brick: #ad4217;
  --paper: #e8e3d0;
  --paper-dim: #d1c9ad;
  --ink: #0d0d0b;
  --muted: #5b5548;
  --danger: #b61712;
}

@font-face {
  font-family: "Troika";
  src: url("/assets/font/FYDOR-BOLD.ttf") format("opentype");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Liberation Sans Local";
  src: url("/assets/font/LiberationSans.ttf") format("truetype");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Troika", Impact, "Arial Black", "Franklin Gothic Heavy", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 4px solid var(--ink);
  border-radius: 0;
  padding: 0.45rem 0.8rem;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  text-transform: uppercase;
  cursor: pointer;
}

button:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--ink);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input {
  width: 100%;
  border: 4px solid var(--ink);
  border-radius: 0;
  padding: 0.65rem 0.8rem;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  text-align: center;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--ink);
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

.mobile-shell {
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background:
    linear-gradient(90deg, transparent 0 10%, rgba(0, 0, 0, 0.05) 10% 11%, transparent 11% 100%),
    var(--brick);
  border-left: 5px solid var(--ink);
  border-right: 5px solid var(--ink);
  overflow: hidden;
}

.home,
.game-shell {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  padding-bottom: 1rem;
}

.top-tabs {
  height: 48px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 5px solid var(--ink);
  background: var(--paper);
}

.top-tabs button {
  position: relative;
  display: grid;
  place-items: center;
  border-right: 4px solid var(--ink);
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  background: var(--paper);
  box-shadow: none;
  transform: skewX(-12deg);
  min-height: 100%;
  padding: 0.25rem;
  cursor: pointer;
}

.top-tabs button:last-child {
  border-right: 0;
}

.top-tabs button:active {
  transform: skewX(-12deg) translate(0, 2px);
}

.top-tabs button.active {
  background: var(--paper-dim);
}

.top-tabs img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: brightness(0);
  transform: skewX(12deg);
}

.top-tabs button:nth-child(2) img,
.top-tabs button:nth-child(3) img {
  width: 40px;
  height: 40px;
  filter: none;
}

.top-tabs button:nth-child(4) img {
  width: 36px;
  height: 36px;
}

.paper-banner,
.panel {
  margin: 0 0.45rem;
  border: 5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
}

.paper-banner {
  padding: 0.45rem 0.7rem;
  text-align: center;
}

.home .paper-banner {
  transform: rotate(-1.2deg);
}

.paper-banner h1 {
  margin: 0;
  font-size: clamp(1.7rem, 9vw, 3.1rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.paper-banner p {
  margin: 0.25rem 0 0;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
}

.phase-banner {
  transform: rotate(-0.7deg);
}

.game-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 0.4rem;
  padding: 0.45rem 0.45rem 0;
}

.game-header .top-tabs {
  grid-column: 1 / -1;
  height: 40px;
}

.nameplate,
.room-code {
  border: 4px solid var(--ink);
  background: var(--paper);
  padding: 0.2rem 0.45rem;
  box-shadow: 4px 4px 0 var(--ink);
  text-transform: uppercase;
}

.room-code {
  background: var(--ink);
  color: var(--paper);
}

.forms,
.main,
.intel-grid,
.grid2 {
  display: grid;
  gap: 0.75rem;
}

.forms {
  padding: 0.2rem 0;
}

.home.mobile-shell {
  width: min(1440px, 100%);
  border: 5px solid var(--ink);
}

.home {
  min-height: 100vh;
  gap: 1.5rem;
}

.home .top-tabs {
  height: 58px;
}

.home .top-tabs span {
  font-size: 2rem;
}

.home .home-title {
  width: min(860px, calc(100% - 4rem));
  justify-self: center;
  margin-top: 1.6rem;
  padding: 0.75rem 1rem;
  transform: rotate(0.7deg);
}

.home-title h1 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.home .forms {
  width: min(1020px, calc(100% - 6rem));
  justify-self: center;
  gap: 2rem;
  padding-top: 0.4rem;
}

.home .home-panel {
  min-height: 275px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  column-gap: 2rem;
  padding: 2rem 1.5rem 1.75rem;
  transform: rotate(-1deg);
}

.home-panel h2 {
  grid-column: 1 / -1;
  justify-self: start;
  margin: 0 0 1.3rem;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.home-fields {
  display: grid;
  gap: 2rem;
  align-items: end;
}

.create-fields {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.join-fields {
  grid-template-columns: repeat(2, minmax(170px, 220px));
}

.home-fields label {
  justify-items: center;
  gap: 0.65rem;
  font-size: clamp(1.15rem, 1.6vw, 1.65rem);
  line-height: 1;
}

.home-fields input {
  height: 56px;
  padding: 0.2rem 0.6rem;
  transform: rotate(1deg);
  font-size: 1.35rem;
}

.home-panel button {
  min-width: 250px;
  min-height: 62px;
  align-self: end;
  margin-bottom: 0.2rem;
  transform: rotate(0.8deg);
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.home .join-panel {
  transform: rotate(-0.8deg);
}

.lobby-room.mobile-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  display: grid;
  align-content: start;
  gap: 0.85rem;
  border: 5px solid var(--ink);
}

.lobby-room .top-tabs {
  height: 58px;
}

.lobby-room-title {
  width: min(820px, calc(100% - 3rem));
  justify-self: center;
  margin-top: 2.25rem;
  padding: 0.75rem 1rem;
  transform: rotate(0.7deg);
}

.lobby-room-title h1 {
  font-size: clamp(1.9rem, 3vw, 3rem);
}

.lobby-room-code {
  margin: -0.15rem 1rem 0;
  color: var(--paper);
  text-align: center;
  text-transform: uppercase;
  font-size: clamp(1rem, 1.55vw, 1.45rem);
  line-height: 1;
}

.lobby-error {
  width: min(820px, calc(100% - 3rem));
  justify-self: center;
}

.lobby-room-stage {
  width: min(1320px, calc(100% - 4rem));
  display: grid;
  grid-template-columns: 320px minmax(360px, 1fr) 320px;
  gap: clamp(1.2rem, 4vw, 4.8rem);
  align-items: start;
  justify-self: center;
  padding-top: 1.1rem;
}

.lobby-settings-panel {
  min-height: 330px;
  padding: 1.4rem 1.2rem;
  transform: rotate(-1deg);
}

.lobby-chat-panel {
  min-height: 405px;
  padding: 1.25rem 1.4rem;
  transform: rotate(1deg);
}

.lobby-settings-panel h2,
.lobby-chat-panel h2 {
  margin-bottom: 1.55rem;
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.lobby-settings-form {
  display: grid;
  gap: 0.95rem;
}

.lobby-settings-form label {
  display: grid;
  grid-template-columns: auto 2.2rem;
  justify-content: center;
  align-items: center;
  gap: 0.15rem;
  border: 4px solid var(--ink);
  background: var(--paper);
  padding: 0.35rem 0.45rem;
  box-shadow: 6px 6px 0 var(--ink);
  transform: rotate(0.6deg);
}

.lobby-settings-form label:nth-child(2) {
  transform: rotate(-0.7deg);
}

.lobby-settings-form span {
  text-align: center;
  font-size: 1.28rem;
  line-height: 1;
}

.lobby-settings-form input {
  height: 36px;
  border: 0;
  box-shadow: none;
  padding: 0 0.15rem;
  background: transparent;
  font-size: 1.28rem;
}

.lobby-settings-form button,
.lobby-start,
.lobby-setting-strip {
  width: 100%;
  margin-top: 1rem;
  box-shadow: 6px 6px 0 var(--ink);
  transform: rotate(0.8deg);
}

.lobby-settings-form button {
  margin-top: 0.25rem;
  font-size: 1.25rem;
}

.lobby-start {
  min-height: 56px;
  font-size: 1.35rem;
}

.lobby-setting-strip {
  border: 4px solid var(--ink);
  background: var(--paper);
  padding: 0.55rem;
  text-align: center;
  text-transform: uppercase;
  font-size: 1.1rem;
}

.lobby-waiting {
  margin: 1.3rem 0 0;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
  text-align: center;
}

.lobby-roster-wrap {
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  min-width: 0;
}

.lobby-roster {
  width: min(430px, 100%);
  display: grid;
  gap: 1.05rem;
}

.lobby-agent-strip {
  position: relative;
  min-height: 52px;
  display: grid;
  place-items: center;
  padding: 0.42rem 3.25rem 0.42rem 1rem;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  line-height: 1;
}

.lobby-agent-strip:nth-child(even) {
  margin-left: 1.05rem;
}

.lobby-agent-strip span {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.lobby-kick {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  width: 42px;
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  transform: translateY(-50%);
  box-shadow: 3px 3px 0 var(--ink);
}

.lobby-kick:active {
  transform: translate(2px, calc(-50% + 2px));
}

.lobby-chat-panel .messages {
  min-height: 190px;
  max-height: 225px;
  margin-bottom: 0.85rem;
  align-content: start;
  font-size: 1rem;
  font-weight: 400;
}

.lobby-chat-panel .messages b {
  font-weight: 900;
}

.lobby-chat-panel form {
  grid-template-columns: 1fr;
}

.lobby-chat-panel input {
  text-align: left;
  font-size: 0.95rem;
}

.lobby-chat-panel button {
  justify-self: end;
  min-width: 130px;
  font-size: 1.18rem;
}

.overlay-scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(13, 13, 10, 0.28);
}

.paper-overlay {
  position: fixed;
  z-index: 31;
  top: 0;
  left: 50%;
  width: min(900px, calc(100% - 1.5rem));
  max-height: min(82vh, 720px);
  overflow: auto;
  padding: 1rem 1.15rem 1.25rem;
  border: 5px solid var(--ink);
  background: var(--paper);
  box-shadow: 8px 8px 0 var(--ink);
  transform: translateX(-50%);
  animation: dropOverlay 240ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.paper-overlay.no-drop {
  animation: none;
}

@keyframes dropOverlay {
  from {
    opacity: 0;
    transform: translate(-50%, -100%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.paper-overlay h2 {
  margin: 0 3.5rem 1rem;
  text-align: center;
  text-transform: uppercase;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  line-height: 1;
}

.overlay-close {
  position: sticky;
  top: 0;
  z-index: 1;
  float: right;
  min-height: 38px;
  padding: 0.25rem 0.5rem;
  font-size: 1rem;
  box-shadow: 4px 4px 0 var(--ink);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  clear: both;
}

.guide-step,
.music-panel,
.setting-choice-panel,
.overlay-description,
.overlay-hint {
  border: 4px solid var(--ink);
  background: var(--paper);
  box-shadow: 5px 5px 0 var(--ink);
}

.guide-step {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem;
}

.guide-step img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.guide-service-icon {
  filter: invert(29%) sepia(73%) saturate(1017%) hue-rotate(168deg) brightness(88%) contrast(89%);
}

.guide-virus-icon {
  filter: invert(20%) sepia(90%) saturate(1814%) hue-rotate(346deg) brightness(79%) contrast(97%);
}

.guide-step p,
.overlay-description,
.overlay-hint {
  margin: 0;
  font-family: "Liberation Sans Local", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.25;
}

.guide-step b {
  font-family: "Troika", Impact, sans-serif;
  font-size: 1.2rem;
  text-transform: uppercase;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  clear: both;
}

.option-card {
  min-height: 148px;
  display: grid;
  grid-template-rows: 78px auto auto;
  justify-items: center;
  align-content: center;
  gap: 0.35rem;
  padding: 0.65rem 0.45rem;
  font-size: 1rem;
  line-height: 1;
}

.option-card img {
  width: 74px;
  height: 74px;
  object-fit: contain;
}

.roles-grid .option-card img {
  filter: brightness(0);
}

.role-option.role-service img {
  filter: invert(29%) sepia(73%) saturate(1017%) hue-rotate(168deg) brightness(88%) contrast(89%);
}

.role-option.role-virus img {
  filter: invert(20%) sepia(90%) saturate(1814%) hue-rotate(346deg) brightness(79%) contrast(97%);
}

.operations-grid .option-card img {
  width: 68px;
  height: 68px;
}

.option-card span {
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.option-card small {
  color: var(--muted);
  font-size: 0.8rem;
}

.option-card.disabled {
  opacity: 0.42;
}

.option-card.selected-info {
  outline: 5px solid var(--brick);
  outline-offset: -9px;
}

.option-card.enabled small {
  color: #126b26;
}

.overlay-description {
  margin-top: 1rem;
  padding: 0.75rem;
}

.overlay-hint {
  margin-top: 0.75rem;
  padding: 0.55rem 0.75rem;
  color: var(--muted);
}

.music-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  clear: both;
}

.music-panel label {
  display: grid;
  gap: 0.75rem;
  font-size: 1.55rem;
}

.music-panel input[type="range"] {
  box-shadow: none;
  padding: 0;
  accent-color: var(--ink);
}

.music-panel span {
  font-size: 1.6rem;
}

.setting-choice-panel {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
  padding: 1rem;
}

.setting-choice-panel h3 {
  margin: 0;
  text-align: center;
  text-transform: uppercase;
  font-size: 1.45rem;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.segmented button {
  min-height: 46px;
  font-size: 1.05rem;
}

.segmented button.selected {
  background: var(--ink);
  color: var(--paper);
}

.number-setting {
  display: grid;
  grid-template-columns: 1fr 5rem;
  align-items: center;
  gap: 0.8rem;
  font-size: 1.1rem;
}

.number-setting input {
  height: 44px;
  padding: 0.2rem;
  font-size: 1.3rem;
}

.active-game-shell.mobile-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  display: grid;
  grid-template-columns: 285px minmax(520px, 1fr) 285px;
  grid-template-rows: 58px auto auto 1fr auto;
  column-gap: 2.1rem;
  align-items: start;
  border: 5px solid var(--ink);
}

.active-game-shell .top-tabs {
  grid-column: 1 / -1;
  height: 58px;
}

.active-identity {
  grid-column: 1;
  grid-row: 2 / 4;
  padding-left: 0.9rem;
  align-self: start;
}

.active-nameplate {
  width: 180px;
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 0.2rem 0.45rem;
  transform: rotate(1deg);
  font-size: 1.35rem;
  line-height: 1;
}

.role-logo-wrap {
  width: 156px;
  height: 171px;
  display: grid;
  place-items: center;
  margin-top: -1.2rem;
}

.role-logo {
  width: 118px;
  height: 136px;
  object-fit: contain;
  object-position: center;
  display: block;
}

.role-logo.service {
  width: 128px;
  height: 128px;
  filter: invert(29%) sepia(73%) saturate(1017%) hue-rotate(168deg) brightness(88%) contrast(89%);
}

.role-logo.virus {
  width: 130px;
  height: 148px;
  transform: scale(1.28);
  filter: invert(20%) sepia(90%) saturate(1814%) hue-rotate(346deg) brightness(79%) contrast(97%);
}

.active-phase-banner {
  grid-column: 2;
  grid-row: 2;
  width: min(860px, 100%);
  justify-self: center;
  margin-top: 1.8rem;
  padding: 0.9rem 1rem;
  transform: rotate(0.7deg);
}

.active-phase-banner h1 {
  font-size: clamp(1.55rem, 2.15vw, 2.35rem);
}

.active-side-panel {
  width: 255px;
  min-height: 420px;
  margin-top: 2.1rem;
  padding: 1.05rem 1.1rem;
}

.active-side-panel h2 {
  margin-bottom: 1.75rem;
  font-size: 1.35rem;
  text-align: left;
}

.active-side-panel .log {
  max-height: 310px;
  font-size: 1rem;
  font-weight: 400;
}

.active-side-panel .log p {
  border-bottom: 0;
  padding-bottom: 0;
}

.active-public-log {
  grid-column: 1;
  grid-row: 3 / 5;
  justify-self: center;
  transform: rotate(1deg);
}

.active-private-log {
  grid-column: 3;
  grid-row: 3 / 5;
  justify-self: center;
  transform: rotate(-1deg);
}

.active-main {
  grid-column: 2;
  grid-row: 3 / 5;
  display: grid;
  align-self: start;
  margin-top: 2rem;
}

.operation-card {
  width: min(730px, 100%);
  min-height: 315px;
  justify-self: center;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1.55rem;
  padding: 2.2rem 3.5rem 1.55rem;
  transform: rotate(-0.5deg);
}

.operation-card h2,
.operation-card p {
  max-width: 580px;
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: clamp(1.25rem, 2vw, 1.9rem);
  line-height: 1.08;
  text-transform: none;
}

.operation-card .choices {
  width: min(470px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3.6rem;
}

.operation-card .choices button {
  width: 100%;
  min-height: 56px;
  margin: 0;
  font-size: clamp(1.25rem, 1.9vw, 1.75rem);
}

.operation-card > button[data-action="complete-op"] {
  min-width: 180px;
  min-height: 52px;
  font-size: 1.6rem;
  line-height: 1;
  transform: rotate(0.8deg);
}

.active-main .dossier-card {
  width: min(730px, 100%);
  min-height: 315px;
  justify-self: center;
  align-content: center;
  justify-items: center;
  gap: 1.25rem;
  padding: 2rem 3.5rem 1.6rem;
  background: var(--paper);
  transform: rotate(-0.5deg);
}

.active-main .dossier-card::before {
  display: none;
}

.active-main .eyebrow {
  margin: 0;
  font-size: 1.05rem;
}

.active-main .dossier-card h2,
.active-main .dossier-card p {
  max-width: 580px;
  margin: 0;
  text-align: center;
}

.ready-count span {
  font-family: "Liberation Sans Local", Arial, sans-serif;
  font-weight: 900;
  font-size: 1.08em;
}

.active-main .dossier-card > button {
  min-width: 180px;
  min-height: 52px;
  font-size: 1.45rem;
}

.active-main .dossier-card .choices {
  width: min(560px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1.4rem;
}

.active-main .dossier-card .choices button {
  width: 100%;
  min-height: 54px;
  margin: 0;
  padding: 0.35rem 0.55rem;
  font-size: clamp(1.1rem, 1.65vw, 1.55rem);
  line-height: 1;
}

.active-main .dossier-card .choices button:nth-child(even) {
  transform: rotate(1deg);
}

.active-main .dossier-card .choices button:nth-child(odd) {
  transform: rotate(-1deg);
}

.active-main .dossier-card .choices .selected,
.active-main .dossier-card .choices .voted {
  background: var(--ink);
  color: var(--paper);
  outline: 5px solid var(--brick);
}

.active-main .dossier-card .vote-card {
  width: min(100%, 14rem);
}

.active-main .dossier-card .results {
  width: min(610px, 100%);
  max-height: 270px;
  overflow: auto;
}

.active-main .dossier-card .results div {
  transform: rotate(-0.5deg);
}

.secure-line-card {
  gap: 0.75rem;
}

.secure-line-card h2 {
  font-size: clamp(1.45rem, 2.5vw, 2.2rem);
}

.secure-messages {
  width: min(560px, 100%);
  min-height: 128px;
  max-height: 170px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 0.45rem;
  padding: 0.7rem;
  border: 4px solid var(--ink);
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
}

.secure-messages p {
  margin: 0;
  text-align: left;
  max-width: none;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 0.35rem;
  font-family: "Agency", Arial, sans-serif;
  font-size: 1rem;
}

.secure-line-form {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
}

.secure-line-form input {
  min-width: 0;
  text-align: left;
}

.secure-line-form button {
  min-height: 52px;
  font-size: 1.35rem;
}

.active-secret-warning {
  grid-column: 1 / -1;
  grid-row: 5;
  justify-self: center;
  align-self: end;
  margin: 0 1rem 1.8rem;
  color: var(--paper);
  text-align: center;
  text-transform: uppercase;
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  line-height: 1;
}

.grid2 {
  grid-template-columns: 1fr 1fr;
}

.panel {
  padding: 0.75rem;
}

.panel h2,
.hero-panel h2 {
  margin-bottom: 0.6rem;
  text-align: center;
  text-transform: uppercase;
  line-height: 1;
}

.form-card {
  transform: rotate(-1.2deg);
  transform-origin: center;
}

.form-card:nth-of-type(2) {
  transform: rotate(1.2deg);
}

.form-card label,
.form-card input,
.form-card button,
.form-card .grid2 {
  transform: none;
}

.form-card h2 {
  margin-bottom: 0.8rem;
}

.form-card input {
  box-shadow: 4px 4px 0 var(--ink);
}

.form-card button {
  justify-self: stretch;
}

.hero-panel {
  min-height: 280px;
  display: grid;
  align-content: center;
  gap: 0.8rem;
}

.dossier-card {
  position: relative;
  background:
    linear-gradient(var(--brick) 0 30%, transparent 30% 100%),
    var(--paper);
}

.dossier-card::before {
  content: "";
  position: absolute;
  inset: 30% 0 auto;
  border-top: 5px solid var(--ink);
}

.dossier-card > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: block;
  margin: -0.2rem 0 0.4rem;
  padding: 0.25rem 0.4rem;
  border: 4px solid var(--ink);
  background: var(--paper);
  text-align: center;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 var(--ink);
}

.role-card {
  display: none;
}

.role-reveal {
  width: min(100%, 16rem);
  min-height: 14rem;
  display: grid;
  place-items: center;
  justify-self: center;
  gap: 0.35rem;
  border: 5px solid var(--ink);
  padding: 0.75rem;
  text-align: center;
  box-shadow: 7px 7px 0 var(--ink);
  animation: revealRole 850ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.role-reveal .role-logo {
  width: 205px;
  height: 205px;
  transform: translateY(-0.45rem);
}

.role-reveal .role-logo.service {
  width: 205px;
  height: 205px;
}

.role-reveal .role-logo.virus {
  width: 210px;
  height: 220px;
  transform: translateY(-0.45rem) scale(1.25);
}

.role-reveal .special-identity-logo {
  width: 210px;
  height: 210px;
  object-fit: contain;
  transform: translateY(-0.8rem);
  filter: brightness(0);
}

.role-reveal.service {
  background: var(--paper);
  color: var(--ink);
}

.role-reveal.virus {
  background: var(--paper);
  color: var(--ink);
}

@keyframes revealRole {
  0% {
    opacity: 0;
    transform: rotateY(88deg) scale(0.92);
    filter: blur(5px);
  }
  60% {
    opacity: 1;
    transform: rotateY(-8deg) scale(1.02);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: rotateY(0) scale(1);
    filter: blur(0);
  }
}

.secret-result {
  max-width: 100%;
  margin-bottom: 0;
  padding: 0.65rem;
  border: 4px solid var(--ink);
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
  line-height: 1.35;
}

.special-role-reveal b {
  font-family: "Troika", Impact, sans-serif;
  font-size: 1.15rem;
  text-transform: uppercase;
}

.settings {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.7rem;
  align-items: end;
}

.paper-list,
.choices,
.players {
  display: grid;
  gap: 0.55rem;
}

.paper-strip,
.choices button,
.player {
  border: 4px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  text-align: center;
  text-transform: uppercase;
  transform: rotate(var(--tilt, -1deg));
}

.paper-strip {
  padding: 0.45rem;
  font-size: 1.35rem;
}

.ghost-strip {
  color: #8b8576;
  font-style: italic;
}

.choices {
  grid-template-columns: 1fr;
}

.choices button {
  display: block;
  width: 82%;
  margin: 0 auto;
  font-size: 1.25rem;
}

.choices button:nth-child(even) {
  --tilt: 1deg;
}

.choices .selected,
.choices .voted {
  background: var(--ink);
  color: var(--paper);
  outline: 5px solid var(--paper-dim);
}

.player {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  text-align: left;
}

.player i {
  color: var(--muted);
  font-style: normal;
}

.offline {
  opacity: 0.65;
}

.ghost {
  min-height: 34px;
  padding: 0.2rem 0.45rem;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
}

.danger {
  color: var(--danger);
}

.compact {
  max-height: 230px;
  overflow: auto;
}

.chat form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
}

.messages,
.log {
  display: grid;
  gap: 0.5rem;
  max-height: 150px;
  overflow: auto;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 800;
}

.messages p,
.log p {
  margin: 0;
  padding-bottom: 0.4rem;
  border-bottom: 3px solid var(--ink);
  line-height: 1.25;
}

.error {
  margin: 0 0.45rem;
  border: 4px solid var(--ink);
  background: var(--paper);
  color: var(--danger);
  padding: 0.6rem;
  box-shadow: 5px 5px 0 var(--ink);
  text-transform: uppercase;
}

.fingerprint-card {
  width: 120px;
  height: 150px;
  display: grid;
  place-items: center;
  justify-self: center;
  border: 4px solid var(--ink);
  background: var(--paper);
  box-shadow: 6px 6px 0 var(--ink);
}

.fingerprint-card.tilted {
  margin: 8rem auto 0;
  transform: rotate(-4deg);
}

.fingerprint-card.small {
  width: 90px;
  height: 112px;
}

.fingerprint-card svg {
  width: 78%;
  height: 78%;
  fill: none;
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
}

.scanner-row {
  display: flex;
  align-items: end;
  justify-content: space-around;
  gap: 1rem;
}

.agent-mark {
  width: 92px;
  color: var(--ink);
  text-align: center;
}

.agent-mark .hat {
  width: 60px;
  height: 26px;
  margin: 0 auto -4px;
  background: var(--ink);
  clip-path: polygon(8% 55%, 34% 42%, 40% 8%, 62% 8%, 68% 42%, 94% 55%, 78% 72%, 22% 72%);
}

.agent-mark .coat {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  background: var(--ink);
  clip-path: polygon(50% 0, 100% 100%, 62% 100%, 50% 58%, 38% 100%, 0 100%);
}

.agent-mark b {
  display: block;
  color: var(--danger);
  font-size: 0.65rem;
  line-height: 0.8;
}

.results {
  display: grid;
  gap: 0.5rem;
}

.results div {
  display: grid;
  gap: 0.2rem;
  border: 4px solid var(--ink);
  background: var(--paper);
  padding: 0.5rem;
  box-shadow: 4px 4px 0 var(--ink);
}

.results span {
  color: var(--muted);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
}

.results em {
  font-style: normal;
}

.won {
  color: #126b26;
}

.lost {
  color: var(--danger);
}

.vote-card {
  position: relative;
  width: min(100%, 16rem);
  aspect-ratio: 3 / 4;
  justify-self: center;
  border-radius: 0;
  transform-style: preserve-3d;
  box-shadow: 9px 9px 0 var(--ink);
  animation: suspenseCard 10s linear forwards;
}

.vote-card::after {
  content: "";
  position: absolute;
  top: 4%;
  right: -12px;
  width: 22px;
  height: 92%;
  border: 4px solid var(--ink);
  background: var(--paper-dim);
  transform: rotateY(78deg);
  transform-origin: left center;
}

.vote-card-front,
.vote-card-back {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 5px solid var(--ink);
  padding: 1rem;
  backface-visibility: hidden;
  text-align: center;
  text-transform: uppercase;
}

.vote-card-front {
  background: var(--paper);
  color: var(--ink);
  font-size: 1.6rem;
}

.vote-card-back {
  opacity: 0;
  transform: rotateY(180deg);
  font-size: clamp(2.6rem, 14vw, 4.5rem);
}

.vote-card.service .vote-card-back {
  background: var(--paper);
  color: var(--ink);
}

.vote-card.virus .vote-card-back {
  background: var(--paper);
  color: var(--ink);
}

.vote-role-logo {
  display: block;
  object-fit: contain;
  object-position: center;
}

.vote-role-logo.service {
  width: 78%;
  height: 78%;
  filter: invert(29%) sepia(73%) saturate(1017%) hue-rotate(168deg) brightness(88%) contrast(89%);
}

.vote-role-logo.virus {
  width: 82%;
  height: 88%;
  transform: scale(1.24);
  filter: invert(20%) sepia(90%) saturate(1814%) hue-rotate(346deg) brightness(79%) contrast(97%);
}

.vote-card.revealed {
  transform: rotateY(180deg);
  animation: none;
}

.vote-card.revealed .vote-card-back {
  opacity: 1;
}

@keyframes suspenseCard {
  0% { transform: rotateY(0) rotate(-2deg); }
  12% { transform: rotateY(70deg) rotate(-1deg); }
  24% { transform: rotateY(-70deg) rotate(1deg); }
  36% { transform: rotateY(66deg) rotate(-1deg); }
  48% { transform: rotateY(-66deg) rotate(1deg); }
  60% { transform: rotateY(58deg) rotate(-0.5deg); }
  72% { transform: rotateY(-58deg) rotate(0.5deg); }
  84% { transform: rotateY(42deg); }
  100% { transform: rotateY(0); }
}

@media (min-width: 980px) {
  .mobile-shell {
    width: min(1220px, calc(100% - 2rem));
    border: 5px solid var(--ink);
  }

  .game-shell {
    grid-template-columns: minmax(360px, 0.95fr) minmax(320px, 1fr);
    align-items: start;
    padding: 0 0.5rem 1rem;
  }

  .game-header,
  .phase-banner {
    grid-column: 1 / -1;
  }

  .main,
  .intel-grid {
    min-width: 0;
  }

  .compact {
    max-height: 260px;
  }
}

@media (max-width: 820px) {
  .home.mobile-shell,
  .lobby-room.mobile-shell,
  .active-game-shell.mobile-shell {
    border-left: 0;
    border-right: 0;
  }

  .home-title,
  .home .forms {
    width: calc(100% - 1.5rem);
  }

  .home-panel {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1.2rem 0.9rem;
  }

  .create-fields,
  .join-fields {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .home-panel button {
    width: min(260px, 100%);
    justify-self: end;
  }

  .lobby-room-title,
  .lobby-error,
  .lobby-room-stage {
    width: calc(100% - 1.5rem);
  }

  .lobby-room-stage {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding-top: 0.3rem;
  }

  .lobby-roster-wrap {
    order: -1;
    gap: 1.25rem;
  }

  .lobby-settings-panel,
  .lobby-chat-panel {
    min-height: 0;
  }

  .paper-overlay {
    width: calc(100% - 0.75rem);
    max-height: 86vh;
    padding: 0.75rem;
  }

  .paper-overlay h2 {
    margin-left: 0;
    margin-right: 0;
    font-size: 1.8rem;
  }

  .guide-grid,
  .option-grid {
    grid-template-columns: 1fr;
  }

  .option-card {
    min-height: 110px;
    grid-template-columns: 76px 1fr auto;
    grid-template-rows: auto;
    text-align: left;
  }

  .option-card img {
    width: 66px;
    height: 66px;
  }

  .music-panel {
    grid-template-columns: 1fr;
  }

  .segmented {
    grid-template-columns: 1fr;
  }

  .active-game-shell.mobile-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 0.75rem;
    padding-bottom: 1rem;
  }

  .active-game-shell .top-tabs,
  .active-identity,
  .active-phase-banner,
  .active-main,
  .active-public-log,
  .active-private-log,
  .active-secret-warning {
    grid-column: 1;
    grid-row: auto;
  }

  .active-identity {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0.75rem 0;
  }

  .role-logo-wrap {
    width: 78px;
    height: 86px;
    margin-top: -0.7rem;
  }

  .role-logo {
    width: 70px;
    height: 78px;
  }

  .role-logo.service {
    width: 74px;
    height: 74px;
  }

  .role-logo.virus {
    width: 76px;
    height: 86px;
    transform: scale(1.22);
  }

  .active-phase-banner,
  .active-main,
  .active-side-panel {
    width: calc(100% - 1.5rem);
    justify-self: center;
    margin-top: 0;
  }

  .active-side-panel {
    min-height: 180px;
  }

  .operation-card {
    min-height: 310px;
    padding: 1.5rem 1rem;
  }

  .operation-card .choices {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .active-main .dossier-card .choices {
    grid-template-columns: 1fr;
  }

  .active-secret-warning {
    margin-bottom: 0;
    font-size: 1.75rem;
  }

}

@media (max-width: 560px) {
  .mobile-shell {
    border-left: 0;
    border-right: 0;
  }

  .grid2,
  .settings,
  .chat form,
  .secure-line-form {
    grid-template-columns: 1fr;
  }

  .paper-banner h1 {
    font-size: 2rem;
  }
}
