:root {
    --background: #ffffff;
    --card: #fafafa;
    --text: #1d1d1f;
    --subtext: #86868b;
    --line: #e8e8e8;
    --empty: #c7c7cc;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 6px;

    display: flex;
    justify-content: center;
    align-items: flex-start;

    background: var(--background);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Display",
        "Apple Symbols",
        Pretendard,
        sans-serif;

    color: var(--text);
}

button {
    font-family: inherit;
}

.mood-widget {
    width: 230px;
    height: 205px;
    padding: 14px;

    overflow: hidden;

    background: var(--card);
    border-radius: 15px;

    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.05);
}


/* 상단 */

.mood-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    font-size: 8px;
}

.mood-header span:first-child {
    font-weight: 600;
}

#currentDate {
    color: var(--subtext);
    font-size: 7px;
}


/* 화면 전환 */

.view-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    margin-top: 8px;
    padding-bottom: 6px;

    border-bottom: 1px solid var(--line);
}

.view-tab {
    padding: 2px;

    border: 0;
    background: transparent;

    color: var(--empty);
    font-size: 7px;

    cursor: pointer;
}

.view-tab.active {
    color: var(--text);
    font-weight: 600;
}


/* 오늘의 기분 */

.mood-stage {
    position: relative;

    min-height: 91px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.main-face {
    position: relative;
    z-index: 2;

    font-size: 22px;
    font-weight: 500;
    line-height: 1;

    transform-origin: center;
}

#moodLabel {
    margin: 11px 0 0;

    color: var(--subtext);
    font-size: 8px;
}

.mood-effect {
    position: absolute;

    color: var(--subtext);
    font-size: 8px;

    pointer-events: none;
}


/* 기분 선택 */

.mood-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;

    padding-top: 7px;

    border-top: 1px solid var(--line);
}

.mood-option {
    min-width: 0;
    padding: 1px 0;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;

    border: 0;
    background: transparent;

    color: var(--subtext);
    cursor: pointer;
}

.mini-face {
    font-size: 7px;
    white-space: nowrap;

    transition:
        color 0.2s ease,
        transform 0.2s ease;
}

.mood-dot {
    color: var(--empty);
    font-size: 11px;
    line-height: 1;

    transition:
        color 0.2s ease,
        transform 0.2s ease;
}

.mood-option.selected {
    color: var(--text);
}

.mood-option.selected .mini-face {
    color: var(--text);
    transform: translateY(-1px);
}

.mood-option.selected .mood-dot {
    color: var(--text);
    transform: scale(1.1);
}


/* 주간 및 월간 공통 */

.history-view {
    padding-top: 8px;
}

.period-header {
    display: grid;
    grid-template-columns: 20px 1fr 20px;
    align-items: center;

    margin-bottom: 8px;
}

.period-header strong {
    text-align: center;
    font-size: 8px;
    font-weight: 600;
}

.period-header button {
    padding: 0;

    border: 0;
    background: transparent;

    color: var(--subtext);
    font-size: 13px;

    cursor: pointer;
}


/* 주간 기록 */

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;

    min-height: 112px;
}

.week-day {
    min-width: 0;
    padding: 7px 1px;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;

    border-radius: 8px;
}

.week-day.today {
    outline: 1px solid var(--text);
    outline-offset: -1px;
}

.week-name,
.week-date {
    color: var(--subtext);
    font-size: 6px;
}

.week-face {
    min-height: 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 7px;
    white-space: nowrap;
}

.week-day.empty .week-face {
    color: var(--empty);
}


/* 월간 기록 */

.month-weekdays,
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.month-weekdays {
    margin-bottom: 3px;
}

.month-weekdays span {
    color: var(--subtext);
    font-size: 5px;
    text-align: center;
}

.month-cell,
.month-empty {
    height: 18px;
}

.month-cell {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 6px;

    font-size: 7px;
}

.month-cell.today {
    outline: 1px solid var(--text);
    outline-offset: -1px;
}

.month-cell.future {
    opacity: 0.3;
}

.month-cell.no-record {
    color: #d2d2d5;
    font-size: 5px;
}

.month-expression {
    display: block;

    font-size: 6px;
    line-height: 1;
    letter-spacing: -0.4px;
    white-space: nowrap;

    transform: scaleX(0.94);
}


/* Happy */

.mood-stage.happy .main-face {
    animation: happyBounce 0.65s ease;
}

@keyframes happyBounce {
    0% {
        transform: translateY(0) scale(1);
    }

    35% {
        transform: translateY(-7px) scale(1.1);
    }

    65% {
        transform: translateY(1px) scale(0.98);
    }

    100% {
        transform: translateY(0) scale(1);
    }
}


/* Calm */

.mood-stage.calm .main-face {
    animation: calmBreath 2.4s ease-in-out infinite;
}

@keyframes calmBreath {
    0%,
    100% {
        transform: scale(0.96);
        opacity: 0.75;
    }

    50% {
        transform: scale(1.06);
        opacity: 1;
    }
}


/* Tired */

.mood-stage.tired .main-face {
    animation: sleepyNod 1.8s ease-in-out infinite;
}

.mood-stage.tired .mood-effect {
    top: 21px;
    right: 69px;
}

