/* ===================================
   Karneval-Theme für Geburtstags-Bingo
   =================================== */

/* ---- Ticket-Karte ---- */
.ticket-card {
  background: white;
  border-radius: 16px;
  border: 2px solid #C41E3A;
  box-shadow: 4px 4px 0px #8B0000;
  position: relative;
}


/* ---- Ticket-Abzeichen ---- */
.ticket-badge {
  background: white;
  border: 2px dashed #C41E3A;
  border-radius: 10px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
}

/* ---- Buttons ---- */
.btn-ticket {
  display: inline-block;
  padding: 10px 24px;
  background: #FFD700;
  color: #C41E3A;
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  border-radius: 999px;
  border: 2px solid #C41E3A;
  box-shadow: 3px 3px 0px #8B0000;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-ticket:hover {
  background: #C41E3A;
  color: #FFD700;
  box-shadow: 1px 1px 0px #8B0000;
  transform: translate(2px, 2px);
}

.btn-ticket:active {
  box-shadow: none;
  transform: translate(3px, 3px);
}

.btn-ticket-sm {
  display: inline-block;
  padding: 4px 12px;
  background: #FFD700;
  color: #C41E3A;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 999px;
  border: 2px solid #C41E3A;
  box-shadow: 2px 2px 0px #8B0000;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1.4;
}

.btn-ticket-sm:hover {
  background: #C41E3A;
  color: #FFD700;
  box-shadow: none;
  transform: translate(2px, 2px);
}

/* ---- Social-Login-Button ---- */
.btn-social {
  display: block;
  padding: 10px 16px;
  background: white;
  color: #374151;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 10px;
  border: 2px solid #e5e7eb;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-social:hover {
  border-color: #C41E3A;
  background: #FFF8E7;
}

/* ---- Bingo-Felder ---- */
.tile-title {
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.tile-card {
  background: white;
  border-color: #C41E3A;
  box-shadow: 2px 2px 0px rgba(139, 0, 0, 0.3);
  font-family: 'Nunito', sans-serif;
  min-height: 80px;
  cursor: default;
}

.tile-revealed {
  background: linear-gradient(135deg, #ffffff 0%, #FFF8E7 100%);
  border-color: #C41E3A;
}

.tile-revealed:hover {
  transform: translateY(-1px);
  box-shadow: 3px 3px 0px rgba(139, 0, 0, 0.4);
}

.tile-completed {
  background: linear-gradient(135deg, #FFD700 0%, #FF8C00 100%);
  border-color: #FF8C00;
  box-shadow: 2px 2px 0px rgba(196, 30, 58, 0.4);
  transform: scale(1.02);
}

.tile-hidden {
  background: #f3f4f6;
  border-color: #d1d5db;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.65;
}

/* ---- Hintergrund-Streifen ---- */
.bg-stripe {
  background: repeating-linear-gradient(
    -45deg,
    #C41E3A,
    #C41E3A 10px,
    #FFD700 10px,
    #FFD700 20px
  );
}

/* ---- Konfetti-Animation ---- */
@keyframes fall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti-piece {
  position: fixed;
  top: 0;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: fall linear forwards;
  z-index: 9999;
  pointer-events: none;
}

/* ---- Tile-Interaktion ---- */
.tile-revealed {
  cursor: pointer;
}

.tile-revealed:active {
  transform: scale(0.97);
}

/* ---- Mobile-Navigation (unten) ---- */
.bottom-nav-safe {
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-safe a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 8px 0;
  font-size: 0.65rem;
  font-weight: 700;
  color: #C41E3A;
  text-decoration: none;
  gap: 2px;
  min-height: 56px;
  transition: background 0.15s ease;
}

.bottom-nav-safe a:hover,
.bottom-nav-safe a.active {
  background: #FFF8E7;
}

/* ---- Responsive Anpassungen ---- */
@media (max-width: 640px) {
  .tile-card {
    min-height: 56px;
    border-width: 2px;
    padding: 3px;
    border-radius: 12px;
    aspect-ratio: 3 / 4;
  }

  .tile-title {
    -webkit-line-clamp: 4;
  }

  .btn-ticket-sm {
    padding: 3px 10px;
    font-size: 0.75rem;
    min-height: 32px;
  }
}

/* ---- HTMX Loading-Indikator ---- */
.htmx-indicator {
  opacity: 0;
  transition: opacity 0.2s;
}

.htmx-request .htmx-indicator {
  opacity: 1;
}

/* ---- Tailwind line-clamp Fallback ---- */
.line-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.line-clamp-3 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.line-clamp-4 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

/* ---- Feldnummer-Badge ---- */
.tile-number {
  position: absolute;
  top: 5px;
  right: 7px;
  font-size: 0.55rem;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.18);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

/* ---- Info-Schaltfläche (Desktop) ---- */
.tile-info-btn {
  position: absolute;
  bottom: 3px;
  left: 3px;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.07);
  color: rgba(0, 0, 0, 0.35);
  font-size: 0.6rem;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}

.tile-info-btn:hover {
  background: rgba(0, 0, 0, 0.16);
  color: rgba(0, 0, 0, 0.7);
}

/* ---- Orientierungshinweis (nur Hochformat, Mobilgerät) ---- */
.landscape-hint-banner {
  display: none;
}

@media screen and (orientation: portrait) and (max-width: 640px) {
  .landscape-hint-banner {
    display: flex;
  }
}

.landscape-hint-banner.dismissed {
  display: none !important;
}

/* ---- Scrollbares Raster (Hochformat, Mobil) ---- */
@media screen and (orientation: portrait) and (max-width: 640px) {
  .board-scroll-wrapper:not(.list-active) {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 70vh;
    margin: 0 -1rem;
    padding: 0 0.25rem;
  }

  .board-scroll-wrapper:not(.list-active) #bingo-board {
    min-width: 500px;
  }
}

/* ---- Listenansicht ---- */
#bingo-board.list-view {
  grid-template-columns: 1fr !important;
  gap: 0.375rem;
}

#bingo-board.list-view .tile-card {
  aspect-ratio: unset !important;
  min-height: 3rem;
  flex-direction: row;
  justify-content: flex-start;
  text-align: left;
  padding: 0.5rem 0.75rem;
  gap: 0.625rem;
}

#bingo-board.list-view .tile-number {
  position: static;
  font-size: 0.8rem;
  color: inherit;
  opacity: 0.35;
  min-width: 1.5rem;
  text-align: right;
  flex-shrink: 0;
  align-self: center;
  pointer-events: none;
}

#bingo-board.list-view .tile-title {
  -webkit-line-clamp: unset !important;
  display: block !important;
  overflow: visible !important;
}

#bingo-board.list-view .tile-description {
  display: block !important;
  -webkit-line-clamp: unset !important;
  overflow: visible !important;
}

/* In der Listenansicht: absolute Positionierungen ausblenden */
#bingo-board.list-view .tile-info-btn {
  display: none !important;
}

#bingo-board.list-view .tile-card > span.absolute {
  display: none;
}
