:root {
    --ios-bg: #000000;
    --ios-card: #1c1c1e;
    --ios-blue: #0a84ff;
    --ios-green: #30d158;
    --ios-red: #ff453a;
    --ios-gray: #8e8e93;
    --ios-tab-bg: rgba(28, 28, 30, 0.8);
    --safe-area-bottom: env(safe-area-inset-bottom);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--ios-bg);
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Noto Sans SC", sans-serif;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden;
}

.iphone-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    background: #000;
}

/* Header */
.app-header {
    padding: 60px 20px 20px;
    background: var(--ios-bg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.brand h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.brand span {
    color: var(--ios-gray);
    font-size: 14px;
    font-weight: 600;
}

/* Mode Toggle Pill */
.mode-pill {
    background: var(--ios-card);
    padding: 6px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ios-gray);
}

.toggle {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3a3a3c;
    transition: .3s;
    border-radius: 22px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: var(--ios-green);
}

input:checked+.toggle-slider:before {
    transform: translateX(16px);
}

/* Dashboard Card */
.floating-dashboard {
    margin: 0 20px 20px;
    background: linear-gradient(135deg, #2c2c2e 0%, #1c1c1e 100%);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.score-main {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 12px;
}

#total-score {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
}

.target-sep {
    font-size: 24px;
    color: var(--ios-gray);
    margin: 0 4px;
    font-weight: 300;
}

#target-score {
    font-size: 28px;
    color: var(--ios-gray);
    font-weight: 600;
}

.unit {
    color: var(--ios-gray);
    font-size: 14px;
    font-weight: 700;
    margin-left: 4px;
}

.status-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
}

.badge.locked {
    background: rgba(255, 69, 58, 0.15);
    color: var(--ios-red);
}

.badge.unlocked {
    background: rgba(48, 209, 88, 0.15);
    color: var(--ios-green);
}

.time-hint {
    color: var(--ios-blue);
    font-weight: 700;
    font-size: 15px;
}

.mini-progress {
    height: 6px;
    background: #3a3a3c;
    border-radius: 3px;
    overflow: hidden;
}

.mini-progress .fill {
    height: 100%;
    width: 0%;
    background: var(--ios-blue);
    transition: width 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Content Area */
.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 100px;
    mask-image: linear-gradient(to bottom, transparent, #000 20px, #000 90%, transparent);
}

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

/* iOS List Style */
.item-card {
    background: var(--ios-card);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 扣分型：深蓝色调 (守分项) */
.item-card.is-deduction {
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.12) 0%, rgba(10, 132, 255, 0.05) 100%);
    border-color: rgba(10, 132, 255, 0.25);
}

/* 必做项：琥珀/橘色调 (生命线项) */
.item-card.is-required {
    background: linear-gradient(135deg, rgba(255, 159, 10, 0.12) 0%, rgba(255, 159, 10, 0.05) 100%);
    border-color: rgba(255, 159, 10, 0.3);
}

/* 选中后的动态反馈 */
.item-card:active {
    transform: scale(0.98);
}

.item-text {
    font-size: 17px;
    font-weight: 600;
    display: block;
}

.item-meta {
    font-size: 13px;
    color: var(--ios-gray);
    margin-top: 2px;
}

.required-dot {
    color: var(--ios-red);
    margin-right: 4px;
}

/* Subtask Chips (胶囊布局) */
.sub-row {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}

.chip {
    padding: 8px 16px;
    background: #2c2c2e;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ios-gray);
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chip.active {
    background: rgba(48, 209, 88, 0.15);
    color: var(--ios-green);
    border-color: rgba(48, 209, 88, 0.3);
}

.chip:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* Unified iOS Dots (Exercise, Meals, Custom) */
.ios-dots {
    display: flex;
    gap: 14px;
    /* 增大间距 */
}

.ios-dot {
    width: 24px;
    /* 增大尺寸 */
    height: 24px;
    border-radius: 50%;
    background: #3a3a3c;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ios-dot.active.is-blue {
    background: var(--ios-blue);
    box-shadow: 0 0 12px rgba(10, 132, 255, 0.5);
}

.ios-dot.active.is-red {
    background: var(--ios-red);
    box-shadow: 0 0 12px rgba(255, 69, 58, 0.5);
}

.ios-dot:active {
    transform: scale(0.9);
}

/* Controls */
.ios-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #3a3a3c;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.ios-check.checked {
    background: var(--ios-blue);
    border-color: var(--ios-blue);
}

