:root {
  --bg1: #2b2f8f; --bg2: #0d1130;
  --card: rgba(26, 33, 82, .72); --card-brd: rgba(255, 255, 255, .09);
  --panel2: #2a3770;
  --text: #eef1ff; --muted: #9aa6d8;
  --accent: #ffcc33; --accent2: #ff9f1c; --good: #3ddc84; --bad: #ff4d5e;
  --empty: rgba(255, 255, 255, .045); --boardbg: rgba(8, 11, 34, .82);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --smooth: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg2); color: var(--text);
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  display: flex; justify-content: center;
  -webkit-user-select: none; user-select: none; overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
input { -webkit-user-select: text; user-select: text; }
.hidden { display: none !important; }
button { font: inherit; }

/* ---------- Живой фон ---------- */
.bg { position: fixed; inset: 0; overflow: hidden; z-index: -1;
  background: radial-gradient(ellipse at 50% -10%, var(--bg1), var(--bg2) 65%); }
.blob { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(80px); opacity: .35; }
.b1 { background: #5b3cff; left: -20vmax; top: -10vmax; animation: drift1 22s ease-in-out infinite alternate; }
.b2 { background: #ff3d9a; right: -25vmax; top: 20vh; opacity: .22; animation: drift2 26s ease-in-out infinite alternate; }
.b3 { background: #00b3ff; left: 10vw; bottom: -35vmax; opacity: .25; animation: drift3 30s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(18vw, 22vh) scale(1.2); } }
@keyframes drift2 { to { transform: translate(-20vw, -10vh) scale(.85); } }
@keyframes drift3 { to { transform: translate(15vw, -18vh) scale(1.15); } }
#fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }
.vignette { position: fixed; inset: 0; pointer-events: none; z-index: 40; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 30, 60, .55)); transition: opacity .4s; }
.vignette.on { animation: vignette 1s ease-in-out infinite alternate; }
@keyframes vignette { from { opacity: .35; } to { opacity: 1; } }

/* ---------- Каркас ---------- */
.app { width: 100%; max-width: 460px; padding: 14px 16px 28px; }
.app.wide-mode { max-width: 1180px; }
.view { display: flex; flex-direction: column; gap: 14px; animation: viewIn .5s var(--smooth); }
@keyframes viewIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.card { background: var(--card); border: 1px solid var(--card-brd); border-radius: 18px; padding: 14px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }

/* ---------- Кнопки ---------- */
.btn { position: relative; overflow: hidden; border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer;
  font-weight: 800; font-size: 15px; color: var(--text); background: var(--panel2);
  transition: transform .18s var(--spring), box-shadow .2s, filter .2s, opacity .2s; }
.btn:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn:active { transform: translateY(1px) scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { color: #2a1a00; background: linear-gradient(180deg, #ffe066, var(--accent) 45%, var(--accent2));
  box-shadow: 0 6px 0 #b86f00, 0 10px 24px rgba(255, 170, 30, .35); }
.btn.primary:active { box-shadow: 0 2px 0 #b86f00, 0 4px 12px rgba(255, 170, 30, .3); transform: translateY(4px); }
.btn.big { width: 100%; padding: 14px; font-size: 18px; margin-top: 10px; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.ghost { background: rgba(255, 255, 255, .07); }
.btn.danger { background: rgba(255, 77, 94, .2); color: #ffb3bb; }
.btn.good { background: rgba(61, 220, 132, .2); color: #a8f5c8; }
.shine::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .6), transparent); transform: skewX(-20deg);
  animation: shine 3.2s ease-in-out infinite; }
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.chip { border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .06); color: var(--text);
  border-radius: 10px; padding: 0 12px; height: 44px; font-weight: 700; cursor: pointer;
  transition: transform .15s var(--spring), background .2s; }
.chip:hover { background: rgba(255, 255, 255, .14); transform: translateY(-2px); }
.chip:active { transform: scale(.94); }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--card-brd); background: var(--card);
  color: var(--muted); font-size: 18px; cursor: pointer; transition: transform .2s var(--spring), color .2s; }
.icon-btn:hover { color: var(--text); transform: rotate(-8deg) scale(1.08); }

input[type=number], input[type=text], input[type=password], input:not([type]), select {
  width: 100%; background: rgba(5, 8, 30, .55); color: var(--text); border: 1px solid rgba(120, 140, 255, .25);
  border-radius: 12px; padding: 11px 13px; font-size: 16px; font-weight: 700; outline: none;
  transition: border-color .2s, box-shadow .2s; }
/* Без стрелочек-спиннеров в числовых полях */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 204, 51, .2); }
.field-label { display: block; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; margin: 10px 0 6px; }
.form-error { min-height: 20px; color: var(--bad); font-size: 14px; font-weight: 600; margin-top: 8px; }
.shake { animation: shakeX .4s; }
@keyframes shakeX { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- Вход ---------- */
#authView { min-height: calc(100vh - 42px); justify-content: center; }
.logo { text-align: center; margin-bottom: 6px; }
.logo h1 { margin: 10px 0 4px; font-size: 44px; font-weight: 900; letter-spacing: -.02em;
  text-shadow: 0 4px 0 rgba(0, 0, 0, .35); }
.logo h1 span { color: var(--accent); }
.logo p { margin: 0; color: var(--muted); }
.logo-blocks { display: inline-grid; grid-template-columns: repeat(2, 26px); gap: 5px; }
.logo-blocks i { width: 26px; height: 26px; border-radius: 7px; animation: logoBounce 2.4s var(--spring) infinite;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25), inset 0 3px 0 rgba(255, 255, 255, .35); }
.logo-blocks i:nth-child(1) { background: #ffd23f; }
.logo-blocks i:nth-child(2) { background: #ff5a5f; animation-delay: .15s; }
.logo-blocks i:nth-child(3) { background: #2ec4f1; animation-delay: .3s; }
.logo-blocks i:nth-child(4) { background: #3ddc84; animation-delay: .45s; }
@keyframes logoBounce { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-10px) rotate(-6deg); } 90% { transform: translateY(2px) scaleY(.9); } }
.tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: rgba(0, 0, 0, .25);
  border-radius: 12px; padding: 4px; }
.tab { position: relative; z-index: 1; border: 0; background: none; color: var(--muted); padding: 10px; font-weight: 800;
  cursor: pointer; transition: color .25s; }
.tab.active { color: #2a1a00; }
.tab-ink { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 9px;
  background: linear-gradient(180deg, #ffe066, var(--accent2)); transition: transform .35s var(--spring); }
.tabs.register .tab-ink { transform: translateX(100%); }

.steam-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 15px; font-size: 18px;
  text-decoration: none; color: #fff; background: linear-gradient(180deg, #2a475e, #171a21);
  border: 1px solid rgba(102, 192, 244, .45); box-shadow: 0 6px 0 #0b0d12, 0 10px 26px rgba(26, 159, 255, .25); }
.steam-btn:hover { box-shadow: 0 6px 0 #0b0d12, 0 10px 30px rgba(26, 159, 255, .45); }
.steam-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #0b0d12; }
.steam-btn svg { width: 26px; height: 26px; color: #66c0f4; flex: none; }
.auth-note { color: var(--muted); font-size: 13px; text-align: center; margin: 14px 0 6px; line-height: 1.4; }
.auth-page { min-height: calc(100vh - 42px); justify-content: center; text-align: center; }
.auth-page h2 { margin: 4px 0 8px; }
.auth-page p { color: var(--muted); margin: 0 0 6px; }
.avatar { width: 28px; height: 28px; border-radius: 8px; flex: none; object-fit: cover; background: rgba(255, 255, 255, .08); }
.user-chip { display: flex; align-items: center; gap: 8px; }
.user-chip #userName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-cell { display: flex; align-items: center; gap: 10px; }
.player-cell .avatar { width: 32px; height: 32px; }
.steam-id { font-size: 11px; color: var(--muted); text-decoration: none; font-variant-numeric: tabular-nums; }
.steam-id:hover { color: #66c0f4; text-decoration: underline; }

/* ---------- Честная игра (provably fair) ---------- */
.link-btn { border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer; padding: 0; }
.link-btn:hover { color: var(--text); }
.fair-box { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(61, 220, 132, .07);
  border: 1px solid rgba(61, 220, 132, .3); font-size: 13px; animation: panelIn .4s var(--smooth); }
.fair-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.fair-title { color: var(--good); font-weight: 800; }
.fair-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 3px 0; color: var(--muted); }
.fair-row b { color: var(--text); }
.fair-row.seed input { flex: 1; min-width: 0; padding: 6px 8px; font-size: 13px; font-family: Consolas, "Courier New", monospace; }
.fair-row.seed .chip { height: 32px; padding: 0 10px; }
.hash { font-family: Consolas, "Courier New", monospace; font-size: 11px; color: var(--text); word-break: break-all; text-align: right; }
.stats { position: relative; }
.fair-chip { position: absolute; top: -9px; right: 12px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 800;
  color: #0b2a18; background: var(--good); box-shadow: 0 0 12px rgba(61, 220, 132, .5); }
.modal-card.wide { max-width: 520px; text-align: left; }
.modal-card.wide h2, .modal-card.wide .modal-icon { text-align: center; }
.verify-info { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12px; margin: 10px 0; color: var(--muted); }
.verify-info code { font-family: Consolas, "Courier New", monospace; color: var(--text); word-break: break-all; }
.verify-list { list-style: none; padding: 0; margin: 8px 0; font-size: 13px; color: var(--text); max-height: 40vh; overflow: auto; }
.verify-list li { padding: 5px 0 5px 24px; position: relative; border-top: 1px solid rgba(255, 255, 255, .06); }
.verify-list li::before { position: absolute; left: 2px; font-weight: 900; }
.verify-list li.good::before { content: "✓"; color: var(--good); }
.verify-list li.bad::before { content: "✗"; color: var(--bad); }
.verify-list li.wait::before { content: "…"; color: var(--muted); }
.verify-note { font-size: 12px; color: var(--muted); }
.history-list { list-style: none; padding: 0; margin: 8px 0; max-height: 50vh; overflow: auto; }
.history-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, .06); font-size: 14px; color: var(--text); }
.history-list li span small { display: block; color: var(--muted); font-size: 11px; }

/* ---------- Верхняя панель ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.top-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.topbar > :first-child { min-width: 0; }
.user-chip { color: var(--muted); font-weight: 700; font-size: 14px; max-width: 170px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.balance #balance { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) { .user-chip #userName { display: none; } }
.balance { display: flex; align-items: center; gap: 9px; font-size: clamp(18px, 6.4vw, 26px); font-weight: 900;
  font-variant-numeric: tabular-nums; padding: 4px 14px 4px 6px; border-radius: 30px; background: rgba(0, 0, 0, .25);
  transition: background .3s; }
.balance.up { animation: balUp .7s; }
.balance.down { animation: balDown .5s; }
@keyframes balUp { 30% { background: rgba(61, 220, 132, .35); transform: scale(1.06); } }
@keyframes balDown { 30% { background: rgba(255, 77, 94, .3); transform: scale(.96); } }
.coin { width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff6b8, #ffcc33 45%, #c98a00);
  box-shadow: inset 0 0 0 2px #a86f00, 0 0 12px rgba(255, 204, 51, .5); animation: coinSpin 6s ease-in-out infinite; }
@keyframes coinSpin { 0%, 85% { transform: rotateY(0); } 100% { transform: rotateY(360deg); } }

/* ---------- Ставка / статистика ---------- */
.panel-slot { display: grid; }
.panel-slot > .card { grid-area: 1 / 1; animation: panelIn .45s var(--smooth); }
@keyframes panelIn { from { opacity: 0; transform: translateY(-10px) scale(.97); } }
.bet-row { display: flex; gap: 8px; }
.bet-row input { flex: 1; min-width: 70px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; align-content: center; }
.stat .k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat { min-width: 0; }
@media (max-width: 400px) { .stat .k { font-size: 9px; letter-spacing: 0; } .stats { gap: 2px; padding: 12px 8px; } }
.stat .v { font-size: clamp(14px, 4.6vw, 19px); font-weight: 900; max-width: 100%; white-space: nowrap; margin-top: 3px; font-variant-numeric: tabular-nums; display: inline-block; }
.stat .v.mult { color: var(--accent); text-shadow: 0 0 14px rgba(255, 204, 51, .45); }
.stat .v.win { color: var(--good); }
.bump { animation: bump .45s var(--spring); }
@keyframes bump { 40% { transform: scale(1.35); } }

/* ---------- Поле ---------- */
.board-wrap { position: relative; }
.board { --gap: 4px; --pad: 7px; position: relative; display: grid; grid-template-columns: repeat(8, 1fr); gap: var(--gap);
  padding: var(--pad); aspect-ratio: 1 / 1; width: 100%; background: var(--boardbg); border-radius: 16px;
  border: 1px solid rgba(140, 160, 255, .14);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45), inset 0 0 40px rgba(80, 100, 255, .08); transition: box-shadow .3s; }
.board.doom { animation: doomGlow .5s ease-in-out infinite alternate; }
@keyframes doomGlow { to { box-shadow: 0 0 0 3px var(--bad), 0 0 45px rgba(255, 60, 80, .7); } }
.cell { position: relative; border-radius: 6px; background: var(--empty); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .025); }
.blk, .pc { border-radius: 6px; background: var(--c);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .22), inset 0 3px 0 rgba(255, 255, 255, .38), 0 2px 6px rgba(0, 0, 0, .25); }
.blk { position: absolute; inset: 0; transition: filter .2s, transform .2s; }
.blk.pop-in { animation: popIn .45s var(--spring) both; }
@keyframes popIn { from { transform: scale(0) rotate(-20deg); opacity: 0; } }
.blk.land { animation: land .38s var(--spring) both; }
@keyframes land { 0% { transform: scale(1.25); filter: brightness(1.6); } 55% { transform: scale(.88, 1.08); } }
.blk.dying { z-index: 2; animation: dying .45s ease-in both; }
@keyframes dying { 0% { filter: brightness(1); } 30% { filter: brightness(2.4); transform: scale(1.18); }
  100% { filter: brightness(2.5); transform: scale(0) rotate(25deg); opacity: 0; } }
.blk.crumble { animation: crumble .9s cubic-bezier(.55, 0, 1, .45) both; }
@keyframes crumble { 0% { filter: grayscale(0); } 25% { filter: grayscale(1) brightness(.7); transform: translateY(-4px); }
  100% { filter: grayscale(1) brightness(.5); transform: translate(var(--dx, 0), 160px) rotate(var(--rot, 40deg)); opacity: 0; } }
.blk.fade-out { animation: fadeOut .4s ease-in both; }
@keyframes fadeOut { to { opacity: 0; transform: scale(.4); } }
.cell.ghost::after { content: ""; position: absolute; inset: 0; border-radius: 6px; background: var(--gc); opacity: .42;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); animation: ghostPulse .8s ease-in-out infinite alternate; }
@keyframes ghostPulse { to { opacity: .6; } }
.cell.will-clear .blk { background: var(--gc); filter: brightness(1.25); box-shadow: 0 0 14px var(--gc), inset 0 0 0 2px rgba(255, 255, 255, .7);
  animation: willClear .5s ease-in-out infinite alternate; }
.cell.will-clear.ghost::after { opacity: 1; box-shadow: 0 0 14px var(--gc), inset 0 0 0 2px rgba(255, 255, 255, .7); }
@keyframes willClear { to { filter: brightness(1.55); } }

.banner { position: absolute; left: 50%; top: 50%; z-index: 5; pointer-events: none; white-space: nowrap;
  transform: translate(-50%, -50%); font-size: clamp(22px, 8vw, 34px); font-weight: 900; letter-spacing: -.01em;
  color: #fff; text-shadow: 0 4px 0 rgba(0, 0, 0, .35), 0 0 30px var(--banner-glow, rgba(255, 204, 51, .8));
  animation: bannerIn 1.4s var(--smooth) both; }
.banner small { display: block; text-align: center; font-size: 16px; color: var(--accent); }
@keyframes bannerIn { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(-8deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(2deg); }
  28% { transform: translate(-50%, -50%) scale(1); } 78% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(.9); } }
