:root {
  --heaven-gold: #FFD700;
  --hell-red: #8B0000;
  --neutral-gray: #333333;
  --bg-gradient-top: #87CEEB;
  --bg-gradient-bottom: #4682B4;
  --font-stack: Arial, sans-serif;
  
  /* Mobile-specific CSS custom properties */
  --vh: 1vh;
  --vw: 1vw;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
  --safe-left: env(safe-area-inset-left, 0);
  --safe-right: env(safe-area-inset-right, 0);
  --keyboard-offset: 0px;
  --thumb-reach: 60px;
  --min-touch-target: 44px;
  --comfortable-touch-target: 48px;
  --gpu-accelerated: translateZ(0);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-stack);
  background: linear-gradient(#87CEEB, #4682B4);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  
  /* Mobile optimizations */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* Fix for Android Chrome address bar */
html {
  height: -webkit-fill-available;
  background: #87CEEB; /* Fallback background */
}

.game-container {
  max-width: 600px;
  width: 100%;
  text-align: center;
  padding: 1rem;
  padding-bottom: 200px; /* Space for Last 3 Judged panel */
  position: relative;
}

.game-logo {
  max-width: 200px;
  height: auto;
  margin: 0 auto 1rem;
  display: block;
}

@media (max-width: 480px) {
  .game-logo {
    max-width: 150px;
    margin-bottom: 0.5rem;
  }
}

h1 {
  font-size: 1.8rem;
  color: #1a1a1a;
  margin-bottom: 1rem;
  text-shadow: 
    0 0 10px rgba(255, 255, 255, 0.9),
    0 2px 4px rgba(255, 255, 255, 0.8),
    0 1px 2px rgba(0, 0, 0, 0.3);
  font-weight: bold;
}

.meter-container {
  margin: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.meter-icon {
  width: 32px;
  height: 32px;
  opacity: 0.9;
}

@media (max-width: 480px) {
  .meter-icon {
    width: 24px;
    height: 24px;
  }
}

.heaven-icon {
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
}

.hell-icon {
  filter: drop-shadow(0 0 8px rgba(139, 0, 0, 0.6));
}

.meter {
  width: 80%;
  height: 30px;
  background: #fff;
  border: 2px solid var(--neutral-gray);
  border-radius: 15px;
  overflow: hidden;
  position: relative;
  margin: 0 auto;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.meter::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 9%,
    rgba(0,0,0,0.1) 9%,
    rgba(0,0,0,0.1) 10%
  );
  z-index: 2;
  pointer-events: none;
}

.meter-fill {
  height: 100%;
  background: linear-gradient(to right, #FFD700 0%, #333333 50%, #8B0000 100%);
  transition: width 0.3s ease-in-out;
  position: relative;
}

.meter-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: -10px;
  width: 20px;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 70%);
  filter: blur(8px);
  opacity: 0.8;
}

.meter-fill.heaven-leaning {
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.meter-fill.hell-leaning {
  box-shadow: 0 0 20px rgba(139, 0, 0, 0.6);
}

.meter-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #1a1a1a;
  font-weight: bold;
  z-index: 3;
  text-shadow: 
    0 0 6px rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(255, 255, 255, 0.8),
    0 1px 1px rgba(0, 0, 0, 0.2);
  font-size: 0.9rem;
}

.sin-card {
  background: #fff;
  border-radius: 10px;
  padding: 1rem;
  margin: 1rem 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  transition: none;
}

#sin-text {
  transition: opacity 0.2s ease;
}

.sin-card.swoosh-left {
  animation: swoosh-left 0.3s ease forwards;
}

.sin-card.swoosh-right {
  animation: swoosh-right 0.3s ease forwards;
}

@keyframes swoosh-left {
  to { transform: translateX(-100%); opacity: 0; }
}

@keyframes swoosh-right {
  to { transform: translateX(100%); opacity: 0; }
}

/* Mobile Gesture System */
.gesture-hints {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gesture-hints.show {
  opacity: 1;
}

.hint-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 24px;
  opacity: 0.3;
  transition: all 0.2s ease;
}

