/* Mobile-first responsive design */
* {
  box-sizing: border-box; /* Makes sizing predictable */
}

body {
  /* Remove any fixed widths */
  margin: 0;
  padding: 10px; /* Small padding on mobile */
  font-size: 16px; /* Never go below 16px on mobile */
}

/* Make your main container flexible */
.container {
  max-width: 100%; /* Never wider than screen */
  margin: 0 auto; /* Center it */
  padding: 15px;
}

/* Content section - flexible container */
.content-section {
  /* Remove fixed width */
  width: 100%;
  max-width: 800px; /* Maximum width for readability */
  
  /* Flexible padding */
  padding: 20px 15px; /* Less padding on mobile */
  margin: 0 auto; /* Center it */
  
  /* Prevent content from touching edges */
  box-sizing: border-box;
}

/* Make buttons touch-friendly */
button {
  min-height: 44px; /* Apple's recommended touch target */
  min-width: 44px;
  padding: 12px 20px;
  font-size: 18px; /* Bigger text for easier reading */
  border-radius: 8px;
  margin: 8px; /* Space between buttons */
}

/* Make text readable on all screens */
h1 {
  font-size: clamp(1.5rem, 5vw, 3rem); /* Scales with screen size */
  text-align: center;
  margin: 20px 0;
}

/* Counter display - make it big and readable */
.counter-display {
  font-size: clamp(2rem, 8vw, 4rem); /* Scales with screen */
  text-align: center;
  padding: 20px;
  word-break: break-all; /* Handle long numbers */
}

/* Tablet styles */
@media (min-width: 768px) {
  body {
    padding: 20px;
    font-size: 18px;
  }
  
  .container {
    max-width: 600px;
  }

  /* More padding on larger screens */
  .content-section {
    padding: 40px 30px;
  }
}

/* Desktop styles */
@media (min-width: 1024px) {
  body {
    padding: 40px;
  }
  
  .container {
    max-width: 800px;
  }
  
  button {
    font-size: 20px;
    padding: 15px 30px;
  }
}

/* Header alignment */
.game-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
}

.game-stats h2 {
  font-size: 1.5rem; /* Adjust font size for better visibility */
  color: #333; /* Darker color for better contrast */
}

#count-button {
    position:absolute; /* Position absolutely within the container */
    top: 50%; /* Center vertically */
    left: 50%; /* Center horizontally */
    transform: translate(-50%, -50%); /* Adjust for button size */
    padding: 1rem 2rem; /* Add padding for better click area */
    font-size: 3rem; /* Increase font size for better visibility */
    border: none; /* Remove default border */
    border-radius: 8px; /* Make the button slightly rounded */
    color: rgb(245, 240, 240);
    background-color: #f30909; /* Green background for visibility */
    cursor: pointer; /* Change cursor to pointer on hover */
    transition: background-color 0.3s ease, transform 0.2s ease; /* Smooth transitions */
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Add a subtle shadow for depth */

}

#count-button:active {
    transform: translate(-50%, -50%) scale(0.95); /* Slightly shrink on click */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Reduce shadow on click */
}

#currentCount {
    font-size: 8rem;
    text-align: center;
    color: #333;
    margin: 2rem 0;
    font-weight: bold;
}

.milestone-message {
    position: absolute;
    top: 75%; /* Position below the button */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%); /* Adjust for message width */
    max-width: 600px;
    margin: 1rem auto;
    padding: 1rem 2rem;
    background: #ff4444;
    color: white;
    border-radius: 12px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
    transform: scale(0);
    opacity: 0;
    transition: all 0.3s ease;
}

.milestone-message.show {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

.stats-container {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 20px;
    width: 95%; /* Flexible width */
    max-width: 400px; /* Readable maximum */
    margin: 20px auto; /* Centers it */
    z-index: 100;
}

.stats-container h3 {
    margin-top: 0;
    color: #000000;
    text-align: center;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    font-size: 14px;
}

.stat-label {
    color: #000000;
}

/* Click Fatigue - Slow cursor effect */
body.cursor-tired {
    cursor: wait !important;
}

body.cursor-tired * {
    cursor: wait !important;
}

/* Existential Questions Modal */
.existential-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.existential-modal.show {
    display: flex;
}

.existential-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    max-width: 500px;
    text-align: center;
}

