/* ==========================================================================
   Focus (Pomodoro) page — phone + desktop. Page background and theme tokens are untouched (--m-* only).
   Scale: 11 label · 12 meta · 14 body · 16 title · 56–72 timer digits · radii 14/18/24 · touch >= 44px
   ========================================================================== */
.pmx { display: none; }
@media screen {
    html.pmx-on .pmx { display: grid; gap: 14px; min-width: 0; color: var(--m-ink); font-size: 14px; line-height: 1.6; --pm: var(--m-accent); }
    html.pmx-on .pmx[data-mode="shortBreak"], html.pmx-on .pmx[data-mode="longBreak"] { --pm: var(--m-good); }
    html.pmx-on body #view-pomodoro > :not(#pmx) { display: none !important; }   /* original controls stay in the DOM and keep driving the timer */
    .pmx :is(h2, h3, p, small, b, strong, ul, li) { margin: 0; padding: 0; min-width: 0; }
    .pmx ul { list-style: none; }
    .pmx button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .pmx :focus-visible { outline: 2px solid var(--pm); outline-offset: 2px; }

    .pmx-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .pmx-title h2 { font-size: 20px; font-weight: 800; letter-spacing: -.2px; }
    .pmx-title p { font-size: 12px; color: var(--m-muted); margin-top: 2px; }
    .pmx-icon { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1px solid var(--m-line); background: var(--m-surface); color: var(--m-ink); display: grid; place-items: center; transition: transform .25s var(--m-ease), background .2s; }
    .pmx-icon .material-symbols-outlined { font-size: 22px; }
    .pmx-icon:active { transform: scale(.9) rotate(30deg); }
    .pmx-layout { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); min-width: 0; }

    /* stage */
    .pmx-stage { position: relative; display: grid; justify-items: center; gap: 16px; padding: 16px 16px 20px; border-radius: 26px; border: 1px solid var(--m-line); background: var(--m-surface); overflow: hidden; isolation: isolate; }
    .pmx-stage::before { content: ''; position: absolute; z-index: -1; inset: -20% -10% auto; height: 80%; background: radial-gradient(60% 60% at 50% 40%, color-mix(in srgb, var(--pm) 20%, transparent), transparent 72%); opacity: .8; transition: background .6s, opacity .6s; }
    .pmx[data-state="running"] .pmx-stage::before { opacity: 1; animation: pmx-breathe 4.2s ease-in-out infinite; }
    .pmx-seg { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; max-width: 420px; padding: 4px; height: 46px; border-radius: 16px; background: color-mix(in srgb, var(--m-ink) 6%, transparent); }
    .pmx-seg button { position: relative; z-index: 1; border: 0; background: transparent; color: var(--m-muted); font-size: 13px; font-weight: 700; transition: color .25s; }
    .pmx-seg button[aria-selected="true"] { color: var(--m-ink); }
    .pmx-thumb { position: absolute; inset-block: 4px; inset-inline-start: 4px; width: calc((100% - 8px) / 3); border-radius: 12px; background: var(--m-surface); box-shadow: 0 2px 10px rgba(0, 0, 0, .1); transition: transform .45s var(--m-ease); }
    .pmx-seg[data-i="1"] .pmx-thumb { transform: translateX(-100%); } .pmx-seg[data-i="2"] .pmx-thumb { transform: translateX(-200%); }
    html[dir="ltr"] .pmx-seg[data-i="1"] .pmx-thumb { transform: translateX(100%); } html[dir="ltr"] .pmx-seg[data-i="2"] .pmx-thumb { transform: translateX(200%); }

    .pmx-task { display: flex; align-items: center; gap: 10px; max-width: 100%; min-height: 48px; padding: 6px 14px 6px 12px; border-radius: 24px; border: 1px solid var(--m-line); background: color-mix(in srgb, var(--m-surface) 80%, transparent); color: var(--m-ink); text-align: start; transition: transform .2s var(--m-ease), border-color .2s; }
    .pmx-task:active { transform: scale(.97); }
    .pmx-task-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--pm) 16%, transparent); color: var(--pm); flex: none; }
    .pmx-task-ic .material-symbols-outlined { font-size: 19px; }
    .pmx-task-tx { display: grid; min-width: 0; line-height: 1.35; }
    .pmx-task-tx small { font-size: 10.5px; color: var(--m-muted); }
    .pmx-task-tx strong { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52vw; }
    .pmx-task > .material-symbols-outlined { font-size: 20px; color: var(--m-muted); }

    /* dial */
    .pmx-dial { position: relative; width: min(78vw, 300px); aspect-ratio: 1; }
    .pmx-dial svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
    html[dir="rtl"] .pmx-dial svg { transform: rotate(-90deg) scaleY(-1); }
    .pmx-dial circle { fill: none; }
    .pmx-dial .ticks { stroke: color-mix(in srgb, var(--m-ink) 18%, transparent); stroke-width: 2.2; stroke-dasharray: 1.6 12.43; }
    .pmx-dial .bg { stroke: color-mix(in srgb, var(--pm) 16%, transparent); stroke-width: 11; }
    .pmx-dial .fg { stroke: var(--pm); stroke-width: 11; stroke-linecap: round; stroke-dasharray: 754 754; stroke-dashoffset: 754; transition: stroke-dashoffset 1s linear, stroke .5s; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--pm) 55%, transparent)); }
    .pmx-time { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 2px; }
    .pmx-time b { font-size: clamp(52px, 17vw, 68px); font-weight: 800; letter-spacing: -1px; line-height: 1.15; font-variant-numeric: tabular-nums; direction: ltr; }
    .pmx-time small { font-size: 12.5px; color: var(--m-muted); }
    .pmx[data-state="running"] .pmx-time small { color: var(--pm); font-weight: 700; }
    .pmx-cycle { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 20px; }
    .pmx-cycle i { width: 10px; height: 10px; border-radius: 50%; background: color-mix(in srgb, var(--m-ink) 15%, transparent); transition: background .4s, transform .4s var(--m-ease); }
    .pmx-cycle i.on { background: var(--pm); transform: scale(1.15); }
    .pmx-cycle small { margin-inline-start: 6px; font-size: 11.5px; color: var(--m-muted); }

    /* controls */
    .pmx-controls { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; }
    .pmx-ctl { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--m-line); background: var(--m-surface); color: var(--m-ink); display: grid; place-items: center; transition: transform .25s var(--m-ease), background .2s; }
    .pmx-ctl .material-symbols-outlined { font-size: 24px; }
    .pmx-ctl:active { transform: scale(.88); }
    .pmx-main { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 190px; height: 60px; padding: 0 28px; border: 0; border-radius: 30px; background: var(--pm); color: var(--m-on-accent); font-size: 16px; font-weight: 800; box-shadow: 0 12px 26px color-mix(in srgb, var(--pm) 38%, transparent); transition: transform .25s var(--m-ease), box-shadow .3s, background .4s; }
    .pmx[data-mode="shortBreak"] .pmx-main, .pmx[data-mode="longBreak"] .pmx-main { color: #fff; }
    .pmx-main .material-symbols-outlined { font-size: 28px; font-variation-settings: 'FILL' 1; }
    .pmx-main:active { transform: scale(.95); }
    .pmx[data-state="running"] .pmx-main { box-shadow: 0 0 0 6px color-mix(in srgb, var(--pm) 20%, transparent), 0 12px 26px color-mix(in srgb, var(--pm) 38%, transparent); }

    /* side column */
    .pmx-side { display: grid; gap: 14px; min-width: 0; align-content: start; }
    .pmx-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    .pmx-stat { display: grid; justify-items: center; gap: 1px; padding: 14px 6px 12px; border-radius: 20px; border: 1px solid var(--m-line); background: var(--m-surface); text-align: center; animation: pmx-rise .5s var(--m-ease) both; }
    .pmx-stat .material-symbols-outlined { font-size: 22px; color: var(--m-accent); margin-bottom: 2px; }
    .pmx-stat.warm .material-symbols-outlined { color: var(--m-warn); }
    .pmx-stat strong { font-size: 16px; font-weight: 800; line-height: 1.3; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .pmx-stat small { font-size: 11px; color: var(--m-muted); }
    .pmx-card { padding: 16px; border-radius: 22px; border: 1px solid var(--m-line); background: var(--m-surface); animation: pmx-rise .55s var(--m-ease) both; }
    .pmx-card > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
    .pmx-card h3 { font-size: 15px; font-weight: 800; }
    .pmx-note { font-size: 12px; color: var(--m-muted); }

    .pmx-opts { display: grid; gap: 8px; }
    .pmx-opt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 56px; padding: 8px 14px 8px 12px; border-radius: 16px; border: 1.5px solid var(--m-line); background: transparent; color: var(--m-ink); text-align: start; transition: border-color .2s, background .25s, transform .2s var(--m-ease); }
    .pmx-opt > .material-symbols-outlined { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: color-mix(in srgb, var(--m-accent) 13%, transparent); color: var(--m-accent); }
    .pmx-opt span:not(.material-symbols-outlined) { display: grid; min-width: 0; line-height: 1.4; }
    .pmx-opt strong { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .pmx-opt small { font-size: 11.5px; color: var(--m-muted); }
    .pmx-opt > i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--m-ink) 25%, transparent); position: relative; transition: border-color .2s, background .2s; }
    .pmx-opt[aria-checked="true"] { border-color: var(--m-accent); background: color-mix(in srgb, var(--m-accent) 9%, transparent); }
    .pmx-opt[aria-checked="true"] > i { border-color: var(--m-accent); background: var(--m-accent); box-shadow: inset 0 0 0 4px var(--m-surface); }
    .pmx-opt:active { transform: scale(.98); }

    .pmx-add { display: flex; gap: 8px; margin-bottom: 10px; }
    .pmx-add input { flex: 1; min-width: 0; height: 48px; padding: 0 14px; border-radius: 15px; border: 1.5px solid var(--m-line); background: color-mix(in srgb, var(--m-ink) 4%, transparent); color: var(--m-ink); font: inherit; font-size: 14px; transition: border-color .2s, box-shadow .2s; }
    .pmx-add input:focus { outline: 0; border-color: var(--m-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--m-accent) 17%, transparent); }
    .pmx-add button { width: 48px; height: 48px; flex: none; border: 0; border-radius: 15px; background: var(--m-accent); color: var(--m-on-accent); display: grid; place-items: center; transition: transform .2s var(--m-ease); }
    .pmx-add button:active { transform: scale(.9); }
    .pmx-list { display: grid; gap: 6px; }
    .pmx-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px; min-height: 48px; padding: 0 4px; border-radius: 14px; font-size: 14px; animation: pmx-rise .4s var(--m-ease) both; }
    .pmx-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .3s; }
    .pmx-list li.is-done span { color: var(--m-muted); text-decoration: line-through; }
    .pmx-check, .pmx-del { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; color: var(--m-muted); padding: 0; }
    .pmx-check::before { content: ''; grid-area: 1/1; width: 24px; height: 24px; border-radius: 8px; border: 2px solid color-mix(in srgb, var(--m-ink) 28%, transparent); transition: background .25s, border-color .25s; }
    .pmx-check .material-symbols-outlined { grid-area: 1/1; font-size: 17px; color: #fff; transform: scale(0); transition: transform .3s cubic-bezier(.3, 1.7, .5, 1); }
    .pmx-check[aria-checked="true"]::before { background: var(--m-good); border-color: var(--m-good); }
    .pmx-check[aria-checked="true"] .material-symbols-outlined { transform: scale(1); }
    .pmx-del .material-symbols-outlined { font-size: 20px; transition: color .2s; }
    .pmx-del:hover .material-symbols-outlined { color: var(--m-bad); }
    .pmx-list .pmx-empty { grid-template-columns: auto 1fr; justify-items: start; gap: 10px; padding: 14px; border: 1.5px dashed var(--m-line); color: var(--m-muted); font-size: 13px; }
    .pmx-empty .material-symbols-outlined { color: var(--m-accent); }

    @keyframes pmx-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
    @keyframes pmx-breathe { 50% { opacity: .55; transform: scale(1.04); } }
}
@media print { .pmx { display: none !important; } }
@media screen and (max-width: 340px) { .pmx-main { min-width: 150px; padding: 0 18px; } .pmx-ctl { width: 46px; height: 46px; } }

