/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #1a0a0a;
    color: #f5e6c8;
}

/* ===== Screen Layout ===== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
    -webkit-overflow-scrolling: touch;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ===== Background ===== */
#quote-screen {
    position: relative;
    background: radial-gradient(ellipse at center, #2d0a0a 0%, #1a0a0a 100%);
}

/* Texture overlay */
#quote-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../assets/bg/paper-texture.png');
    opacity: 0.02;
    pointer-events: none;
    z-index: 1;
}

/* ===== Particles ===== */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #f5e6c8;
    border-radius: 50%;
    opacity: 0.05;
    animation: floatUp linear infinite;
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.08;
    }
    50% {
        transform: translateY(50vh) translateX(15px);
    }
    90% {
        opacity: 0.06;
    }
    100% {
        transform: translateY(-10vh) translateX(-5px);
        opacity: 0;
    }
}

/* Particle burst effect */
.particle.burst {
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 0.3 !important;
}

/* ===== Quote Typography ===== */
.quote-container {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 2rem;
    max-width: 800px;
    animation: quoteEnter 1.2s ease-out forwards;
}

.quote-text {
    font-family: "Noto Serif SC", "Source Han Serif CN", SimSun, serif;
    font-size: clamp(1.8rem, 6vw, 3.5rem);
    font-weight: 700;
    line-height: 1.6;
    color: #f5e6c8;
    text-shadow: 0 2px 20px rgba(0,0,0,0.5);
    margin-bottom: 1.5rem;
}

.quote-source {
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    color: #a08060;
    letter-spacing: 0.1em;
    opacity: 0;
    animation: quoteEnter 1.2s ease-out 0.3s forwards;
}

@keyframes quoteEnter {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Scroll Hint ===== */
.scroll-hint {
    position: absolute;
    bottom: 40px;
    z-index: 10;
    text-align: center;
    animation: hintPulse 2s ease-in-out infinite;
    cursor: pointer;
}

.scroll-arrow {
    display: block;
    font-size: 1.5rem;
    color: #a08060;
    margin-bottom: 0.3rem;
}

.scroll-text {
    font-size: 0.75rem;
    color: #a08060;
    letter-spacing: 0.2em;
}

@keyframes hintPulse {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(5px); }
}

/* ===== Analysis Screen ===== */
#analysis-screen {
    background: #1a0a0a;
    padding-top: 60px;
}

#analysis-screen.active {
    display: block;
}

