* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #121212;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 10px;
}

/* ===== Login Screen ===== */
.login-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a0f 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.login-box {
  background: #16213e;
  border: 2px solid #4a4e69;
  border-radius: 16px;
  padding: 32px 24px;
  width: 90%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6), 0 0 80px rgba(74, 78, 105, 0.2);
  animation: loginFadeIn 0.6s ease-out;
}

@keyframes loginFadeIn {
  0% { opacity: 0; transform: translateY(20px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.login-icon {
  font-size: 64px;
  animation: loginFloat 2.5s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255, 209, 102, 0.6));
}

@keyframes loginFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.login-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: #ffd166;
  text-shadow: 0 0 20px rgba(255, 209, 102, 0.4);
  letter-spacing: 4px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: #8d99ae;
  margin-top: -6px;
}

.login-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 1.1rem;
  background: #0f0f12;
  border: 2px solid #4a4e69;
  border-radius: 8px;
  color: #fff;
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
}

.login-input:focus {
  border-color: #ffd166;
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.4);
}

.login-btn-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 8px;
}

.login-btn {
  width: 100%;
  padding: 12px;
  border: 2px solid;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 2px;
}

.login-btn-new {
  background: linear-gradient(135deg, #b71c1c, #d32f2f);
  border-color: #ff5252;
  color: #fff;
}

.login-btn-new:hover {
  background: linear-gradient(135deg, #d32f2f, #f44336);
  box-shadow: 0 0 15px rgba(255, 82, 82, 0.5);
  transform: scale(1.03);
}

.login-btn-continue {
  background: linear-gradient(135deg, #0d47a1, #1565c0);
  border-color: #42a5f5;
  color: #fff;
}

.login-btn-continue:hover {
  background: linear-gradient(135deg, #1565c0, #1e88e5);
  box-shadow: 0 0 15px rgba(66, 165, 245, 0.5);
  transform: scale(1.03);
}

.login-hint {
  font-size: 0.75rem;
  color: #90caf9;
  min-height: 1em;
  text-align: center;
}

/* ===== Main Menu ===== */
.main-menu {
  width: 100%;
  max-width: 600px;
  background-color: #1e1e24;
  border: 2px solid #4a4e69;
  border-radius: 12px;
  padding: 24px 16px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: menuFadeIn 0.5s ease-out;
}

@keyframes menuFadeIn {
  0% { opacity: 0; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

.menu-header {
  text-align: center;
  width: 100%;
  padding-bottom: 12px;
  border-bottom: 1px solid #4a4e69;
}

.menu-welcome {
  font-size: 1.2rem;
  font-weight: bold;
  color: #ffd166;
}

.menu-player-info {
  font-size: 0.85rem;
  color: #8d99ae;
  margin-top: 4px;
}

.menu-battle-btn {
  width: 100%;
  padding: 16px;
  border: 2px solid #4caf50;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  background: linear-gradient(135deg, #1b5e20, #2e7d32);
  color: #fff;
  transition: all 0.2s;
  letter-spacing: 4px;
}

.menu-battle-btn:hover {
  background: linear-gradient(135deg, #2e7d32, #43a047);
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
  transform: scale(1.03);
}

.menu-ranking-title {
  font-size: 1rem;
  font-weight: bold;
  color: #ffd166;
  text-align: center;
  width: 100%;
  margin-top: 4px;
}

.menu-ranking {
  width: 100%;
  background-color: #0f0f12;
  border: 1px solid #3d405b;
  border-radius: 8px;
  padding: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.menu-ranking::-webkit-scrollbar {
  width: 4px;
}

.menu-ranking::-webkit-scrollbar-thumb {
  background-color: #4a4e69;
  border-radius: 2px;
}

.ranking-loading {
  text-align: center;
  color: #8d99ae;
  padding: 16px;
  font-size: 0.85rem;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.ranking-table th {
  text-align: left;
  padding: 4px 6px;
  color: #ffd166;
  border-bottom: 1px solid #4a4e69;
  font-weight: bold;
}

.ranking-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #2b2d42;
  color: #e0e0e0;
}

.ranking-table tr:last-child td {
  border-bottom: none;
}

.ranking-table .rank-num {
  color: #8d99ae;
  width: 24px;
  text-align: center;
}

.ranking-table .rank-1 { color: #ffd700; font-weight: bold; }
.ranking-table .rank-2 { color: #c0c0c0; font-weight: bold; }
.ranking-table .rank-3 { color: #cd7f32; font-weight: bold; }
.ranking-table .rank-me { background-color: rgba(66, 165, 245, 0.15); }

.menu-logout-btn {
  width: 100%;
  padding: 10px;
  border: 1.5px solid #4a4e69;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  background: #2b2d42;
  color: #8d99ae;
  transition: all 0.2s;
}

.menu-logout-btn:hover {
  background: #3d405b;
  color: #ffd166;
}

.game-container {
  width: 100%;
  max-width: 600px;
  background-color: #1e1e24;
  border: 2px solid #4a4e69;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #2b2d42;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: bold;
  color: #ffd166;
}

.save-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.save-btn, .load-btn {
  background-color: #2b2d42;
  border: 1.5px solid #4a4e69;
  color: #ffd166;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.save-btn:hover, .load-btn:hover {
  background-color: #3d405b;
  border-color: #ffd166;
}

.player-id-display {
  font-size: 0.75rem;
  color: #8d99ae;
  margin-left: auto;
}

.stage-progress-container {
  background-color: #16161a;
  border: 1px solid #3d405b;
  border-radius: 20px;
  padding: 8px 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.stage-title {
  font-size: 0.85rem;
  font-weight: bold;
  color: #00f5d4;
}

.progress-nodes {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  position: relative;
}

.progress-nodes::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 10px;
  right: 10px;
  height: 3px;
  background-color: #333;
  z-index: 1;
  transform: translateY(-50%);
}

.node {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: #2b2d42;
  border: 2px solid #555;
  z-index: 2;
  transition: all 0.3s;
}

.node.active {
  background-color: #00f5d4;
  border-color: #fff;
  box-shadow: 0 0 8px #00f5d4;
}

.node.completed {
  background-color: #4caf50;
  border-color: #4caf50;
}

.node.boss-node {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background-color: #ff4757;
  border: 2px solid #ffd166;
}

.node.boss-node.active {
  background-color: #ff0000;
  box-shadow: 0 0 12px #ff0000;
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.25); }
}

.battle-stage {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  background-image: url('gemini_bg_forest.png');
  background-size: cover;
  background-repeat: repeat-x;
  background-position: 0px 0px;
  border-radius: 12px;
  padding: 20px 15px 15px;
  margin-bottom: 10px;
  border: 2px solid #5d4037;
  min-height: 170px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
  transition: background-position 1.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.character {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 45%;
  z-index: 2;
}

.avatar {
  font-size: 48px;
  margin-bottom: 4px;
  transition: transform 0.2s;
  filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.6));
}

.avatar.boss-style {
  font-size: 72px;
  filter: drop-shadow(0 0 12px rgba(255, 0, 0, 0.8));
}

.avatar.running {
  animation: heroRun 1.2s ease-in-out;
}

@keyframes heroRun {
  0% { transform: translateX(0) scale(1); }
  30% { transform: translateX(40px) translateY(-10px) scale(1.1); }
  60% { transform: translateX(80px) translateY(0) scale(1); }
  100% { transform: translateX(0) scale(1); }
}

.hp-bar-bg {
  width: 100%;
  height: 12px;
  background-color: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 4px;
}

.hp-bar-fill {
  height: 100%;
  width: 100%;
  background-color: #4caf50;
  transition: width 0.3s ease;
}

.monster-hp {
  background-color: #f44336;
}

.char-name {
  font-weight: bold;
  font-size: 0.85rem;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
}

.log-box {
  background-color: #0f0f12;
  border-radius: 6px;
  padding: 6px 10px;
  height: 48px;
  overflow-y: auto;
  margin-bottom: 10px;
  font-size: 0.8rem;
  border: 1px solid #333;
  color: #ffd166;
}

.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.skill-card {
  background-color: #2b2d42;
  border: 1.5px solid #4a4e69;
  border-radius: 8px;
  padding: 6px 10px;
  text-align: left;
  transition: all 0.2s;
}

.skill-card.matched {
  border-color: #4caf50;
  background-color: #1b4332;
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.skill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.skill-title {
  font-size: 0.8rem;
  font-weight: bold;
  color: #ffd166;
}

.skill-badge {
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: bold;
}

.badge-easy { background-color: #4caf50; color: #fff; }
.badge-medium { background-color: #2196f3; color: #fff; }
.badge-hard { background-color: #ff9800; color: #fff; }
.badge-extreme { background-color: #f44336; color: #fff; }

.skill-sentence {
  font-size: 0.88rem;
  color: #ffffff;
  font-weight: 500;
  word-break: break-all;
}

.input-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-box {
  width: 100%;
  padding: 12px;
  font-size: 1.1rem;
  background-color: #0f0f12;
  border: 2px solid #ffd166;
  border-radius: 8px;
  color: #fff;
  outline: none;
  text-align: center;
}

.input-box:focus {
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.6);
}

.hint {
  font-size: 0.75rem;
  color: #8d99ae;
  text-align: center;
}

@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.shake {
  animation: shake 0.3s;
}

.death-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, rgba(80,0,0,0.85) 0%, rgba(10,0,0,0.97) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  border-radius: 12px;
  opacity: 0;
  animation: deathFadeIn 1.5s ease-out forwards;
  pointer-events: auto;
}

@keyframes deathFadeIn {
  0% { opacity: 0; }
  40% { opacity: 1; }
  100% { opacity: 1; }
}

.death-icon {
  font-size: 80px;
  animation: deathFloat 2.5s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.8));
  margin-bottom: 10px;
}

@keyframes deathFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.death-title {
  font-size: 2rem;
  font-weight: 900;
  color: #ff1744;
  text-shadow: 0 0 20px rgba(255, 23, 68, 0.8), 0 0 40px rgba(255, 0, 0, 0.4);
  letter-spacing: 6px;
  animation: deathGlow 1.5s ease-in-out infinite alternate;
  margin-bottom: 8px;
}

@keyframes deathGlow {
  0% { text-shadow: 0 0 20px rgba(255, 23, 68, 0.8), 0 0 40px rgba(255, 0, 0, 0.4); }
  100% { text-shadow: 0 0 30px rgba(255, 23, 68, 1), 0 0 60px rgba(255, 0, 0, 0.7), 0 0 80px rgba(200, 0, 0, 0.3); }
}

.death-subtitle {
  font-size: 0.95rem;
  color: #ff8a80;
  margin-bottom: 6px;
  text-align: center;
  line-height: 1.5;
}

.death-stats {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #b71c1c;
  border-radius: 8px;
  padding: 10px 18px;
  margin: 12px 0;
  font-size: 0.85rem;
  color: #ffcdd2;
  text-align: center;
  line-height: 1.6;
}

.death-stats span {
  color: #ffd166;
  font-weight: bold;
}

.death-particles {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
  border-radius: 12px;
  pointer-events: none;
}

.death-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #ff1744;
  border-radius: 50%;
  animation: particleRise linear infinite;
  opacity: 0.6;
}

@keyframes particleRise {
  0% { transform: translateY(100%) scale(0); opacity: 0; }
  20% { opacity: 0.8; }
  100% { transform: translateY(-100%) scale(1.5); opacity: 0; }
}

.death-btn-group {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.death-btn {
  padding: 10px 22px;
  border: 2px solid;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.death-btn-retry {
  background: linear-gradient(135deg, #b71c1c, #d32f2f);
  border-color: #ff5252;
  color: #fff;
}

.death-btn-retry:hover {
  background: linear-gradient(135deg, #d32f2f, #f44336);
  box-shadow: 0 0 15px rgba(255, 82, 82, 0.6);
  transform: scale(1.05);
}

.death-btn-revive {
  background: linear-gradient(135deg, #1b5e20, #2e7d32);
  border-color: #4caf50;
  color: #fff;
}

.death-btn-revive:hover {
  background: linear-gradient(135deg, #2e7d32, #43a047);
  box-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
  transform: scale(1.05);
}

.death-btn-revive:disabled {
  background: #333;
  border-color: #555;
  color: #888;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.death-revive-cost {
  font-size: 0.7rem;
  color: #a5d6a7;
  margin-top: 2px;
}

.death-countdown-box {
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.death-countdown-label {
  font-size: 0.9rem;
  color: #90caf9;
  font-weight: bold;
}

.death-countdown-timer {
  font-size: 3.5rem;
  font-weight: 900;
  color: #42a5f5;
  text-shadow: 0 0 20px rgba(66, 165, 245, 0.8), 0 0 40px rgba(33, 150, 243, 0.4);
  animation: countdownPulse 1s ease-in-out infinite alternate;
}

@keyframes countdownPulse {
  0% { transform: scale(1); text-shadow: 0 0 20px rgba(66, 165, 245, 0.8); }
  100% { transform: scale(1.05); text-shadow: 0 0 30px rgba(66, 165, 245, 1), 0 0 50px rgba(33, 150, 243, 0.6); }
}

.death-countdown-progress {
  width: 80%;
  height: 8px;
  background-color: rgba(255,255,255,0.2);
  border-radius: 4px;
  overflow: hidden;
}

.death-countdown-fill {
  height: 100%;
  background: linear-gradient(90deg, #1e88e5, #42a5f5);
  border-radius: 4px;
  transition: width 0.3s linear;
}
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.death-countdown-label {
  font-size: 0.9rem;
  color: #90caf9;
  font-weight: bold;
}

.death-countdown-timer {
  font-size: 3.5rem;
  font-weight: 900;
  color: #42a5f5;
  text-shadow: 0 0 20px rgba(66, 165, 245, 0.8), 0 0 40px rgba(33, 150, 243, 0.4);
  animation: countdownPulse 1s ease-in-out infinite alternate;
}

@keyframes countdownPulse {
  0% { transform: scale(1); text-shadow: 0 0 20px rgba(66, 165, 245, 0.8); }
  100% { transform: scale(1.05); text-shadow: 0 0 30px rgba(66, 165, 245, 1), 0 0 50px rgba(33, 150, 243, 0.6); }
}

.death-countdown-progress {
  width: 80%;
  height: 8px;
  background-color: rgba(255,255,255,0.2);
  border-radius: 4px;
  overflow: hidden;
}

.death-countdown-fill {
  height: 100%;
  background: linear-gradient(90deg, #1e88e5, #42a5f5);
  border-radius: 4px;
  transition: width 0.3s linear;
}

@keyframes reviveFlash {
  0% { filter: brightness(1) drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.6)); }
  50% { filter: brightness(3) drop-shadow(0 0 20px rgba(255, 215, 0, 1)); }
  100% { filter: brightness(1) drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.6)); }
}

.revive-flash {
  animation: reviveFlash 0.8s ease-out;
}

.low-hp-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  border-radius: 12px;
  z-index: 50;
  box-shadow: inset 0 0 60px rgba(255, 0, 0, 0.6);
  animation: lowHpPulse 1s ease-in-out infinite alternate;
  display: none;
}

@keyframes lowHpPulse {
  0% { box-shadow: inset 0 0 40px rgba(255, 0, 0, 0.3); }
  100% { box-shadow: inset 0 0 80px rgba(255, 0, 0, 0.7); }
}

/* ===== Co-op Menu ===== */
.coop-menu {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a0f 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.coop-box {
  background: #16213e;
  border: 2px solid #7209b7;
  border-radius: 16px;
  padding: 32px 24px;
  width: 90%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 0 40px rgba(0,0,0,0.6), 0 0 80px rgba(114,9,183,0.25);
  animation: coopFadeIn 0.5s ease-out;
}

@keyframes coopFadeIn {
  0% { opacity: 0; transform: translateY(20px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.coop-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #b388ff;
  text-shadow: 0 0 20px rgba(179,136,255,0.4);
  letter-spacing: 3px;
}

.coop-subtitle {
  font-size: 0.8rem;
  color: #8d99ae;
  margin-top: -6px;
}

.coop-btn {
  width: 100%;
  padding: 12px;
  border: 2px solid;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 2px;
}

.coop-btn-create {
  background: linear-gradient(135deg, #4a148c, #6a1b9a);
  border-color: #b388ff;
  color: #fff;
}

.coop-btn-create:hover {
  background: linear-gradient(135deg, #6a1b9a, #8e24aa);
  box-shadow: 0 0 15px rgba(179,136,255,0.5);
  transform: scale(1.03);
}

.coop-btn-join {
  background: linear-gradient(135deg, #004d40, #00695c);
  border-color: #4db6ac;
  color: #fff;
}

.coop-btn-join:hover {
  background: linear-gradient(135deg, #00695c, #00897b);
  box-shadow: 0 0 15px rgba(77,182,172,0.5);
  transform: scale(1.03);
}

.coop-btn-back {
  background: #2b2d42;
  border-color: #4a4e69;
  color: #8d99ae;
}

.coop-btn-back:hover {
  background: #3d405b;
  color: #ffd166;
}

.coop-divider {
  color: #4a4e69;
  font-size: 0.85rem;
  letter-spacing: 2px;
}

.coop-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 1.1rem;
  background: #0f0f12;
  border: 2px solid #4a4e69;
  border-radius: 8px;
  color: #fff;
  outline: none;
  text-align: center;
  letter-spacing: 8px;
  font-weight: bold;
  text-transform: uppercase;
}

.coop-input:focus {
  border-color: #b388ff;
  box-shadow: 0 0 8px rgba(179,136,255,0.4);
}

.coop-hint {
  font-size: 0.75rem;
  color: #90caf9;
  min-height: 1em;
  text-align: center;
}

/* ===== Room Lobby ===== */
.room-lobby {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a0f 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.lobby-box {
  background: #16213e;
  border: 2px solid #4361ee;
  border-radius: 16px;
  padding: 24px 20px;
  width: 90%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 0 40px rgba(0,0,0,0.6), 0 0 60px rgba(67,97,238,0.15);
  animation: coopFadeIn 0.5s ease-out;
}

.lobby-title {
  font-size: 1.1rem;
  font-weight: 900;
  color: #ffd166;
  letter-spacing: 2px;
}

.room-code-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.room-code-label {
  font-size: 0.75rem;
  color: #8d99ae;
}

.room-code-value {
  font-size: 2.5rem;
  font-weight: 900;
  color: #00f5d4;
  text-shadow: 0 0 20px rgba(0,245,212,0.5);
  letter-spacing: 12px;
  font-family: 'Courier New', monospace;
  background: #0f0f12;
  border: 2px solid #4361ee;
  border-radius: 8px;
  padding: 8px 16px;
  width: 100%;
  text-align: center;
}

.room-code-copy-btn {
  background: #2b2d42;
  border: 1.5px solid #4a4e69;
  color: #ffd166;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.room-code-copy-btn:hover {
  background: #3d405b;
  border-color: #ffd166;
}

.lobby-players {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 100px;
}

.lobby-player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f0f12;
  border: 1.5px solid #2b2d42;
  border-radius: 8px;
  padding: 8px 12px;
  transition: border-color 0.3s;
}

.lobby-player-host {
  border-color: #ffd166;
}

.lobby-player-avatar {
  font-size: 1.3rem;
}

.lobby-player-name {
  flex: 1;
  font-weight: bold;
  font-size: 0.9rem;
  color: #e0e0e0;
}

.lobby-player-tag {
  font-size: 0.7rem;
  color: #ffd166;
  margin-left: 4px;
}

.lobby-player-status {
  font-size: 0.7rem;
  color: #4caf50;
}

.lobby-empty-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1.5px dashed #2b2d42;
  border-radius: 8px;
  color: #4a4e69;
  font-size: 0.85rem;
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 8px;
}

.lobby-btn {
  width: 100%;
  padding: 12px;
  border: 2px solid;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 2px;
}

.lobby-btn-start {
  background: linear-gradient(135deg, #1b5e20, #2e7d32);
  border-color: #4caf50;
  color: #fff;
}

.lobby-btn-start:hover {
  background: linear-gradient(135deg, #2e7d32, #43a047);
  box-shadow: 0 0 15px rgba(76,175,80,0.5);
  transform: scale(1.03);
}

.lobby-btn-leave {
  background: #b71c1c;
  border-color: #ff5252;
  color: #fff;
}

.lobby-btn-leave:hover {
  background: #d32f2f;
  box-shadow: 0 0 15px rgba(255,82,82,0.4);
}

.lobby-hint {
  font-size: 0.8rem;
  color: #90caf9;
  text-align: center;
  min-height: 1.2em;
}

/* ===== Menu Co-op Button ===== */
.menu-coop-btn {
  width: 100%;
  padding: 14px;
  border: 2px solid #b388ff;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  background: linear-gradient(135deg, #4a148c, #6a1b9a);
  color: #fff;
  transition: all 0.2s;
  letter-spacing: 3px;
}

.menu-coop-btn:hover {
  background: linear-gradient(135deg, #6a1b9a, #8e24aa);
  box-shadow: 0 0 20px rgba(179,136,255,0.5);
  transform: scale(1.03);
}

/* ===== Co-op Battle: Players Area ===== */
.players-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 48%;
  z-index: 2;
}

.coop-player-entry {
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.4);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 4px 8px;
  transition: all 0.3s;
}

.coop-player-entry.alive {
  border-color: rgba(76,175,80,0.3);
}

.coop-player-entry.dead {
  opacity: 0.5;
  border-color: rgba(244,67,54,0.3);
}

.coop-player-entry.self {
  border-color: #ffd166;
  box-shadow: 0 0 6px rgba(255,209,102,0.3);
}

.coop-player-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.coop-player-avatar {
  font-size: 1.1rem;
}

.coop-player-name {
  font-size: 0.75rem;
  font-weight: bold;
  color: #e0e0e0;
  flex: 1;
}

.coop-player-tag {
  font-size: 0.6rem;
  color: #ffd166;
}

.coop-player-dead-tag {
  font-size: 0.6rem;
  color: #ff5252;
}

.coop-player-hp-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.coop-player-hp-bar {
  flex: 1;
  height: 8px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  overflow: hidden;
}

.coop-player-hp-fill {
  height: 100%;
  background: #4caf50;
  transition: width 0.3s ease;
}

.coop-player-hp-fill.low {
  background: #f44336;
}

.coop-player-hp-fill.medium {
  background: #ff9800;
}

.coop-player-hp-text {
  font-size: 0.65rem;
  color: #aaa;
  min-width: 52px;
  text-align: right;
}

.monster-character {
  width: 48%;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}

.coop-room-badge {
  background: #4a148c;
  color: #b388ff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: bold;
  margin-left: auto;
}

.hp-text {
  font-size: 0.75rem;
  margin-top: 2px;
}