.float { position: absolute; z-index: 6; pointer-events: none; font-weight: 900; font-size: 26px; color: var(--accent);
  text-shadow: 0 3px 0 rgba(0, 0, 0, .4); transform: translate(-50%, -50%); animation: floatUp 1.1s var(--smooth) forwards; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -180%) scale(1); } }
.doom-ring { position: absolute; z-index: 7; left: 50%; top: 50%; width: 120px; height: 120px; transform: translate(-50%, -50%) rotate(-90deg);
  pointer-events: none; filter: drop-shadow(0 0 10px rgba(255, 60, 80, .9)); }
.doom-ring circle { fill: rgba(10, 5, 20, .55); stroke: var(--bad); stroke-width: 7; stroke-linecap: round;
  stroke-dasharray: 277; stroke-dashoffset: 0; }
.doom-ring.run circle { animation: ring 2s linear forwards; }
@keyframes ring { to { stroke-dashoffset: 277; } }
body.quake .app { animation: quake .5s; }
@keyframes quake { 10%, 50%, 90% { transform: translate(-6px, 3px); } 30%, 70% { transform: translate(6px, -3px); } }

/* ---------- Лоток с фигурами ---------- */
.tray { position: relative; height: 140px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: center; }
.slot { display: flex; align-items: center; justify-content: center; height: 100%; }
.piece { display: grid; cursor: grab; touch-action: none; transition: transform .25s var(--spring), filter .3s, opacity .2s; }
.piece:hover { transform: translateY(-5px) scale(1.06); }
.piece .pc, .piece .e { border-radius: 5px; }
.piece .e { visibility: hidden; }
.piece.enter { animation: pieceIn .55s var(--spring) both; }
@keyframes pieceIn { from { opacity: 0; transform: translateY(40px) scale(.3) rotate(-15deg); } }
.piece.picked { opacity: 0; transform: scale(.6); transition: none; }
.piece.unfit { filter: grayscale(1) brightness(.55); }
.tray.locked .piece { cursor: not-allowed; animation: jitter .25s linear infinite; }
@keyframes jitter { 25% { transform: translateX(-2px) rotate(-1deg); } 75% { transform: translateX(2px) rotate(1deg); } }
.dragging { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; cursor: grabbing; will-change: transform;
  transform-origin: 0 0; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .5)); }
