/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 900px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 顶部标题区 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.title {
    font-size: 2em;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 0.9em;
    opacity: 0.9;
}

/* 动物展示区 */
.zoo-area {
    flex: 1;
    background: linear-gradient(180deg, #87CEEB 0%, #B0E0E6 50%, #98FB98 50%, #90EE90 100%);
    position: relative;
    overflow: hidden;
    border-radius: 0 0 20px 20px;
}

.ground {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, #90EE90 0%, #7CCD7C 100%);
    opacity: 0.5;
}

/* 动物样式 */
.animal {
    position: absolute;
    font-size: 40px;
    animation: fadeIn 0.5s ease-out;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    user-select: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 底部控制区 */
.controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.control-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 音量控制 */
.volume-control {
    gap: 10px;
}

.volume-display {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
}

.volume-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    min-width: 50px;
    text-align: center;
}

.volume-unit {
    color: #666;
    font-size: 0.8em;
}

.threshold-control {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.threshold-label {
    font-size: 0.8em;
    color: #666;
    white-space: nowrap;
}

.threshold-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.threshold-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.threshold-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.threshold-value {
    font-weight: bold;
    color: #667eea;
    min-width: 30px;
    text-align: center;
}

/* 计时器 */
.timer-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.timer-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.timer-label {
    font-size: 0.8em;
    opacity: 0.9;
}

.timer-value {
    font-size: 2.5em;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

/* 按钮区 */
.buttons-section {
    flex-direction: row;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

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

.btn:active {
    transform: translateY(0);
}

.btn-pause {
    background: #f44336;
    color: white;
    flex: 1;
}

.btn-pause.paused {
    background: #4CAF50;
}

.btn-settings {
    background: #2196F3;
    color: white;
    flex: 1;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-small {
    padding: 5px 15px;
    font-size: 0.8em;
}

.btn-large {
    padding: 15px 40px;
    font-size: 1.2em;
}

/* 设置面板 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3em;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    transition: background 0.3s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.setting-group {
    margin-bottom: 25px;
}

.setting-label {
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.speed-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.speed-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.speed-value {
    font-weight: bold;
    color: #667eea;
    min-width: 30px;
    text-align: center;
}

.animal-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.animal-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.animal-checkbox:hover {
    background: #e9ecef;
}

.animal-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.select-buttons {
    display: flex;
    gap: 10px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 开始页面 */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.start-screen.hide {
    display: none;
}

.start-content {
    text-align: center;
    color: white;
    padding: 40px;
}

.start-content h1 {
    font-size: 3em;
    margin-bottom: 20px;
}

.start-content p {
    font-size: 1.2em;
    margin-bottom: 30px;
    opacity: 0.9;
}

.permission-note {
    font-size: 0.9em;
    opacity: 0.7;
    margin-bottom: 40px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        height: 95vh;
        border-radius: 10px;
    }

    .title {
        font-size: 1.5em;
    }

    .controls {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .timer-value {
        font-size: 2em;
    }

    .animal-selection {
        grid-template-columns: 1fr;
    }

    .buttons-section {
        flex-direction: row;
    }
}
