* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    color: white;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 500px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.back-btn {
    position: absolute;
    top: 25px;
    left: 25px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
    opacity: 0.8;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

header {
    margin-bottom: 20px;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

h2 {
    margin-bottom: 20px;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
}

.game-info {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.info-box {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 20px;
    border-radius: 15px;
    min-width: 120px;
}

.info-label {
    font-size: 0.8rem;
    opacity: 0.8;
}

.info-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.screen {
    display: none;
    position: relative;
}

#gameScreen, #resultScreen {
    padding-top: 40px;
}

.screen.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.time-selection {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.time-btn {
    background: linear-gradient(135deg, #4A00E0, #8E2DE2);
    border: none;
    color: white;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.time-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.scoreboard-container {
    margin-top: 30px;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 15px;
}

.scoreboard-container h3 {
    margin-bottom: 15px;
    color: #FFD700;
}

.scoreboard {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.score-entry {
    text-align: center;
    position: relative;
    flex-grow: 1;
}

.score-time {
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 0.9;
}

.score-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
}

.score-plays {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 2px;
}

.timer-display {
    font-size: 5rem;
    font-weight: bold;
    margin: 20px 0;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.timer-display.warning {
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

.click-button {
    background: linear-gradient(135deg, #00b09b, #96c93d);
    border: none;
    color: white;
    padding: 20px 50px;
    border-radius: 50px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.click-button.stop {
    background: linear-gradient(135deg, #F44336, #D32F2F);
}

.click-button:hover {
    transform: scale(1.05);
}

.result-details {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
}

.result-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    padding: 10px 0;
}
.result-row:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.result-value {
    font-weight: bold;
    color: #FFD700;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.action-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.action-btn:hover {
    transform: translateY(-3px);
}

.sharing {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.share-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    font-weight: bold;
}

.share-btn i {
    line-height: 0;
}

.share-btn.facebook { background: #3b5998; }
.share-btn.twitter { background: #000; }
.share-btn.instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }

.share-btn:hover {
    transform: translateY(-3px) scale(1.05);
    opacity: 0.9;
}

.history-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 5px;
    transition: background 0.3s ease;
}

.history-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.reset-container {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px dashed rgba(255,255,255,0.2);
}

.reset-btn {
    background: rgba(220, 53, 69, 0.5);
    border: 1px solid rgba(220, 53, 69, 0.8);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.reset-btn:hover {
    background: rgba(220, 53, 69, 0.8);
    opacity: 1;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.visible {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #2c3e50, #4ca1af);
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: fadeIn 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.modal-close:hover {
    opacity: 1;
}

#historySubtitle {
    margin: -15px 0 15px 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

#historyList {
    list-style: none;
    padding: 0;
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
}

#historyList li {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
}

.new-best-banner {
    display: none;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #333;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 50px;
    margin-bottom: 20px;
    font-size: 1.2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.new-best-banner.visible {
    display: inline-block;
    animation: tada 1s ease;
}

.hidden {
    display: none !important;
}

@keyframes tada {
  from { transform: scale3d(1, 1, 1); }
  10%, 20% { transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg); }
  30%, 50%, 70%, 90% { transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); }
  40%, 60%, 80% { transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); }
  to { transform: scale3d(1, 1, 1); }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .container { padding: 20px; }
    h1 { font-size: 2rem; }
    .timer-display { font-size: 3.5rem; }
    .click-button { padding: 18px 40px; font-size: 1.3rem; }
    .action-buttons, .time-selection { flex-direction: column; align-items: center; }
}