/* 整體樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft JhengHei', sans-serif;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 40px;
    pointer-events: none;
    /* 穿透到背景 */
}

/* 主要布局：三欄設計 */
.main-layout {
    display: grid;
    grid-template-columns: 350px 1fr 380px;
    gap: 30px;
    padding: 20px;
    position: relative;
    z-index: 1;
    pointer-events: none;
    /* 穿透到背景 */
}

/* 左欄 */
.left-panel {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    z-index: 10;
    pointer-events: auto;
    /* 恢復點擊 */
}

/* 標題區 */
.header {
    text-align: center;
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    pointer-events: auto;
    /* 恢復點擊 */
}

.header h1 {
    color: #ff6b6b;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    color: #666;
    font-size: 1.1em;
}

/* 寵物農場區 - 中間最大 */
.pet-farm {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    /* 提高層級 */
    pointer-events: auto;
    /* 允許點擊 */
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    overflow: hidden;
}

.pet-farm h2,
.pet-stats {
    position: absolute;
    width: 100%;
    z-index: 2;
    top: 20px;
}

.pet-stats {
    top: 80px;
}

.pet-farm h2 {
    color: #ff6b6b;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.pet-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-item {
    background: white;
    padding: 10px 20px;
    border-radius: 15px;
    font-size: 1.1em;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.stat-item strong {
    color: #ff6b6b;
    font-size: 1.3em;
}

.pet-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#threeCanvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    border-radius: 15px;
}

.pet {
    font-size: 3em;
    animation: petBounce 2s infinite;
    cursor: pointer;
    transition: transform 0.3s;
}

.pet:hover {
    transform: scale(1.2);
}

@keyframes petBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.warning-text {
    text-align: center;
    color: #ff4757;
    font-weight: bold;
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 71, 87, 0.1);
    border-radius: 10px;
}

/* 日記區 */
.diary-section {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.diary-section h2 {
    color: #4ecdc4;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.diary-form textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.95em;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
    min-height: 80px;
}

.diary-form textarea:focus {
    outline: none;
    border-color: #4ecdc4;
}

/* 臨時筆記區 */
.notes-section {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.notes-section h2 {
    color: #ffa502;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.note-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.note-form input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.note-form input:focus {
    outline: none;
    border-color: #ffa502;
}

.notes-list {
    list-style: none;
}

.note-item {
    background: #fff3cd;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.note-btns {
    display: flex;
    gap: 8px;
}

.note-item button.btn-complete {
    background: #2ed573;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.note-item button.btn-delete {
    background: #ff4757;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.note-item button:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

/* 按鈕樣式 */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary:hover {
    background: #ff8c00;
    transform: translateY(-2px);
}

/* 日記歷史區 */
.history-section {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    grid-column: 3;
    max-height: 75vh;
    overflow-y: auto;
    pointer-events: auto;
    /* 恢復點擊 */
}

.history-section h2 {
    color: #ee5a6f;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.diary-history {
    max-height: 500px;
    overflow-y: auto;
}

.diary-entry {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #ee5a6f;
    animation: slideIn 0.3s;
}

.diary-entry-date {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.diary-entry-content {
    color: #333;
    line-height: 1.6;
}

.diary-entry-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-delete-small {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
    line-height: 1;
}

.btn-delete-small:hover {
    background: rgba(255, 71, 87, 0.15);
}

.pet-reward {
    background: #e8f5e9;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.85em;
    color: #2e7d32;
    font-weight: bold;
}

/* 響應式設計 */
@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .pet-farm {
        grid-column: 1;
    }

    .history-section {
        grid-column: 1;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }

    .pet {
        font-size: 2.5em;
    }
    
    .left-panel {
        margin-top: 200px; /* 手機版讓日記區往下移動 */
    }

    .pet-stats {
        flex-direction: column;
        gap: 10px;
    }

    .note-form {
        flex-direction: column;
    }

    .main-layout {
        grid-template-columns: 1fr;
    }
}

/* 滾動條樣式 */
.diary-history::-webkit-scrollbar {
    width: 8px;
}

.diary-history::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.diary-history::-webkit-scrollbar-thumb {
    background: #ee5a6f;
    border-radius: 10px;
}

.diary-history::-webkit-scrollbar-thumb:hover {
    background: #d64a5f;
}

/* 空狀態提示 */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-state p {
    font-size: 1.2em;
    margin-bottom: 10px;
}
