/* ===== 番茄钟 App ===== */
:root { --pt: #1ABCAA; --pt-dark: #14a090; --pt-light: #e8f9f7; }

#pomodoro-page {
    background: #f2f2f2;
    /* display/flex-direction由 .page.active 控制，不用!important覆盖 */
}
#pomodoro-page.active {
    overflow: hidden;
    height: 100vh;
}
#pomodoro-page .pt-page-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* ── header：仿聊天页风格 ── */
.pt-header {
    display: flex;
    align-items: center;
    padding: 0;
    padding-top: env(safe-area-inset-top);
    background: #EDEDED;
    border-bottom: 1px solid #dcdcdc;
    height: calc(44px + env(safe-area-inset-top));
    box-sizing: border-box;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.pt-header-back {
    background: none; border: none; color: #333;
    width: 48px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0; padding: 0;
}
.pt-header-title {
    font-size: 17px; font-weight: 600; color: #111;
    flex: 1; text-align: center;
}
.pt-header-actions { display: flex; align-items: center; padding-right: 4px; }
.pt-header-btn {
    background: none; border: none; color: #333;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; cursor: pointer;
}

/* ── bottom nav ── */
.pt-bottom-nav {
    display: flex;
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid #e8e8e8;
    background: #fff;
    flex-shrink: 0;
}
.pt-nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px; font-size: 10px; color: #aaa;
    cursor: pointer; background: none; border: none; padding: 0;
}
.pt-nav-item.active { color: var(--pt); }
.pt-nav-icon { font-size: 20px; line-height: 1; }

/* ── scrollable tab content：flex:1 + min-height:0 是让子区域可滚动的关键 ── */
.pt-tab-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── task cards (todo tab) ── */
.pt-todo-view { padding: 10px 12px 100px; }

.pt-task-card {
    border-radius: 14px; margin-bottom: 10px; overflow: hidden;
    position: relative; min-height: 84px;
    display: flex; align-items: center; padding: 16px 18px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}
