@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&family=ZCOOL+KuaiLe&display=swap");

@font-face {
    font-family: "ZhuqueFangsong";
    src: url("assets/ZhuqueFangsong.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* 姐姐攻略耶耶 - 可爱粉嫩主题 (新版布局) */
:root {
    --pink-100: #fff1f6;
    --pink-200: #ffd9e8;
    --pink-300: #ffb8d2;
    --pink-400: #ff8fb6;
    --pink-500: #ff6f9f;
    --peach-200: #ffe4d6;
    --peach-300: #ffc7ad;
    --cream: #fff8f2;
    --cocoa: #7c4a4a;
    --shadow: 0 18px 40px rgba(255, 111, 159, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Nunito", "Microsoft YaHei", sans-serif;
    margin: 0;
    padding: 16px;
    min-height: 100vh;
    color: var(--cocoa);
    background: linear-gradient(160deg, var(--pink-100), var(--cream) 45%, var(--peach-200) 100%);
    overflow-x: hidden;
}

#app {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.86);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

.app-header h1 {
    margin: 0 0 8px;
    font-family: "ZCOOL KuaiLe", "STKaiti", cursive;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    color: var(--pink-500);
    letter-spacing: 1px;
}

.subtitle {
    margin: 0 0 12px;
    font-size: 1rem;
    color: #b05f7a;
}

.streak-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: linear-gradient(135deg, var(--pink-200), var(--peach-200));
    border-radius: 20px;
    font-weight: 700;
    color: #8a4a5f;
}

.streak-icon {
    font-size: 1.2rem;
}

/* Main Layout */
.app-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
}

/* Main Content - Story Panel */
.main-content {
    min-width: 0;
}

.story-panel {
    background: var(--cream);
    border-radius: 20px;
    padding: 24px;
    border: 2px dashed var(--pink-200);
}

.story-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.story-meta {
    flex: 1;
}

.story-badge {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
    color: white;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.story-title {
    margin: 0;
    font-size: 1.4rem;
    color: var(--pink-500);
    line-height: 1.3;
}

.story-thumbnail {
    font-size: 3rem;
    margin-left: 16px;
}

.story-world {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    border-left: 4px solid var(--pink-400);
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: #8a5a6a;
    line-height: 1.6;
}

.story-content {
    min-height: 200px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    border: 1px dashed var(--pink-200);
    margin-bottom: 16px;
    line-height: 1.8;
    color: var(--cocoa);
    font-family: "ZhuqueFangsong", "STFangsong", "FangSong", serif;
}

.story-content p {
    margin: 0 0 16px;
    text-indent: 2em;
}

.story-content p:last-child {
    margin-bottom: 0;
}

.story-loading {
    text-align: center;
    color: #b56c82;
    font-style: italic;
}

/* Story Choices */
.story-choices {
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 217, 232, 0.5), rgba(255, 244, 239, 0.5));
    border-radius: 16px;
    margin-bottom: 16px;
}

.story-choices.hidden {
    display: none;
}

.choice-prompt {
    margin: 0 0 12px;
    font-weight: 600;
    color: #8a4a5f;
}

.choice-buttons {
    display: grid;
    gap: 10px;
}

.choice-btn {
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #8a4a5f;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.choice-btn:hover {
    border-color: var(--pink-400);
    transform: translateX(4px);
}

.choice-btn:active {
    transform: translateX(2px);
}

/* Story Actions */
.story-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.story-btn {
    flex: 1;
    border: none;
    border-radius: 16px;
    padding: 14px 20px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
    box-shadow: 0 8px 20px rgba(255, 111, 159, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.story-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(255, 111, 159, 0.4);
}

.story-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.story-btn.secondary {
    background: linear-gradient(135deg, var(--peach-200), var(--pink-200));
    color: #8a4a5f;
}

/* Story Progress */
.story-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 184, 210, 0.4);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--pink-400), var(--pink-500));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--pink-500);
    min-width: 40px;
}

/* Story History Modal */
.story-history-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.story-history-modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--pink-200);
}

.modal-header h3 {
    margin: 0;
    color: var(--pink-500);
}

.modal-close {
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #b56c82;
}

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

.empty-history {
    text-align: center;
    color: #b56c82;
    font-style: italic;
}

.history-item {
    padding: 12px;
    background: var(--cream);
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.history-item:hover {
    transform: translateX(4px);
}

/* Sidebar */
.sidebar {
    position: relative;
}

.sidebar-toggle {
    display: none;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--pink-200), var(--peach-200));
    color: #8a4a5f;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 12px;
}

.toggle-icon {
    margin-right: 8px;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-panel {
    background: var(--cream);
    border-radius: 16px;
    padding: 16px;
    border: 1px dashed var(--pink-200);
}

.sidebar-title {
    margin: 0 0 12px;
    font-size: 1rem;
    color: var(--pink-500);
}

/* Affection Panel */
.affection-meter {
    display: flex;
    align-items: center;
    gap: 12px;
}

.affection-track {
    flex: 1;
    height: 12px;
    background: rgba(255, 184, 210, 0.4);
    border-radius: 6px;
    overflow: hidden;
}

.affection-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--pink-400), var(--pink-500));
    border-radius: 6px;
    transition: width 0.5s ease;
}

.affection-value {
    font-weight: 700;
    color: var(--pink-500);
    min-width: 45px;
    text-align: right;
}