.hint-arrow span {
  font-size: 30px;
  margin-bottom: 5px;
}

.hint-arrow small {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hint-left {
  color: var(--heaven-gold);
}

.hint-right {
  color: var(--hell-red);
}

/* Touch feedback */
.touch-ripple {
  position: fixed;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  animation: ripple-expand 0.6s ease-out;
  pointer-events: none;
  z-index: 9999;
}

@keyframes ripple-expand {
  to {
    transform: translate(-50%, -50%) scale(4);
    opacity: 0;
  }
}

/* Preview states */
.sin-card.preview-forgive {
  background: linear-gradient(to right, rgba(255, 215, 0, 0.2), white) !important;
}

.sin-card.preview-forgive .hint-left {
  opacity: 1;
  transform: scale(1.2);
}

.sin-card.preview-condemn {
  background: linear-gradient(to left, rgba(139, 0, 0, 0.2), white) !important;
}

.sin-card.preview-condemn .hint-right {
  opacity: 1;
  transform: scale(1.2);
}

/* Hold state */
.sin-card.holding {
  transform: scale(0.95);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Exit animations */
.sin-card.exit-left {
  animation: exitLeft 0.3s ease-out forwards;
}

.sin-card.exit-right {
  animation: exitRight 0.3s ease-out forwards;
}

.sin-card.exit-up {
  animation: exitUp 0.3s ease-out forwards;
}

@keyframes exitLeft {
  to {
    transform: translateX(-150%) rotate(-30deg);
    opacity: 0;
  }
}

@keyframes exitRight {
  to {
    transform: translateX(150%) rotate(30deg);
    opacity: 0;
  }
}

@keyframes exitUp {
  to {
    transform: translateY(-150%) scale(0.5);
    opacity: 0;
  }
}

.timer-bar {
  width: 100%;
  height: 5px;
  background: #ccc;
  position: absolute;
  bottom: 0;
  left: 0;
}

.timer-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--neutral-gray);
}

.timer-bar.active::after {
  animation: timer var(--timer-duration, 3.5s) linear forwards;
}

.timer-bar.pulse::after {
  animation: timer var(--timer-duration, 3.5s) linear forwards, timerPulse 0.5s ease-in-out infinite;
  background: #FF0000;
}

@keyframes timer {
  to { width: 0; }
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.button-container {
  display: flex;
  justify-content: space-around;
  margin: 1rem 0;
}

.judge-btn {
  padding: 0.8rem 2rem;
  font-size: 1.2rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  min-width: 120px;
  min-height: 44px;
  transition: all 0.1s ease;
  position: relative;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.judge-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 5px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.2), transparent);
  pointer-events: none;
}

.judge-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.judge-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.heaven-btn {
  background: var(--heaven-gold);
  color: var(--neutral-gray);
}

.heaven-btn:hover {
  background: #FFE033;
}

.hell-btn {
  background: var(--hell-red);
  color: #fff;
}

.hell-btn:hover {
  background: #A00000;
}

.stats-container {
  margin-top: 1rem;
  font-size: 1rem;
  color: #1a1a1a;
  text-shadow: 
    0 0 8px rgba(255, 255, 255, 0.9),
    0 2px 3px rgba(255, 255, 255, 0.7),
    0 1px 2px rgba(0, 0, 0, 0.2);
  font-weight: 600;
}

.stats-container p {
  margin: 0.5rem 0;
  display: inline-block;
  margin: 0 1rem;
}

.stats-container span {
  font-weight: bold;
  font-size: 1.2rem;
  display: inline-block;
  min-width: 3rem;
  text-align: center;
  transition: all 0.3s ease;
}

.stats-container span.pop {
  animation: popNumber 0.4s ease;
}