.existential-question {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #333;
    font-weight: bold;
}

.existential-input {
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
    border: 2px solid #ccc;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.existential-submit {
    background: #ff4444;
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
}

/* Bureaucracy Form */
.bureaucracy-form {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #f0f0f0;
    padding: 2rem;
    border: 3px solid #666;
    border-radius: 0;
    width: 400px;
    display: none;
    z-index: 999;
}

.bureaucracy-form.show {
    display: block;
}

.form-title {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
}

.form-field {
    margin-bottom: 1rem;
}

.form-field label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: bold;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #999;
}

.submit-button {
    background: #333;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    width: 100%;
}

/* Economy Bug Alert */
.economy-alert {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: #ff0000;
    color: white;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1.3rem;
    font-weight: bold;
    display: none;
    z-index: 500;
    animation: shake 0.5s;
}

.economy-alert.show {
    display: block;
}

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



/* Motivational Quotes (Sarcastic) */
.sarcastic-quote {
    position: fixed;
    bottom: 50px;
    right: 20px;
    background: #444;
    color: white;
    padding: 1rem;
    border-radius: 8px;
    font-style: italic;
    max-width: 300px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.sarcastic-quote.show {
    opacity: 1;
    transform: translateY(0);
}

/* Click Streak Fire Effect */
.fire-mode #currentCount {
    animation: fire-text 0.5s infinite alternate;
}

@keyframes fire-text {
    0% { color: #ff4444; text-shadow: 0 0 10px #ff0000; }
    100% { color: #ff8800; text-shadow: 0 0 20px #ff4400; }
}

/* Fake Achievement Popup */
.fake-achievement {
    position: fixed;
    top: 50%;
    right: -400px;
    transform: translateY(-50%);
    background: gold;
    color: #333;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    font-weight: bold;
    transition: right 0.5s ease;
}

.fake-achievement.show {
    right: 20px;
}

.achievement-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.achievement-desc {
    font-size: 0.9rem;
    font-weight: normal;
}

/* YouTube Video Distraction - Rename to Local Video Distraction */
.local-video-distraction { /* Renamed from .youtube-distraction */
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px; /* You can adjust size */
    height: 200px; /* You can adjust size */
    display: none;
    z-index: 200;
    border: 3px solid #ff0000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.local-video-distraction.show { /* Renamed from .youtube-distraction.show */
    display: block;
}

.local-video-distraction video { /* Changed from iframe to video */
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures video covers the area */
}

/* Obstacle Message Styling */
.obstacle-message {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: #000;
    color: #0ff;
    padding: 1.5rem 2rem;
    border: 3px solid #0ff;
    border-radius: 0;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    max-width: 600px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
    box-shadow: 0 0 20px #0ff;
}

.obstacle-message.show {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

/* Spinning button animation */
@keyframes spin-button {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Mouse trail elements */
.mouse-trail {
    position: absolute;
    font-size: 2rem;
    pointer-events: none;
    animation: fade-trail 2s ease-out forwards;
    z-index: 9998;
}

@keyframes fade-trail {
    0% { 
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    100% { 
        opacity: 0;
        transform: scale(3) rotate(720deg);
    }
}

/* Screen shake animation */
.screen-shake {
    animation: shake-screen 0.5s ease-in-out;
}

@keyframes shake-screen {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* Color inversion */
.invert-colors {
    filter: invert(1) hue-rotate(180deg);
}

/* Fix button visibility during obstacles */
#count-button {
    z-index: 1000 !important; /* Ensure button stays clickable */
}

/* Ensure obstacles don't break existing layouts */
body {
    transform-origin: center center;
    overflow-x: hidden;
}

/* Red button - mobile-first approach */
.red-button {
  /* Remove any fixed width */
  width: 90%; /* Takes up 90% of container */
  max-width: 300px; /* Never bigger than 300px */
  min-height: 60px; /* Finger-friendly height */
  
  /* Flexible padding scales with screen */
  padding: 15px 20px;
  
  /* Text that scales */
  font-size: clamp(16px, 4vw, 20px);
  
  /* Center the button */
  margin: 20px auto;
  display: block;
}

/* Larger screens get inline buttons */
@media (min-width: 768px) {
  .red-button {
    width: auto; /* Natural width */
    display: inline-block; /* Side by side if multiple */
    margin: 20px 10px;
  }
}