.ios-check.checked:after {
    content: '✓';
    color: white;
    font-weight: 800;
}

/* Tab Bar */
.tab-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(84px + var(--safe-area-bottom));
    background: var(--ios-tab-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    border-top: 0.5px solid rgba(255, 255, 255, 0.1);
    padding-bottom: var(--safe-area-bottom);
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--ios-gray);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: color 0.2s;
}

.tab-btn.active {
    color: var(--ios-blue);
}

.tab-btn .icon {
    font-size: 24px;
}

.tab-btn .label {
    font-size: 10px;
    font-weight: 600;
}

/* Reminder Counter */
.ios-counter {
    display: flex;
    align-items: center;
    background: #2c2c2e;
    border-radius: 10px;
    padding: 2px;
}

.c-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--ios-blue);
    font-size: 20px;
    font-weight: 500;
}

.c-val {
    width: 24px;
    text-align: center;
    font-weight: 700;
}

.chip {
    padding: 6px 12px;
    background: #2c2c2e;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ios-gray);
}

.chip.active {
    background: var(--ios-green);
    color: white;
}

/* Toast */
.toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(44, 44, 46, 0.9);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: 0.3s;
    pointer-events: none;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
}

/* Auth Overlay */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: var(--ios-card);
    width: 100%;
    max-width: 320px;
    padding: 30px 24px;
    border-radius: 28px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.auth-card h2 {
    margin-bottom: 24px;
    font-size: 24px;
}

#family-code-input {
    width: 100%;
    background: #2c2c2e;
    border: none;
    padding: 16px;
    border-radius: 12px;
    color: white;
    font-size: 18px;
    text-align: center;
    margin-bottom: 16px;
    letter-spacing: 2px;
}

#login-btn {
    width: 100%;
    padding: 16px;
    background: var(--ios-blue);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 17px;
    font-weight: 700;
}

.user-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

.user-item {
    background: #2c2c2e;
    padding: 16px;
    border-radius: 16px;
    cursor: pointer;
}

.user-item .avatar {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.user-item span {
    font-size: 14px;
    font-weight: 600;
}

/* Child Selector (Top) */
.child-selector {
    padding: 10px 20px;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    background: var(--ios-bg);
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
}

.child-chip {
    flex-shrink: 0;
    padding: 8px 16px;
    background: var(--ios-card);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ios-gray);
    border: 1px solid transparent;
}

.child-chip.active {
    background: rgba(10, 132, 255, 0.1);
    color: var(--ios-blue);
    border-color: rgba(10, 132, 255, 0.3);
}

/* Week Strip */
.week-strip {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    background: var(--ios-card);
    padding: 12px;
    border-radius: 18px;
}

.day-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 4px;
    width: 42px;
    border-radius: 12px;
    cursor: pointer;
}

.day-pill.active {
    background: var(--ios-blue);
    color: white;
}

.day-pill .dow {
    font-size: 10px;
    opacity: 0.6;
    font-weight: 700;
}

.day-pill .dom {
    font-size: 15px;
    font-weight: 800;
}

.day-pill.has-data:after {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--ios-green);
    border-radius: 50%;
}

.day-pill.active.has-data:after {
    background: white;
}

