/* ========================================
   Plain Days Rhythm
   Complete CSS v15
======================================== */


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

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    padding: 6px;

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

    overflow: hidden;
    background: var(--background);
    color: var(--text);

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

button {
    color: inherit;
    font: inherit;
}

.widget {
    width: min(100%, 430px);
    height: 410px;
    padding: 18px 20px 16px;

    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 18px;
    align-content: start;

    overflow: hidden;
    background: rgba(250, 250, 250, 0.94);
    border: 1px solid rgba(0, 0, 0, 0.018);
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.055);
}

.brand h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 650;
    line-height: 1.1;
}

.brand p {
    margin: 3px 0 0;
    color: var(--subtext);
    font-size: 12px;
}

.date {
    margin: 0;
    text-align: right;
}

#day {
    display: block;
    color: var(--subtext);
    font-size: 11px;
    letter-spacing: 2px;
}

#date {
    display: block;
    margin-top: 4px;
    font-size: 15px;
    font-weight: 550;
}

.habits {
    grid-column: 1 / -1;
    max-height: 162px;
    margin-top: 18px;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 22px;
    align-content: start;

    overflow-y: auto;
    scrollbar-width: none;
}

.habits::-webkit-scrollbar {
    display: none;
}

.habit {
    min-width: 0;
    min-height: 51px;
    padding: 9px 0;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

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

.habit-label,
.habit span,
.habit span[contenteditable="true"] {
    flex: 1;
    min-width: 0;
    margin-left: -4px;
    padding: 4px;

    overflow: visible;
    border-radius: 6px;
    outline: none;

    font-size: 15px;
    font-weight: 450;
    line-height: 1.3;

    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
    cursor: text;
}

.habit-label:focus,
.habit span[contenteditable="true"]:focus {
    background: #eeeeef;
}

.habit-check {
    flex: 0 0 auto;

    margin-left: 7px;
    padding: 2px;

    border: 0;
    background: transparent;

    color: var(--empty);

    font-size: 17px;
    line-height: 1;

    cursor: pointer;

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


.habit-check:hover {
    transform: scale(1.05);
}


.habit-check.checked {
    color: var(--text);

    transform: scale(1.04);
}

.habit-controls {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-top: 10px;
}

.habit-action {
    padding: 3px 0;
    border: 0;
    background: transparent;
    color: var(--subtext);
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.habit-action:hover {
    color: var(--text);
}

.habit-action:disabled {
    opacity: 0.4;
    cursor: default;
}

.delete-habit {
    display: none;
    flex: 0 0 auto;
    margin-left: 6px;
    padding: 0;

    border: 0;
    background: transparent;
    color: #aaaab0;

    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.habits.editing .delete-habit {
    display: block;
}

.habits.editing .habit-check {
    display: none;
}

.divider {
    grid-column: 1 / -1;
    height: 1px;
    margin: 13px 0 10px;
    background: var(--line);
}

.progress {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 9px;
}

#percent {
    font-size: 27px;
    font-weight: 650;
}

.progress p {
    margin: 0;
    color: var(--subtext);
    font-size: 12px;
}

.quote {
    grid-column: 1 / -1;
    margin-top: 8px;
    color: var(--subtext);
    font-size: 11px;
    font-style: italic;
    text-align: center;
}

.history-toggle {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 11px;
    padding: 9px 6px 2px;

    border: 0;
    border-top: 1px solid var(--line);
    background: transparent;
    color: var(--subtext);

    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.history-toggle:hover {
    color: var(--text);
}

.history-panel {
    grid-column: 1 / -1;
    margin-top: 12px;
}

.month-header {
    display: grid;
    grid-template-columns: 34px 1fr 34px;
    align-items: center;
    margin-bottom: 17px;
    text-align: center;
}

.month-header strong {
    font-size: 16px;
    font-weight: 650;
}

.month-nav {
    padding: 4px;
    border: 0;
    background: transparent;
    color: var(--subtext);
    font-size: 24px;
    cursor: pointer;
}

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

.weekdays {
    margin-bottom: 9px;
}

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

.heatmap-day,
.heatmap-empty {
    width: 34px;
    height: 34px;

    justify-self: center;
}

.heatmap-day {
    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    color: var(--subtext);
    font-size: 11px;

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

.heatmap-day:hover {
    transform: scale(1.08);
}

.heatmap-day.level-0 {
    background: #eeeeef;
}

.heatmap-day.level-1 {
    background: #d6d6d8;
}

.heatmap-day.level-2 {
    background: #aaaab0;
    color: #ffffff;
}

.heatmap-day.level-3 {
    background: #656569;
    color: #ffffff;
}

.heatmap-day.level-4 {
    background: #1d1d1f;
    color: #ffffff;
}

.heatmap-day.no-record {
    background: transparent;
    color: #b8b8bd;
}

.heatmap-day.future {
    background: transparent;
    color: #dddddf;
    opacity: 0.45;
}

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

.widget.month-mode > .brand,
.widget.month-mode > .date,
.widget.month-mode > .habits,
.widget.month-mode > .habit-controls,
.widget.month-mode > .divider,
.widget.month-mode > .progress,
.widget.month-mode > .quote {
    display: none;
}

.widget.month-mode {
    align-content: start;
}

.widget.month-mode .history-panel {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    margin-top: 0;
}

.widget.month-mode .history-toggle {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 18px;
}

@media (max-width: 390px) {
    .widget {
        padding-inline: 16px;
    }

    .habits {
        column-gap: 15px;
    }

    .habit-label,
    .habit span,
    .habit span[contenteditable="true"] {
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

.heatmap-day {
    font-size: 7px !important;
}
