/* View-specific layouts */

.view-home {
    align-items: center;
    text-align: center;
    gap: 0.65rem;
    padding-top: clamp(4.5rem, 21vh, 8.25rem);
    flex: 1;
    min-height: 0;
}

.view-home .stats-bento {
    margin-bottom: 0.25rem;
}

.view-home .message-card {
    margin-top: auto;
    margin-bottom: 0;
}

@media (max-width: 767px) {
    .view.view-home {
        padding: 0.35rem 1rem calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 0.75rem);
    }

    .view-home {
        padding-top: clamp(1.25rem, 4vh, 2rem);
        gap: 0.25rem;
        justify-content: flex-start;
    }

    .view-home .countdown-num {
        font-size: clamp(1.35rem, 5vw, 1.75rem);
    }

    .view-home .countdown-label {
        font-size: 0.72rem;
        margin-top: 0.1rem;
    }

    .view-home .progress-wrap {
        margin-top: 0.05rem;
        max-width: 220px;
    }

    .view-home .progress-label {
        font-size: 0.68rem;
        margin-top: 0.3rem;
    }

    .view-home .stats-bento {
        margin-top: 0.1rem;
        margin-bottom: 0;
        gap: 0.35rem;
        max-width: 280px;
    }

    .view-home .stats-bento .stat-chip--today {
        padding: 0.5rem 0.75rem;
        gap: 0.35rem;
    }

    .view-home .stats-bento .stat-chip--today .stat-chip__val {
        font-size: clamp(1.25rem, 5vw, 1.5rem);
    }

    .view-home .stats-bento .stat-chip--today .stat-chip__label {
        font-size: 0.68rem;
    }

    .view-home .stats-bento .stat-chip--side {
        padding: 0.45rem 0.35rem;
    }

    .view-home .stats-bento .stat-chip--side .stat-chip__val {
        font-size: 1rem;
    }

    .view-home .stats-bento .stat-chip--side .stat-chip__label {
        font-size: 0.62rem;
        margin-top: 0.05rem;
    }

    .view-home .heart-section {
        margin-top: clamp(0.35rem, 6vh, 1.25rem);
        margin-bottom: 0;
        transform: translateY(-0.5rem);
    }

    .view-home .message-card {
        margin-top: auto;
        margin-bottom: 0.35rem;
        padding: 0.85rem 0.9rem;
        max-width: 300px;
    }

    .view-home .message-card h3 {
        font-size: 0.65rem;
        margin-bottom: 0.35rem;
        letter-spacing: 0.06em;
    }

    .view-home .message-card p {
        font-size: 0.85rem;
        line-height: 1.45;
    }
}

.stats-bento {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
    max-width: 340px;
}

.stats-bento .stat-chip--today {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    text-align: center;
}

.stats-bento .stat-chip--today .stat-chip__val {
    font-size: clamp(1.75rem, 7vw, 2.25rem);
}

.stats-bento .stat-chip--today .stat-chip__label {
    margin-top: 0;
    font-size: 0.8rem;
}

.stats-bento .stat-chip--side {
    padding: 0.65rem 0.5rem;
}

.message-card {
    width: 100%;
    max-width: 340px;
    padding: 1.25rem;
    text-align: left;
}

.message-card h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--chrome-400);
    margin-bottom: 0.5rem;
}

.message-card p {
    font-size: 1rem;
    line-height: 1.55;
    font-weight: 300;
}

.view-calendar {
    gap: 0.75rem;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.calendar-nav h2 {
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    flex: 1;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.35rem;
    margin-top: 0.25rem;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--chrome-400);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.35rem;
}

.cal-day {
    aspect-ratio: 1;
    min-height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-family: inherit;
    color: var(--chrome-100);
}

.cal-day--empty {
    visibility: hidden;
    pointer-events: none;
    border: none;
    background: none;
}

