/* ==========================================================================
   Sacra UNO - Catholic Liturgical Theme CSS (Mobile Optimized Edition)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;900&family=MedievalSharp&family=Inter:wght@400;600;700&display=swap');

:root {
  --bg-cathedral: #0d0a14;
  --table-felt: #151120;
  --gold-foil: linear-gradient(135deg, #ffe57f 0%, #d4af37 50%, #aa820a 100%);
  --gold-accent: #f5c542;
  --gold-glow: rgba(245, 197, 66, 0.5);
  --gold-border: #d4af37;
  
  --suit-green-bg: linear-gradient(145deg, #1b4d24, #2e7d32);
  --suit-red-bg: linear-gradient(145deg, #8e0000, #c62828);
  --suit-purple-bg: linear-gradient(145deg, #4a148c, #7b1fa2);
  --suit-gold-bg: linear-gradient(145deg, #e65100, #f57f17);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-cathedral);
  background-image: 
    radial-gradient(circle at 50% 25%, rgba(106, 27, 154, 0.3) 0%, transparent 60%),
    radial-gradient(circle at 80% 85%, rgba(198, 40, 40, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 20% 85%, rgba(46, 125, 50, 0.2) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23d4af37' fill-opacity='0.03' fill-rule='evenodd'%3E%3Cpath d='M30 30L15 0h30L30 30zM0 30l30 15v-30L0 30zm60 0L30 15v30l30-15zM30 30l15 30H15l15-30z'/%3E%3C/g%3E%3C/svg%3E");
  color: #f5f3f0;
  font-family: 'Cinzel', 'Georgia', serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header Bar */
