* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px;
}

.container {
    background-color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    width: 100%;
    max-width: 600px;
    text-align: center;
    overflow: hidden;
}

.welcome-banner {
    margin: -1.5rem -1.5rem 1.2rem -1.5rem;
    padding: 1rem 0.8rem;
    background: linear-gradient(120deg, #1f3c88, #2a77d4, #2bb9d8, #5ec8f2);
    background-size: 260% 260%;
    animation: banner-gradient-flow 20s ease-in-out infinite;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

@keyframes banner-gradient-flow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.welcome-banner::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0));
}

.school-emblem-wrap {
    display: flex;
    justify-content: center;
    margin: 0;
    background-color: #ffffff;
    border-radius: 999px;
    padding: 0.2rem 0.32rem;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.school-emblem {
    width: min(104px, 27vw);
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.2), rgba(236, 244, 255, 0.06));
    border-radius: 50%;
    padding: 0.3rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

h1 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

h1.updated {
    animation: welcome-update 0.8s ease;
}

@keyframes welcome-update {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.timer-container {
    margin: 1rem 0;
    padding: 0.8rem;
    border-radius: 10px;
    background-color: #f9f9f9;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
}

.timer-display {
    font-size: 4.5rem;
    font-weight: bold;
    margin: 0.5rem 0;
    color: #333;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
}

.timer-display span {
    display: inline-block;
    min-width: 90px;
    text-align: center;
    position: relative;
}

.timer-display span:first-child {
    position: relative;
    margin-right: 20px;
}

.timer-display span:first-child::after {
    content: ":";
    position: absolute;
    right: -18px;
    top: 45%;
    transform: translateY(-50%);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.timer-display.warning {
    color: #f39c12;
    text-shadow: 2px 2px 0px rgba(243, 156, 18, 0.1);
}

.timer-display.danger {
    color: #e74c3c;
    text-shadow: 2px 2px 0px rgba(231, 76, 60, 0.1);
    animation: pulse 1s infinite;
}

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

.status {
    margin: 0.8rem 0;
}

#status-text {
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #555;
    font-size: 0.9rem;
}

#volume-meter {
    height: 8px;
    background-color: #eee;
    border-radius: 20px;
    overflow: hidden;
    margin: 0 auto;
    width: 80%;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

#volume-level {
    height: 100%;
    width: 0;
    background: linear-gradient(to right, #27ae60, #2ecc71);
    transition: width 0.1s ease;
    border-radius: 20px;
}

.action-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    margin: 1rem 0 0.5rem;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.controls {
    margin-top: 1rem;
    transition: max-height 0.5s ease, opacity 0.3s ease, margin 0.5s ease;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin: 0;
}

.controls.visible {
    max-height: 800px;
    opacity: 1;
    margin-top: 1rem;
}

.settings-toggle {
    background-color: #3498db;
    color: white;
    border-radius: 6px;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.settings-toggle:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.settings-toggle i {
    transition: transform 0.3s ease;
    display: inline-block;
    font-size: 1.1rem;
}

.settings-toggle.active i {
    transform: rotate(90deg);
}

.settings-panel {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1rem;
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 10px;
}

.settings-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.timer-settings, .sensitivity-settings {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}

.welcome-settings {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
}

label {
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
    text-align: left;
}

input[type="number"], input[type="range"], input[type="text"] {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

input[type="text"] {
    font-size: 0.9rem;
}

input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#reset-btn {
    background-color: #e74c3c;
}

#reset-btn:hover {
    background-color: #c0392b;
}

#update-welcome-btn {
    background-color: #2ecc71;
    margin-top: 0.3rem;
    align-self: flex-end;
}

#update-welcome-btn:hover {
    background-color: #27ae60;
}

.running #timer-duration, .running #voice-sensitivity {
    opacity: 0.5;
    pointer-events: none;
}

.current-time {
    background-color: #f5f7fa;
    border-radius: 8px;
    padding: 0.5rem;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: center;
    transition: all 0.3s ease;
}

#beijing-time {
    background: linear-gradient(to right, #2980b9, #3498db);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: inline-block;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.copyright {
    margin-top: 1.5rem;
    padding-top: 0.8rem;
    border-top: 1px solid #eee;
    font-size: 0.75rem;
    color: #777;
    text-align: center;
}

.copyright p {
    opacity: 0.8;
    letter-spacing: 0.3px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .container {
        max-height: 100vh;
        overflow-y: auto;
        padding: 1rem;
    }
    
    .welcome-banner {
        margin: -1rem -1rem 1rem -1rem;
        padding: 0.8rem 0.5rem;
    }

    .school-emblem {
        width: min(92px, 31vw);
        padding: 0.25rem;
    }
    
    h1 {
        font-size: 1.1rem;
    }
    
    .timer-display {
        font-size: 3.5rem;
    }
    
    .timer-display span {
        min-width: 70px;
    }
    
    .settings-group {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .timer-settings, .sensitivity-settings {
        margin-bottom: 0.5rem;
    }
    
    .action-controls {
        flex-wrap: wrap;
    }
    
    .settings-toggle, .action-buttons {
        margin: 0.3rem;
    }
    
    .action-buttons {
        flex-direction: row;
    }
    
    button {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    

    #beijing-time {
        padding: 0.3rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* Ultra-compact mode for very small screens */
@media (max-width: 380px) {
    .timer-display {
        font-size: 3rem;
    }
    
    .timer-display span {
        min-width: 55px;
    }
    
    .welcome-banner {
        padding: 0.6rem 0.4rem;
    }

    .school-emblem {
        width: min(82px, 35vw);
    }
    
    h1 {
        font-size: 1rem;
    }
    
    .settings-panel {
        padding: 0.7rem;
    }
    
    button {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .action-controls {
        flex-direction: column;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: center;
    }
} 