/* iOS 风格模态框 */
.ios-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-blur {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-card {
    position: relative;
    background: #1c1c1e;
    width: 270px;
    border-radius: 14px;
    padding-top: 20px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    animation: modalSpring 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalSpring {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-card h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
}

.modal-card p {
    font-size: 13px;
    color: var(--ios-gray);
    margin-bottom: 15px;
}

#modal-input {
    width: calc(100% - 32px);
    background: #000;
    border: 0.5px solid #333;
    padding: 8px;
    border-radius: 8px;
    color: white;
    text-align: center;
    font-size: 17px;
    margin-bottom: 20px;
    outline: none;
}

.modal-btns {
    border-top: 0.5px solid #333;
    display: flex;
}

.modal-btns button {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px;
    font-size: 17px;
    color: var(--ios-blue);
    cursor: pointer;
}

#modal-cancel {
    border-right: 0.5px solid #333;
    font-weight: 400;
}

#modal-confirm {
    font-weight: 600;
}

.modal-btns button:active {
    background: rgba(255, 255, 255, 0.05);
}

/* PIN 码蒙层样式 */
.pin-container {
    width: 100%;
    max-width: 320px;
    text-align: center;
}

.pin-user-info {
    margin-bottom: 30px;
}

.pin-user-info p {
    color: var(--ios-gray);
    font-size: 15px;
    margin-top: 5px;
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 50px;
}

.pin-dots .dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid white;
    transition: 0.15s;
}

.pin-dots .dot.filled {
    background: white;
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.pin-keypad .key {
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 28px;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pin-keypad .key:active {
    background: rgba(255, 255, 255, 0.25);
}

.pin-keypad .key.empty {
    background: transparent;
    cursor: default;
}

.pin-keypad .key.delete {
    font-size: 20px;
    background: transparent;
}

.pin-cancel-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
}

/* iOS 设置列表风格 */
.ios-settings-list {
    margin-top: 24px;
    background: var(--ios-card);
    border-radius: 14px;
    overflow: hidden;
}

.ios-setting-item {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border: none;
    width: 100%;
    font-size: 17px;
    color: white;
    cursor: pointer;
    border-bottom: 0.5px solid #333;
    transition: background 0.2s;
}

.ios-setting-item:last-child {
    border-bottom: none;
}

.ios-setting-item:active {
    background: rgba(255, 255, 255, 0.1);
}

.ios-setting-item.destructive {
    color: var(--ios-red);
    justify-content: center;
    font-weight: 600;
}

.ios-setting-item .arrow {
    color: var(--ios-gray);
    font-size: 14px;
}

/* 堆叠按钮 (用于警告框) */
.modal-btns.stack {
    flex-direction: column-reverse;
}

.modal-btns.stack button {
    border-right: none;
    border-top: 0.5px solid #333;
    width: 100%;
    padding: 14px;
    font-size: 17px;
}

#dialog-confirm.destructive {
    color: var(--ios-red);
}

#dialog-confirm {
    font-weight: 600;
}

#dialog-cancel {
    font-weight: 400;
}

/* Keypad Modal Styles */
.keypad-modal {
    width: 280px;
    padding-top: 20px;
}

.modal-display {
    background: #000;
    margin: 10px 20px 20px;
    padding: 15px;
    border-radius: 12px;
    font-size: 32px;
    font-weight: 700;
    color: var(--ios-blue);
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0.5px solid #333;
}

.pin-keypad.mini {
    gap: 10px;
    padding: 0 20px;
    margin-bottom: 20px;
}

.pin-keypad.mini .key {
    font-size: 22px;
    background: rgba(255, 255, 255, 0.06);
}

/* iOS 灵动岛通知样式 */
.ios-banner {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    background: rgba(44, 44, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 12px 16px;
    z-index: 5000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(-120%);
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

.ios-banner.show {
    transform: translateY(0);
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.banner-icon {
    font-size: 24px;
    background: #007aff;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.banner-text {
    flex: 1;
}

.banner-text strong {
    display: block;
    font-size: 14px;
    color: white;
}

.banner-text p {
    font-size: 12px;
    color: var(--ios-gray);
    margin-top: 2px;
}