.pt-cat-work    { background: linear-gradient(135deg,#1e3a5f 0%,#2d6a9f 100%); }
.pt-cat-study   { background: linear-gradient(135deg,#2c1654 0%,#6b3fa0 100%); }
.pt-cat-health  { background: linear-gradient(135deg,#0f4c3a 0%,#1e8a6e 100%); }
.pt-cat-hobby   { background: linear-gradient(135deg,#7a2a2a 0%,#c45a3a 100%); }
.pt-cat-other   { background: linear-gradient(135deg,#5a3d1a 0%,#a8733a 100%); }

.pt-task-decoration {
    position: absolute; right: 72px; bottom: 4px;
    font-size: 36px; opacity: 0.3; pointer-events: none; user-select: none;
}
.pt-task-info { flex: 1; z-index: 1; }
.pt-task-name {
    font-size: 16px; font-weight: 600; color: #fff;
    margin-bottom: 5px; text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.pt-task-meta { font-size: 12px; color: rgba(255,255,255,0.65); }
.pt-task-start-btn {
    background: rgba(255,255,255,0.18);
    border: 1.5px solid rgba(255,255,255,0.55);
    color: #fff; border-radius: 20px;
    padding: 7px 18px; font-size: 14px; font-weight: 500;
    cursor: pointer; z-index: 1; flex-shrink: 0;
    backdrop-filter: blur(4px); transition: background 0.15s;
}
.pt-task-start-btn:active { background: rgba(255,255,255,0.35); }

/* simple desktop widget todos */
.pt-section-title {
    font-size: 12px; color: #aaa; margin: 16px 0 8px 4px;
    font-weight: 500; letter-spacing: 0.5px;
}
.pt-simple-todo {
    display: flex; align-items: center; gap: 12px;
    background: #fff; border-radius: 12px;
    padding: 12px 14px; margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.pt-simple-check {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid var(--pt); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 12px; color: transparent;
    transition: all 0.15s;
}
.pt-simple-check.done { background: var(--pt); border-color: var(--pt); color: #fff; }
.pt-simple-text { flex: 1; font-size: 14px; color: #333; }
.pt-simple-todo.done-item .pt-simple-text { text-decoration: line-through; color: #aaa; }
.pt-simple-del { color: #ddd; font-size: 20px; cursor: pointer; padding: 0 2px; }
.pt-simple-del:active { color: #e64a19; }

.pt-todo-empty {
    text-align: center; padding: 60px 20px 0;
}
.pt-todo-empty-icon { font-size: 52px; margin-bottom: 12px; }
.pt-todo-empty-text { font-size: 14px; color: #bbb; line-height: 1.7; }

/* FAB */
.pt-fab {
    position: absolute; bottom: 72px; right: 18px;
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--pt); color: #fff; font-size: 28px;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(26,188,170,0.45);
    z-index: 10; transition: transform 0.12s;
}
.pt-fab:active { transform: scale(0.92); }

/* ── add task modal ── */
.pt-add-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 1000; display: none; align-items: flex-end;
    justify-content: center;
}
.pt-add-overlay.open { display: flex; }
.pt-add-sheet {
    background: #fff; border-radius: 20px 20px 0 0;
    width: 100%; max-width: 480px;
    padding: 20px 20px 40px; box-sizing: border-box;
}
.pt-add-sheet-header {
    display: flex; align-items: center;
    justify-content: space-between; margin-bottom: 16px;
}
.pt-add-sheet-title { font-size: 16px; font-weight: 600; color: #222; }
.pt-add-x { background: none; border: none; font-size: 22px; color: #bbb; cursor: pointer; }
.pt-add-ok { background: none; border: none; font-size: 22px; color: var(--pt); cursor: pointer; font-weight: 700; }

.pt-type-tabs {
    display: flex; background: #f5f5f5; border-radius: 10px;
    padding: 3px; margin-bottom: 18px; gap: 0;
}
.pt-type-tab {
    flex: 1; padding: 7px 0; border: none; border-radius: 8px;
    font-size: 12px; color: #888; background: transparent; cursor: pointer;
}
.pt-type-tab.active {
    background: #fff; color: var(--pt); font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.pt-add-name-input {
    width: 100%; border: none; border-bottom: 1.5px solid #eee;
    padding: 10px 0; font-size: 15px; color: #333;
    outline: none; margin-bottom: 18px; box-sizing: border-box;
    background: transparent;
}
.pt-add-name-input::placeholder { color: #ccc; }

.pt-add-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pt-add-row-label { font-size: 12px; color: #aaa; min-width: 40px; }

.pt-cat-chip {
    padding: 5px 12px; border-radius: 14px;
    border: 1.5px solid #e5e5e5; background: #fff;
    color: #666; font-size: 12px; cursor: pointer; transition: all 0.12s;
}
.pt-cat-chip.active { border-color: var(--pt); color: var(--pt); background: var(--pt-light); }

.pt-mode-btn {
    padding: 6px 14px; border-radius: 14px;
    border: 1.5px solid #e5e5e5; background: #fff;
    color: #666; font-size: 12px; cursor: pointer; transition: all 0.12s;
}
.pt-mode-btn.active { border-color: var(--pt); color: var(--pt); background: var(--pt-light); }

.pt-dur-row { display: flex; align-items: center; gap: 10px; width: 100%; }
.pt-dur-slider {
    flex: 1; -webkit-appearance: none; height: 4px;
    border-radius: 2px; background: #e0e0e0; outline: none;
}
.pt-dur-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 20px; height: 20px;
    border-radius: 50%; background: var(--pt);
    box-shadow: 0 1px 4px rgba(26,188,170,0.4); cursor: pointer;
}
.pt-dur-badge { min-width: 52px; text-align: right; font-size: 14px; font-weight: 700; color: var(--pt); }

.pt-goal-sentence { font-size: 13px; color: #555; line-height: 2; margin-bottom: 14px; }
.pt-goal-sentence span { color: var(--pt); border-bottom: 1px solid var(--pt); cursor: pointer; }
.pt-goal-inline { border: none; border-bottom: 1.5px solid var(--pt); font-size: 13px; color: var(--pt); width: 52px; text-align: center; outline: none; padding: 2px 0; background: transparent; }
.pt-habit-sentence { font-size: 13px; color: #555; line-height: 2.2; margin-bottom: 14px; }

/* ── full-screen timer overlay ── */
.pt-timer-overlay {
    position: fixed; inset: 0; z-index: 600;
    display: flex; flex-direction: column;
    background: linear-gradient(160deg, #a8bedd 0%, #b8a8d8 50%, #d8a8c4 100%);
    background-size: cover; background-position: center;
}
.pt-timer-overlay.hidden { display: none; }

/* topbar */
.pt-timer-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 8px 0;
    padding-top: calc(12px + env(safe-area-inset-top));
    box-sizing: border-box; flex-shrink: 0;
}
.pt-timer-close-btn {
    background: none; border: none; color: rgba(255,255,255,0.75);
    padding: 8px; cursor: pointer;
    display: flex; align-items: center;
}
.pt-timer-topbar-right { display: flex; }
.pt-timer-tool-btn {
    background: none; border: none; color: rgba(255,255,255,0.65);
    width: 40px; height: 40px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.pt-timer-tool-btn:active { color: #fff; }

/* quote */
.pt-timer-quote {
    display: flex; align-items: flex-start; gap: 6px;
    padding: 10px 24px 0; flex-shrink: 0; min-height: 56px;
}
.pt-quote-mark {
    font-size: 32px; color: rgba(255,255,255,0.55);
    line-height: 1; font-family: Georgia, serif; flex-shrink: 0;
}
.pt-quote-text {
    font-size: 14px; color: rgba(255,255,255,0.8);
    line-height: 1.65; padding-top: 6px;
}

/* main body */
.pt-timer-body {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 0 20px; gap: 0;
}
.pt-timer-task-label {
    font-size: 16px; font-weight: 500;
    color: rgba(255,255,255,0.9);
    margin-bottom: 24px; text-align: center;
    max-width: 260px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.pt-circle-wrap { position: relative; width: 240px; height: 240px; }
.pt-circle-svg { transform: rotate(-90deg); width: 240px; height: 240px; }
.pt-circle-bg { fill: none; stroke: rgba(255,255,255,0.2); stroke-width: 6; }
.pt-circle-fg {
    fill: none; stroke: rgba(255,255,255,0.9); stroke-width: 6; stroke-linecap: round;
    transition: stroke-dashoffset 0.8s linear;
}
.pt-circle-center {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%); text-align: center;
}
.pt-timer-digits {
    font-size: 60px; font-weight: 700; color: #fff;
    letter-spacing: -2px; line-height: 1;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 24px rgba(0,0,0,0.12);
}
.pt-timer-sublabel { font-size: 12px; color: rgba(255,255,255,0.55); margin-top: 8px; }
.pt-phase-label {
    margin-top: 20px; font-size: 13px;
    color: rgba(255,255,255,0.6); letter-spacing: 0.5px;
}

/* bottom control bar */
.pt-timer-bar {
    display: flex; align-items: center; justify-content: space-around;
    padding: 14px 32px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    background: rgba(200,200,220,0.25);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255,255,255,0.25);
    flex-shrink: 0;
}
.pt-bar-btn {
    width: 52px; height: 52px; border-radius: 50%; border: none;
    background: rgba(255,255,255,0.2); color: #fff;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.pt-bar-btn:active { background: rgba(255,255,255,0.38); }
.pt-bar-btn-main {
    width: 62px; height: 62px;
    background: rgba(255,255,255,0.3);
}
.pt-bar-btn-main:active { background: rgba(255,255,255,0.48); }

/* 旧样式保留防报错 */
.pt-timer-abandon {
    background: none; border: none;
    color: rgba(255,255,255,0.25); font-size: 13px;
    cursor: pointer; text-decoration: underline;
}

/* ── stats ── */
.pt-stats-view { padding: 12px 12px 80px; }
.pt-stats-card {
    background: #fff; border-radius: 14px;
    padding: 16px 18px; margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.pt-stats-card-title {
    font-size: 12px; color: #aaa; margin-bottom: 14px;
    font-weight: 500; letter-spacing: 0.3px;
}
.pt-stats-row { display: flex; justify-content: space-around; }
.pt-stats-item { text-align: center; }
.pt-stats-num {
    font-size: 26px; font-weight: 700; color: var(--pt);
    line-height: 1; margin-bottom: 4px;
}
.pt-stats-num small { font-size: 12px; font-weight: 400; }
.pt-stats-sub .pt-stats-num { color: #444; font-size: 22px; }
.pt-stats-label { font-size: 11px; color: #aaa; }

.pt-chart-tabs {
    display: flex; background: #f5f5f5; border-radius: 8px;
    padding: 3px; margin-bottom: 14px; gap: 0; width: fit-content;
}
.pt-chart-tab {
    padding: 5px 14px; border: none; border-radius: 6px;
    font-size: 12px; color: #888; background: transparent; cursor: pointer;
}
.pt-chart-tab.active {
    background: #fff; color: var(--pt); font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.pt-bar-chart {
    display: flex; align-items: flex-end; gap: 4px; height: 80px;
    padding-top: 8px;
}
.pt-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pt-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.pt-bar {
    width: 100%; border-radius: 3px 3px 0 0; min-height: 2px;
    background: var(--pt-light); transition: height 0.4s ease;
}
.pt-bar.has-data { background: var(--pt); }
.pt-bar-lbl { font-size: 9px; color: #ccc; white-space: nowrap; }
.pt-chart-empty { color: #ccc; font-size: 13px; text-align: center; padding: 24px 0; }

/* ── friends ── */
.pt-friends-view { padding: 12px 12px 80px; }
.pt-friends-topbar {
    display: flex; align-items: center;
    justify-content: space-between; margin-bottom: 12px;
}
.pt-friends-subtitle { font-size: 12px; color: #bbb; }
.pt-friends-refresh {
    font-size: 12px; color: var(--pt); background: none;
    border: 1px solid var(--pt); border-radius: 12px;
    padding: 3px 10px; cursor: pointer;
}
.pt-friend-card {
    display: flex; align-items: flex-start; gap: 12px;
    background: #fff; border-radius: 14px;
    padding: 14px; margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.pt-friend-avatar {
    width: 46px; height: 46px; border-radius: 50%;
    flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; color: var(--pt);
    background: var(--pt-light); overflow: hidden;
}
.pt-friend-avatar img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
.pt-friend-body { flex: 1; min-width: 0; }
.pt-friend-name { font-size: 14px; font-weight: 600; color: #222; margin-bottom: 4px; }
.pt-friend-what {
    font-size: 13px; color: #444; margin-bottom: 5px;
    display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.pt-activity-dot {
    width: 7px; height: 7px; border-radius: 50%;
    display: inline-block; flex-shrink: 0;
}
.pt-friend-detail { font-size: 12px; color: #999; line-height: 1.6; }
.pt-friend-timer-col { text-align: right; flex-shrink: 0; padding-top: 2px; }
.pt-friend-timer { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pt-timer-cd { color: #e8602a; font-weight: 600; }
.pt-timer-cu { color: var(--pt); }
.pt-friends-empty, .pt-friends-loading {
    text-align: center; color: #ccc; font-size: 14px; padding: 52px 0;
}
.pt-friends-loading { animation: pt-pulse 1.2s ease infinite; }
@keyframes pt-pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }
