/* ============================================================
   💬 KOMMENTTIOSIO & CHAT-PUHEKUPLAT
   ============================================================ */

.comments-container { 
  margin-top: 12px; 
  padding: 12px; 
  background: rgba(255, 255, 255, 0.95); 
  border-radius: 12px; 
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: commentsSlideDown 0.25s ease-out;
}

@keyframes commentsSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Yksittäisen kommentin säiliö */
.comment-bubble-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 4px;
}

/* Valkoinen puhekupla (pienennetty & tiivistetty) */
.comment-bubble {
  position: relative;
  background: #ffffff;
  border: 1.5px solid #2B2B2B;
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 10.5px;
  color: #2B2B2B;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  max-width: 85%;
  line-height: 1.35;
  box-sizing: border-box;
  margin-left: 2px;
  margin-bottom: 4px;
}

/* Puhekuplan kärki (pito siististi alareunan tuntumassa) */
.comment-bubble::before {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 12px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 7px 6px 0 6px;
  border-color: #2B2B2B transparent transparent transparent;
}

.comment-bubble::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 13px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 5px 0 5px;
  border-color: #ffffff transparent transparent transparent;
}

.comment-text {
  word-break: break-word;
}

/* Poisto- ja ilmiantonapit kuplan sisällä */
.comment-actions { 
  display: flex; 
  gap: 4px; 
  align-items: center; 
  flex-shrink: 0; 
  opacity: 0.65;
  transition: opacity 0.2s;
}

.comment-actions:hover {
  opacity: 1;
}

.btn-comment-action { 
  background: none; 
  border: none; 
  cursor: pointer; 
  font-size: 11px; 
  padding: 0; 
}

/* Kuplan alapuolella oleva kirjoittajarivi (siirretty kohdalleen kärjen kanssa) */
.comment-author-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding-left: 9px;
}

.comment-author-name {
  font-size: 10px;
  font-weight: 700;
  color: #2B2B2B;
}

.comment-time {
  font-size: 8.5px;
  color: #2B2B2B;
  font-weight: 500;
}

/* Pyöristetty syöttökenttä */
.comment-input-box {
  display: flex; 
  gap: 6px; 
  margin-top: 4px;
  align-items: center;
}

.comment-input-box input {
  flex: 1; 
  padding: 6px 12px; 
  font-size: 11px; 
  border: 1.5px solid #2B2B2B; 
  border-radius: 20px; 
  outline: none;
  background: #ffffff;
  color: #2B2B2B;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.comment-input-box input:focus {
  border-color: #2c705f;
  box-shadow: 0 0 5px rgba(44, 112, 95, 0.3);
}