.streak-container {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.streak-fire {
  font-size: 1.5rem;
  margin-left: 0.5rem;
  animation: flicker 1.5s ease-in-out infinite;
  display: none;
}

.streak-fire.active {
  display: inline-block;
}

.streak-multiplier {
  position: absolute;
  top: -8px;
  right: -25px;
  background: var(--heaven-gold);
  color: var(--neutral-gray);
  padding: 1px 4px;  /* Smaller padding */
  border-radius: 10px;  /* Slightly smaller radius */
  font-size: 0.6rem;  /* Smaller font */
  font-weight: bold;
  display: none;  /* Hidden by default */
}

.streak-multiplier.active {
  display: block;
  animation: bounceIn 0.5s ease;
}

@keyframes popNumber {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); color: var(--heaven-gold); }
  100% { transform: scale(1); }
}

@keyframes flicker {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@media (max-width: 480px) {
  h1 { 
    font-size: 1.3rem; 
    margin-bottom: 0.5rem;
  }
  
  .game-container {
    padding: 0.5rem;
    padding-bottom: 90px; /* Smaller space for compact Last Judged panel */
    padding-top: calc(var(--safe-top) + 0.5rem);
    max-height: 100vh;
    overflow: hidden;
  }
  
  .judge-btn { 
    font-size: 1rem; 
    padding: 0.8rem 1.2rem;
    min-height: var(--comfortable-touch-target);
    min-width: 100px;
    touch-action: manipulation;
  }
  
  .sin-card { 
    font-size: 0.85rem;
    padding: 0.6rem;
    min-height: 70px; /* Reduced from 100px */
    margin: 0.5rem 0; /* Reduced margins */
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: pan-y;
  }
  
  .button-container {
    gap: 0.5rem;
    margin: 0.5rem 0; /* Reduced margins */
  }
  
  .stats-container {
    margin-top: 0.5rem;
    font-size: 0.85rem;
  }
  
  .stats-container p {
    margin: 0.25rem 0.3rem;
    font-size: 0.85rem;
  }
  
  .meter-container {
    margin: 0.5rem 0; /* Reduced from 1rem */
  }
  
  .meter {
    width: 90%;
    height: 25px; /* Slightly smaller */
  }
  
  .streak-multiplier {
    right: -20px;  /* Closer on mobile */
    top: -6px;     /* Higher on mobile */
    font-size: 0.5rem;  /* Even smaller on mobile */
    padding: 1px 3px;   /* Tighter padding on mobile */
  }
  
  .menu-btn {
    width: 45px;
    height: 45px;
    top: calc(var(--safe-top) + 15px);
    right: calc(var(--safe-right) + 15px);
  }
  
  /* Hide buttons on mobile when gestures are available */
  .mobile-device .button-container {
    opacity: 0.4;
    transform: scale(0.9);
    transition: all 0.3s ease;
  }
  
  .mobile-device .button-container:hover {
    opacity: 1;
    transform: scale(1);
  }
  
  /* Show gesture hints on mobile */
  .mobile-device .gesture-hints {
    display: flex;
  }
  
  /* Touch indicator for mobile */
  .mobile-device .sin-card::before {
    content: '👆 Swipe or tap to judge';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: #666;
    opacity: 0.7;
    pointer-events: none;
  }
  
  .mobile-device .sin-card.holding::before {
    content: '⏸️ Hold to pause timer';
    color: #FFD700;
    opacity: 1;
  }
}

.shake {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Hamburger Menu */
.menu-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: #fff;
  border: 2px solid var(--neutral-gray);
  border-radius: 50%;
  cursor: pointer;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

.menu-btn span {
  width: 20px;
  height: 2px;
  background: var(--neutral-gray);
  transition: all 0.3s ease;
}

.menu-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translateY(6px);
}

.menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translateY(-6px);
}

.menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.menu-overlay.active {
  display: block;
  opacity: 1;
}

.menu-content {
  position: fixed;
  top: 80px;
  right: 20px;
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  min-width: 200px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  margin: 8px 0;
  background: #f5f5f5;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.menu-item:hover {
  background: #e0e0e0;
  transform: translateX(-2px);
}

.menu-icon {
  width: 24px;
  height: 24px;
}

.start-btn {
  margin-top: 1rem;
  padding: 1rem 2rem;
  font-size: 1.2rem;
  background: var(--heaven-gold);
  color: var(--neutral-gray);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: transform 0.1s ease;
  font-weight: bold;
}