.analysis-content {
    max-width: 640px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.quote-preview {
    text-align: center;
    padding: 2rem 0;
    border-bottom: 1px solid rgba(160, 128, 96, 0.2);
    margin-bottom: 2rem;
}

.quote-text-small {
    font-family: "Noto Serif SC", "Source Han Serif CN", SimSun, serif;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    color: #f5e6c8;
    line-height: 1.5;
    margin-bottom: 0.8rem;
}

.quote-source-small {
    font-size: 0.85rem;
    color: #a08060;
}

.analysis-sections .section {
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.analysis-sections .section.visible {
    opacity: 1;
    transform: translateY(0);
}

.analysis-sections .section:nth-child(1) { transition-delay: 0ms; }
.analysis-sections .section:nth-child(2) { transition-delay: 150ms; }
.analysis-sections .section:nth-child(3) { transition-delay: 300ms; }

.analysis-sections h3 {
    font-size: 0.9rem;
    color: #c41e3a;
    margin-bottom: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.analysis-sections p {
    font-size: 1rem;
    line-height: 1.8;
    color: #d4c4a8;
}

/* ===== Check-in Button ===== */
.checkin-area {
    text-align: center;
    padding: 2rem 0;
}

.checkin-btn {
    background: #c41e3a;
    color: #fff;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.1em;
    font-family: inherit;
}

.checkin-btn:hover {
    background: #d4283f;
    transform: scale(1.02);
}

.checkin-btn:active {
    transform: scale(0.96);
}

.checkin-btn.checked {
    background: #2d5a27;
    pointer-events: none;
}

/* ===== Share Options ===== */
.share-options {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.share-options.hidden {
    opacity: 0;
    pointer-events: none;
}

.share-btn {
    background: transparent;
    color: #a08060;
    border: 1px solid rgba(160, 128, 96, 0.4);
    padding: 0.6rem 1.5rem;
    font-size: 0.85rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.share-btn:hover {
    border-color: #f5e6c8;
    color: #f5e6c8;
}

/* ===== Streak Bar ===== */
.streak-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid rgba(160, 128, 96, 0.15);
    margin-top: 1rem;
    min-height: 36px;
}

.streak-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 14px;
    color: #a08060;
}

.streak-icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.streak-icon.pop {
    animation: streakPop 0.3s ease;
}

@keyframes streakPop {
    0% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.3) translateY(-4px); }
    100% { transform: scale(1) translateY(0); }
}

.streak-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.history-btn {
    background: transparent;
    color: #a08060;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s ease;
    font-family: inherit;
    padding: 0.2rem 0;
}

.history-btn:hover {
    color: #f5e6c8;
}

.mute-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 0.2rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.mute-btn:hover {
    opacity: 1;
}

/* ===== Share Preview Overlay ===== */
.share-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.share-preview-overlay.active {
    display: flex;
}

.share-preview-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.share-preview-overlay.active .share-preview-backdrop {
    opacity: 1;
}

.share-preview-panel {
    position: relative;
    z-index: 201;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.share-preview-overlay.active .share-preview-panel {
    transform: scale(1);
    opacity: 1;
}

.share-preview-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: transparent;
    border: none;
    color: #a08060;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0.5rem;
}

.share-preview-image {
    max-height: 60vh;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.share-preview-image img {
    height: 60vh;
    width: auto;
    display: block;
}

.share-download-btn {
    background: #c41e3a;
    color: #fff;
    border: none;
    padding: 0.9rem 2.5rem;
    font-size: 1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.1em;
    font-family: inherit;
}

.share-download-btn:hover {
    background: #d4283f;
    transform: scale(1.02);
}

.share-download-btn:active {
    transform: scale(0.96);
}

/* ===== Calendar Overlay ===== */
.calendar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: none;
    flex-direction: column;
    justify-content: flex-end;
}

.calendar-overlay.active {
    display: flex;
}

.calendar-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.calendar-overlay.active .calendar-backdrop {
    opacity: 1;
}

.calendar-panel {
    position: relative;
    background: #1a0a0a;
    border-radius: 20px 20px 0 0;
    padding: 1.5rem 1rem 1rem;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-height: 85vh;
    overflow-y: auto;
    z-index: 101;
}

.calendar-overlay.active .calendar-panel {
    transform: translateY(0);
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.calendar-close {
    background: transparent;
    border: none;
    color: #a08060;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.5rem;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.calendar-nav-btn {
    background: transparent;
    border: 1px solid rgba(160, 128, 96, 0.3);
    color: #a08060;
    font-size: 16px;
    cursor: pointer;
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.calendar-nav-btn:hover {
    border-color: #f5e6c8;
    color: #f5e6c8;
}

.calendar-month-label {
    font-size: 16px;
    color: #f5e6c8;
    min-width: 120px;
    text-align: center;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(160, 128, 96, 0.1);
}

.calendar-weekdays span {
    font-size: 12px;
    color: #a08060;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 0.5rem 0;
}

.calendar-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #d4c4a8;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease;
    min-height: 40px;
}

.calendar-cell:hover:not(.disabled):not(.future) {
    background: rgba(196, 30, 58, 0.15);
}

.calendar-cell.today {
    border: 1px solid #c41e3a;
}

.calendar-cell.checked::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    background: #c41e3a;
    border-radius: 50%;
}

.calendar-cell.future {
    color: #555;
    cursor: default;
}

.calendar-cell.disabled {
    color: #555;
    cursor: default;
}

.calendar-cell.selected {
    background: rgba(196, 30, 58, 0.25);
}

.calendar-quote-preview {
    padding: 1rem 0.5rem;
    border-top: 1px solid rgba(160, 128, 96, 0.15);
    margin-top: 0.5rem;
    cursor: pointer;
    transition: background 0.15s ease;
    border-radius: 8px;
}

.calendar-quote-preview:hover {
    background: rgba(160, 128, 96, 0.05);
}

.calendar-quote-text {
    font-size: 14px;
    color: #f5e6c8;
    line-height: 1.5;
    margin-bottom: 0.3rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.calendar-quote-source {
    font-size: 12px;
    color: #a08060;
}

/* ===== Check-in Button Enhancements ===== */
.checkin-btn {
    transition: all 0.15s ease;
}

.checkin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(196, 30, 58, 0.3);
}

.checkin-btn.checked {
    background: #8b1538;
    pointer-events: none;
}

/* ===== Share Button Enhancements ===== */
.share-btn {
    transition: all 0.15s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
    border-color: #f5e6c8;
    color: #f5e6c8;
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
    .analysis-content {
        padding: 3rem 2rem 5rem;
    }
}

/* ===== Silhouette ===== */
.silhouette {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 30%;
    z-index: 3;
    pointer-events: none;
    opacity: 0.08;
}

.silhouette img {
    width: 100%;
    height: auto;
    display: block;
}

/* Responsive */
@media (max-width: 767px) {
    .silhouette {
        width: 25%;
    }
}