.comment-input-box button {
  width: auto !important; 
  padding: 5px 12px !important; 
  font-size: 10px !important; 
  margin: 0 !important;
  border-radius: 20px !important;
  background: linear-gradient(180deg, #3A3A3A 0%, #2B2B2B 100%) !important;
  color: #F5F1E8 !important;
  border: 1px solid #171717 !important;
  font-weight: 700 !important;
  transition: all 0.2s ease !important;
}

.comment-input-box button:hover {
  background: linear-gradient(180deg, #484848 0%, #333333 100%) !important;
  color: #FFFFFF !important;
}

/* 10. LOMAKKEET & MODALIT */
.autocomplete-wrapper { position: relative; flex-grow: 1; min-width: 0; }
.input-control { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #2B2B2B; font-family: 'Inter', sans-serif; font-size: 14px; box-sizing: border-box; outline: none; }
.autocomplete-results { position: absolute; top: 100%; left: 0; right: 0; background: #ffffff; border: 1px solid #2B2B2B; border-radius: 0 0 8px 8px; z-index: 50; max-height: 120px; overflow-y: auto; display: none; }
.autocomplete-item { padding: 6px 10px; font-size: 12px; cursor: pointer; border-bottom: 1px solid #F5F1E8; }
.error-box { background: #fce8e6; border-left: 4px solid #d9534f; color: #a8201a; padding: 8px 12px; font-size: 12px; font-weight: 600; margin-bottom: 12px; display: none; }

.modal-overlay { position: fixed; top:0; left:0; right:0; bottom:0; background: rgba(43, 43, 43, 0.6); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 15px; }
.modal-overlay.active { display: flex; animation: modalOverlayFade 0.25s ease-out; }
.modal-card { background: #ffffff; border-radius: 14px; padding: 20px; width: 100%; max-width: 350px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); max-height: 85vh; overflow-y: auto; }

/* Brändivärien mukaiset modaalit (kaverihaku, tietosuojaseloste) */
#addFriendModal .modal-card,
#privacyModal .modal-card {
  background: #F5F1E8;
  border: 2px solid #2B2B2B;
}
#addFriendModal h3,
#privacyModal h3 {
  color: #2c705f;
}
#privacyModal h4 {
  color: #2B2B2B;
}
#addFriendModal .autocomplete-results {
  border-color: #2B2B2B;
}
#addFriendModal .btn-submit {
  background: #2B2B2B linear-gradient(180deg, #3A3A3A 0%, #2B2B2B 100%) !important;
  color: #F5F1E8 !important;
  border: 1px solid #171717 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
}
#addFriendModal .btn-submit:hover:not(:disabled) {
  background: linear-gradient(180deg, #484848 0%, #333333 100%) !important;
  color: #FFFFFF !important;
}
#addFriendModal .btn-secondary {
  background: #F5F1E8 !important;
  color: #2B2B2B !important;
  border: 1.5px solid #2B2B2B !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}
#addFriendModal .btn-secondary:hover {
  background: #2B2B2B !important;
  color: #F5F1E8 !important;
  border-color: #2B2B2B !important;
}

/* Tuplaraportoinnin varoitusmodaali: brändi (kermanvalkoinen kortti, tumma teksti), varoitusväri
   #f59e0b samasta paletista kuin viikkostriikin 48h-varoitus (11-venue-effects.css .streak-warning-48h) */
#duplicateMatchModal .modal-card {
  background: #F5F1E8;
  border: 2px solid #f59e0b;
}
#duplicateMatchModal h3 {
  color: #92400e;
}
#duplicateMatchModal p {
  color: #2B2B2B;
}
#duplicateMatchModal .btn-submit {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%) !important;
  color: #2B2B2B !important;
  border: 1px solid #b45309 !important;
}
#duplicateMatchModal .btn-submit:hover:not(:disabled) {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%) !important;
}
#duplicateMatchModal .btn-secondary {
  background: #F5F1E8 !important;
  color: #2B2B2B !important;
  border: 1.5px solid #2B2B2B !important;
}
#duplicateMatchModal .btn-secondary:hover {
  background: #2B2B2B !important;
  color: #F5F1E8 !important;
  border-color: #2B2B2B !important;
}

/* 🌟 MODALIN JA PELAAJAKORTIN NOUSUANIMAATIOT */
@keyframes modalOverlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cardPopUp {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.88);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-overlay.active .modal-card,
.modal-overlay.active #modalStreakContainer {
  animation: cardPopUp 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.25);
}

/* 🌟 TOISEN PELAAJAN KORTIN PASSIIVIANIMAATIO & VALO-EFEKTI */
#otherPlayerCard:not(:hover) {
  animation: playerCardPassiveFloat 7s ease-in-out infinite !important;
}

/* Pomppiva avausanimaatio soitetaan vain kerran kortin avautuessa (JS lisää .card-pop-in), ei joka kerta kun hiiri siirtyy pois kortin päältä */
#otherPlayerCard.card-pop-in:not(:hover) {
  animation: cardPopUp 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.25) 0s 1 normal forwards, playerCardPassiveFloat 7s ease-in-out 0.35s infinite !important;
}

#otherPlayerCard:not(:hover)::after {
  animation: playerCardPassiveShine 7s ease-in-out 0.35s infinite !important;
}

#otherPlayerCard:hover {
  animation: none !important;
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(var(--tz, 0px)) scale(var(--scale, 1.025)) !important;
}

#otherPlayerCard:hover::after {
  animation: none !important;
  opacity: var(--holo-opacity, 1) !important;
  background: radial-gradient(
    circle 260px at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.08) 40%,
    transparent 70%
  ) !important;
}

