.sp-wrap { padding: 16px; max-width: 500px; margin: 0 auto; color: #e8e8f0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.sp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.sp-title { font-size: 20px; font-weight: 800;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; }
.sp-back { background: transparent; border: none; color: #a78bfa;
  font-size: 22px; cursor: pointer; padding: 4px 10px; }
.sp-section { font-size: 12px; font-weight: 700; color: #8b8ba7;
  text-transform: uppercase; letter-spacing: 1px; margin: 20px 0 10px; }
.sp-stakes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.sp-stake { padding: 14px 8px; text-align: center;
  background: rgba(124, 58, 237, 0.1); border: 1.5px solid rgba(167, 139, 250, 0.3);
  border-radius: 12px; cursor: pointer; font-weight: 700; font-size: 14px;
  color: #c4b5fd; transition: all 0.15s; }
.sp-stake.active { background: rgba(124, 58, 237, 0.4); border-color: #a78bfa;
  color: #fff; box-shadow: 0 0 20px rgba(167, 139, 250, 0.4); }
.sp-create { width: 100%; padding: 16px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa); color: #fff;
  border: none; border-radius: 14px; font-weight: 800; font-size: 15px;
  cursor: pointer; margin-bottom: 24px; box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4); }
.sp-rooms { display: flex; flex-direction: column; gap: 10px; }
.sp-room-card { display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; background: rgba(30, 30, 50, 0.9);
  border: 1px solid rgba(167, 139, 250, 0.2); border-radius: 14px; }
.sp-room-info { flex: 1; }
.sp-room-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.sp-room-bet { color: #a78bfa; font-weight: 700; font-size: 13px; }
.sp-join { padding: 10px 20px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed); color: #fff;
  border: none; border-radius: 10px; font-weight: 700; cursor: pointer; font-size: 14px; }
.sp-join.mine { background: linear-gradient(135deg, #f59e0b, #d97706); }
.sp-join.play { background: linear-gradient(135deg, #10b981, #059669); }
.sp-empty { padding: 30px 16px; text-align: center; color: #6b6b8b; font-style: italic; }
.sp-board-wrap { display: flex; justify-content: center; margin: 16px 0; }
.sp-board { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  background: rgba(20, 20, 40, 0.9); padding: 6px; border-radius: 12px;
  box-shadow: inset 0 0 20px rgba(124, 58, 237, 0.2), 0 0 30px rgba(124, 58, 237, 0.15);
  width: 100%; max-width: 400px; aspect-ratio: 1; }
.sp-cell { aspect-ratio: 1; background: linear-gradient(135deg, #2d2d4d, #1e1e35);
  border: 1px solid rgba(167, 139, 250, 0.15); border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #c4b5fd; transition: all 0.1s;
  padding: 0; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; }
@media (hover: hover) {
  .sp-cell:not(.disabled):not(.revealed):not(.flagged):not(.exploded):hover {
    background: linear-gradient(135deg, #3d3d5d, #2e2e45); transform: scale(1.03); }
}
.sp-cell.disabled { cursor: default; }
.sp-cell.revealed { background: rgba(60, 60, 100, 0.6); cursor: default; color: #e8e8f0; }
.sp-cell.revealed.num-1 { color: #60a5fa; }
.sp-cell.revealed.num-2 { color: #34d399; }
.sp-cell.revealed.num-3 { color: #fbbf24; }
.sp-cell.revealed.num-4 { color: #f97316; }
.sp-cell.revealed.num-5 { color: #ef4444; }
.sp-cell.revealed.num-6 { color: #db2777; }
.sp-cell.revealed.num-7 { color: #a855f7; }
.sp-cell.revealed.num-8 { color: #6b7280; }
.sp-cell.flagged { background: linear-gradient(135deg, #dc2626, #991b1b); }
.sp-cell.exploded { background: linear-gradient(135deg, #f97316, #ea580c);
  animation: spExplode 0.4s ease-out; }
@keyframes spExplode {
  0% { transform: scale(0.5); background: #fbbf24; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.sp-cell.mine-placed { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.sp-lives { display: flex; justify-content: center; gap: 6px; margin: 12px 0; }
.sp-lives .heart { font-size: 24px; }
.sp-lives .heart.lost { opacity: 0.2; filter: grayscale(1); }
.sp-timer { font-size: 20px; font-weight: 800; color: #a78bfa; }
.sp-timer.warn { color: #ef4444; animation: spPulse 0.5s infinite; }
@keyframes spPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.sp-countdown { position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%);
  font-size: 140px; font-weight: 900; color: #ef4444;
  text-shadow: 0 0 60px rgba(239, 68, 68, 0.9); pointer-events: none; z-index: 1000;
  animation: spCdPop 0.8s ease-out infinite; }
@keyframes spCdPop {
  0% { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.7; }
}
.sp-mode-row { display: flex; gap: 8px; margin: 12px 0; }
.sp-mode { flex: 1; padding: 12px; background: rgba(30, 30, 50, 0.9);
  border: 2px solid rgba(167, 139, 250, 0.3); border-radius: 12px;
  font-weight: 700; cursor: pointer; color: #c4b5fd; font-size: 14px; }
.sp-mode.active { background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff; border-color: #a78bfa; box-shadow: 0 0 20px rgba(167, 139, 250, 0.4); }
.sp-waiting { text-align: center; padding: 32px 16px; }
.sp-spinner { width: 40px; height: 40px; margin: 0 auto 16px;
  border: 3px solid rgba(167, 139, 250, 0.2); border-top-color: #a78bfa;
  border-radius: 50%; animation: spSpin 0.8s linear infinite; }
@keyframes spSpin { to { transform: rotate(360deg); } }
.sp-waiting-text { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.sp-waiting-hint { font-size: 13px; color: #8b8ba7; line-height: 1.5; }
.sp-ready-btn { flex: 1; padding: 14px; background: linear-gradient(135deg, #10b981, #059669);
  color: #fff; border: none; border-radius: 12px; font-weight: 800;
  font-size: 15px; cursor: pointer; }
.sp-ready-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.sp-result { padding: 20px; text-align: center; }
.sp-result-icon { font-size: 72px; margin-bottom: 12px; }
.sp-result-title { font-size: 32px; font-weight: 900; margin-bottom: 8px; }
.sp-result-title.win { color: #10b981; text-shadow: 0 0 30px rgba(16, 185, 129, 0.5); }
.sp-result-title.lose { color: #ef4444; }
.sp-result-title.draw { color: #fbbf24; }
.sp-result-scores { display: flex; justify-content: center; gap: 24px;
  margin: 20px 0; padding: 16px; background: rgba(30, 30, 50, 0.6); border-radius: 12px; }
.sp-result-score { text-align: center; }
.sp-result-score b { display: block; font-size: 32px; font-weight: 900; color: #a78bfa; }
.sp-result-score span { font-size: 13px; color: #8b8ba7; }
.sp-result-rows { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.sp-result-row { display: flex; justify-content: space-between;
  padding: 10px 16px; background: rgba(30, 30, 50, 0.6); border-radius: 8px; font-size: 14px; }
.sp-result-row.gold { background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4); color: #10b981; font-weight: 700; }
.sp-result-actions { display: flex; gap: 10px; margin-top: 20px; }
.sp-result-btn { flex: 1; padding: 14px; border: none; border-radius: 12px;
  font-weight: 800; font-size: 14px; cursor: pointer; color: #fff; }
.sp-result-btn.primary { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.sp-result-btn.secondary { background: rgba(60, 60, 90, 0.9); color: #c4b5fd; }
.sp-tiebreak-banner { background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; padding: 12px 16px; border-radius: 12px; text-align: center;
  font-weight: 800; font-size: 14px; margin-bottom: 12px;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4); animation: spPulse 1s infinite; }
.sp-opp-wait { background: rgba(30, 30, 50, 0.95);
  border: 2px solid rgba(167, 139, 250, 0.4); color: #c4b5fd;
  padding: 14px 16px; border-radius: 12px; text-align: center;
  font-weight: 700; font-size: 14px; margin: 12px 0; }

/* BANNER (соперник зашёл) */
@keyframes spBannerPulse {
  0%, 100% { transform: translateX(-50%) scale(1); box-shadow: 0 12px 32px rgba(124, 58, 237, 0.8); }
  50% { transform: translateX(-50%) scale(1.05); box-shadow: 0 16px 40px rgba(124, 58, 237, 1); }
}

/* NAV ROW (История / Топ) */
.sp-nav-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 8px; }
.sp-nav-btn {
    padding: 14px 12px;
    background: rgba(30, 30, 50, 0.9);
    border: 1.5px solid rgba(167, 139, 250, 0.3);
    border-radius: 12px;
    font-weight: 700; font-size: 14px;
    color: #c4b5fd; cursor: pointer;
    transition: all 0.15s;
}
.sp-nav-btn:hover { background: rgba(124, 58, 237, 0.2); border-color: #a78bfa; }

/* HISTORY CARDS */
.sp-hist-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; margin-bottom: 8px;
    background: rgba(30, 30, 50, 0.9);
    border: 1px solid rgba(167, 139, 250, 0.2);
    border-radius: 12px;
}
.sp-hist-win { border-left: 4px solid #10b981; }
.sp-hist-lose { border-left: 4px solid #ef4444; }
.sp-hist-draw { border-left: 4px solid #fbbf24; }
.sp-hist-icon { font-size: 26px; flex-shrink: 0; }
.sp-hist-info { flex: 1; min-width: 0; }
.sp-hist-title { font-weight: 800; font-size: 14px; margin-bottom: 2px; }
.sp-hist-win .sp-hist-title { color: #10b981; }
.sp-hist-lose .sp-hist-title { color: #ef4444; }
.sp-hist-draw .sp-hist-title { color: #fbbf24; }
.sp-hist-sub { font-size: 12px; color: #8b8ba7; }
.sp-hist-stake { font-weight: 800; color: #a78bfa; font-size: 14px; flex-shrink: 0; }

/* LEADERBOARD */
.sp-lb-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; margin-bottom: 6px;
    background: rgba(30, 30, 50, 0.9);
    border: 1px solid rgba(167, 139, 250, 0.15);
    border-radius: 10px;
}
.sp-lb-row.sp-lb-me {
    background: rgba(124, 58, 237, 0.2);
    border-color: #a78bfa;
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.3);
}
.sp-lb-rank {
    font-size: 22px; font-weight: 900;
    width: 42px; text-align: center;
    color: #a78bfa;
}
.sp-lb-name {
    flex: 1; font-weight: 700; font-size: 14px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-lb-wins {
    font-weight: 800; font-size: 14px; color: #fbbf24;
}

/* STATS BLOCK (в лобби) */
.sp-stats-block {
    background: rgba(30, 30, 50, 0.7);
    border: 1px solid rgba(167, 139, 250, 0.2);
    border-radius: 14px;
    padding: 14px 12px;
    margin-bottom: 8px;
}
.sp-stats-empty {
    font-size: 13px;
    color: #8b8ba7;
    text-align: center;
    font-style: italic;
}
.sp-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.sp-stat {
    text-align: center;
}
.sp-stat b {
    display: block;
    font-size: 20px;
    font-weight: 900;
    color: #e8e8f0;
    margin-bottom: 2px;
}
.sp-stat span {
    font-size: 10px;
    color: #8b8ba7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sp-stat-win b { color: #10b981; }
.sp-stat-lose b { color: #ef4444; }
.sp-stats-net {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(167, 139, 250, 0.15);
    text-align: center;
    font-size: 13px;
    color: #8b8ba7;
}
.sp-stats-net b {
    font-size: 16px;
    font-weight: 900;
}
.sp-net-win b { color: #10b981; }
.sp-net-lose b { color: #ef4444; }
.sp-net-zero b { color: #8b8ba7; }

/* DELTA в истории */
.sp-hist-delta {
    font-size: 16px;
    font-weight: 900;
    flex-shrink: 0;
    text-align: right;
    min-width: 70px;
}
.sp-hist-delta small {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.7;
    margin-left: 2px;
}
.sp-hd-win { color: #10b981; }
.sp-hd-lose { color: #ef4444; }
.sp-hd-zero { color: #8b8ba7; }

/* Detail-строка статистики */
.sp-stats-detail {
    margin-top: 6px;
    text-align: center;
    font-size: 11px;
    color: #6b6b8b;
}
.sp-detail-win { color: #10b981; font-weight: 800; }
.sp-detail-lose { color: #ef4444; font-weight: 800; }

/* Winnings line */
.sp-stats-winnings {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(167, 139, 250, 0.15);
    text-align: center;
    font-size: 13px;
    color: #8b8ba7;
}
.sp-stats-winnings b {
    font-size: 16px;
    font-weight: 900;
    color: #10b981;
}

/* Код комнаты */
.sp-code-block {
    margin: 8px 0 12px;
    padding: 14px;
    background: rgba(167, 139, 250, 0.1);
    border: 1px dashed rgba(167, 139, 250, 0.5);
    border-radius: 12px;
    text-align: center;
}
.sp-code-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #8b8ba7;
    letter-spacing: 1px;
    margin-bottom: 6px;
}
.sp-code-value {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 4px;
    color: #a78bfa;
    margin: 8px 0;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 12px rgba(167, 139, 250, 0.5);
}
.sp-code-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}
.sp-code-btn {
    padding: 8px 14px;
    background: rgba(167, 139, 250, 0.2);
    border: 1px solid rgba(167, 139, 250, 0.5);
    color: #a78bfa;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
}
.sp-code-btn:hover { background: rgba(167, 139, 250, 0.35); }
.sp-code-hint {
    font-size: 11px;
    color: #8b8ba7;
    margin-top: 8px;
}

.sp-create-private {
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    background: rgba(60, 60, 90, 0.9);
    color: #c4b5fd;
    border: 1.5px solid rgba(167, 139, 250, 0.3);
    border-radius: 14px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}
.sp-create-private:hover { background: rgba(80, 80, 120, 0.9); }

/* ───── ACTION CARDS (2 в ряд) ───── */
.sp-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}
.sp-action-card {
    padding: 18px 12px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.12s, box-shadow 0.12s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.sp-action-card:active { transform: scale(0.97); }
.sp-action-auto {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}
.sp-action-private {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: #fff;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}
.sp-action-icon {
    font-size: 32px;
    margin-bottom: 6px;
    line-height: 1;
}
.sp-action-title {
    font-weight: 800;
    font-size: 15px;
    margin-bottom: 2px;
}
.sp-action-sub {
    font-size: 11px;
    opacity: 0.9;
}
.sp-join-code-btn {
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    background: transparent;
    border: 1.5px dashed rgba(167, 139, 250, 0.4);
    color: #c4b5fd;
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}
.sp-join-code-btn:hover { background: rgba(167, 139, 250, 0.1); }
