* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', sans-serif;
}

body {
  background: #0f0c29;
  background: linear-gradient(135deg, #24243e, #302b63, #0f0c29);
  color: #fff;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Background animated blobs */
.background-animation {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: -1;
  overflow: hidden;
}

.shape {
  position: absolute;
  filter: blur(80px);
  border-radius: 50%;
  animation: float 10s infinite alternate ease-in-out;
}

.shape-1 {
  width: 400px; height: 400px;
  background: rgba(118, 56, 255, 0.5);
  top: -100px; left: -100px;
}

.shape-2 {
  width: 500px; height: 500px;
  background: rgba(255, 65, 108, 0.4);
  bottom: -150px; right: -100px;
  animation-delay: -5s;
}

.shape-3 {
  width: 300px; height: 300px;
  background: rgba(0, 210, 255, 0.3);
  top: 40%; left: 40%;
  animation-duration: 15s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Glassmorphism Container */
.glass-container {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  width: 90%;
  max-width: 1000px;
  height: 90vh;
  padding: 30px;
  box-shadow: 0 25px 45px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: auto;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

/* Screens */
.screen { display: none; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center;}
.screen.active { display: flex; animation: fadeIn 0.5s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

h1 { font-size: 3rem; margin-bottom: 10px; background: linear-gradient(to right, #ff416c, #ff4b2b); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
p { font-size: 1.1rem; color: rgba(255, 255, 255, 0.7); margin-bottom: 30px; }

/* Inputs and Buttons */
input[type="text"], textarea {
  width: 100%; max-width: 400px;
  padding: 15px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 20px;
  outline: none;
  transition: all 0.3s ease;
}
input[type="text"]:focus, textarea:focus { border-color: #ff416c; box-shadow: 0 0 15px rgba(255, 65, 108, 0.4); }
textarea { resize: none; height: 120px; }

.primary-btn {
  padding: 12px 35px;
  border-radius: 30px;
  border: none;
  background: linear-gradient(45deg, #ff416c, #ff4b2b);
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(255, 65, 108, 0.4);
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(255, 65, 108, 0.6); }
.primary-btn:active { transform: translateY(0); }

/* Lobby List */
.player-list {
  list-style: none;
  width: 100%; max-width: 400px;
  margin-bottom: 30px;
}
.player-list li {
  background: rgba(255, 255, 255, 0.1);
  padding: 12px 20px;
  margin-bottom: 10px;
  border-radius: 12px;
  font-size: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Game Screen specific layout */
#game-screen { justify-content: flex-start; }
.header { display: flex; justify-content: space-between; width: 100%; margin-bottom: 20px; }
.phase-info { background: rgba(0,0,0,0.3); padding: 8px 15px; border-radius: 8px; font-weight: 600; }
.scoreboard { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end;}
.score-badge { background: rgba(255,255,255,0.1); padding: 5px 12px; border-radius: 20px; font-size: 0.9rem; }

.main-play-area { flex-grow: 1; display: flex; flex-direction: column; align-items: center; width: 100%; }
#role-alert { margin-bottom: 20px; font-size: 1.5rem; }

.sentence-card {
  background: #fff;
  color: #000;
  font-size: 1.5rem;
  font-weight: 800;
  padding: 30px;
  border-radius: 16px;
  width: 100%; max-width: 600px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  margin-bottom: 30px;
}

.cards-container { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; width: 100%; }

/* Playable Cards */
.play-card {
  width: 160px; height: 220px;
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  border-radius: 12px;
  padding: 15px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
  position: relative;
  text-align: center;
}
.play-card:hover { transform: translateY(-10px) rotate(2deg); box-shadow: 0 15px 30px rgba(0,0,0,0.3); }

/* Revealed Cards on Table */
.table-card {
  width: 150px; height: 200px;
  background: linear-gradient(135deg, #111, #222);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; padding: 15px;
  cursor: pointer;
  opacity: 0; transform: scale(0.8) translateY(20px);
  transition: transform 0.2s;
}
.table-card.revealed {
  animation: revealAnim 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  background: white; color: black;
}
@keyframes revealAnim {
  to { opacity: 1; transform: scale(1) translateY(0) rotateY(360deg); }
}

.table-card:hover.revealed { transform: scale(1.05) rotateY(360deg); border-color: #ff416c; }

.hand-area { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); width: 100%; }
.hand-area h3 { margin-bottom: 15px; font-size: 1.2rem; color: rgba(255,255,255,0.8); }

.result-box {
  background: rgba(0,0,0,0.4); padding: 30px; border-radius: 16px; border: 2px solid #ff416c;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Image Card Adjustments (Horizontal / Vertical support) */
.play-card.image-card, .table-card.image-card {
  width: auto;
  height: auto;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.play-card.image-card img {
  max-height: 220px;
  max-width: 320px;
  width: auto;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.table-card.image-card img {
  max-height: 200px;
  max-width: 320px;
  width: auto;
  height: auto;
  display: block;
  border-radius: 12px;
}

/* Timer and Story Mode Styles */
.timer-display {
  background: rgba(255, 65, 108, 0.2);
  border: 1px solid #ff416c;
  padding: 8px 15px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 1.2rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 5px;
}

.timer-display.urgent {
  animation: pulseRed 1s infinite;
  background: rgba(255, 0, 0, 0.4);
  border-color: red;
}

@keyframes pulseRed {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.story-item {
  background: rgba(255, 255, 255, 0.05);
  border-left: 4px solid #00d2ff;
  padding: 15px;
  border-radius: 0 8px 8px 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  animation: slideInLeft 0.5s ease forwards;
  opacity: 0;
}

.story-item .author {
  font-size: 0.9rem;
  color: #aaa;
  font-weight: 600;
}

.story-item .content {
  font-size: 1.2rem;
  font-weight: 400;
  color: #fff;
}

.story-item img {
  max-width: 100%;
  max-height: 250px;
  border-radius: 8px;
  object-fit: contain;
  align-self: flex-start;
}

@keyframes slideInLeft {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