/* ---------- Desktop / tablet ---------- */
@media screen and (min-width: 721px) {
    html.pmx-on .pmx { max-width: 1180px; margin-inline: auto; gap: 20px; font-size: 15px; }
    .pmx-title h2 { font-size: 28px; } .pmx-title p { font-size: 14px; }
    .pmx-icon { width: 48px; height: 48px; }
    .pmx-layout { grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr); gap: 20px; align-items: start; }
    .pmx-stage { padding: 28px 28px 32px; gap: 22px; min-height: 640px; align-content: center; }
    .pmx-dial { width: min(100%, 360px); }
    .pmx-time b { font-size: 76px; } .pmx-time small { font-size: 14px; }
    .pmx-main { height: 64px; min-width: 220px; font-size: 17px; } .pmx-ctl { width: 56px; height: 56px; }
    .pmx-task-tx strong { max-width: 320px; }
    .pmx-card { padding: 20px; border-radius: 24px; } .pmx-card h3 { font-size: 16px; }
    .pmx-stat strong { font-size: 18px; }
}
@media screen and (min-width: 721px) and (max-width: 1000px) {
    .pmx-layout { grid-template-columns: minmax(0, 1fr); } .pmx-stage { min-height: 0; }
}
@media screen and (hover: hover) {
    .pmx-opt:hover { border-color: color-mix(in srgb, var(--m-accent) 55%, var(--m-line)); }
    .pmx-ctl:hover, .pmx-icon:hover { background: color-mix(in srgb, var(--pm) 10%, var(--m-surface)); }
    .pmx-main:hover { transform: translateY(-2px); }
    .pmx-task:hover { border-color: color-mix(in srgb, var(--pm) 55%, var(--m-line)); }
    .pmx-list li:hover { background: color-mix(in srgb, var(--m-ink) 4%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .pmx *, .pmx *::before, .pmx *::after { animation: none !important; transition-duration: .01ms !important; } }