.start-btn:hover {
  transform: scale(1.05);
}

.start-btn:active {
  transform: scale(0.95);
}

.soul-animation {
  position: fixed;
  width: 40px;
  height: 60px;
  object-fit: contain;
  z-index: 1000;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease;
  pointer-events: none;
}

.soul-ascending {
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
}

.soul-falling {
  filter: drop-shadow(0 0 10px rgba(139, 0, 0, 0.8));
}

/* Last 2 Judged Panel */
#last-judged-panel {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  width: 90%;
  max-width: 500px;
  font-size: 0.9rem;
  z-index: 50;
  display: none; /* Hidden until sins are judged */
  max-height: 120px; /* Limit height */
  overflow-y: auto;
}

#last-judged-panel h3 {
  margin-top: 0;
  font-size: 1rem;
  color: #1a1a1a;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
  margin-bottom: 12px;
  font-weight: 600;
}

#last-sins-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

#last-sins-list li {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}

#last-sins-list li span {
  flex: 1;
  line-height: 1.4;
}

.copy-btn, .share-btn {
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.copy-btn {
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
  border: 1px solid #2968A3;
  color: white;
  font-weight: bold;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: linear-gradient(135deg, #357ABD 0%, #2968A3 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(53, 122, 189, 0.4);
}

.copy-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Copy button loading state */
.copy-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.copy-btn.loading::after {
  content: '...';
  animation: loadingDots 1s infinite;
}

.share-btn {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  border: 1px solid #FF8C00;
  color: #1a1a1a;
  font-weight: bold;
  transition: all 0.2s ease;
}

.share-btn:hover {
  background: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 140, 0, 0.4);
}

.share-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Share button loading state */
.share-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.share-btn.loading::after {
  content: '...';
  animation: loadingDots 1s infinite;
}

@keyframes loadingDots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Share Card Template - Enhanced */
#share-card-template {
  display: none;
  width: 480px;
  background: #0a0a0a;
  font-family: var(--font-stack);
  position: absolute;
  left: -9999px;
  overflow: hidden;
}

/* Dynamic background based on verdict */
#share-card-template.heaven-verdict {
  background: linear-gradient(135deg, #1a3a52 0%, #2a4a62 50%, #FFD700 200%);
}

#share-card-template.hell-verdict {
  background: linear-gradient(135deg, #1a0a0a 0%, #3a1a1a 50%, #8B0000 200%);
}

/* Card content wrapper */
.share-card-content {
  padding: 40px 30px;
  position: relative;
  z-index: 2;
}

/* Logo styling */
#share-logo {
  width: 140px;
  display: block;
  margin: 0 auto 25px;
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.8));
}

/* Sin text */
#share-sin {
  font-size: 22px;
  text-align: center;
  margin: 0 0 20px;
  line-height: 1.5;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  font-weight: 500;
  padding: 0 20px;
}

/* Verdict display */
#share-verdict {
  font-size: 20px;
  text-align: center;
  margin: 0 0 25px;
  color: #FFD700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  font-weight: bold;
  line-height: 1.4;
}

/* URL footer */
#share-footer {
  font-size: 16px;
  text-align: center;
  color: #fff;
  opacity: 0.9;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  letter-spacing: 1px;
}

#share-footer strong {
  color: #FFD700;
  font-size: 18px;
}

/* Decorative elements */
#share-card-template::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 215, 0, 0.1) 0%, transparent 40%);
  pointer-events: none;
}

#share-card-template::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, #FFD700, transparent);
  opacity: 0.6;
}

@media (max-width: 768px) {
  #last-judged-panel {
    width: 95%;
    bottom: 10px;
    padding: 10px;
    max-height: 100px;
  }
}

@media (max-width: 480px) {
  #last-judged-panel {
    font-size: 0.75rem;
    bottom: 5px;
    padding: 8px;
    max-height: 80px;
  }
  
  #last-judged-panel h3 {
    font-size: 0.85rem;
    margin-bottom: 6px;
    padding-bottom: 4px;
  }
  
  #last-sins-list {
    margin: 0;
  }
  
  #last-sins-list li {
    font-size: 0.7rem;
    margin-bottom: 0.4rem;
    gap: 4px;
  }
  
  .copy-btn, .share-btn {
    font-size: 0.65rem;
    padding: 2px 4px;
  }
}

