/**
 * SCDev Spades - Core Stylesheet
 */

:root {
  --scdsp-felt: #0c3823;
  --scdsp-felt-border: #134e32;
  --scdsp-gold: #fbbf24;
  --scdsp-text: #f8fafc;
}

.scdsp-app {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: var(--scdsp-text);
  background: #06170f;
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px;
  box-sizing: border-box;
}

/* Toolbar & Score Strip */
.scdsp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(12, 56, 35, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.scdsp-toolbar-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--scdsp-gold);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.scdsp-score-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.scdsp-team-pill {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.scdsp-team-pill.team-you { border-color: #10b981; }
.scdsp-team-pill.team-you strong { color: #34d399; font-size: 15px; }

.scdsp-team-pill.team-opp { border-color: #f59e0b; }
.scdsp-team-pill.team-opp strong { color: #fbbf24; font-size: 15px; }

.scdsp-pill-bags {
  font-size: 11px;
  color: #94a3b8;
}

.scdsp-toolbar-controls {
  display: flex;
  gap: 8px;
}

/* Buttons */
.scdsp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  line-height: 1;
}

.scdsp-btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.scdsp-btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.scdsp-btn-accent {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.scdsp-btn-secondary {
  background: #1e293b;
  color: #cbd5e1 !important;
  border: 1px solid #334155;
}

.scdsp-btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.scdsp-btn-xs {
  padding: 4px 8px;
  font-size: 11px;
}

/* Felt Table Arena */
.scdsp-felt-table {
  background: radial-gradient(ellipse at center, #0f462c 0%, #082417 100%);
  border: 4px solid #134e32;
  border-radius: 16px;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.6), 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 16px;
  min-height: 520px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 140px 1fr 140px;
  grid-template-areas:
    ". north ."
    "west center east"
    "south south south";
  gap: 10px;
  position: relative;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .scdsp-felt-table {
    grid-template-columns: 90px 1fr 90px;
  }
}

/* Seat Pods */
.scdsp-seat-north { grid-area: north; justify-self: center; }
.scdsp-seat-west  { grid-area: west; align-self: center; }
.scdsp-seat-east  { grid-area: east; align-self: center; }
.scdsp-seat-south-wrapper { grid-area: south; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }

.scdsp-seat-pod {
  background: rgba(8, 30, 20, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
}

.scdsp-seat-pod.active-turn {
  border-color: #fbbf24;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
  transform: scale(1.04);
}

.scdsp-pod-header {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.scdsp-pod-avatar { font-size: 16px; }

.scdsp-pod-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.scdsp-pod-name {
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scdsp-pod-bid {
  font-size: 10px;
  font-weight: 700;
  color: #fbbf24;
}

.scdsp-pod-tricks {
  background: #10b981;
  color: #000000;
  font-size: 11px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 10px;
}

/* Center Trick Arena */
.scdsp-center-arena {
  grid-area: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 220px;
}

.scdsp-arena-status {
  font-size: 13px;
  font-weight: 800;
  color: #fef08a;
  text-align: center;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.scdsp-spades-broken-badge {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  color: #e0e7ff;
  border: 1px solid #6366f1;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.scdsp-spades-broken-badge[hidden] { display: none !important; }

/* 4-Card Trick Cross Layout */
.scdsp-trick-pile {
  width: 190px;
  height: 150px;
  position: relative;
}

.scdsp-trick-slot {
  position: absolute;
  width: 48px;
  height: 70px;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scdsp-trick-slot.slot-north { top: 0; left: 50%; transform: translateX(-50%); }
.scdsp-trick-slot.slot-south { bottom: 0; left: 50%; transform: translateX(-50%); }
.scdsp-trick-slot.slot-west  { top: 50%; left: 0; transform: translateY(-50%); }
.scdsp-trick-slot.slot-east  { top: 50%; right: 0; transform: translateY(-50%); }

/* Playing Cards */
.scdsp-card {
  width: 48px;
  height: 70px;
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px 4px;
  box-sizing: border-box;
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
  user-select: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.scdsp-card.red { color: #dc2626; }
.scdsp-card.black { color: #0f172a; }

.scdsp-card.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.scdsp-card.playable:hover {
  transform: translateY(-8px) scale(1.08);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5), 0 0 10px rgba(52, 211, 153, 0.8);
  border-color: #10b981;
}

.scdsp-card.back {
  background: repeating-linear-gradient(
    45deg,
    #1e3a8a,
    #1e3a8a 5px,
    #172554 5px,
    #172554 10px
  );
  border: 2px solid #ffffff;
}

/* Hand Fan (South) */
.scdsp-hand-fan {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100%;
  padding: 6px 0 2px 0;
  gap: -12px;
}

.scdsp-hand-fan .scdsp-card {
  margin-right: -16px;
}

.scdsp-hand-fan .scdsp-card:last-child {
  margin-right: 0;
}

/* Modals */
.scdsp-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.scdsp-modal[hidden] { display: none !important; }

.scdsp-modal-card {
  background: linear-gradient(135deg, #0e3020 0%, #071c13 100%);
  border: 2px solid #10b981;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  text-align: center;
}

.scdsp-modal-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--scdsp-gold);
  margin-bottom: 6px;
}

.scdsp-bid-subtitle {
  font-size: 13px;
  color: #cbd5e1;
  margin: 0 0 16px 0;
}

.scdsp-bid-options {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.scdsp-bid-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid #10b981;
  border-radius: 8px;
  color: #ffffff;
  padding: 10px 0;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.scdsp-bid-btn.nil {
  grid-column: span 7;
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
  margin-bottom: 4px;
}

.scdsp-bid-btn:hover {
  background: #10b981;
  color: #000000;
  transform: scale(1.08);
}

.scdsp-bid-btn.nil:hover {
  background: #dc2626;
  color: #ffffff;
}

.scdsp-modal-body {
  font-size: 14px;
  color: #e2e8f0;
  margin-bottom: 18px;
  line-height: 1.6;
}

.scdsp-modal-actions {
  display: flex;
  justify-content: center;
}