.dragging.snap { transition: transform .09s ease-out; }
.dragging.back { transition: transform .3s var(--smooth), opacity .3s; }
.tray-hint { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 14px; animation: viewIn .5s var(--smooth); }

/* Убийственный блок */
.killer-wrap { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 14px; height: 100%; }
.killer-name { font-weight: 900; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; color: var(--bad);
  text-shadow: 0 0 12px rgba(255, 60, 80, .9); animation: glitch 1.2s steps(2) infinite; max-width: 110px; }
.killer-name small { display: block; font-size: 11px; letter-spacing: .02em; text-transform: none; color: var(--muted); text-shadow: none; }
@keyframes glitch { 0%, 90% { transform: none; } 92% { transform: translate(2px, -1px) skewX(8deg); } 96% { transform: translate(-2px, 1px); } }
.piece.killer { cursor: not-allowed; animation: killerDrop .7s cubic-bezier(.5, 0, .75, 0) both, killerHover 1.6s .7s ease-in-out infinite alternate; }
@keyframes killerDrop { 0% { opacity: 0; transform: translateY(-420px) scale(1.6) rotate(-12deg); } 85% { opacity: 1; transform: translateY(6px) scale(1); }
  100% { transform: none; } }
@keyframes killerHover { to { transform: translateY(-4px) rotate(1.5deg); } }
.piece.killer.monolith .pc { --c: #2a2633; background: linear-gradient(135deg, #3b3647, #1c1924);
  box-shadow: inset 0 0 0 1px rgba(255, 70, 90, .55), inset 0 -3px 0 rgba(0, 0, 0, .4), 0 0 10px rgba(255, 50, 70, .45); }
