/* Timer and tasks: the only owner of their layout and responsive sizes. */
.workspace {
  --timer-hit: 36px; --timer-face-size: 32px; --timer-icon: 16px;
  position: fixed; z-index: var(--z-panel); top: calc(88px + var(--safe-top)); left: calc(32px + var(--safe-left));
  width: 280px; max-height: calc(100dvh - 108px - var(--safe-top) - var(--safe-bottom));
  padding: 8px 10px; overflow-y: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: minmax(0,1fr) 76px; grid-template-rows: 32px 36px 2px; gap: 4px 8px;
  border: 1px solid var(--pixel-edge); border-radius: 0; background: var(--paper); color: var(--ink);
  box-shadow: inset 1px 1px var(--pixel-light), 2px 3px 0 rgba(17,20,32,.28); color-scheme: light;
  scrollbar-width: thin; scrollbar-color: var(--ui-mid) transparent;
}
.workspace.is-compact { width: 248px; }
.focus-topline { grid-area: 1 / 1 / 2 / -1; display: flex; align-items: center; justify-content: space-between; height: 32px; gap: 8px; }
.phase-switch { display: flex; gap: 4px; }
.phase-switch button {
  position: relative; min-width: 44px; height: 32px; padding: 0 8px;
  color: var(--muted); font-size: 11px; line-height: 1;
}
.phase-switch button[aria-pressed="true"] { color: var(--ink); }
.phase-switch button[aria-pressed="true"]::before {
  content: ''; position: absolute; height: 2px; bottom: 2px; left: 8px; right: 8px; background: var(--ink);
}
.phase-switch button:hover { color: var(--ink); }
.workspace :is(#focus-details,#timer-action,#timer-reset,.task-remove) {
  position: relative; isolation: isolate; display: grid; place-items: center; flex: none;
  width: var(--timer-hit); height: var(--timer-hit); min-height: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; color: var(--ink); box-shadow: none;
}
.workspace :is(#focus-details,#timer-action,#timer-reset,.task-remove)::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  width: var(--timer-face-size); height: var(--timer-face-size); box-sizing: border-box;
  border: 1px solid transparent; background: transparent;
}
.workspace :is(#focus-details,#timer-reset,.task-remove):hover::before,
.workspace #focus-details[aria-expanded="true"]::before { background: var(--ui-inset); }
.workspace #timer-action::before {
  border-color: var(--pixel-edge); background: var(--scene-point);
  box-shadow: inset 1px 1px var(--pixel-light), inset -1px -1px rgba(0,0,0,.15);
}
.workspace #timer-action:hover::before { background: var(--ui-selected); }
.workspace #timer-action:active::before { box-shadow: inset 1px 1px var(--ui-mid); }
.workspace :is(#focus-details,#timer-action,#timer-reset,.task-remove):focus-visible { outline-width: 1px; outline-offset: -4px; }
.workspace :is(#timer-action,#timer-reset) svg { width: var(--timer-icon); height: var(--timer-icon); }
.workspace #focus-details { width: 36px; height: 32px; --timer-face-size: 28px; }
.workspace #focus-details svg { width: 16px; height: 16px; }
.timer-face { grid-area: 2 / 1 / 3 / 2; align-self: center; min-width: 0; }
.timer { display: block; margin: 0; font-size: 0; line-height: 0; }
#clock-digits { display: flex; align-items: center; justify-content: flex-start; height: 30px; }
#clock-digits svg { width: auto; height: 30px; max-width: 100%; flex-shrink: 1; filter: none; }
.timer-actions { grid-area: 2 / 2 / 3 / 3; display: flex; align-items: center; justify-content: center; gap: 4px; }
.timer-progress { grid-area: 3 / 1 / 4 / -1; height: 2px; margin: 0 2px; background: var(--ui-inset); overflow: hidden; }
.timer-progress span { display: block; height: 100%; width: 100%; background: var(--scene-point); transform: scaleX(0); transform-origin: left; }
.workspace[data-timer-state="paused"] .timer-progress { opacity: .5; }
.focus-options { grid-column: 1 / -1; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.duration-row { display: grid; grid-template-columns: 1fr 1fr 80px; gap: 6px; margin-bottom: 10px; }
.duration-row button {
  position: relative; isolation: isolate; height: 36px; padding: 0 6px; color: var(--muted); font-size: 11px;
}
.duration-row button::before { content: ''; position: absolute; z-index: -1; inset: 3px 0; border: 1px solid var(--line); background: var(--ui-input); }
.duration-row button[aria-pressed="true"] { color: var(--ink); }
.duration-row button[aria-pressed="true"]::before { border-color: var(--pixel-edge); background: var(--ui-selected); }
.duration-custom { display: flex; align-items: center; height: 36px; border-bottom: 1px solid var(--ui-mid); color: var(--ink); }
.duration-custom[data-selected="true"] { border-bottom-color: var(--ink); }
.duration-custom[data-disabled="true"] { opacity: .4; }
.duration-custom input { width: 54px; min-width: 0; padding: 0 4px; border: 0; border-radius: 0; background: transparent; color: inherit; font-size: 16px; text-align: right; appearance: textfield; }
.duration-custom input::-webkit-inner-spin-button,.duration-custom input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.duration-custom span { font-size: 11px; }
.duration-feedback { margin: 0 0 8px; font-size: 11px; color: var(--muted); }
.intention-input,.task-form { width: 100%; border: 1px solid var(--line); border-radius: 0; background: var(--ui-input); }
.intention-input { height: 40px; padding: 0 8px; color: var(--ink); font-size: 14px; }
.timer-bell { display: flex; align-items: center; gap: 8px; min-height: 40px; color: var(--muted); font-size: 11px; cursor: pointer; }
.timer-bell input { width: 14px; height: 14px; margin: 0; accent-color: var(--ink); }
.timer-confirm[hidden] { display: none; }
.timer-confirm { position: fixed; z-index: var(--z-confirm); inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(8,12,20,.7); }
.timer-confirm-card { width: min(360px,100%); padding: 20px; color: var(--ink); background: var(--paper); border: 2px solid var(--pixel-edge); box-shadow: 4px 4px 0 rgba(0,0,0,.3); }
.timer-confirm-card h2 { margin: 0 0 10px; font-size: 18px; }
.timer-confirm-card p { margin: 0; font-size: 12px; line-height: 1.7; }
.timer-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.timer-confirm-actions button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--ink); color: var(--ink); font-size: 12px; }
.timer-confirm-actions #timer-confirm-accept { color: var(--paper); background: var(--ink); }
.tasks { border-top: 1px solid var(--line); }
.tasks summary { display: flex; align-items: center; justify-content: space-between; min-height: 40px; list-style: none; font-size: 11px; cursor: pointer; }
.tasks summary::-webkit-details-marker { display: none; }
.tasks summary small { margin-left: 6px; color: var(--muted); font-size: 10px; }
.disclosure { font-size: 16px; color: var(--muted); }
.tasks[open] .disclosure { transform: rotate(45deg); }
.task-form { display: flex; align-items: center; }
.task-form input { flex: 1; min-width: 0; width: 100%; height: 40px; padding: 0 8px; border: 0; background: transparent; color: var(--ink); font-size: 14px; }
.task-form button { flex: 0 0 36px; display: grid; place-items: center; height: 40px; }
.task-form button svg { width: 14px; height: 14px; }
.task-list { list-style: none; padding: 0; margin: 4px 0 0; max-height: 180px; overflow-y: auto; }
.task-list li { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.task-list input { flex: none; width: 16px; height: 16px; margin: 0 4px; accent-color: var(--ink); cursor: pointer; }
.task-title { flex: 1; min-width: 0; min-height: 40px; padding: 6px 0; text-align: left; overflow-wrap: anywhere; line-height: 1.6; font-size: 12px; }
.task-title[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 3px; }
.task-list .done .task-title { color: var(--muted); text-decoration: line-through; }
.workspace .task-remove svg { width: 12px; height: 12px; }
.empty-note { margin: 8px 0; font-size: 10px; color: var(--muted); line-height: 1.7; }
#clear-done { min-height: 36px; padding: 4px 0; font-size: 10px; color: var(--muted); text-underline-offset: 3px; }
.today-stats { display: grid; grid-template-columns: 1fr 1fr; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.today-stats div { display: flex; align-items: baseline; gap: 6px; }
.today-stats div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.today-stats span { font-size: 10px; color: var(--muted); }
.today-stats strong { font-size: 12px; font-weight: 400; }
.storage-note { display: none; }
@media (min-width: 1600px) { .workspace { left: 5vw; } }
@media (max-width: 700px), (max-width: 900px) and (max-height: 540px) {
  .workspace,.workspace.is-compact {
    --timer-hit: 44px; --timer-face-size: 28px; --timer-icon: 12px;
    top: var(--focus-music-top); left: calc(12px + var(--safe-left));
    width: var(--focus-music-width); height: var(--focus-music-height); max-height: none;
    display: grid; grid-template-columns: minmax(0,1fr) 72px; grid-template-rows: 32px 36px 2px;
    gap: 2px 4px; padding: 6px 4px; overflow: visible;
  }
  .focus-topline { grid-area: 1 / 1 / 2 / -1; display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 0; height: 32px; }
  .phase-switch { display: flex; min-width: 0; gap: 0; }
  .phase-switch button { flex: 0 0 44px; width: 44px; padding: 0 0 0 8px; font-size: 10px; }
  .phase-switch button[aria-pressed="true"]::before { left: 14px; right: 6px; bottom: 3px; }
  /* Invisible extension gives the 32px header controls a 44px touch height. */
  .phase-switch button::after,.workspace #focus-details::after { content: ''; position: absolute; inset: -10px 0 -2px; }
  .workspace #focus-details { width: 44px; --timer-face-size: 24px; }
  .workspace #focus-details svg { width: 12px; height: 12px; }
  .timer-face { grid-area: 2 / 1 / 3 / 2; min-width: 0; padding-left: 8px; }
  #clock-digits,#clock-digits svg { height: 20px; }
  .timer-actions { --timer-hit: 36px; --timer-face-size: 24px; grid-area: 2 / 2 / 3 / 3; justify-content: flex-end; gap: 0; padding-right: 4px; }
  .timer-progress { grid-area: 3 / 1 / 4 / -1; height: 2px; margin: 0 4px; }
  .focus-options {
    position: fixed; top: calc(var(--focus-music-top) + var(--focus-music-height) + 8px);
    left: calc(12px + var(--safe-left)); right: calc(12px + var(--safe-right));
    max-height: max(44px,calc(100dvh - var(--focus-music-top) - var(--focus-music-height) - 92px - var(--safe-bottom)));
    margin: 0; padding: 10px 12px; overflow-y: auto; overscroll-behavior: contain;
    border: 1px solid var(--pixel-edge); background: var(--paper); box-shadow: 2px 3px rgba(17,20,32,.28);
  }
  .duration-row { margin-bottom: 6px; }
  .duration-row button,.duration-custom { height: 44px; }
  .duration-row button::before { inset-block: 8px; }
  .intention-input,.task-form input { height: 44px; font-size: 16px; }
  .timer-bell,.tasks summary,.task-title { min-height: 44px; }
  .task-form button { flex-basis: 44px; height: 44px; }
  .task-form button svg { width: 12px; height: 12px; }
}