.mood-stage.tired .mood-effect::after {
    content: "zZ";
    animation: sleepyText 1.8s ease-in-out infinite;
}

@keyframes sleepyNod {
    0%,
    100% {
        transform: rotate(0deg) translateY(0);
    }

    50% {
        transform: rotate(4deg) translateY(3px);
    }
}

@keyframes sleepyText {
    0% {
        opacity: 0;
        transform: translateY(3px);
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateY(-6px);
    }
}


/* Sad */

.mood-stage.sad .main-face {
    animation: sadDrop 1.8s ease-in-out infinite;
}

.mood-stage.sad .mood-effect {
    top: 43px;
    left: 101px;
}

.mood-stage.sad .mood-effect::after {
    content: "˙";

    font-size: 15px;
    animation: tearDrop 1.8s ease-in infinite;
}

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

    50% {
        transform: translateY(2px);
    }
}

@keyframes tearDrop {
    0% {
        opacity: 0;
        transform: translateY(-4px);
    }

    35% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateY(10px);
    }
}


/* Angry */

.mood-stage.angry .main-face {
    animation: angryShake 0.32s ease-in-out 3;
}

@keyframes angryShake {
    0%,
    100% {
        transform: translateX(0) rotate(0);
    }

    25% {
        transform: translateX(-3px) rotate(-2deg);
    }

    75% {
        transform: translateX(3px) rotate(2deg);
    }
}


/* 효과음 버튼 */

.header-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

#soundToggle {
    width: 14px;
    height: 14px;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    background: transparent;

    color: var(--text);
    font-size: 8px;
    line-height: 1;

    cursor: pointer;

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

#soundToggle:hover {
    transform: scale(1.12);
}

#soundToggle.muted {
    opacity: 0.3;
}


/* ========================================
   Mood Widget — Larger Text Version
======================================== */


/* 카드 높이 */

.mood-widget {
    height: 250px;
}


/* 상단 브랜드와 날짜 */

.mood-header {
    font-size: 11px;
}

#currentDate {
    font-size: 9px;
}

#soundToggle {
    width: 17px;
    height: 17px;

    font-size: 11px;
}


/* Today · Week · Month */

.view-tabs {
    margin-top: 10px;
    padding-bottom: 8px;
}

.view-tab {
    padding: 4px 2px;

    font-size: 9px;
}


/* 오늘의 표정 */

.mood-stage {
    min-height: 112px;
}

.main-face {
    font-size: 30px;
}

#moodLabel {
    margin-top: 13px;

    font-size: 10px;
}


/* 하단 기분 선택 */

.mood-options {
    padding-top: 10px;
}

.mood-option {
    gap: 6px;
}

.mini-face {
    font-size: 9px;
}

.mood-dot {
    font-size: 15px;
}


/* 주간·월간 제목 */

.history-view {
    padding-top: 10px;
}

.period-header {
    grid-template-columns: 25px 1fr 25px;

    margin-bottom: 10px;
}

.period-header strong {
    font-size: 10px;
}

.period-header button {
    font-size: 17px;
}


/* 주간 기록 */

.week-grid {
    min-height: 145px;
}

.week-day {
    padding: 9px 1px;
    gap: 12px;
}

.week-name,
.week-date {
    font-size: 8px;
}

.week-face {
    min-height: 14px;

    font-size: 9px;
}


/* 월간 요일 */

.month-weekdays {
    margin-bottom: 5px;
}

.month-weekdays span {
    font-size: 7px;
}


/* 월간 기록 */

.month-weekdays,
.month-grid {
    gap: 3px 2px;
}

.month-cell,
.month-empty {
    height: 22px;
}

.month-cell.no-record {
    font-size: 7px;
}

.month-expression {
    font-size: 8px;
    letter-spacing: -0.5px;
}

/* Mood Widget — Force Larger Text */

.mood-widget {
    height: 250px !important;
    padding: 16px !important;
}

.mood-header,
.mood-header span {
    font-size: 11px !important;
}

#currentDate {
    font-size: 9px !important;
}

#soundToggle {
    font-size: 12px !important;
}

.view-tab {
    font-size: 10px !important;
}

.mood-stage {
    min-height: 112px !important;
}

.main-face,
#mainFace {
    font-size: 32px !important;
}

#moodLabel {
    font-size: 11px !important;
}

.mini-face {
    font-size: 10px !important;
}

.mood-dot {
    font-size: 16px !important;
}

.period-header strong,
#weekTitle,
#monthTitle {
    font-size: 11px !important;
}

.period-header button {
    font-size: 18px !important;
}

.week-name,
.week-date {
    font-size: 8px !important;
}

.week-face {
    font-size: 10px !important;
}

.month-weekdays span {
    font-size: 7px !important;
}

.month-expression {
    font-size: 9px !important;
}


/* Week View — Prevent Clipping */

.week-grid {
    min-height: 0 !important;
    height: 92px !important;
    align-items: start !important;
}

.week-day {
    height: 92px !important;
    padding: 8px 1px !important;
    gap: 10px !important;
}

.week-day.today {
    border-radius: 10px !important;
    outline-offset: -1px !important;
}