.piece.killer.monolith .pc:nth-child(3n) { box-shadow: inset 0 0 0 1px rgba(255, 70, 90, .9), inset 0 0 8px rgba(255, 60, 80, .8), 0 0 12px rgba(255, 50, 70, .6); }
.piece.killer.cursed .pc { --c: #8a2be2; background: radial-gradient(circle at 35% 30%, #e0a8ff, #8a2be2 55%, #3d0a6b);
  box-shadow: 0 0 14px rgba(190, 90, 255, .9), inset 0 0 0 1px rgba(255, 255, 255, .5); animation: curse 1s ease-in-out infinite alternate; }
@keyframes curse { to { filter: brightness(1.5) hue-rotate(-25deg); } }

/* Кнопки решения после раунда */
.decision { grid-column: 1 / -1; display: flex; gap: 12px; justify-content: center; }
.decision button { flex: 1; max-width: 190px; padding: 14px 8px; border-radius: 16px; cursor: pointer; line-height: 1.25;
  background: rgba(255, 255, 255, .06); color: var(--text); font-size: 16px; font-weight: 800;
  border: 1px solid rgba(255, 255, 255, .18); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: decisionIn .55s var(--spring) both; transition: transform .2s var(--spring), background .2s, box-shadow .2s; }
.decision button:nth-child(2) { animation-delay: .08s; }
.decision button:hover:not(:disabled) { transform: translateY(-3px); background: rgba(255, 255, 255, .12); }
.decision button:active:not(:disabled) { transform: scale(.96); }
.decision button:disabled { opacity: .45; cursor: not-allowed; }
.decision button small { display: block; font-weight: 600; font-size: 12px; color: var(--muted); margin-top: 2px; }
.decision .take { border-color: rgba(61, 220, 132, .55); box-shadow: 0 0 18px rgba(61, 220, 132, .18); }
.decision .take b { color: var(--good); font-size: 18px; }
.decision .more { border-color: rgba(255, 204, 51, .55); box-shadow: 0 0 18px rgba(255, 204, 51, .15); }
@keyframes decisionIn { from { opacity: 0; transform: translateY(30px) scale(.85); } }

