:root {
    --bg: #eafaf1;
    /* 연한 숲 느낌 */
    --card-bg: #ffffff;
    --border-soft: #d3e9db;
    --primary: #2b8a3e;
    /* 숲 초록 */
    --primary-dark: #216e31;
    --primary-soft: #d0ebff;
    --accent: #ff8c42;
    /* 열매 색 */
    --text-main: #212529;
    --text-sub: #868e96;
    --danger: #fa5252;
    --r: 20px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
}

.page {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 16px 80px;
}

/* Tree Visualization Area */
.tree-stage {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
}

.tree-title-box {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    padding: 10px 20px;
    border-radius: 999px;
    display: inline-block;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-soft);
}

.tree-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tree-desc {
    font-size: 13px;
    color: var(--text-sub);
    margin-top: 2px;
}

.tree-container {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    position: relative;
    /* Background image is loaded dynamically from JS to prevent flickering */
    background-position: center bottom;
    background-size: contain;
    background-repeat: no-repeat;
    transition: background-image 0.5s ease-in-out;
    /* v2 fix: multiply blend mode causes items to disappear on dark backgrounds */
    /* mix-blend-mode: multiply; */
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.fruit {
    position: absolute;
    font-size: 24px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    cursor: pointer;
    z-index: 2;
}

@keyframes popIn {
    from {
        transform: scale(0) translateY(10px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Modal Overlay for Message Card */
#fruitModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    padding: 20px;
}

.message-card {
    background: #fff;
    width: 100%;
    max-width: 340px;
    border-radius: 24px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: cardPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cardPop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.m-card-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.m-card-header {
    font-weight: 800;
    font-size: 18px;
    color: var(--primary-dark);
    margin-bottom: 16px;
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
}

.m-card-body {
    font-size: 16px;
    line-height: 1.6;
    color: #444;
    white-space: pre-wrap;
    margin-bottom: 24px;
}

.m-card-close {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: none;
    background: var(--primary);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    color: white;
}


.goal-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ffec99;
    color: #e67700;
    font-weight: 700;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 8px;
}

/* Card Common */
.card {
    background: var(--card-bg);
    border-radius: var(--r);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border-soft);
}

.card h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-dark);
}

/* Input Form */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    display: block;
    color: var(--text-main);
}

select,
input[type="text"],
textarea {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    font-size: 15px;
    font-family: inherit;
    background: #f8f9fa;
    outline: none;
    transition: all 0.2s;
}

select:focus,
input[type="text"]:focus,
textarea:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43, 138, 62, 0.2);
}

textarea {
    min-height: 100px;
    resize: none;
    line-height: 1.6;
}

/* Safety Check */
.safety-check {
    background: #fff5f5;
    border: 1px solid #ffc9c9;
    padding: 12px;
    border-radius: 12px;
    font-size: 13px;
    color: #c92a2a;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
    cursor: pointer;
}

.safety-check.checked {
    background: #e6fcf5;
    border-color: #63e6be;
    color: #087f5b;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.check-row input {
    margin-top: 3px;
}

/* Button */
.btn-submit {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(43, 138, 62, 0.3);
    transition: transform 0.1s;
}

.btn-submit:active {
    transform: scale(0.98);
}

.btn-submit:disabled {
    background: #ced4da;
    cursor: not-allowed;
    box-shadow: none;
}

/* Public Notes */
.note-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.note-card {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 16px;
    position: relative;
}

.note-card::before {
    content: "🍎";
    position: absolute;
    top: -10px;
    right: 10px;
    font-size: 24px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

.note-header {
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 8px;
    font-weight: 700;
}

.note-content {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-main);
    white-space: pre-wrap;
}

/* User Check */
#loginCheck {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.info-modal {
    background: #fff;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 320px;
}

.back-btn-row {
    margin-bottom: 12px;
}

.back-btn {
    background: none;
    border: none;
    font-size: 14px;
    color: var(--text-sub);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* My Log (New) */
.my-log-card {
    margin-top: 20px;
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    border: 1px dashed var(--border-soft);
}

.my-log-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f3f5;
    padding: 12px 0;
    font-size: 14px;
}

.my-log-item:last-child {
    border-bottom: none;
}

.status-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 700;
}

.status-pending {
    background: #f1f3f5;
    color: #868e96;
}

.status-approved {
    background: #d3f9d8;
    color: #2b8a3e;
}
