:root {
  --bg: #060b11;
  --panel: rgba(12, 20, 31, 0.88);
  --panel-2: rgba(18, 30, 46, 0.72);
  --line: rgba(86, 215, 255, 0.22);
  --text: #eef8ff;
  --muted: #8aa0b4;
  --cyan: #00d8ff;
  --cyan-2: #7ef0ff;
  --violet: #7c5cff;
  --red: #ff4f72;
  --green: #5cf2a5;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 216, 255, 0.20), transparent 34rem),
    radial-gradient(circle at 12% 22%, rgba(124, 92, 255, 0.14), transparent 26rem),
    linear-gradient(180deg, #08111b 0%, var(--bg) 100%);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 28%, rgba(0, 216, 255, 0.10) 28.2%, transparent 29%),
    linear-gradient(78deg, transparent 0 62%, rgba(124, 92, 255, 0.12) 62.2%, transparent 63%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 22px);
  opacity: 0.46;
}

.app-shell {
  position: relative;
  width: min(100%, 460px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 14px 12px 24px;
}

.hero-card {
  position: relative;
  min-height: calc(100dvh - 38px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(13, 24, 38, 0.88), rgba(6, 11, 17, 0.92));
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,255,255,0.03);
  backdrop-filter: blur(16px);
}

.logo-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(0, 216, 255, 0.20);
  background: rgba(0, 0, 0, 0.24);
}

.logo-wrap::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(180deg, transparent, rgba(6, 11, 17, 0.88));
}

.logo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 0.72;
  object-fit: cover;
  object-position: center 34%;
  filter: saturate(1.08) contrast(1.08);
}

.brand {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  z-index: 1;
}

.kicker {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid rgba(126, 240, 255, 0.26);
  border-radius: 999px;
  color: rgba(238, 248, 255, 0.92);
  background: rgba(6, 11, 17, 0.58);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 6px;
  font-size: clamp(24px, 7.2vw, 34px);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 8px;
  font-size: 26px;
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.subline {
  margin: 0;
  color: #c4d5e4;
  font-size: 14px;
  line-height: 1.35;
}

.rules {
  display: grid;
  gap: 10px;
}

.rule-item,
.panel,
.status-card,
.role-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: var(--panel-2);
  padding: 13px;
}

.rule-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: start;
  color: #d9e9f5;
  font-size: 14px;
  line-height: 1.35;
}

.rule-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 12px;
  background: rgba(0, 216, 255, 0.12);
  color: var(--cyan-2);
}

.actions {
  display: grid;
  gap: 10px;
  margin-top: 0;
}

.button,
button {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.button:active,
button:active {
  transform: translateY(1px) scale(0.99);
}

.primary {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #031018;
  box-shadow: 0 14px 30px rgba(0, 216, 255, 0.18);
}

.secondary {
  border: 1px solid rgba(0, 216, 255, 0.28);
  background: rgba(0, 216, 255, 0.08);
}

.danger {
  border: 1px solid rgba(255, 79, 114, 0.34);
  background: rgba(255, 79, 114, 0.11);
}

.ghost {
  min-height: 42px;
  color: var(--muted);
  background: transparent;
}

input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1px solid rgba(0, 216, 255, 0.22);
  border-radius: 16px;
  outline: 0;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font: inherit;
}

input:focus {
  border-color: rgba(0, 216, 255, 0.62);
  box-shadow: 0 0 0 4px rgba(0, 216, 255, 0.10);
}

.form {
  display: grid;
  gap: 10px;
}

.hint,
.meta,
.error {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.error {
  color: #ff9aae;
}

.room-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 128px;
  padding: 8px 14px;
  border-radius: 16px;
  background: rgba(0, 216, 255, 0.10);
  border: 1px solid rgba(0, 216, 255, 0.25);
  color: var(--cyan-2);
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.players {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.players li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  color: #dcecf8;
}

.badge {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 216, 255, 0.11);
  color: var(--cyan-2);
  font-size: 12px;
}

.role-card {
  position: relative;
  overflow: hidden;
  min-height: 170px;
  display: grid;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 20%, rgba(0, 216, 255, 0.22), transparent 18rem),
    rgba(0, 0, 0, 0.24);
}

.role-title {
  margin: 0 0 8px;
  font-size: 31px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.role-subtitle {
  margin: 0;
  color: #c9ddeb;
}

.spy {
  color: #ff9aae;
}

.civilian {
  color: var(--cyan-2);
}

.request {
  display: grid;
  gap: 8px;
  padding: 11px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
}

.request-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.footer-note {
  margin-top: auto;
  text-align: center;
  color: rgba(238, 248, 255, 0.42);
  font-size: 11px;
}

.footer-note a {
  color: rgba(126, 240, 255, 0.78);
  text-decoration: none;
}

.footer-note a:active,
.footer-note a:hover {
  color: var(--cyan-2);
  text-decoration: underline;
}

.screen-content {
  display: grid;
  gap: 16px;
}

.qr-button {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 5;
  width: 44px;
  min-height: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(126, 240, 255, 0.34);
  border-radius: 16px;
  background: rgba(6, 11, 17, 0.62);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

.qr-button img {
  width: 22px;
  height: 22px;
  display: block;
  filter: brightness(0) saturate(100%) invert(88%) sepia(70%) saturate(673%) hue-rotate(159deg) brightness(105%) contrast(104%);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: end center;
  padding: 18px 12px calc(18px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(12px);
}

.tg-modal {
  position: relative;
  width: min(100%, 390px);
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 22px 18px 18px;
  border: 1px solid rgba(126, 240, 255, 0.18);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(20, 31, 45, 0.98), rgba(8, 15, 24, 0.98));
  box-shadow: 0 26px 86px rgba(0, 0, 0, 0.62);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  min-height: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  color: rgba(238, 248, 255, 0.74);
  background: rgba(255, 255, 255, 0.07);
  font-size: 22px;
  line-height: 1;
}

.qr-frame {
  width: 232px;
  height: 232px;
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: 24px;
  background: #ffffff;
}

.qr-frame img {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.qr-caption,
.qr-link,
.qr-message {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
}

.qr-link {
  color: var(--cyan-2);
  font-weight: 700;
}

.qr-message {
  color: var(--green);
}

.loading {
  margin: auto;
  color: var(--muted);
}

@media (max-width: 360px) {
  .qr-button {
    top: 18px;
    right: 18px;
  }

  .hero-card {
    border-radius: 24px;
    padding: 12px;
  }

  .logo {
    aspect-ratio: 1 / 0.66;
  }

  .room-code {
    font-size: 30px;
  }
}