.msg { min-height: 22px; text-align: center; font-size: 14px; color: var(--muted); transition: color .3s; }
.msg.bad { color: var(--bad); font-weight: 800; }
.msg.good { color: var(--good); font-weight: 800; }
.msg.flash { animation: msgIn .4s var(--spring); }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px) scale(.95); } }

/* ---------- Модальное окно ---------- */
.overlay { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(4, 6, 20, .7); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fadeIn .3s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-card { width: 100%; max-width: 360px; text-align: center; padding: 26px 20px 20px; animation: modalIn .55s var(--spring); }
@keyframes modalIn { from { opacity: 0; transform: scale(.6) translateY(40px); } }
.modal-card h2 { margin: 6px 0; font-size: 26px; }
.modal-card p { color: var(--muted); margin: 8px 0 4px; }
.modal-big { font-size: 44px; font-weight: 900; margin: 6px 0; font-variant-numeric: tabular-nums; }
.modal-card.win .modal-big { color: var(--good); text-shadow: 0 0 24px rgba(61, 220, 132, .6); }
.modal-card.lose .modal-big { color: var(--bad); text-shadow: 0 0 24px rgba(255, 60, 80, .5); }
.modal-card.win { box-shadow: 0 0 0 1px rgba(61, 220, 132, .4), 0 0 60px rgba(61, 220, 132, .25); }
.modal-card.lose { box-shadow: 0 0 0 1px rgba(255, 77, 94, .4), 0 0 60px rgba(255, 77, 94, .25); }
.modal-icon { font-size: 54px; line-height: 1; animation: iconIn .8s var(--spring) .1s both; }
@keyframes iconIn { from { transform: scale(0) rotate(-90deg); } }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal-actions .btn { flex: 1; margin-top: 0; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translateX(-50%); padding: 10px 16px;
  border-radius: 12px; background: rgba(20, 26, 70, .95); border: 1px solid var(--card-brd); font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: toastIn .4s var(--spring); max-width: calc(100vw - 32px); }
.toast.bad { border-color: rgba(255, 77, 94, .6); color: #ffc2c8; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 20px) scale(.9); } }

/* ---------- Админка ---------- */
.admin-title { margin: 0; font-size: 22px; }
/* minmax(0, 1fr): широкие таблицы не распирают сетку, а прокручиваются внутри своей карточки */
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.admin-grid > .card { min-width: 0; }
@media (min-width: 900px) { .admin-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .admin-grid .wide { grid-column: 1 / -1; } }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head h3 { margin: 0; font-size: 17px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.kpi { background: rgba(0, 0, 0, .22); border-radius: 12px; padding: 10px 12px; animation: panelIn .4s var(--smooth) both; }
.kpi .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi .v { font-size: 20px; font-weight: 900; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .v.good { color: var(--good); } .kpi .v.bad { color: var(--bad); }
.set-group { margin: 6px 0 14px; }
.set-group h4 { margin: 14px 0 4px; font-size: 13px; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.set-row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; align-items: center; padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .05); }
.set-row label { font-weight: 700; font-size: 14px; }
.set-row .hint { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: -4px; }
.set-row input, .set-row select { padding: 8px 10px; font-size: 15px; }
.set-row.range { grid-template-columns: 1fr 56px; }
.set-row.select { grid-template-columns: 1fr; }
.set-row.range input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
.set-row .val { text-align: right; font-weight: 900; color: var(--accent); }
.switch { position: relative; width: 50px; height: 28px; justify-self: end; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: rgba(255, 255, 255, .15); cursor: pointer; transition: background .25s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  transition: transform .3s var(--spring); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(22px); }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 10px; }
.save-status { color: var(--good); font-weight: 700; font-size: 14px; }
.save-status.bad { color: var(--bad); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px; white-space: nowrap; }
.table td { padding: 8px; border-top: 1px solid rgba(255, 255, 255, .06); white-space: nowrap; }
.table tr { animation: panelIn .35s var(--smooth) both; }
.table .acts { display: flex; gap: 6px; align-items: center; }
.table .acts input { width: 90px; padding: 6px 8px; font-size: 14px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 800; background: rgba(255, 255, 255, .1); }
.tag.good { background: rgba(61, 220, 132, .2); color: #a8f5c8; }
.tag.bad { background: rgba(255, 77, 94, .2); color: #ffb3bb; }
.tag.warn { background: rgba(255, 204, 51, .2); color: #ffe39a; }
.tag.purple { background: rgba(160, 80, 255, .25); color: #e0b8ff; }
.risk-bar { display: inline-block; width: 60px; height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .1); vertical-align: middle; margin-right: 6px; overflow: hidden; }
.risk-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--good), var(--accent), var(--bad)); background-size: 60px 100%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Игровые режимы ---------- */
.mode { display: flex; flex-direction: column; gap: 14px; }
.mode-nav { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: rgba(0, 0, 0, .25); overflow-x: auto; }
.mode-tab { flex: 1; text-align: center; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 800;
  text-decoration: none; white-space: nowrap; transition: background .25s, color .25s; }
.mode-tab:hover { color: var(--text); }
.mode-tab.active { color: #2a1a00; background: linear-gradient(180deg, #ffe066, var(--accent2)); }
.modes-table { margin-top: 12px; }