/* Timeout fail animation */
.flash-fail {
  animation: flashFail 0.4s ease;
}

@keyframes flashFail {
  0% { 
    background-color: rgba(139, 0, 0, 0.25);
    background-image: linear-gradient(rgba(139, 0, 0, 0.25), rgba(139, 0, 0, 0.15));
  }
  100% { 
    background-color: transparent;
    background-image: linear-gradient(var(--bg-gradient-top), var(--bg-gradient-bottom));
  }
}

/* Golden sin glow */
.golden-sin {
  animation: goldenPulse 0.8s ease-in-out infinite alternate;
  border: 2px solid #FFD700 !important;
  background: linear-gradient(135deg, #FFF8DC 0%, #FFFACD 100%) !important;
}

.golden-sin #sin-text {
  color: #B8860B;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

@keyframes goldenPulse {
  from { box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); }
  to { box-shadow: 0 0 40px rgba(255, 215, 0, 0.9), inset 0 0 20px rgba(255, 215, 0, 0.3); }
}

/* Clutch save animation */
.clutch-save {
  animation: clutchFlash 0.3s ease-out;
}

@keyframes clutchFlash {
  0% { border-color: #FF8C00; }
  50% { border-color: #FFD700; transform: scale(1.05); }
  100% { border-color: #333; }
}

/* Divine pot */
.divine-pot {
  position: absolute;
  top: 10px;
  left: 20px;
  font-size: 0.9rem;
  color: #FFD700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
  transition: all 0.3s ease;
}

#pot-value {
  font-weight: bold;
  font-size: 1.1rem;
}

@media (max-width: 480px) {
  .divine-pot {
    position: absolute;
    top: 5px;
    left: 10px;
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: 12px;
    z-index: 100;
  }
  
  .pot-label {
    font-size: 0.7rem;
  }
  
  #pot-value {
    font-size: 0.85rem;
  }
}

/* Pot burst animation */
@keyframes potBurst {
  0% { 
    opacity: 0; 
    transform: translateX(-50%) scale(0.5);
  }
  50% { 
    opacity: 1; 
    transform: translateX(-50%) scale(1.2);
  }
  100% { 
    opacity: 0; 
    transform: translateX(-50%) translateY(-50px) scale(1);
  }
}

/* Frenzy mode overlay */
.frenzy-mode {
  animation: frenzyBg 0.5s ease infinite alternate;
}

@keyframes frenzyBg {
  from { background-color: rgba(255, 215, 0, 0.1); }
  to { background-color: rgba(255, 100, 0, 0.1); }
}

.frenzy-mode .sin-card {
  animation: frenzyShake 0.1s ease infinite;
}

@keyframes frenzyShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px) rotate(-1deg); }
  75% { transform: translateX(2px) rotate(1deg); }
}

/* Frenzy prompt bounce */
@keyframes frenzyBounce {
  from { transform: translate(-50%, -50%) scale(1); }
  to { transform: translate(-50%, -50%) scale(1.05); }
}

/* Consolation float */
@keyframes floatUpFade {
  0% { opacity: 0; transform: translate(-50%, -50%); }
  50% { opacity: 1; transform: translate(-50%, -70%); }
  100% { opacity: 0; transform: translate(-50%, -100%); }
}

/* Enhanced multiplier */
.streak-multiplier.active {
  animation: multiplierPulse 0.6s ease infinite;
}

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

/* Progressive pop animation */
.pop {
  animation: popNumber calc(0.4s * var(--pop-scale, 1.2)) ease;
}

/* Frenzy start button */
.frenzy-start-btn {
  padding: 15px 30px !important;
  font-size: 1.3rem !important;
  font-weight: bold;
  border: none;
  background: #FF4500;
  color: white;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 10px;
  box-shadow: 0 4px 15px rgba(255, 69, 0, 0.4);
  transition: all 0.2s ease;
}

