/* 수분 섭취 팝업 (footer2) */
html.wip-scroll-lock,
body.wip-scroll-locked {
    overflow: hidden !important;
    overscroll-behavior: none;
}

body.wip-sheet-open {
    overflow: hidden;
}
.wip-dim[hidden],
.wip-sheet[hidden],
.wip-history-dim[hidden],
.wip-history-page[hidden] {
    display: none !important;
}

.wip-dim {
    position: fixed;
    inset: 0;
    z-index: 9285;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.wip-dim.open {
    opacity: 1;
    pointer-events: auto;
}

.wip-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9310;
    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -14px 32px rgba(15, 23, 42, 0.22);
    transform: translateY(105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.24s ease, visibility 0.24s;
    max-width: 560px;
    margin: 0 auto;
    max-height: min(94dvh, 960px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wip-sheet.open {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

.wip-handle {
    width: 48px;
    height: 5px;
    border-radius: 999px;
    background: #cbd5e1;
    margin: 10px auto 8px;
    flex-shrink: 0;
}

.wip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 16px 10px;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
}

.wip-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}

.wip-sub {
    margin: 2px 0 0;
    font-size: 12px;
    color: #64748b;
}

.wip-pet-dots {
    display: none;
}

/* 물병 위 펫 아바타 — mq-header-back 패턴 재사용, 중앙 정렬 */
.wip-pet-avatars.mq-pet-avatars {
    justify-content: center;
    max-width: 100%;
    width: 100%;
    margin: 0 auto 12px;
    padding: 4px 16px 2px;
    scroll-padding-inline: 16px;
}

.wip-pet-avatars .mq-pet-avatar-item__circle {
    width: 52px;
    height: 52px;
}

.wip-pet-avatars .mq-pet-avatar-item__name {
    max-width: 68px;
    font-size: 12px;
}

.wip-pet-avatars .mq-pet-avatar-item.is-active {
    transform: scale(1.04);
}

.wip-pet-avatars .mq-pet-avatar-item.is-active .mq-pet-avatar-item__name {
    color: #406cb4;
}

/* 물병·입력·오늘 기록 — wip-body 한 덩어리 스크롤 */
.wip-swipe-zone {
    touch-action: pan-y;
    transition: transform 0.2s ease, opacity 0.2s ease;
    will-change: transform;
    overflow: visible;
}

.wip-swipe-zone.is-dragging {
    transition: none;
}

.wip-swipe-zone.swipe-to-prev {
    animation: wipSwipeFlashPrev 0.28s ease;
}

.wip-swipe-zone.swipe-to-next {
    animation: wipSwipeFlashNext 0.28s ease;
}

@keyframes wipSwipeFlashPrev {
    0% { transform: translateX(0); opacity: 1; }
    40% { transform: translateX(14px); opacity: 0.85; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes wipSwipeFlashNext {
    0% { transform: translateX(0); opacity: 1; }
    40% { transform: translateX(-14px); opacity: 0.85; }
    100% { transform: translateX(0); opacity: 1; }
}

.wip-swipe-hint {
    margin: 0 0 6px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
}

.wip-close {
    border: none;
    background: #f1f5f9;
    color: #334155;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.wip-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}

/* flex 컨테이너가 아닌 block — 물병·입력·기록이 순서대로 쌓이고 함께 스크롤 */
.wip-body > .wip-swipe-zone,
.wip-body > .wip-input-card,
.wip-body > .wip-records {
    flex: none;
    position: relative;
    width: 100%;
}

.wip-records {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eef2f7;
}

.wip-input-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    background: #f8fafc;
    margin: 12px 0 0;
    overflow: hidden;
    box-sizing: border-box;
}

.wip-records-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 8px;
    padding: 6px 0 4px;
}

.wip-records-title {
    position: static;
    margin: 0;
    padding: 0;
    background: none;
}

.wip-records-more {
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #406cb4;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1.3;
}

.wip-records-more:active {
    transform: scale(0.97);
}

/* ── 수분 기록 전체 화면 (자세히 보기) ── */
body.wip-history-open {
    overflow: hidden;
}

.wip-history-dim {
    position: fixed;
    inset: 0;
    z-index: 9410;
    background: rgba(15, 23, 42, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
}

.wip-history-dim.open {
    opacity: 1;
    pointer-events: auto;
}

.wip-history-page {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    z-index: 9420;
    width: min(100vw, 560px);
    max-width: 560px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.28s;
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.12);
}

.wip-history-page.open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
}

/* mq-header-back 재사용 — 부제(펫 이름)만 추가 */
.wip-history-head {
    background: #fff;
}

.wip-history-head-main {
    flex: 1 1 auto;
    min-width: 0;
}

.wip-history-head .mq-header-back__title {
    white-space: normal;
    line-height: 1.2;
}

.wip-history-sub {
    margin: 2px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wip-history-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px));
}

.wip-history-date {
    margin-bottom: 16px;
    padding: 12px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.wip-history-date .index2-date-btn-pc {
    width: 100%;
    justify-content: center;
    font-size: 15px;
    padding: 10px 14px;
}

.wip-history-date .index2-week-strip {
    margin-top: 10px;
}

.wip-history-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.wip-input-card--history {
    margin-bottom: 16px;
}

.wip-history-input-hint {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    line-height: 1.35;
}

.wip-input-card--history .wip-save {
    height: 48px;
    font-size: 18px;
}

.wip-history-stat {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 8px;
    text-align: center;
}

.wip-history-stat__label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 4px;
}