/* Anniversary Panel */
.anniversary-info p {
    margin: 0 0 6px;
    font-size: 0.95rem;
    color: #8a5a6a;
}

.anniversary-info .highlight {
    font-weight: 700;
    color: var(--pink-500);
    font-size: 1.1rem;
}

.countdown-text {
    font-size: 0.85rem !important;
    color: #b56c82 !important;
}

/* Check-in Panel */
.checkin-tip {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: #b56c82;
}

.checkin-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkin-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    border: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.checkin-item.completed {
    border-color: #90EE90;
    background: rgba(144, 238, 144, 0.1);
}

.checkin-icon {
    font-size: 1.3rem;
}

.checkin-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.checkin-name {
    font-weight: 600;
    color: #8a4a5f;
    font-size: 0.9rem;
}

.checkin-status {
    font-size: 0.75rem;
    color: #b56c82;
}

.checkin-status.done {
    color: #5a9a5a;
}

.checkin-btn {
    border: none;
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #8a4a5f;
    background: linear-gradient(135deg, var(--pink-200), var(--peach-200));
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkin-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.checkin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.checkin-progress {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--pink-200);
    font-size: 0.9rem;
    color: #8a5a6a;
}

#checkin-progress {
    font-weight: 700;
    color: var(--pink-500);
}

/* Feedback Panel */
.feedback-bubble {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    border: 1px dashed var(--pink-300);
}

.feedback-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-image: url("assets/yeye.jpg");
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    font-size: 0;
    overflow: hidden;
}

.feedback-text {
    margin: 0;
    font-size: 0.95rem;
    color: #8a5a6a;
    line-height: 1.5;
}

/* Details Panels */
.card-details, .fortune-details, .audio-details {
    border: 1px dashed var(--pink-200);
}

.card-summary, .fortune-summary, .audio-summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--pink-500);
    padding: 4px 0;
    list-style: none;
}

.card-summary::-webkit-details-marker,
.fortune-summary::-webkit-details-marker,
.audio-summary::-webkit-details-marker {
    display: none;
}

.card-summary::before,
.fortune-summary::before,
.audio-summary::before {
    content: "▶ ";
    font-size: 0.8rem;
}

details[open] .card-summary::before,
details[open] .fortune-summary::before,
details[open] .audio-summary::before {
    content: "▼ ";
}

.card-content, .fortune-content, .audio-content {
    margin-top: 12px;
}

.card-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dotted var(--pink-200);
}

.card-label {
    color: #b56c82;
    font-size: 0.85rem;
}

.card-value {
    font-weight: 600;
    color: #8a4a5f;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.card-tag {
    padding: 4px 10px;
    background: var(--pink-200);
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #8a4a5f;
}

.card-tag.drink {
    background: var(--peach-200);
}

/* Fortune Panel */
.fortune-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.fortune-label {
    color: #8a5a6a;
    font-size: 0.9rem;
}

.fortune-badge {
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--pink-200), var(--peach-200));
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #8a4a5f;
}

.fortune-couple {
    margin: 10px 0 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    font-size: 0.9rem;
    color: #8a5a6a;
    text-align: center;
}

/* Audio Panel */
.audio-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.audio-row span {
    color: #8a5a6a;
}

.audio-toggle {
    border: none;
    border-radius: 10px;
    padding: 6px 14px;
    font-weight: 600;
    color: #8a4a5f;
    background: rgba(255, 255, 255, 0.8);
    border: 1px dashed var(--pink-300);
    cursor: pointer;
}

.audio-toggle.is-on {
    background: linear-gradient(135deg, var(--pink-200), var(--peach-200));
    border-color: var(--pink-400);
}

/* Easter Egg */
.easter-egg {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 200;
}

.easter-egg.is-active {
    opacity: 1;
    visibility: visible;
}

.easter-card {
    padding: 24px 32px;
    background: linear-gradient(135deg, var(--pink-200), var(--cream));
    border-radius: 20px;
    text-align: center;
    animation: easter-pop 0.6s ease;
}

.easter-title {
    font-family: "ZCOOL KuaiLe", cursive;
    font-size: 1.5rem;
    color: var(--pink-500);
    margin-bottom: 10px;
}

.easter-emoji {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.easter-text {
    margin: 0;
    color: #8a4a5f;
    font-weight: 600;
}

/* Footer */
.app-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--pink-200);
    color: #b56c82;
}

/* Animations */
@keyframes easter-pop {
    0% { transform: scale(0.8); opacity: 0; }
    60% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* Typing animation for story text */
.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--pink-500);
    margin-left: 2px;
    animation: blink 0.7s infinite;
}

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

/* Responsive Design */
@media (max-width: 900px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-content {
        display: none;
    }

    .sidebar-content.is-open {
        display: flex;
    }

    .story-panel {
        padding: 16px;
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    #app {
        padding: 14px;
        border-radius: 18px;
    }

    .app-header h1 {
        font-size: 1.6rem;
    }

    .story-header {
        flex-direction: column;
        gap: 12px;
    }

    .story-thumbnail {
        margin-left: 0;
        align-self: flex-end;
    }

    .story-actions {
        flex-direction: column;
    }

    .checkin-item {
        padding: 8px 10px;
    }

    .checkin-name {
        font-size: 0.85rem;
    }
}

/* Hidden utility */
.hidden {
    display: none !important;
}