.footer-section { text-align: center; font-size: 12px; color: #2B2B2B; padding-top: 10px; padding-bottom: 20px; border-radius: 0 0 15px 15px; }
.footer-section a { color: #2B2B2B; border-bottom: 1px dotted #2B2B2B; text-decoration: none; }
.footer-section a:hover { color: #2B2B2B; border-bottom: 1px solid #2B2B2B; }

#toastNotification { position: fixed; bottom: calc(var(--bottom-nav-height, 64px) + 20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%) translateY(calc(100px + var(--bottom-nav-height, 64px))); background: #2B2B2B; color: #F5F1E8; padding: 12px 24px; border-radius: 30px; font-size: 13px; font-weight: 700; box-shadow: 0 4px 15px rgba(43, 43, 43, 0.4); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 10000; pointer-events: none; white-space: nowrap; }
#toastNotification.show { transform: translateX(-50%) translateY(0); }
#toastNotification.error { background: #d9534f; box-shadow: 0 4px 15px rgba(217, 83, 79, 0.4); }

.top-user-nav { position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 8px; z-index: 120; }
.top-nav-btn { display: flex; align-items: center; justify-content: center; background: #F5F1E8; border: 1px solid #2B2B2B; border-radius: 50%; width: 38px; height: 38px; cursor: pointer; position: relative; box-shadow: 0 2px 5px rgba(0,0,0,0.1); transition: transform 0.15s, background 0.2s; }
.top-nav-btn:hover { background: #ffffff; transform: scale(1.05); }

#headerAvatarContainer { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #F5F1E8; }
#headerAvatarContainer img { width: 100%; height: 100%; object-fit: cover; }
/* 🔔 KELTAINEN KELLO ILMOITUS-TILASSA (OHITTAA PELITEEMAN) */
#topFeedBtn.has-notifs .nav-icon-bell {
  stroke: #f59e0b !important;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.7)) !important;
}

/* 🎨 FEED-IKONIN TEEMAVÄRIT KUN EI OLE UUSIA NOTIFIKAATIOITA (KORJATTU KORKEA KONTRASTI) */
#topFeedBtn:not(.has-notifs) .nav-icon-bell {
  stroke: #2B2B2B !important;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2)) !important;
}

body[data-theme="kimble"] #topFeedBtn:not(.has-notifs) .nav-icon-bell {
  stroke: #e0f2fe !important;
  filter: drop-shadow(0 0 4px rgba(224, 242, 254, 0.4)) !important;
}

body[data-theme="yatzy"] #topFeedBtn:not(.has-notifs) .nav-icon-bell {
  stroke: #fce7f3 !important;
  filter: drop-shadow(0 0 4px rgba(252, 231, 243, 0.4)) !important;
}

body[data-theme="alias"] #topFeedBtn:not(.has-notifs) .nav-icon-bell {
  stroke: #fde8e8 !important;
  filter: drop-shadow(0 0 4px rgba(253, 232, 232, 0.4)) !important;
}

body[data-theme="afrikan_tahti"] #topFeedBtn:not(.has-notifs) .nav-icon-bell {
  stroke: #fef08a !important;
  filter: drop-shadow(0 0 4px rgba(254, 240, 138, 0.4)) !important;
}

/* 🔴 NUMERAALINEN ILMOITUSBADGE (0-9+) */
.notif-dot-top { 
  position: absolute; 
  top: -3px; 
  right: -5px; 
  min-width: 17px; 
  height: 17px; 
  padding: 0 4px;
  background-color: #dc2626; 
  color: #ffffff;
  font-family: 'Oswald', sans-serif;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  border-radius: 10px; 
  border: 1.5px solid #F5F1E8; 
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  pointer-events: none;
  animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badgePop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}
#topFeedBtn, #topStreakBtn { background: transparent !important; border: none !important; box-shadow: none !important; width: auto !important; height: auto !important; padding: 4px !important; transition: transform 0.2s ease; position: relative !important; }
#topStreakBtn { margin-right: -13px !important; }
#topFeedBtn:hover, #topStreakBtn:hover { background: transparent !important; transform: scale(1.12) !important; }

/* 🔒 ESTETÄÄN FLEXBOX-LITISTYMINEN (22x22px kiinteä koko kellolle) */
.nav-icon-bell { 
  width: 22px !important; 
  height: 22px !important; 
  min-width: 22px !important; 
  min-height: 22px !important; 
  display: block !important; 
  flex-shrink: 0 !important; 
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15)); 
  transition: stroke 0.2s ease, filter 0.2s ease; 
}

/* 🔥 STRIKKILIEKIN IKONI (Täsmälleen saman kokoinen kuin kello: 22x22px) */
#topStreakBtn .nav-icon-flame,
.nav-icon-flame {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  display: block !important;
  flex-shrink: 0 !important;
  transition: color 0.3s ease, filter 0.3s ease, transform 0.2s ease;
}

.nav-icon-flame.flame-lit {
  color: #f59e0b !important;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.95)) drop-shadow(0 0 2px #d97706) !important;
}

.nav-icon-flame.flame-dark {
  color: #2B2B2B !important;
  opacity: 0.65;
  filter: none !important;
}

/* ⚠️ STRIKKI VAARASSA -HUUTOMERKKIBADGE (<48h) */
.streak-warning-badge {
  position: absolute !important;
  top: 4px !important;
  right: 4px !important;
  width: 8.5px !important;
  height: 8.5px !important;
  min-width: 8.5px !important;
  min-height: 8.5px !important;
  background-color: #dc2626 !important;
  color: #ffffff !important;
  font-family: 'Oswald', sans-serif !important;
  font-size: 6.5px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  border-radius: 50% !important;
  border: 1px solid #F5F1E8 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
  pointer-events: none !important;
  animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
