* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Cal Sans', 'Noto Sans', sans-serif;
    background: #0f0f0f;
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
    overscroll-behavior: none;
    touch-action: pan-x pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float 8s infinite linear;
}

.particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 6s;
}

.particle:nth-child(2) {
    left: 20%;
    animation-delay: 1s;
    animation-duration: 8s;
}

.particle:nth-child(3) {
    left: 30%;
    animation-delay: 2s;
    animation-duration: 7s;
}

.particle:nth-child(4) {
    left: 40%;
    animation-delay: 3s;
    animation-duration: 9s;
}

.particle:nth-child(5) {
    left: 50%;
    animation-delay: 4s;
    animation-duration: 6s;
}

.particle:nth-child(6) {
    left: 60%;
    animation-delay: 5s;
    animation-duration: 8s;
}

.particle:nth-child(7) {
    left: 70%;
    animation-delay: 6s;
    animation-duration: 7s;
}

.particle:nth-child(8) {
    left: 80%;
    animation-delay: 7s;
    animation-duration: 9s;
}

.particle:nth-child(9) {
    left: 90%;
    animation-delay: 8s;
    animation-duration: 6s;
}

.particle:nth-child(10) {
    left: 95%;
    animation-delay: 9s;
    animation-duration: 8s;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
}

.header {
    background: #1a1a1a;
    padding: 1rem;
    text-align: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-bottom: 1px solid #333;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.03),
        transparent
    );
    animation: headerWave 4s infinite linear;
    pointer-events: none;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(76, 175, 80, 0.5),
        transparent
    );
    animation: headerGlow 3s infinite ease-in-out;
    pointer-events: none;
}

@keyframes headerWave {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes headerGlow {
    0%, 100% {
        opacity: 0.3;
        transform: scaleX(0.8);
    }
    50% {
        opacity: 1;
        transform: scaleX(1);
    }
}

.header h1 {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
}

.header p {
    color: #999;
    font-size: 0.9rem;
}

.back-btn, .export-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 50%;
    transition: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.back-btn {
    left: 1rem;
}

.export-btn {
    right: 1rem;
}

.back-btn:hover, .export-btn:hover {
    background: none;
}

.back-btn:active, .export-btn:active {
    background: none;
}

.content {
    flex: 1;
    padding: 2rem 1rem;
    margin-top: 80px;
    margin-bottom: 80px;
}

.noise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    max-width: 800px;
    margin: 2rem auto 0;
}

.noise-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: none;
    position: relative;
    overflow: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.noise-card:hover {
    background: #1a1a1a;
    border-color: #333;
    transform: none;
}

.noise-card:active {
    transform: none;
    background: #1a1a1a;
    border-color: #333;
}

.noise-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.noise-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.noise-card p {
    color: #999;
    font-size: 0.9rem;
}

.player-container {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.noise-visual {
    margin-bottom: 2rem;
}

.noise-icon-large {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
    cursor: pointer;
    transition: none;
    border-radius: 50%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.noise-icon-large:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: none;
}

.noise-icon-large:active {
    background: rgba(255, 255, 255, 0.05);
    transform: none;
}

.noise-icon-large.playing {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
    animation: pulse 2s infinite;
}

.icon-instruction {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 2rem;
    font-style: italic;
}

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

.controls {
    display: none;
}

.play-btn, .stop-btn {
    background: #333;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.play-btn:hover, .stop-btn:hover {
    background: #555;
}

.play-btn.playing {
    background: #4caf50;
}

.volume-control, .timer-control {
    margin-bottom: 2rem;
}

.volume-control label, .timer-control label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #ccc;
}

.volume-control input, .timer-control input {
    width: 100%;
    margin-bottom: 0.5rem;
    accent-color: #4caf50;
}

.timer-control {
    margin-bottom: 2rem;
}

.timer-control label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #ccc;
}

.timer-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.timer-btn {
    background: #333;
    border: none;
    color: #fff;
    padding: 0.6rem 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.timer-btn:hover {
    background: #555;
}

.timer-btn.active {
    background: #4caf50;
    color: #fff;
}

.timer-display {
    display: flex;
    justify-content: center;
    align-items: center;
}

.timer-countdown {
    font-size: 0.9rem;
    color: #4caf50;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.timer-countdown.hidden {
    display: none;
}

.volume-control span, .timer-control span {
    font-size: 0.9rem;
    color: #999;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 2rem;
    max-width: 90%;
    width: 400px;
    text-align: center;
}

.modal-content h2 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: #ccc;
}

.duration-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.duration-btn {
    background: #333;
    border: none;
    color: #fff;
    padding: 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.duration-btn:hover {
    background: #555;
}

.duration-btn.selected {
    background: #4caf50;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-actions button {
    background: #333;
    border: none;
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.modal-actions button:hover {
    background: #555;
}

.modal-actions button:disabled {
    background: #222;
    color: #666;
    cursor: not-allowed;
}

#confirm-ok {
    background: #f44336;
}

#confirm-ok:hover {
    background: #d32f2f;
}

#confirm-export {
    background: #4caf50;
}

#confirm-export:hover:not(:disabled) {
    background: #45a049;
}

#update-confirm {
    background: #4caf50;
}

#update-confirm:hover {
    background: #45a049;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top: 3px solid #4caf50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.footer {
    background: #1a1a1a;
    padding: 1rem;
    text-align: center;
    border-top: 1px solid #333;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    margin-top: auto;
}

.version {
    color: #999;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.made-by {
    color: #ccc;
    font-size: 0.9rem;
}

.made-by a {
    color: #4caf50;
    text-decoration: none;
    transition: color 0.2s;
}

.made-by a:hover {
    color: #66bb6a;
}

.benefits-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
}

.benefits-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #4caf50;
    font-weight: 500;
}

.benefits-section p {
    color: #ccc;
    line-height: 1.5;
    font-size: 0.9rem;
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff9800;
    color: #000;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.9rem;
    z-index: 1001;
    display: none;
}

body.offline .offline-indicator {
    display: block;
}

body.offline .header {
    top: 40px;
}

body.offline .content {
    margin-top: 120px;
}

@media (max-width: 480px) {
    .noise-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
        max-width: none;
    }
    
    .noise-card {
        padding: 1rem;
    }
    
    .noise-icon {
        font-size: 1.5rem;
    }
    
    .content {
        padding: 1rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
    
    .duration-options {
        grid-template-columns: 1fr;
    }
}