.header-bar {
  background: linear-gradient(180deg, #231735 0%, #12091f 100%);
  border-bottom: 2px solid var(--gold-border);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.9);
  z-index: 20;
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 1px;
  background: var(--gold-foil);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 15px var(--gold-glow);
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-badge {
  background: rgba(20, 15, 30, 0.85);
  border: 1.5px solid var(--gold-accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

/* Host Main Desktop Layout */
.host-layout {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 16px;
  height: calc(100vh - 65px);
  padding: 16px;
}

/* Sidebar Panels */
.sidebar-panel {
  background: rgba(20, 16, 32, 0.9);
  border: 2px solid var(--gold-border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.7);
  backdrop-filter: blur(12px);
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.panel-heading {
  color: var(--gold-accent);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 2px dashed rgba(212, 175, 55, 0.3);
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Buttons */
.btn {
  background: var(--gold-foil);
  color: #110d1a;
  border: none;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 900;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 100%;
  touch-action: manipulation;
}

.btn:active, .btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(245, 197, 66, 0.7);
}

.btn-secondary {
  background: linear-gradient(135deg, #3a1c5c, #24113e);
  color: #f5f3f0;
  border: 1px solid var(--gold-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.btn-secondary:active, .btn-secondary:hover {
  background: linear-gradient(135deg, #512b7a, #3a1c5c);
  border-color: #ffe57f;
}

/* Central Cathedral Table */
.board-center {
  background: radial-gradient(circle at 50% 50%, #1e172e 0%, #100b1a 100%);
  border: 2px solid var(--gold-border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  position: relative;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.95), 0 0 25px rgba(0,0,0,0.8);
  padding: 16px;
  overflow: hidden;
}

/* Liturgical Suit Dynamic Aura Overlay */
.board-center::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--active-aura-color, rgba(245, 197, 66, 0.25)) 0%, transparent 70%);
  pointer-events: none;
  transition: all 0.6s ease;
  z-index: 1;
}

.season-indicator {
  z-index: 5;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  border-radius: 30px;
  background: rgba(13, 10, 20, 0.85);
  border: 1.5px solid var(--gold-border);
  box-shadow: 0 4px 15px rgba(0,0,0,0.8);
}

.direction-indicator {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(13, 10, 20, 0.85);
  padding: 6px 14px;
  border-radius: 18px;
  border: 1.5px solid var(--gold-border);
}

/* Central Discard Pile */
.piles-container {
  z-index: 5;
  display: flex;
  gap: 30px;
  align-items: center;
  margin: 10px 0;
}

/* Catholic Card Component */
.uno-card {
  width: 140px;
  height: 210px;
  border-radius: 14px;
  border: 3px solid #d4af37;
  box-shadow: 0 10px 25px rgba(0,0,0,0.85), 0 0 12px rgba(212, 175, 55, 0.3);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  user-select: none;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background-size: cover;
  overflow: hidden;
  touch-action: manipulation;
}

.uno-card::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 1px dashed rgba(255, 235, 179, 0.5);
  border-radius: 9px;
  pointer-events: none;
}

.uno-card.green { background: var(--suit-green-bg); }
.uno-card.red { background: var(--suit-red-bg); }
.uno-card.purple { background: var(--suit-purple-bg); }
.uno-card.gold { background: var(--suit-gold-bg); }
.uno-card.wild {
  background: linear-gradient(135deg, #1b4d24 0%, #8e0000 33%, #4a148c 66%, #e65100 100%);
  border-color: #ffffff;
}

.card-top-left {
  font-size: 1.1rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
}

.card-center-symbol {
  font-size: 3.2rem;
  text-align: center;
  margin: 2px 0;
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.7));
}

.card-title-text {
  font-size: 0.85rem;
  text-align: center;
  font-weight: 800;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.95);
}

.card-desc-text {
  font-size: 0.68rem;
  text-align: center;
  color: #ffe57f;
  font-style: italic;
  margin-top: 2px;
  font-family: 'Inter', sans-serif;
  line-height: 1.15;
}

.uno-card.card-back {
  background: linear-gradient(135deg, #160a26, #361654);
  border: 3px solid var(--gold-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back-cross {
  font-size: 3.2rem;
  color: var(--gold-accent);
  filter: drop-shadow(0 0 15px var(--gold-glow));
}

/* Player Grid Badges */
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
}

.player-card-node {
  background: linear-gradient(145deg, rgba(30, 24, 46, 0.9), rgba(18, 14, 28, 0.9));
  border: 1.5px solid rgba(212, 175, 55, 0.4);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

.player-card-node.active-turn {
  border-color: #ffe57f;
  box-shadow: 0 0 20px var(--gold-glow);
  background: linear-gradient(145deg, rgba(74, 20, 140, 0.8), rgba(45, 12, 85, 0.9));
  transform: scale(1.04);
}

.player-avatar {
  font-size: 1.8rem;
  line-height: 1;
}

.player-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-count-badge {
  display: inline-block;
  background: var(--gold-foil);
  color: #110d1a;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  margin-top: 4px;
}

.amen-badge {
  position: absolute;
  top: -8px;
  right: -4px;
  background: linear-gradient(135deg, #c62828, #b71c1c);
  color: #fff;
  font-weight: 900;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid #ff8a80;
  animation: pulse 1s infinite alternate;
}

/* Action Log Box */
.action-log-box {
  background: rgba(10, 8, 18, 0.95);
  border: 1.5px solid rgba(212, 175, 55, 0.3);
  border-radius: 12px;
  padding: 10px;
  flex: 1;
  min-height: 0;
  max-height: 350px;
  overflow-y: auto;
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-item {
  padding: 5px 8px;
  border-left: 3px solid var(--gold-accent);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0 4px 4px 0;
  line-height: 1.3;
  color: #e0e0e0;
}

/* Bottom Player Controller Bar */
.integrated-player-bar {
  grid-column: 1 / -1;
  background: rgba(16, 12, 26, 0.95);
  border: 2px solid var(--gold-border);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 -5px 25px rgba(0,0,0,0.8);
  z-index: 10;
}

.integrated-hand-scroll {
  display: flex;
  overflow-x: auto;
  padding: 10px 24px 14px 24px;
  align-items: center;
  justify-content: flex-start;
  min-height: 155px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.integrated-hand-scroll .uno-card {
  width: 95px;
  height: 142px;
  margin-left: -12px;
  flex-shrink: 0;
}

.integrated-hand-scroll .uno-card:first-child {
  margin-left: 0 !important;
}

.integrated-hand-scroll .uno-card.playable {
  cursor: pointer;
  box-shadow: 0 0 18px var(--gold-glow);
  border-color: #ffe57f;
  transform: translateY(-4px);
}

.integrated-hand-scroll .uno-card.disabled,
.hand-cards-flex .uno-card.disabled {
  filter: brightness(0.48) contrast(1.15);
  opacity: 0.9;
  border-color: rgba(212, 175, 55, 0.3);
  cursor: not-allowed;
}


/* Prominent Cathedral Seats Bar across top of Central Playing Area */
.top-seats-bar {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(14, 10, 24, 0.85);
  border: 1.5px solid var(--stained-glass-border);
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.6);
  z-index: 10;
}

.seat-node {
  position: relative;
  background: linear-gradient(145deg, rgba(30, 24, 46, 0.95), rgba(18, 14, 28, 0.95));
  border: 2px solid var(--gold-border);
  border-radius: 14px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 130px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.7);
  transition: all 0.25s ease;
}

.seat-node.active-turn {
  border-color: #ffe57f;
  box-shadow: 0 0 20px var(--gold-glow);
  transform: scale(1.06);
  background: linear-gradient(145deg, rgba(60, 48, 90, 0.95), rgba(28, 20, 44, 0.95));
}

.seat-avatar {
  font-size: 1.6rem;
  line-height: 1;
}

.seat-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.seat-name {
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  white-space: nowrap;
}

.seat-card-count {
  font-weight: 900;
  font-size: 0.82rem;
  color: var(--gold-accent);
  background: rgba(212, 175, 55, 0.15);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  margin-top: 2px;
}

/* Mobile Controller Screen Layout - 100% Visible Cards Without Side Scrolling */

.controller-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 65px);
  max-width: 500px;
  margin: 0 auto;
  padding: 8px;
  gap: 8px;
  box-sizing: border-box;
}

.controller-hand-container {
  flex: 1;
  background: rgba(16, 12, 26, 0.92);
  border: 2px solid var(--gold-border);
  border-radius: 16px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: visible;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

.hand-cards-flex {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 25px 8px 10px 8px;
  width: 100%;
  box-sizing: border-box;
}

.hand-cards-flex .uno-card {
  width: 74px;
  height: 115px;
  flex-shrink: 0;
  margin-left: -36px;
  border-radius: 10px;
  border: 2px solid var(--gold-border);
  box-shadow: -4px 4px 12px rgba(0,0,0,0.9);
  transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275), z-index 0.22s ease, box-shadow 0.22s ease;
  transform-origin: bottom center;
  padding: 6px;
}

.hand-cards-flex .uno-card:first-child {
  margin-left: 0 !important;
}

/* Hover & Touch Pop-up Effect on Mobile Cards */
.hand-cards-flex .uno-card:active,
.hand-cards-flex .uno-card:hover,
.hand-cards-flex .uno-card.selected {
  transform: translateY(-24px) scale(1.18) !important;
  z-index: 50 !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.95), 0 0 20px var(--gold-glow) !important;
}

.hand-cards-flex .card-top-left {
  font-size: 0.82rem;
}

.hand-cards-flex .card-center-symbol {
  font-size: 1.8rem;
  margin: 1px 0;
}

.hand-cards-flex .card-title-text {
  font-size: 0.65rem;
  line-height: 1.1;
}

.hand-cards-flex .uno-card.playable {
  cursor: pointer;
  border-color: #ffe57f;
  box-shadow: 0 0 14px var(--gold-glow);
  transform: translateY(-6px);
}

.hand-cards-flex .uno-card.disabled {
  filter: brightness(0.75) contrast(1.1) !important;
  opacity: 0.95 !important;
  border-color: rgba(212, 175, 55, 0.5) !important;
  cursor: pointer !important;
}

.action-bar {
  display: flex;
  gap: 8px;
  width: 100%;
}


.integrated-controls-row {

  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

/* Toast Banner Notification */
.toast-banner {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 14, 32, 0.96);
  border: 2.5px solid var(--gold-accent);
  border-radius: 30px;
  padding: 10px 28px;
  text-align: center;
  box-shadow: 0 10px 35px rgba(0,0,0,0.9), 0 0 25px var(--gold-glow);
  z-index: 99;
  animation: slideDown 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideDown {
  from { top: 30px; opacity: 0; }
  to { top: 70px; opacity: 1; }
}

  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 3, 10, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(8px);
  padding: 16px;
}

.card-panel {
  background: rgba(20, 16, 32, 0.95);
  border: 2px solid var(--gold-border);
  border-radius: 20px;
  padding: 24px 20px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.9);
  text-align: center;
}

.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.color-option-btn {
  height: 95px;
  border-radius: 14px;
  border: 2px solid #fff;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}

/* ==========================================================================
   MOBILE RESPONSIVE MEDIA QUERIES (Smartphones & Tablets)
   ========================================================================== */

@media (max-width: 850px) {
  .host-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    padding: 10px;
    gap: 12px;
  }

  .sidebar-panel {
    max-height: 250px;
    padding: 12px;
    gap: 8px;
  }

  .board-center {
    padding: 14px 10px;
    min-height: 320px;
  }

  .piles-container {
    gap: 20px;
  }

  .uno-card {
    width: 110px;
    height: 165px;
  }

  .card-center-symbol {
    font-size: 2.6rem;
  }

  .card-back-cross {
    font-size: 2.6rem;
  }

  .integrated-player-bar {
    position: sticky;
    bottom: 0;
    margin: 0 -10px -10px -10px;
    border-radius: 16px 16px 0 0;
    padding: 10px;
  }

  .integrated-hand-scroll .uno-card {
    width: 85px;
    height: 128px;
    margin-left: -20px;
  }

  .integrated-controls-row .btn {
    padding: 10px 12px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .brand-title {
    font-size: 1.1rem;
  }

  .room-badge {
    padding: 3px 8px;
    font-size: 0.75rem;
  }

  .piles-container {
    gap: 14px;
  }

  .uno-card {
    width: 95px;
    height: 142px;
    padding: 6px;
  }

  .card-top-left {
    font-size: 0.95rem;
  }

  .card-center-symbol {
    font-size: 2.2rem;
  }

  .card-title-text {
    font-size: 0.75rem;
  }

  .card-desc-text {
    font-size: 0.62rem;
  }

  .integrated-hand-scroll {
    min-height: 135px;
    padding: 8px 16px 12px 18px;
  }

  .integrated-hand-scroll .uno-card {
    width: 80px;
    height: 120px;
    margin-left: -10px;
  }

  .integrated-hand-scroll .uno-card:first-child {
    margin-left: 0 !important;
  }


  .color-option-btn {
    height: 80px;
    font-size: 0.85rem;
  }
}