.frenzy-start-btn:hover {
  background: #FF6500;
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 69, 0, 0.6);
}

.frenzy-start-btn:active {
  transform: scale(0.98);
}

/* Share toast notification */
.share-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: #FFD700;
  padding: 12px 24px;
  border-radius: 24px;
  font-weight: bold;
  animation: toastSlideIn 0.3s ease;
  z-index: 1000;
}

@keyframes toastSlideIn {
  from { transform: translate(-50%, 100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Penalty animations */
@keyframes penaltyFloat {
  0% { 
    opacity: 0;
    transform: translate(-50%, 0) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -10px) scale(1.2);
  }
  100% { 
    opacity: 0;
    transform: translate(-50%, -60px) scale(0.8);
  }
}

@keyframes protectBounce {
  0% { 
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Visual indicator on streak counter during high streaks */
#streak-count.protected {
  position: relative;
}

#streak-count.protected::after {
  content: '🛡️';
  position: absolute;
  right: -25px;
  top: -2px;
  font-size: 0.8rem;
  animation: shieldPulse 2s ease infinite;
}

@keyframes shieldPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* Mobile Keyboard and Orientation Handling */
.keyboard-visible {
  --keyboard-height: 0px; /* This will be set by JavaScript */
}

.keyboard-visible #last-judged-panel {
  bottom: calc(var(--keyboard-height) + 10px);
  transition: bottom 0.3s ease;
}

.keyboard-visible .divine-pot {
  bottom: calc(var(--keyboard-height) + 80px);
  transition: bottom 0.3s ease;
}

/* Landscape optimizations */
@media (orientation: landscape) and (max-height: 500px) {
  .game-container {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 0.5rem;
    max-width: 100%;
    height: 100vh;
    padding: 0.5rem;
  }
  
  .game-logo {
    grid-column: 1 / -1;
    max-width: 120px;
    margin: 0 auto 0.5rem;
  }
  
  .meter-container {
    grid-column: 1 / -1;
    margin: 0.5rem 0;
  }
  
  .sin-card {
    grid-column: 2;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    margin: 0;
  }
  
  .stats-container {
    grid-column: 1;
    align-self: start;
    margin-top: 1rem;
  }
  
  .button-container {
    position: fixed;
    bottom: calc(var(--safe-bottom) + 10px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 3rem;
    z-index: 100;
  }
  
  .judge-btn {
    min-width: 120px;
    min-height: 50px;
    font-size: 1.1rem;
  }
  
  /* Landscape panel positioning */
  #last-judged-panel {
    position: fixed;
    right: calc(var(--safe-right) + 10px);
    top: calc(var(--safe-top) + 60px);
    bottom: calc(var(--safe-bottom) + 60px);
    left: auto;
    width: 200px;
    max-width: 200px;
    transform: translateX(180px);
    transition: transform 0.3s ease;
    overflow-y: auto;
  }
  
  .divine-pot {
    position: fixed;
    top: calc(var(--safe-top) + 10px);
    left: calc(var(--safe-left) + 10px);
    bottom: auto;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.7);
    color: #FFD700;
    padding: 6px 12px;
    border-radius: 15px;
    z-index: 40;
  }
}

/* Panel tab for landscape mode */
.panel-tab {
  position: absolute;
  left: -25px;
  top: 50%;
  transform: translateY(-50%);
  width: 25px;
  height: 60px;
  background: #fff;
  border-radius: 8px 0 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  box-shadow: -2px 0 5px rgba(0,0,0,0.1);
  z-index: 1;
  transition: all 0.2s ease;
}

.panel-tab:hover {
  background: #f5f5f5;
}

/* Performance-based styling */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .soul-animation {
    display: none !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-gradient-top: #1a1a2e;
    --bg-gradient-bottom: #16213e;
    --neutral-gray: #e0e0e0;
  }
  
  .sin-card {
    background: #2a2a2a;
    color: #e0e0e0;
  }
  
  .menu-content {
    background: #2a2a2a;
    color: #e0e0e0;
  }
  
  #last-judged-panel {
    background: #2a2a2a;
    color: #e0e0e0;
  }
}