.cal-day__num {
    font-size: 0.85rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.cal-day:not(.cal-day--empty):active {
    transform: scale(0.96);
}

.cal-day--today {
    border-color: var(--accent-rose);
    box-shadow: 0 0 0 1px rgba(255, 71, 87, 0.35);
}

.cal-day.level-0 { background: rgba(255, 255, 255, 0.06); }
.cal-day.level-1 { background: #fecdd3; color: #4a1520; }
.cal-day.level-2 { background: #fb7185; color: #fff; }
.cal-day.level-3 { background: #fbbf24; color: #3d2a00; }

.calendar-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    color: var(--chrome-400);
    margin-top: 0.25rem;
}

.calendar-legend .cal-day {
    width: 14px;
    height: 14px;
    min-height: 0;
    aspect-ratio: 1;
    border-radius: 3px;
    cursor: default;
    pointer-events: none;
}

.view-capsule {
    gap: 1rem;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

.capsule-locked {
    text-align: center;
    padding: 2rem 1.5rem;
}

.capsule-locked .lock-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.capsule-form textarea,
#capsuleText {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border-radius: var(--radius-btn);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.08);
    color: var(--chrome-100);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

.capsule-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.capsule-item {
    padding: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.capsule-item time {
    display: block;
    font-size: 0.75rem;
    color: var(--chrome-400);
    margin-bottom: 0.35rem;
}

.capsule-heading {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.capsule-closed-banner {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 0.75rem;
    color: var(--chrome-300);
}

.capsule-empty {
    text-align: center;
    font-size: 0.9rem;
    color: var(--chrome-400);
    padding: 1.5rem 1rem;
}

.capsule-guy-hint {
    font-size: 0.9rem;
    color: var(--chrome-300);
    line-height: 1.45;
    margin-bottom: 1rem;
}

.capsule-item--sealed {
    opacity: 0.92;
    border: 1px solid var(--glass-border);
}

.capsule-item__sealed-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.capsule-item__sealed-head time {
    margin-bottom: 0;
}

.capsule-item__lock {
    font-size: 1.1rem;
    opacity: 0.75;
}

.capsule-item__warm {
    font-size: 0.9rem;
    color: var(--accent-rose-soft, #e8a0b0);
    line-height: 1.45;
    margin: 0;
}

.capsule-item__age {
    font-size: 0.8rem;
    color: var(--chrome-400);
    margin: 0.35rem 0 0;
}

.view-room {
    padding: 0;
    position: relative;
    overflow: hidden;
}

#roomCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.room-scene {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--sky-2) 0%, var(--sky-1) 60%);
}

.room-window {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: min(280px, 70vw);
    height: min(200px, 35vh);
    border-radius: var(--radius-card);
    border: 4px solid rgba(255, 255, 255, 0.15);
    background: linear-gradient(180deg, var(--sky-3), var(--sky-2));
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.room-lamp {
    position: absolute;
    bottom: 28%;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 80px;
    background: linear-gradient(180deg, #3d3d4a 0%, #2a2a35 100%);
    border-radius: 8px 8px 4px 4px;
}

.room-lamp::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 24px;
    background: #fbbf24;
    border-radius: 50% 50% 40% 40%;
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.6);
    animation: lampFlicker 4s ease-in-out infinite;
}

@keyframes lampFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.room-caption {
    position: absolute;
    bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 1.5rem);
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--chrome-400);
    padding: 0 1rem;
}

.view-return {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
    justify-content: center;
    padding: 2rem 1rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    background: var(--month-gradient, linear-gradient(135deg, var(--sky-1), var(--sky-2), var(--sky-3)));
    background-size: 200% 200%;
    background-attachment: fixed;
}

.return-close {
    position: absolute;
    top: calc(1rem + env(safe-area-inset-top, 0px));
    right: 1rem;
    z-index: 2;
    font-size: 1.5rem;
    line-height: 1;
}

.return-continue {
    width: 100%;
    max-width: 280px;
    margin-top: 0.5rem;
}

.view-return h1 {
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 600;
    line-height: 1.3;
    max-width: 20ch;
}

.return-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    width: 100%;
    max-width: 360px;
}

.return-stat {
    padding: 1rem;
    text-align: center;
}

.return-stat__num {
    font-size: 1.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent-rose);
}

.return-stat__label {
    font-size: 0.75rem;
    color: var(--chrome-400);
    margin-top: 0.25rem;
}

.confetti {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    to {
        transform: translateY(100dvh) rotate(720deg);
        opacity: 0;
    }
}

.ach-sheet-panel {
    position: relative;
    max-height: min(88vh, 720px);
    display: flex;
    flex-direction: column;
}

.ach-sheet-panel__title {
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.achievements-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
    padding-right: 0.15rem;
}

.ach-section {
    margin-bottom: 1.1rem;
}

.ach-section__title {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--chrome-400);
    margin: 0 0 0.5rem;
}

.ach-section__grid {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.ach-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    opacity: 0.42;
}

.ach-item.unlocked {
    opacity: 1;
}

.ach-item--legendary.unlocked {
    border-color: rgba(251, 191, 36, 0.35);
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.12);
}

.ach-item--secret:not(.unlocked) .ach-item__title {
    letter-spacing: 0.08em;
}

.ach-item__icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 71, 87, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.ach-item.unlocked .ach-item__icon {
    background: rgba(251, 191, 36, 0.18);
}

.ach-item__body {
    min-width: 0;
    flex: 1;
}

.ach-item__title {
    font-size: 0.92rem;
    line-height: 1.35;
}

.ach-item__progress {
    font-size: 0.75rem;
    color: var(--chrome-400);
    margin-top: 0.2rem;
    font-variant-numeric: tabular-nums;
}

.streak-grace-modal {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(8, 8, 16, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.streak-grace-modal__panel {
    width: 100%;
    max-width: 340px;
    padding: 1.25rem;
    text-align: center;
}

.streak-grace-modal__panel h3 {
    margin-bottom: 0.65rem;
}

.streak-grace-modal__panel p {
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--chrome-300);
}

@media (prefers-reduced-motion: reduce) {
    .streak-grace-modal {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

.music-panel {
    position: fixed;
    bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 4rem);
    right: 1rem;
    z-index: 45;
    padding: 1rem;
    min-width: 160px;
    display: none;
}

.music-panel.open { display: block; }

.music-panel button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.35rem;
    border: none;
    background: none;
    color: var(--chrome-100);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 8px;
}

.music-panel button:hover,
.music-panel button.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-violet);
}
