* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background-image: url("https://t.alcy.cc/ycy");
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.main-wrapper {
    display: flex;
    gap: 20px;
    max-width: 1200px;
    width: 100%;
    flex-wrap: wrap;
}

.container {
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    flex: 1;
    min-width: 320px;
    animation: slideIn 0.5s ease-out;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
    .main-wrapper {
        flex-direction: column;
    }
    .container {
        padding: 20px;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.selection-step {
    margin-bottom: 25px;
}

.step-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.step-indicator {
    font-size: 14px;
    color: #667eea;
    background: rgb(240 242 255 / 50%);
    padding: 4px 12px;
    border-radius: 20px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
}

@media (min-width: 768px) {
    .options-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

@media (min-width: 1024px) {
    .options-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

.option-btn {
    padding: 12px;
    border: 2px solid rgb(224 224 224 / 35%);
    border-radius: 10px;
    background: rgba(255,255,255,0.35);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: translateY(0);
}

.option-btn:hover {
    border-color: #667eea;
    background: #f0f2ff;
    transform: translateY(-2px);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.option-btn.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
    animation: selectPulse 0.4s ease-out;
}

@keyframes selectPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.nav-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-back {
    background: #e0e0e0;
    color: #666;
}

.btn-back:hover {
    background: #d0d0d0;
}

.btn-next {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-next:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.confirmation {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.confirmation-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.confirmation-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.confirmation-item:last-child {
    border-bottom: none;
}

.confirmation-label {
    color: #666;
    font-size: 14px;
}

.confirmation-value {
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.button-group {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.btn-primary {
    padding: 12px 40px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 200% auto;
    transition: all 0.4s ease;
    color: white;
}

.btn-primary:hover, .nav-btn.btn-next:hover {
    background-position: right center;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.result-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    display: none;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card.show {
    display: block;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.room-info {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.battery-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.battery-bar {
    width: 120px;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.battery-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: width 0.5s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    color: #666;
    font-size: 14px;
}

.detail-value {
    color: #333;
    font-weight: 500;
}

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    display: none;
    animation: shake 0.5s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.error-message.show {
    display: block;
}

.loading {
    display: none;
    text-align: center;
    margin-top: 20px;
}

.loading.show {
    display: block;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.timestamp {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin-top: 15px;
}

.history-container {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
    width: 100%;
    max-width: 350px;
    animation: slideIn 0.5s ease-out;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.history-container.hidden {
    display: none;
}

@media (max-width: 768px) {
    .history-container {
        max-width: 100%;
    }
}

.history-section {
    margin-top: 0;
}

.history-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-item {
    background: rgba(255,255,255,0.55);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.history-item:hover {
    background: #e8eaf6;
    transform: translateX(8px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.history-info {
    font-size: 14px;
    color: #333;
}

.history-date {
    font-size: 12px;
    color: #999;
}

.delete-btn {
    background: rgb(255 213 213 / 55%);
    color: #c62828;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: #ffcdd2;
}

.clear-history-btn {
    background: rgba(255,255,255,0.45);
    color: #666;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.clear-history-btn:hover {
    background: #d0d0d0;
}

.privacy-notice {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 12px;
    margin-top: 15px;
    border-radius: 5px;
    font-size: 12px;
    color: #1976d2;
}

.empty-history {
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 20px;
}

.hidden {
    display: none !important;
}

.selection-step {
    animation: fadeIn 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.confirmation {
    animation: slideUp 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.options-grid::-webkit-scrollbar {
    width: 6px;
}

.options-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.options-grid::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.options-grid::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

.initial-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.initial-loading .spinner {
    width: 60px;
    height: 60px;
    border-width: 4px;
    border-top-width: 4px;
}

.initial-loading p {
    margin-top: 20px;
    color: #fff;
    font-size: 16px;
    text-shadow: #000 3px 3px 11px;
}

.btn-reselect {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 20px auto;
    display: block;
}

.btn-reselect:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* --- 自定义通知弹窗 (Toast) 样式 --- */

.custom-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 400px;
    z-index: 2000;
    opacity: 0;
    transform: translateX(100%);
    transition: none;
}

.custom-toast.show-in {
    animation: slide-in-right 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.custom-toast.show-out {
    animation: slide-out-right 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.toast-icon {
    font-size: 24px;
    line-height: 1;
}

.toast-content {
    flex-grow: 1;
}

.toast-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 3px;
}

.toast-body {
    font-size: 16px;
    color: #555;
    line-height: 1.3;
}

@keyframes slide-in-right {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slide-out-right {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

@media (max-width: 500px) {
    .custom-toast {
        top: 10px;
        right: 20px;
        transform: translateX(100%);
        max-width: 50%;
    }
    @keyframes slide-in-right {
        0% { transform: translate(100%, 0); opacity: 0; }
        100% { transform: translate(0, 0); opacity: 1; }
    }
    @keyframes slide-out-right {
        0% { transform: translate(0, 0); opacity: 1; }
        100% { transform: translate(100%, 0); opacity: 0; }
    }
}