.wip-history-stat__val {
    display: block;
    font-size: 16px;
    font-weight: 800;
    color: #406cb4;
    line-height: 1.2;
}

.wip-history-stat__val--fluid {
    color: #5aab9e;
}

.wip-history-records-title {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 800;
    color: #334155;
}

.wip-history-records-list {
    display: grid;
    gap: 8px;
}

.wip-record-row--lg {
    padding: 14px 14px;
    font-size: 15px;
    border-radius: 14px;
}

.wip-record-row--lg .wip-record-delete {
    padding: 6px 12px;
    font-size: 12px;
}

.wip-record-main {
    flex: 1;
    min-width: 0;
}

/* 캘린더 시트 — 기록 전체 화면 위 */
.wip-cal-dim {
    z-index: 9510 !important;
}

.wip-cal-sheet {
    z-index: 9520 !important;
}

.wip-records-title {
    font-size: 13px;
    font-weight: 800;
    color: #334155;
}

.wip-bottle-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.wip-bottle {
    width: 108px;
    height: 188px;
}

.wip-bottle-glass {
    position: relative;
    width: 100%;
    height: 100%;
    border: 1px solid #94a3b8;
    border-radius: 8px 8px 14px 14px;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(255, 255, 255, 0.8);
}

.wip-bottle-layers {
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 6px;
    top: 8px;
    border-radius: 4px 4px 10px 10px;
    overflow: hidden;
}

.wip-layer {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    transition: height 0.45s ease, bottom 0.45s ease;
}

/* 수분 4종: 남색 → 바다 → 하늘 → 민트 (파스텔) */
.wip-layer--metabolic {
    background: linear-gradient(180deg, #7a9bc4, #6b8ebb);
}

.wip-layer--food {
    background: linear-gradient(180deg, #8ecae8, #7eb8dc);
}

.wip-layer--drink {
    background: linear-gradient(180deg, #b5dff7, #a5d4f2);
}

.wip-layer--fluid {
    background: linear-gradient(180deg, #c5efe8, #b5e8df);
}

.wip-bottle-cap {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 12px;
    background: #64748b;
    border-radius: 4px 4px 2px 2px;
}

.wip-pct {
    font-size: 26px;
    font-weight: 800;
    color: #406cb4;
    line-height: 1.2;
}

.wip-goal {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.wip-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
    margin-bottom: 14px;
}

.wip-legend .hydration-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.wip-legend .hyd-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.wip-legend .hydration-item.metabolic-water .hyd-dot { background: #6b8ebb; }
.wip-legend .hydration-item.food-water .hyd-dot { background: #7eb8dc; }
.wip-legend .hydration-item.drink-water .hyd-dot { background: #a5d4f2; }
.wip-legend .hydration-item.fluid-water .hyd-dot { background: #b5e8df; }

.wip-legend .hyd-label { color: #94a3b8; }
.wip-legend .hyd-val { font-weight: 700; color: #334155; }

.wip-bar-track {
    display: flex;
    height: 10px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.wip-bar-track .hydration-bar-fill {
    height: 100%;
    transition: width 0.4s ease;
}

.wip-bar-track .hydration-bar-fill.metabolic-water {
    background: linear-gradient(90deg, #7a9bc4, #6b8ebb);
}
.wip-bar-track .hydration-bar-fill.food-water {
    background: linear-gradient(90deg, #8ecae8, #7eb8dc);
}
.wip-bar-track .hydration-bar-fill.drink-water {
    background: linear-gradient(90deg, #b5dff7, #a5d4f2);
}
.wip-bar-track .hydration-bar-fill.fluid-water {
    background: linear-gradient(90deg, #c5efe8, #b5e8df);
}

.wip-bar-track {
    margin-bottom: 18px;
}

.wip-type-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.wip-type-tab {
    flex: 1;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
}

.wip-type-tab.active {
    border-color: #406cb4;
    background: #eff6ff;
    color: #406cb4;
}

.wip-input-row {
    display: grid;
    grid-template-columns: minmax(84px, 96px) minmax(0, 1fr);
    gap: 8px;
    align-items: end;
}

.wip-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.wip-field--grow {
    min-width: 0;
}

.wip-field-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
}

/* 인풋+단위 박스: common.css .cfl-field-box 사용 */

.wip-save {
    grid-column: 1 / -1;
    width: 100%;
    height: 44px;
    margin-top: 2px;
    border: none;
    border-radius: 12px;
    background: #406cb4;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    box-sizing: border-box;
}

.wip-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wip-records-list {
    display: grid;
    gap: 6px;
}

.wip-record-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
}

.wip-record-row .wip-record-type {
    font-weight: 700;
    color: #406cb4;
}

.wip-record-row .wip-record-type.is-fluid {
    color: #5aab9e;
}

.wip-record-delete {
    border: none;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.wip-records-empty {
    margin: 0;
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    padding: 8px;
}

.wip-foot {
    flex-shrink: 0;
    padding: 8px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #eef2f7;
    text-align: center;
}

.wip-foot-link {
    font-size: 12px;
    font-weight: 700;
    color: #406cb4;
    text-decoration: none;
}
