* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #14141e;
  color: #e8e8f0;
  overscroll-behavior: none;
}
#app { max-width: 560px; margin: 0 auto; padding: 12px 14px 90px; min-height: 100%; }
.loading { text-align: center; padding: 60px 0; color: #888; }
.hidden { display: none !important; }

h1 { font-size: 26px; text-align: center; margin: 18px 0 4px; }
h2 { font-size: 18px; margin: 16px 0 8px; }
.subtitle { text-align: center; color: #9a9ab0; margin-bottom: 24px; font-size: 14px; }

button {
  font: inherit; border: none; border-radius: 12px; cursor: pointer;
  background: #2b2b3d; color: #e8e8f0; padding: 12px 16px;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
button:active { transform: scale(.98); }
button.primary { background: #5865f2; color: #fff; font-weight: 600; }
button.danger { background: #b3392f; color: #fff; }
button.good { background: #2e8b57; color: #fff; }
button.big { width: 100%; padding: 15px; font-size: 17px; margin-top: 10px; }
button.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
button:disabled { opacity: .45; cursor: default; }

input[type=text], input[type=number], select {
  font: inherit; width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid #3a3a52; background: #1e1e2c; color: #fff; outline: none;
}
input:focus { border-color: #5865f2; }
label.fld { display: block; margin: 10px 0 4px; font-size: 13px; color: #9a9ab0; }

.card-box { background: #1e1e2c; border: 1px solid #2c2c40; border-radius: 16px; padding: 14px; margin: 10px 0; }

/* ---------- role art (портреты ролей) ---------- */
.role-art { display: block; object-fit: cover; border-radius: 12px; }
.reveal-art { width: 148px; height: 148px; margin: 0 auto 12px; border-radius: 18px; box-shadow: 0 8px 30px rgba(0,0,0,.45); }
.prow .row-av { width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto; }

/* ---------- settings tabs ---------- */
.settabs { display: flex; gap: 6px; overflow-x: auto; margin: 6px 0 10px; padding-bottom: 3px; -webkit-overflow-scrolling: touch; }
.settab { flex: 0 0 auto; border: 1px solid #34344e; background: transparent; color: #9a9ab0; padding: 9px 14px; border-radius: 11px; font-size: 13.5px; white-space: nowrap; }
.settab.on { background: #5865f2; color: #fff; font-weight: 600; border-color: #5865f2; }

/* ---------- pack editor v2 (карточки ролей) ---------- */
.pk-tray { position: sticky; top: 6px; z-index: 5; background: #1a1a28; border: 1px solid #2c2c40; border-radius: 14px; padding: 10px 12px; margin: 10px 0 12px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.pk-tray-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pk-tray-h b { font-size: 14px; } .pk-tray-h .c { color: #9a9ab0; font-size: 12px; font-variant-numeric: tabular-nums; }
.pk-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.pk-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; background: #24243a; border: 1px solid #34344e; border-radius: 999px; padding: 4px 9px 4px 6px; font-size: 12.5px; white-space: nowrap; }
.pk-chip .em { font-size: 15px; } .pk-chip .dot { width: 7px; height: 7px; border-radius: 50%; } .pk-chip .n { color: #9a9ab0; }
.pk-filters { display: flex; gap: 7px; flex-wrap: wrap; margin: 0 0 12px; }
.pk-pill { border: 1px solid #34344e; background: transparent; color: #9a9ab0; padding: 7px 12px; border-radius: 999px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.pk-pill.on { background: rgba(88,101,242,.16); border-color: #5865f2; color: #c7ccff; }
.pk-pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.pk-search { width: 100%; margin: 0 0 12px; padding: 11px 14px; border-radius: 12px; border: 1px solid #34344e; background: #14141e; color: #fff; font-size: 14px; outline: none; }
.pk-search:focus { border-color: #5865f2; }
.pk-sec { margin-bottom: 8px; }
.pk-sec-h { width: 100%; display: flex; align-items: center; gap: 8px; background: #1a1a28; border: 1px solid #2c2c40; border-radius: 12px; padding: 12px 14px; color: #e8e8f0; font-size: 14.5px; font-weight: 600; text-align: left; }
.pk-sec-h .cv { color: #9a9ab0; width: 14px; display: inline-block; }
.pk-sec-h .pk-sec-n { margin-left: auto; color: #9a9ab0; font-size: 12px; font-weight: 400; }
.pk-sec .pk-grid { margin-top: 8px; }
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 10px; }
.pk-card { position: relative; border: 1px solid #2c2c40; border-radius: 14px; background: linear-gradient(180deg,#1f1f30,#191926); padding: 12px 12px 11px; overflow: hidden; }
.pk-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tc,#5865f2); }
.pk-card.on { border-color: var(--tc,#5865f2); box-shadow: inset 0 0 0 1px var(--tc,#5865f2); }
.pk-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pk-em { position: relative; width: 44px; height: 44px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; font-size: 24px; border: 1px solid #34344e; overflow: hidden; }
.pk-em img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pk-name { font-size: 15.5px; font-weight: 600; line-height: 1.15; }
.pk-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.pk-tag { font-size: 10px; color: #9a9ab0; background: #191926; border: 1px solid #2c2c40; border-radius: 5px; padding: 2px 5px; }
.pk-desc { font-size: 12.3px; color: #9a9ab0; line-height: 1.42; margin: 0; }
.pk-desc.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pk-more { background: none; border: none; color: #7d88ff; font-size: 11px; padding: 2px 0 0; }
.pk-stp { display: flex; gap: 7px; margin-top: 10px; }
.pk-one { flex: 1; display: flex; align-items: center; justify-content: space-between; border: 1px solid #34344e; border-radius: 10px; overflow: hidden; background: #14141e; }
.pk-one .lb { font-size: 11px; color: #9a9ab0; padding-left: 8px; display: flex; align-items: center; gap: 5px; }
.pk-one .lb .dot { width: 7px; height: 7px; border-radius: 50%; }
.pk-one .v { font-weight: 700; font-size: 14px; min-width: 14px; text-align: center; }
.pk-one .g { display: flex; align-items: center; }
.pk-one button { width: 30px; height: 30px; padding: 0; border-radius: 0; background: transparent; font-size: 17px; color: #e8e8f0; }
.pk-one button:hover { background: #22223a; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 2px; gap: 8px; flex-wrap: wrap;
}
.topbar .code { font-weight: 700; letter-spacing: 3px; color: #ffd166; font-size: 18px; }
.topbar .round { color: #9a9ab0; font-size: 14px; }

.timer {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 44px;
  text-align: center; margin: 4px 0; letter-spacing: 2px;
}
.timer.warn { color: #ff6b6b; animation: blink 1s infinite; }
.timer.paused { color: #9a9ab0; }
@keyframes blink { 50% { opacity: .45; } }

.roombadge {
  display: block; text-align: center; border-radius: 14px; padding: 10px;
  font-size: 20px; font-weight: 800; margin: 8px 0;
  background: #23233a; border: 1px dashed #44446a;
}

/* ---------- my card ---------- */
.mycard {
  position: relative; border-radius: 18px; overflow: hidden;
  background: repeating-linear-gradient(135deg, #23233a 0 12px, #1d1d30 12px 24px);
  border: 1px solid #35355a;
  padding: 22px 14px; text-align: center; margin: 12px 0;
}
.mycard .back-title { font-size: 20px; font-weight: 800; letter-spacing: 1px; color: #6f6fa0; }
.mycard .back-sub { color: #55557d; font-size: 13px; margin-top: 4px; }
.holdrow { display: flex; gap: 10px; margin-top: 16px; }
.holdbtn {
  flex: 1; padding: 16px 8px; font-size: 15px; font-weight: 700;
  border-radius: 14px; background: #2b2b44; color: #cfcfe8;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.holdbtn small { display: block; font-weight: 400; color: #8888ad; margin-top: 3px; font-size: 11px; }

/* fullscreen reveal overlay */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 24px;
  user-select: none; -webkit-user-select: none;
  background: #0a0d14; color: #e8e8f0; /* тёмный фон — цвет карты показываем текстом, чтобы не спалили сбоку */
}
.tt-red { color: #ff6f63; } .tt-blue { color: #7ea6ff; } .tt-grey { color: #b3bccf; } .tt-green { color: #52d69b; }
.overlay .role-name { font-size: 42px; font-weight: 900; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.overlay .role-tags { font-size: 15px; opacity: .85; margin: 6px 0 14px; font-style: italic; }
.overlay .role-desc { font-size: 17px; line-height: 1.45; max-width: 440px; background: rgba(0,0,0,.25); border-radius: 14px; padding: 14px; }
.overlay .hint { position: absolute; bottom: 26px; font-size: 13px; opacity: .7; }
.overlay.color-only .colorname { font-size: 56px; font-weight: 900; text-transform: uppercase; letter-spacing: 4px; text-shadow: 0 2px 10px rgba(0,0,0,.45); }
.overlay .role-note { color: #ffcf6b; font-size: 14px; margin-top: 10px; }
.overlay .role-effs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

.team-red { background: linear-gradient(160deg, #c0392b, #7d1f16); color: #fff; }
.team-blue { background: linear-gradient(160deg, #2980b9, #14486e); color: #fff; }
.team-grey { background: linear-gradient(160deg, #7f8c8d, #4a5556); color: #fff; }
.team-green { background: linear-gradient(160deg, #27ae60, #14603a); color: #fff; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge.red { background: #c0392b; color: #fff; }
.badge.blue { background: #2980b9; color: #fff; }
.badge.grey { background: #7f8c8d; color: #fff; }
.badge.green { background: #27ae60; color: #fff; }

/* ---------- player lists ---------- */
.plist { display: flex; flex-direction: column; gap: 6px; }
.prow {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: #2222326; background: #212132; border-radius: 12px; font-size: 15px;
}
.prow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow.off .nm { color: #776; color: #77778f; }
.prow .ic { font-size: 15px; }
.prow.selected { outline: 2px solid #ffd166; }
.prow.me { background: #26264a; box-shadow: inset 0 0 0 1.5px #5865f2; }
.youtag { background: #5865f2; color: #fff; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; margin-left: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; flex: none; }
.off .dot { background: #666; }

/* ---------- tabs ---------- */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; background: #1b1b2a; border-top: 1px solid #2c2c40;
  max-width: 560px; margin: 0 auto;
}
.tabs button {
  flex: 1; background: none; border-radius: 0; padding: 12px 4px 16px; font-size: 13px; color: #9a9ab0;
}
.tabs button.active { color: #fff; font-weight: 700; }
.tabs button .tic { display: block; font-size: 20px; margin-bottom: 2px; }

/* ---------- roles tab ---------- */
.rolecard { background: #1e1e2c; border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; border-left: 5px solid #444; }
.rolecard.red { border-left-color: #c0392b; }
.rolecard.blue { border-left-color: #2980b9; }
.rolecard.grey { border-left-color: #7f8c8d; }
.rolecard.green { border-left-color: #27ae60; }
.rolecard h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rolecard .tags { color: #8b8bad; font-size: 12px; font-style: italic; margin: 2px 0 6px; }
.rolecard p { font-size: 14px; line-height: 1.4; color: #cfcfdd; }
.rolecard .notes { font-size: 12.5px; color: #94949f; margin-top: 6px; }
.rolecard .cnt { margin-left: auto; display: flex; gap: 6px; align-items: center; }

/* ---------- modal ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.65);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #20202f; width: 100%; max-width: 560px; border-radius: 20px 20px 0 0;
  padding: 18px 16px 26px; max-height: 85vh; overflow-y: auto;
}
.modal h2 { margin-top: 0; }

.banner { border-radius: 14px; padding: 12px 14px; margin: 10px 0; font-size: 15px; line-height: 1.4; }
.banner.info { background: #24304d; }
.banner.warn { background: #4d3a24; }
.banner.alert { background: #4d2424; }
.banner.ok { background: #1f3d2c; }

.log { font-size: 12.5px; color: #8b8ba5; line-height: 1.5; margin-top: 14px; }
.center { text-align: center; }
.muted { color: #9a9ab0; font-size: 13px; }
.spacer { height: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }

.hostage-flash {
  position: fixed; inset: 0; z-index: 95; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  background: linear-gradient(160deg, #b98a29, #6e4e0e); color: #fff; padding: 24px;
}
.hostage-flash .big { font-size: 34px; font-weight: 900; margin: 12px 0; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rules h3 { margin: 14px 0 6px; font-size: 16px; }
.rules p, .rules li { font-size: 14px; line-height: 1.5; color: #cfcfdd; }
.rules ul, .rules ol { padding-left: 20px; }
table.htable { border-collapse: collapse; margin: 8px 0; width: 100%; font-size: 14px; }
table.htable td, table.htable th { border: 1px solid #3a3a52; padding: 6px 8px; text-align: center; }

/* ---------- effects / connect / powers ---------- */
.cardnote { margin-top: 10px; font-size: 12.5px; color: #ffcf87; }
.effrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.effchip { display: inline-block; background: #3a2f4d; color: #d9c8f0; border-radius: 20px; padding: 3px 10px; font-size: 12px; }
.effchip.sm { padding: 1px 7px; font-size: 10.5px; background: #34344d; color: #b9b9d6; }
.effchip-zombie { background: #2e6b34; color: #eafff0; font-weight: 800; letter-spacing: .3px; box-shadow: 0 0 0 1px #4ac591 inset, 0 0 14px rgba(74,197,145,.5); animation: zpulse 1.4s ease-in-out infinite; }
@keyframes zpulse { 0%,100% { box-shadow: 0 0 0 1px #4ac591 inset, 0 0 8px rgba(74,197,145,.35); } 50% { box-shadow: 0 0 0 1px #4ac591 inset, 0 0 18px rgba(74,197,145,.7); } }
#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px); max-width: 88%; z-index: 9000; background: #123a1c; color: #eafff0; border: 1px solid #4ac591; border-radius: 14px; padding: 13px 16px; font-size: 14.5px; line-height: 1.35; font-weight: 600; box-shadow: 0 10px 34px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .effchip-zombie { animation: none; } }

.connect-card { background: #1c2233; border: 1px solid #33405e; border-radius: 14px; padding: 10px 12px; margin: 8px 0; }
.cc-head { font-size: 14px; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cc-head button { margin-left: auto; }
.revealbox { border-radius: 12px; padding: 14px; text-align: center; }
.revealbox .reveal-art { width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 12px; }
.revealbox b { font-size: 22px; font-weight: 900; display: block; letter-spacing: 1px; }
.revealbox small { display: block; margin-top: 3px; font-size: 12.5px; opacity: .9; }

/* ---------- grouped settings ---------- */
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 13.5px; border-bottom: 1px solid #2a2a3d; }
.setrow:last-child { border-bottom: none; }
.setrow span { flex: 1; color: #cfcfdd; }
.setrow input[type=checkbox] { width: 20px; height: 20px; flex: none; }
.setgroup { margin: 6px 0; border: 1px solid #2c2c40; border-radius: 12px; overflow: hidden; }
.setgroup-h { padding: 11px 12px; background: #23233a; font-weight: 600; font-size: 14px; cursor: pointer; user-select: none; }
.setgroup-b { padding: 4px 12px 10px; }

/* QR / net / oracle */
.qr { display: block; width: 200px; height: 200px; margin: 12px auto 6px; border-radius: 12px; background: #fff; padding: 6px; }
.netbar { position: fixed; top: 0; left: 0; right: 0; z-index: 200; text-align: center; padding: 0; height: 0; overflow: hidden; background: #b3392f; color: #fff; font-size: 13px; transition: height .2s; }
.netbar.show { height: 30px; padding: 6px; }
.badge.oracle { outline: 1px dashed rgba(255,255,255,.6); opacity: .85; }

/* seat switcher (тест-перспективы) */
.seatbar { position: fixed; top: 0; left: 0; right: 0; max-width: 560px; margin: 0 auto; z-index: 150; display: none; gap: 6px; overflow-x: auto; white-space: nowrap; background: #191926; border-bottom: 1px solid #33334d; padding: 6px 8px; }
.seatbar.show { display: flex; align-items: center; }
.seatbar-lbl { color: #9a9ab0; font-size: 12px; flex: none; }
.seatbar .seat { flex: none; padding: 6px 10px; border-radius: 8px; background: #2b2b3d; color: #cfcfe8; font-size: 13px; border: none; }
.seatbar .seat.on { background: #5865f2; color: #fff; font-weight: 700; }
.sdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #ffd166; margin-right: 4px; }
body.hasseats #app { padding-top: 48px; }
body.hasseats .netbar { top: 42px; }
