:root {
  color-scheme: dark;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --line: rgba(148, 163, 184, 0.35);
  --glass: rgba(15, 23, 42, 0.78);
  --glass-soft: rgba(15, 23, 42, 0.34);
  --button: rgba(30, 41, 59, 0.9);
  --button-hover: rgba(51, 65, 85, 0.95);
  --timer: #ffffff;
  --timer-shadow: rgba(0, 0, 0, 0.94);
  --clock-opacity: 0.15;
  --coral: #ff7f50;
  --orange: #fb923c;
  --red: #ef4444;
  --ui-scale: 1;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 50% 10%, #1e3a5f 0, #0f172a 45%, #020617 100%);
}

body[data-theme="light"] {
  color-scheme: light;
  --text: #0f172a;
  --muted: #334155;
  --line: rgba(51, 65, 85, 0.28);
  --glass: rgba(248, 250, 252, 0.84);
  --glass-soft: rgba(255, 255, 255, 0.4);
  --button: rgba(255, 255, 255, 0.94);
  --button-hover: rgba(226, 232, 240, 0.98);
  --timer: #0b132b;
  --timer-shadow: rgba(100, 116, 139, 0.24);
  background: radial-gradient(circle at 50% 10%, #dbeafe 0, #f8fafc 50%, #e2e8f0 100%);
}

body.browser-mode[data-theme="light"] .top-pane {
  background: #ffffff;
}

body.browser-mode[data-theme="light"] .left-clock-wrap {
  background: #f8fafc;
}

body[data-theme="light"] .clock-svg {
  filter: drop-shadow(0 3px 7px rgba(71, 85, 105, 0.28));
}

body[data-theme="light"] .left-clock-wrap .clock-face,
body[data-theme="light"] .left-clock-wrap .clock-marks {
  stroke: #64748b;
}

body[data-theme="light"] .left-clock-wrap .clock-numbers {
  fill: #475569;
}

body[data-theme="light"] .left-clock-wrap .clock-hand.hour,
body[data-theme="light"] .left-clock-wrap .clock-hand.minute {
  stroke: #0b132b;
}

body[data-theme="light"] .background-clock .clock-face,
body[data-theme="light"] .background-clock .clock-marks,
body[data-theme="light"] .background-clock .clock-hand.hour,
body[data-theme="light"] .background-clock .clock-hand.minute {
  stroke: #94a3b8;
}

body[data-theme="light"] .background-clock .clock-numbers {
  fill: #64748b;
}

body[data-theme="light"] #digital-text {
  stroke-width: 2px;
  filter: drop-shadow(0 7px 9px rgba(71, 85, 105, 0.24));
}

body.electron-mode {
  background: transparent;
}

.app-shell {
  width: calc(100vw / var(--ui-scale));
  height: calc(100vh / var(--ui-scale));
  display: flex;
  flex-direction: column;
  background: transparent;
  transform: scale(var(--ui-scale));
  transform-origin: left top;
}

/* 縮小時に増えた論理上の余白は時計表示へ渡し、操作部の下に空白を残さない。 */
.app-shell.is-compact-scale .top-pane {
  flex-grow: 1;
}

.app-shell.is-compact-scale .controls {
  flex-grow: 0;
}

.ui-scale-controls {
  position: fixed;
  top: 7px;
  left: 7px;
  z-index: 240;
  display: flex;
  gap: 3px;
  padding: 2px;
  border: 1px solid rgba(100, 116, 139, 0.2);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.52);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  opacity: 0.4;
  backdrop-filter: blur(6px);
  transition: opacity 160ms ease, background-color 160ms ease;
}

.ui-scale-controls:hover,
.ui-scale-controls:focus-within {
  opacity: 0.96;
  background: rgba(248, 250, 252, 0.9);
}

.ui-scale-controls button {
  width: 25px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: #334155;
  background: transparent;
  cursor: pointer;
  font: 700 17px/1 ui-sans-serif, system-ui, sans-serif;
}

.ui-scale-controls .compact-window-button {
  width: 29px;
  margin-left: 1px;
  border-left: 1px solid rgba(100, 116, 139, 0.2);
  border-radius: 0 6px 6px 0;
  font-size: 14px;
}

.ui-scale-value {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  width: 100%;
  color: currentColor;
  opacity: 0.62;
  pointer-events: none;
  text-align: center;
  font: 700 9px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.78);
}

body[data-theme="dark"] .ui-scale-value {
  text-shadow: 0 1px 2px rgba(2, 6, 23, 0.82);
}

.ui-scale-controls button:hover,
.ui-scale-controls button:focus-visible {
  color: #0f172a;
  background: rgba(148, 163, 184, 0.22);
  outline: none;
}

.ui-scale-controls button:focus-visible {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.32);
}

.ui-scale-controls button:disabled {
  opacity: 0.25;
  cursor: default;
}

body.electron-mode .ui-scale-controls {
  top: 44px;
}

body[data-theme="dark"] .ui-scale-controls {
  border-color: rgba(148, 163, 184, 0.24);
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.5);
}

body[data-theme="dark"] .ui-scale-controls:hover,
body[data-theme="dark"] .ui-scale-controls:focus-within {
  background: rgba(15, 23, 42, 0.88);
}

body[data-theme="dark"] .ui-scale-controls button {
  color: #cbd5e1;
}

body[data-theme="dark"] .ui-scale-controls button:hover,
body[data-theme="dark"] .ui-scale-controls button:focus-visible {
  color: #ffffff;
  background: rgba(148, 163, 184, 0.2);
}

.electron-only {
  display: none !important;
}

body.electron-mode .electron-only {
  display: flex !important;
}

[hidden] {
  display: none !important;
}

body.electron-mode .browser-only {
  display: none !important;
}

.titlebar {
  height: 38px;
  flex: 0 0 38px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--glass);
  user-select: none;
}

.drag-region {
  -webkit-app-region: drag;
  min-width: 0;
  height: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.no-drag,
button,
input,
select,
label {
  -webkit-app-region: no-drag;
}

.app-mark {
  color: #60a5fa;
  font-size: 18px;
}

.status-chip {
  padding: 3px 8px;
  border-radius: 999px;
  color: #bfdbfe;
  background: rgba(37, 99, 235, 0.35);
  font-size: 10px;
  white-space: nowrap;
}

.window-actions {
  height: 100%;
  display: flex;
}

.icon-button {
  min-width: 58px;
  height: 100%;
  padding: 0 10px;
  border: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.icon-button:hover,
.icon-button.is-active {
  background: rgba(59, 130, 246, 0.3);
}

.icon-button.danger:hover {
  color: white;
  background: #dc2626;
}

.top-pane {
  position: relative;
  min-height: 120px;
  height: 60vh;
  flex: 0 0 60vh;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.left-clock-wrap {
  position: relative;
  width: calc((100% - 12px) / 2);
  flex: 0 0 calc((100% - 12px) / 2);
  min-width: 100px;
  max-width: calc(100% - 84px);
  padding: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-soft);
}

.clock-resizer {
  position: relative;
  width: 12px;
  flex: 0 0 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: ew-resize;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--glass);
  transition: background 150ms ease, border-color 150ms ease;
  z-index: 5;
  touch-action: none;
}

.clock-resizer:hover,
.clock-resizer.is-active {
  border-color: rgba(96, 165, 250, 0.8);
  background: rgba(37, 99, 235, 0.38);
}

.clock-resizer span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
}

.clock-svg {
  width: min(100%, 380px);
  height: min(100%, 380px);
  filter: drop-shadow(0 2px 7px rgba(0, 0, 0, 0.75));
}

.analog-timer-preview {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  max-width: calc(100% - 32px);
  padding: clamp(7px, 1.4vmin, 14px) clamp(13px, 2.6vmin, 28px);
  border: 1px solid rgba(100, 116, 139, 0.22);
  border-radius: clamp(12px, 2vmin, 20px);
  color: #0b132b;
  background: rgba(248, 250, 252, 0.82);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(0.96);
  backdrop-filter: blur(5px);
  pointer-events: none;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(34px, 10vmin, 92px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.055em;
  text-shadow: 0 4px 8px rgba(71, 85, 105, 0.2);
  transition: opacity 220ms ease, transform 220ms ease, visibility 0s linear 220ms;
}

body.right-clock-hidden .analog-timer-preview.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
  transition-delay: 0s;
}

body[data-theme="dark"] .analog-timer-preview {
  border-color: rgba(148, 163, 184, 0.3);
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.84);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  text-shadow: 0 4px 9px rgba(0, 0, 0, 0.6);
}

.clock-face {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
}

.clock-marks {
  stroke: currentColor;
}

.clock-numbers {
  display: none;
  fill: currentColor;
  font-family: system-ui, sans-serif;
  font-size: 7px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

body.show-clock-numbers .clock-numbers {
  display: block;
}

.background-clock .clock-numbers {
  font-size: 6.5px;
}

.clock-hand {
  stroke: currentColor;
  stroke-linecap: round;
}

.clock-hand.hour {
  stroke-width: 3.5;
}

.clock-hand.minute {
  stroke-width: 2.2;
}

.clock-hand.second {
  stroke: var(--red);
  stroke-width: 1;
  transition: opacity 140ms ease;
}

body.is-stopwatch-mode .clock-hand.second {
  opacity: 0;
}

.clock-pin {
  fill: var(--red);
}

.break-clock-visual {
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.break-clock-visual.is-visible {
  opacity: 1;
}

.break-clock-full,
.break-clock-sector {
  opacity: 0;
  transition: opacity 180ms ease;
}

.break-clock-full {
  fill: #f59e0b;
  fill-opacity: 0.2;
}

.break-clock-sector {
  fill: #38bdf8;
  fill-opacity: 0.38;
}

.break-clock-full.is-visible,
.break-clock-sector.is-visible {
  opacity: 1;
}

.break-clock-end {
  stroke: #f97316;
  stroke-width: 3.2;
  stroke-linecap: round;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.55));
}

.break-clock-end-label {
  fill: #c2410c;
  stroke: rgba(255, 255, 255, 0.96);
  stroke-width: 1.7;
  paint-order: stroke fill;
  font-family: system-ui, sans-serif;
  font-size: 4.2px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

body[data-theme="dark"] .break-clock-end-label {
  fill: #fdba74;
  stroke: rgba(15, 23, 42, 0.96);
}

.break-clock-badge {
  display: none;
}

.break-clock-badge.is-visible {
  display: block;
}

.break-clock-badge rect {
  fill: rgba(15, 23, 42, 0.9);
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 0.6;
}

.break-clock-badge text {
  fill: #ffffff;
  font-family: system-ui, sans-serif;
  font-size: 5px;
  font-weight: 850;
  letter-spacing: 0.01em;
}

body[data-theme="light"] .break-clock-badge rect {
  fill: rgba(255, 255, 255, 0.94);
  stroke: rgba(15, 23, 42, 0.7);
}

body[data-theme="light"] .break-clock-badge text {
  fill: #0b132b;
}

.timer-stage {
  position: relative;
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.stage-collapse-controls {
  position: absolute;
  left: 9px;
  bottom: 9px;
  z-index: 12;
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid rgba(100, 116, 139, 0.18);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.54);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  opacity: 0.42;
  backdrop-filter: blur(6px);
  transition: opacity 160ms ease, background-color 160ms ease;
}

.stage-collapse-controls:hover,
.stage-collapse-controls:focus-within {
  opacity: 0.96;
  background: rgba(248, 250, 252, 0.92);
}

.stage-collapse-controls button {
  width: 26px;
  height: 24px;
  padding: 3px;
  border: 0;
  border-radius: 6px;
  color: #475569;
  background: transparent;
  cursor: pointer;
  font: 700 16px/1 system-ui, sans-serif;
}

.stage-collapse-controls button:hover,
.stage-collapse-controls button:focus-visible,
.stage-collapse-controls button:active {
  color: #0f172a;
  background: rgba(148, 163, 184, 0.24);
  outline: none;
}

.stage-collapse-controls button:disabled {
  opacity: 0.28;
  cursor: default;
}

body[data-theme="dark"] .stage-collapse-controls {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.52);
}

body[data-theme="dark"] .stage-collapse-controls:hover,
body[data-theme="dark"] .stage-collapse-controls:focus-within {
  background: rgba(15, 23, 42, 0.88);
}

body[data-theme="dark"] .stage-collapse-controls button {
  color: #cbd5e1;
}

body[data-theme="dark"] .stage-collapse-controls button:hover,
body[data-theme="dark"] .stage-collapse-controls button:focus-visible,
body[data-theme="dark"] .stage-collapse-controls button:active {
  color: #ffffff;
  background: rgba(148, 163, 184, 0.2);
}

.stage-quick-controls {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 12;
  max-width: calc(100% - 18px);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(100, 116, 139, 0.18);
  border-radius: 9px;
  background: rgba(248, 250, 252, 0.54);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  opacity: 0.48;
  backdrop-filter: blur(6px);
  transition: opacity 160ms ease, background-color 160ms ease;
}

.stage-quick-controls:hover,
.stage-quick-controls:focus-within {
  opacity: 0.96;
  background: rgba(248, 250, 252, 0.92);
}

.stage-quick-controls button {
  width: 27px;
  height: 25px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: #334155;
  background: transparent;
  cursor: pointer;
  font: 800 12px/1 ui-sans-serif, system-ui, sans-serif;
}

.stage-quick-controls button:hover,
.stage-quick-controls button:focus-visible,
.stage-quick-controls button.is-active {
  color: #0f172a;
  background: rgba(148, 163, 184, 0.24);
  outline: none;
}

.stage-quick-controls button:disabled {
  opacity: 0.24;
  cursor: default;
}

.stage-quick-controls .stage-mode-switch {
  margin-left: 1px;
  border-left: 1px solid rgba(100, 116, 139, 0.22);
  border-radius: 0 6px 6px 0;
  font-size: 14px;
}

body[data-theme="dark"] .stage-quick-controls {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.52);
}

body[data-theme="dark"] .stage-quick-controls:hover,
body[data-theme="dark"] .stage-quick-controls:focus-within {
  background: rgba(15, 23, 42, 0.88);
}

body[data-theme="dark"] .stage-quick-controls button {
  color: #cbd5e1;
}

body[data-theme="dark"] .stage-quick-controls button:hover,
body[data-theme="dark"] .stage-quick-controls button:focus-visible,
body[data-theme="dark"] .stage-quick-controls button.is-active {
  color: #ffffff;
  background: rgba(148, 163, 184, 0.2);
}

.stage-volume-control {
  position: absolute;
  right: 9px;
  bottom: 9px;
  z-index: 12;
  width: min(151px, calc(100% - 18px));
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border: 1px solid rgba(100, 116, 139, 0.18);
  border-radius: 9px;
  color: #334155;
  background: rgba(248, 250, 252, 0.54);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  opacity: 0.48;
  backdrop-filter: blur(6px);
  transition: opacity 160ms ease, background-color 160ms ease;
}

.stage-volume-control:hover,
.stage-volume-control:focus-within {
  opacity: 0.96;
  background: rgba(248, 250, 252, 0.92);
}

.stage-volume-icon {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  flex: 0 0 auto;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.stage-volume-icon:hover,
.stage-volume-icon:focus-visible {
  background: rgba(148, 163, 184, 0.24);
  outline: none;
}

.stage-volume-control input[type="range"] {
  min-width: 0;
  height: 14px;
  flex: 1 1 auto;
  accent-color: #64748b;
  cursor: pointer;
}

.stage-volume-control output {
  width: 28px;
  flex: 0 0 28px;
  text-align: right;
  font: 750 8px/1 ui-sans-serif, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

.stage-sound-settings {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-left: 1px solid rgba(100, 116, 139, 0.22);
  border-radius: 0 5px 5px 0;
  flex: 0 0 20px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.stage-sound-settings:hover,
.stage-sound-settings:focus-visible,
.stage-sound-settings[aria-expanded="true"] {
  color: #0f172a;
  background: rgba(148, 163, 184, 0.24);
  outline: none;
}

body[data-theme="dark"] .stage-volume-control {
  border-color: rgba(148, 163, 184, 0.24);
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.52);
}

body[data-theme="dark"] .stage-volume-control:hover,
body[data-theme="dark"] .stage-volume-control:focus-within {
  background: rgba(15, 23, 42, 0.88);
}

body[data-theme="dark"] .stage-sound-settings:hover,
body[data-theme="dark"] .stage-sound-settings:focus-visible,
body[data-theme="dark"] .stage-sound-settings[aria-expanded="true"] {
  color: #ffffff;
}

.sound-settings-popover {
  position: fixed;
  z-index: 320;
  width: min(340px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  padding: 15px;
  overflow: auto;
  border: 1px solid rgba(100, 116, 139, 0.28);
  border-radius: 17px;
  color: #172033;
  background: rgba(248, 250, 252, 0.97);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(18px);
}

.sound-settings-popover[hidden] {
  display: none;
}

.sound-settings-heading {
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sound-settings-heading h2 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.2;
}

.sound-settings-kicker {
  display: block;
  color: #64748b;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.18em;
}

.sound-settings-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(100, 116, 139, 0.22);
  border-radius: 8px;
  color: #475569;
  background: rgba(226, 232, 240, 0.7);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.sound-settings-close:hover,
.sound-settings-close:focus-visible {
  color: #0f172a;
  background: #e2e8f0;
  outline: 2px solid rgba(59, 130, 246, 0.34);
}

.sound-settings-primary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.sound-settings-primary > label,
.sound-settings-grid label > span {
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}

.sound-settings-popover select,
.sound-preview-button {
  min-width: 0;
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  color: #172033;
  background: #ffffff;
  font: 750 12px/1.2 ui-sans-serif, system-ui, sans-serif;
}

.sound-settings-popover select {
  width: 100%;
  padding: 0 28px 0 9px;
}

.sound-settings-popover select:focus,
.sound-preview-button:focus-visible {
  border-color: #60a5fa;
  outline: 3px solid rgba(59, 130, 246, 0.18);
}

.sound-settings-popover select:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.sound-preview-button {
  padding: 0 11px;
  cursor: pointer;
  color: #075985;
  border-color: #7dd3fc;
  background: #f0f9ff;
  white-space: nowrap;
}

.sound-preview-button:hover {
  background: #e0f2fe;
}

.sound-settings-grid {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(100, 116, 139, 0.18);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sound-settings-grid label {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.sound-settings-note {
  margin: 11px 0 0;
  color: #64748b;
  font-size: 10px;
  line-height: 1.45;
  text-align: right;
}

body[data-theme="dark"] .sound-settings-popover {
  border-color: rgba(148, 163, 184, 0.28);
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.97);
  box-shadow: 0 20px 64px rgba(0, 0, 0, 0.62);
}

body[data-theme="dark"] .sound-settings-kicker,
body[data-theme="dark"] .sound-settings-primary > label,
body[data-theme="dark"] .sound-settings-grid label > span,
body[data-theme="dark"] .sound-settings-note {
  color: #cbd5e1;
}

body[data-theme="dark"] .sound-settings-close {
  border-color: rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
  background: rgba(51, 65, 85, 0.82);
}

body[data-theme="dark"] .sound-settings-popover select {
  border-color: #475569;
  color: #f8fafc;
  background: #1e293b;
}

body[data-theme="dark"] .sound-preview-button {
  border-color: #0e7490;
  color: #cffafe;
  background: #164e63;
}

.timer-repeat-status {
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 11;
  max-width: calc(100% - 310px);
  padding: 5px 11px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 999px;
  color: #1e3a8a;
  background: rgba(239, 246, 255, 0.9);
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.12);
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(9px, 1.5vmin, 12px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

body[data-theme="dark"] .timer-repeat-status {
  border-color: rgba(96, 165, 250, 0.38);
  color: #dbeafe;
  background: rgba(30, 58, 138, 0.82);
}

.quick-pomodoro-status {
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 11;
  max-width: calc(100% - 330px);
  padding: 5px 11px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 999px;
  color: #991b1b;
  background: rgba(254, 242, 242, 0.92);
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.12);
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(9px, 1.5vmin, 12px);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.quick-pomodoro-status.is-break {
  border-color: rgba(14, 116, 144, 0.3);
  color: #155e75;
  background: rgba(236, 254, 255, 0.92);
}

body[data-theme="dark"] .quick-pomodoro-status {
  border-color: rgba(248, 113, 113, 0.4);
  color: #fee2e2;
  background: rgba(127, 29, 29, 0.84);
}

body[data-theme="dark"] .quick-pomodoro-status.is-break {
  border-color: rgba(34, 211, 238, 0.38);
  color: #cffafe;
  background: rgba(22, 78, 99, 0.86);
}

@media (max-width: 520px) {
  .sound-settings-grid {
    grid-template-columns: 1fr;
  }

  .timer-repeat-status {
    left: 9px;
    right: 9px;
    max-width: none;
    transform: none;
    text-align: center;
  }

  .quick-pomodoro-status {
    left: 9px;
    right: 9px;
    max-width: none;
    transform: none;
    text-align: center;
  }
}

body.right-clock-hidden .left-clock-wrap:not([hidden]) {
  display: flex;
  width: 100%;
  max-width: none;
  flex: 1 1 100%;
}

.background-clock {
  position: absolute;
  width: min(95vmin, 100%);
  height: min(95vmin, 100%);
  opacity: var(--clock-opacity);
  filter: drop-shadow(0 0 3px var(--timer-shadow));
  pointer-events: none;
}

.digital-svg {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
}

#digital-text {
  fill: var(--timer);
  stroke: var(--timer-shadow);
  stroke-width: 5px;
  paint-order: stroke fill;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 285px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.055em;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.55));
  transition: fill 180ms ease;
}

body.digital-hidden .digital-svg,
body.digital-hidden .break-display {
  visibility: hidden;
}

.timer-stage.is-stopwatch #digital-text {
  font-size: 220px;
  letter-spacing: -0.04em;
}

.timer-stage.is-stopwatch-hours #digital-text {
  font-size: 160px;
  letter-spacing: -0.035em;
}

.extension-confirm {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 12;
  width: min(420px, calc(100% - 32px));
  padding: 22px;
  border: 2px solid #60a5fa;
  border-radius: 18px;
  color: #ffffff;
  background: #0f172a;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.62);
  transform: translate(-50%, -50%);
  text-align: center;
}

.extension-question {
  margin: 0 0 16px;
  font-size: clamp(18px, 3.2vmin, 30px);
  font-weight: 850;
}

.extension-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.button.extension-yes {
  border-color: #34d399;
  color: #ffffff;
  background: #047857;
}

.button.extension-no {
  border-color: #94a3b8;
  color: #ffffff;
  background: #475569;
}

.break-display {
  position: absolute;
  z-index: 3;
  min-width: min(72%, 760px);
  padding: clamp(18px, 4vh, 42px) clamp(28px, 6vw, 76px);
  border: 1px solid #64748b;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1.5vh, 14px);
  color: white;
  background: #0f172a;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
  backdrop-filter: none;
  text-align: center;
  pointer-events: none;
}

.break-title {
  font-size: clamp(28px, 5.5vmin, 66px);
  font-weight: 850;
  letter-spacing: 0.16em;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.8);
}

.break-resume-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(34px, 7.5vmin, 92px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.05;
  white-space: pre-line;
  word-break: keep-all;
  overflow-wrap: normal;
  text-shadow:
    -3px -3px 0 rgba(0, 0, 0, 0.78),
    3px -3px 0 rgba(0, 0, 0, 0.78),
    -3px 3px 0 rgba(0, 0, 0, 0.78),
    3px 3px 0 rgba(0, 0, 0, 0.78),
    0 8px 18px rgba(0, 0, 0, 0.68);
}

.timer-stage.is-warning #digital-text {
  fill: var(--orange);
}

.timer-stage.is-urgent #digital-text {
  fill: var(--coral);
}

@keyframes flash-red {
  0%, 100% { fill: #f87171; filter: drop-shadow(0 0 22px rgba(239, 68, 68, 0.95)); }
  50% { fill: #7f1d1d; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.8)); }
}

.timer-stage.is-ended #digital-text {
  animation: flash-red 1s infinite;
}

@keyframes flash-analog-dial {
  0%, 100% {
    stroke: #ef4444;
    opacity: 1;
    filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.72));
  }
  50% {
    stroke: #991b1b;
    opacity: 0.42;
    filter: drop-shadow(0 0 1px rgba(153, 27, 27, 0.25));
  }
}

@keyframes flash-analog-numbers {
  0%, 100% {
    fill: #ef4444;
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.72));
  }
  50% {
    fill: #991b1b;
    opacity: 0.42;
    filter: none;
  }
}

body.timer-ended .left-clock-wrap .clock-face,
body.timer-ended .left-clock-wrap .clock-marks {
  animation: flash-analog-dial 1s ease-in-out infinite;
}

body.timer-ended .left-clock-wrap .clock-numbers {
  animation: flash-analog-numbers 1s ease-in-out infinite;
}

.click-through-hint {
  position: absolute;
  z-index: 4;
  right: 14px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(127, 29, 29, 0.82);
  color: white;
  font-size: 11px;
  font-weight: 750;
}

.resizer {
  position: relative;
  height: 11px;
  flex: 0 0 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: ns-resize;
  background: var(--glass);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  touch-action: none;
  z-index: 20;
}

.resizer span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
}

.controls {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px clamp(12px, 4vw, 46px) 14px;
  background: var(--glass);
  scrollbar-color: rgba(148, 163, 184, 0.55) transparent;
}

.settings-content {
  width: min(980px, 100%);
  margin: 6px auto 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
}

body.collapse-from-timer .time-settings-row,
body.collapse-from-timer .compact-utility-row,
body.collapse-from-timer .shortcut-help,
body.collapse-from-timer .copyright,
body.collapse-from-timer .bottom-actions,
body.collapse-from-view .compact-utility-row,
body.collapse-from-view .shortcut-help,
body.collapse-from-view .copyright,
body.collapse-from-view .bottom-actions {
  display: none !important;
}

body.collapse-to-clock .controls,
body.collapse-to-clock .resizer {
  display: none !important;
}

body.control-sections-collapsed .controls {
  flex: 0 0 auto;
  overflow: visible;
}

body.control-sections-collapsed .app-shell.is-compact-scale .top-pane {
  flex-grow: 0;
}

.control-row {
  width: min(980px, 100%);
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.row-label {
  width: 76px;
  flex: 0 0 76px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-align: right;
}

.button-grid {
  flex: 1;
  display: grid;
  gap: 8px;
}

.button-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.button-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.button-grid.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.button-grid.six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.button {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--button);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  transition: transform 100ms ease, background 150ms ease, border-color 150ms ease;
}

.button:hover {
  background: var(--button-hover);
  border-color: rgba(96, 165, 250, 0.7);
}

.button:active {
  transform: scale(0.975);
}

.button:disabled {
  opacity: 0.38;
  cursor: default;
  transform: none;
}

.button.primary {
  border-color: #3b82f6;
  color: white;
  background: #2563eb;
}

.button.stopwatch {
  border-color: #14b8a6;
  color: white;
  background: #0f766e;
}

.button.pause {
  border-color: #64748b;
  color: white;
  background: #475569;
}

.button.warning {
  border-color: #f59e0b;
  color: #1c1917;
  background: #fbbf24;
}

.button.danger {
  border-color: #ef4444;
  color: white;
  background: #dc2626;
}

.main-controls .button,
.main-controls .button.primary,
.main-controls .button.stopwatch,
.main-controls .button.pause,
.main-controls .button.warning,
.main-controls .button.danger {
  border-color: var(--line);
  color: var(--text);
  background: var(--button);
}

.main-controls .button:hover {
  border-color: rgba(100, 116, 139, 0.72);
  background: var(--button-hover);
}

.main-controls #btn-toggle-play {
  color: #60a5fa;
}

.main-controls #btn-reset {
  color: #fbbf24;
}

.main-controls #btn-clear {
  color: #f87171;
}

.main-controls #btn-stopwatch {
  color: #2dd4bf;
  white-space: pre-line;
  line-height: 1.25;
}

body[data-theme="light"] .main-controls #btn-toggle-play {
  color: #315f8c;
}

body[data-theme="light"] .main-controls #btn-reset {
  color: #8a5a35;
}

body[data-theme="light"] .main-controls #btn-clear {
  color: #a33f4b;
}

body[data-theme="light"] .main-controls #btn-stopwatch {
  color: #2e6c66;
}

.button.add {
  border-color: rgba(52, 211, 153, 0.62);
  color: #a7f3d0;
  background: rgba(6, 95, 70, 0.58);
}

.button.subtract {
  border-color: rgba(251, 146, 60, 0.7);
  color: #fed7aa;
  background: rgba(154, 52, 18, 0.5);
}

.button.undo {
  border-color: rgba(148, 163, 184, 0.6);
  color: var(--muted);
  background: rgba(51, 65, 85, 0.62);
}

body[data-theme="light"] .button.add {
  border-color: #b8c7c4;
  color: #315f59;
  background: #f5f7f7;
}

body[data-theme="light"] .button.subtract {
  border-color: #dbc9c3;
  color: #9a5148;
  background: #faf7f5;
}

body[data-theme="light"] .button.undo {
  border-color: #cbd5e1;
  color: #64748b;
  background: #e7ebef;
}

body[data-theme="light"] .button.add:hover,
body[data-theme="light"] .button.break-quick:hover {
  border-color: #789c95;
  background: #e7efed;
}

body[data-theme="light"] .button.subtract:hover {
  border-color: #b98e84;
  background: #f3e9e6;
}

.button.manual {
  min-width: 112px;
  color: white;
  background: #4f46e5;
}

.button.compact {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 11px;
}

.button.accent {
  border-color: #c084fc;
  color: white;
  background: #7e22ce;
}

.manual-controls {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr)) auto;
  gap: 8px;
}

.break-controls {
  flex: 1;
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr) minmax(90px, 1fr) minmax(112px, 1fr) minmax(76px, 0.7fr);
  align-items: center;
  gap: 8px;
}

.break-control-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.break-controls label {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--button);
  font-size: 11px;
}

.button.break-start {
  border-color: #315f6b;
  color: white;
  background: #315f6b;
}

.button.break-start.break-stop {
  border-color: #ef4444;
  background: #b91c1c;
}

.manual-controls label {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--button);
  font-size: 11px;
}

select {
  width: 58px;
  padding: 4px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font: 800 14px ui-monospace, monospace;
  text-align: center;
}

select option {
  color: #0f172a;
}

.utility-row {
  width: min(980px, 100%);
  margin: 10px auto 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.check-control,
.range-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

input[type="checkbox"] {
  accent-color: #2563eb;
}

input[type="range"] {
  width: 92px;
  accent-color: #60a5fa;
}

.shortcut-help {
  align-items: center;
  justify-content: center;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.copyright {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
  opacity: 0.72;
}

.copyright-separator {
  opacity: 0.58;
}

.copyright a {
  color: inherit;
  text-decoration: none;
}

.copyright a:hover,
.copyright a:focus-visible {
  color: #3b82f6;
  text-decoration: underline;
}

.compact-row {
  width: 100%;
  margin: 0 auto 7px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.time-settings-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 16px;
}

.compact-group {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.group-controls {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.duration-controls .compact-time-input {
  flex: 1;
}

.view-controls {
  flex-wrap: nowrap;
}

.language-toggle {
  min-width: 44px;
  border-color: #94a3b8;
  color: #334155;
  background: #f8fafc;
  letter-spacing: 0.04em;
}

body[data-theme="dark"] .language-toggle {
  color: #e2e8f0;
  background: #1e293b;
}

.compact-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.add-group > .compact-label,
.duration-group > .compact-label,
.compact-utility-row > .compact-label {
  width: 56px;
  flex-basis: 56px;
}

.add-group > .compact-label {
  color: #b42332;
  font-weight: 900;
}

body[data-theme="dark"] .add-group > .compact-label {
  color: #fb7185;
}

.break-group > .compact-label {
  width: 44px;
  flex-basis: 44px;
}

.segmented-control {
  min-width: 0;
  flex: 1;
  display: flex;
  gap: 3px;
}

.button.segment {
  min-width: 0;
  min-height: 32px;
  flex: 1;
  padding: 4px 6px;
  border-radius: 6px;
  box-shadow: none;
  font-size: 11px;
  white-space: nowrap;
}

.button.segment.undo {
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.segmented-control .button.segment:not(.undo) {
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.compact-time-input {
  min-width: 0;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--button);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.18);
}

.compact-time-input label {
  min-width: 0;
  display: flex;
}

.compact-time-input select {
  width: 43px;
  height: 30px;
  padding: 2px 1px;
  font-size: 14px;
}

.time-colon {
  color: var(--muted);
  font: 850 14px ui-monospace, monospace;
}

.button.compact-action {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 11px;
  white-space: nowrap;
}

.break-quick-buttons {
  min-width: 0;
  display: flex;
  gap: 3px;
}

.button.break-quick {
  min-width: 36px;
  min-height: 32px;
  padding: 4px 6px;
  border-color: #b8c7c4;
  border-radius: 6px;
  color: #315f59;
  background: #f5f7f7;
  box-shadow: none;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.button.break-quick.adjust {
  min-width: 30px;
  padding-inline: 5px;
}

body[data-theme="dark"] .button.break-quick {
  color: #d1fae5;
  background: #065f46;
}

.button.set-button {
  border-color: #334155;
  color: white;
  background: #334155;
}

.button.set-button:hover,
.button.break-start:hover {
  border-color: #475569;
  background: #475569;
}

.compact-utility-row {
  margin-top: 7px;
  padding-top: 7px;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 6px;
}

.toggle-chip {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(51, 65, 85, 0.28);
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.toggle-chip:has(input:checked) {
  border-color: rgba(96, 165, 250, 0.62);
  background: rgba(37, 99, 235, 0.2);
}

body[data-theme="light"] .toggle-chip:has(input:checked) {
  border-color: #94a3b8;
  background: #e9eef3;
}

.toggle-chip input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: #526d82;
}

.compact-range {
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(51, 65, 85, 0.28);
  font-size: 10px;
}

.compact-range input[type="range"] {
  width: 72px;
}

body.controls-hidden .titlebar,
body.controls-hidden .controls,
body.controls-hidden .resizer,
body.controls-hidden .stage-collapse-controls,
body.controls-hidden .icon-maker-launch,
body.controls-hidden .agenda-launch,
body.controls-hidden .pomodoro-launch,
body.controls-hidden .tutorial-launch {
  display: none !important;
}

.icon-maker-launch,
.agenda-launch,
.pomodoro-launch,
.tutorial-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: static;
  z-index: auto;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid #3b82f6;
  border-radius: 8px;
  color: #ffffff;
  background: #2563eb;
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.34);
  cursor: pointer;
  font: 800 11px/1 system-ui, sans-serif;
  text-decoration: none;
}

.icon-maker-launch {
  border-color: #94a3b8;
  color: #475569;
  background: #ffffff;
}

.icon-maker-launch:hover,
.icon-maker-launch:focus-visible {
  border-color: #64748b;
  color: #334155;
  background: #f1f5f9;
  transform: translateY(-1px);
}

.agenda-launch {
  border-color: #64748b;
  color: #0f172a;
  background: #ffffff;
}

.agenda-launch:hover,
.agenda-launch:focus-visible {
  border-color: #2563eb;
  color: #1d4ed8;
  background: #eff6ff;
  transform: translateY(-1px);
}

.helper-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  margin-top: 0;
}

.bottom-actions {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 8px;
}

.purpose-accordion {
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.purpose-accordion summary {
  width: fit-content;
  margin-left: 0;
  padding: 7px 2px 4px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  list-style-position: inside;
}

.purpose-accordion summary:hover,
.purpose-accordion summary:focus-visible {
  color: var(--text);
}

.purpose-content {
  max-width: 850px;
  margin: 0 0 4px auto;
  padding: 15px 18px 13px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-left: 4px solid #3b82f6;
  border-radius: 12px;
  color: var(--muted);
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.42), rgba(248, 250, 252, 0.68));
  box-shadow: 0 4px 14px rgba(71, 85, 105, 0.08);
  line-height: 1.65;
}

.purpose-content h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.purpose-content h3::after {
  display: block;
  width: 42px;
  height: 3px;
  margin-top: 7px;
  border-radius: 99px;
  background: #3b82f6;
  content: '';
}

.purpose-content p {
  margin: 0 0 8px;
  font-size: 12px;
}

.purpose-content p:last-child {
  margin-bottom: 0;
}

.purpose-signature {
  margin-top: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: right;
}

body[data-theme="dark"] .purpose-content {
  border-color: rgba(96, 165, 250, 0.42);
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.48), rgba(15, 23, 42, 0.62));
}

body[data-theme="dark"] .agenda-launch {
  border-color: #64748b;
  color: #e2e8f0;
  background: #1e293b;
}

.tutorial-launch {
  right: 14px;
  border-color: #315f8c;
  background: #315f8c;
}

.pomodoro-launch {
  right: 116px;
  border-color: #b6423e;
  background: #b6423e;
}

.tutorial-launch:hover,
.tutorial-launch:focus-visible,
.pomodoro-launch:hover,
.pomodoro-launch:focus-visible {
  background: #274f78;
  transform: translateY(-1px);
}

.pomodoro-launch:hover,
.pomodoro-launch:focus-visible {
  border-color: #963934;
  background: #963934;
}

.agenda-overlay {
  position: fixed;
  inset: 0;
  z-index: 225;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.58);
}

.agenda-overlay[hidden] {
  display: none;
}

/* ワーク進行表の設定は agenda.html の別タブ画面へ移行済み。 */
#agenda-overlay {
  display: none !important;
}

.agenda-card {
  position: relative;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 24px;
  border: 2px solid #60a5fa;
  border-radius: 18px;
  color: #0f172a;
  background: #f8fafc;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.42);
}

.agenda-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 44px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.agenda-mode-label {
  padding: 6px 10px;
  border: 1px solid #60a5fa;
  border-radius: 999px;
  color: #1d4ed8;
  background: #dbeafe;
  font-size: 10px;
  letter-spacing: 0.12em;
}

.agenda-card h2 {
  margin: 16px 0 8px;
  font-size: 26px;
}

.agenda-lead {
  margin: 0 0 18px;
  color: #475569;
  font-size: 13px;
  line-height: 1.7;
}

.agenda-name-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #475569;
  font-size: 11px;
  font-weight: 900;
}

.agenda-name-field input,
.agenda-library select {
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  color: #0f172a;
  background: #ffffff;
  font: 700 13px/1 system-ui, sans-serif;
}

.agenda-name-field input:focus,
.agenda-library select:focus {
  border-color: #3b82f6;
  outline: 3px solid rgba(59, 130, 246, 0.18);
}

.agenda-theme-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.agenda-theme-picker legend {
  grid-column: 1 / -1;
  margin-bottom: 1px;
  color: #475569;
  font-size: 11px;
  font-weight: 900;
}

.agenda-theme-option {
  min-width: 0;
  cursor: pointer;
}

.agenda-theme-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.agenda-theme-option > span {
  display: grid;
  min-height: 48px;
  place-items: center;
  padding: 6px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  color: #475569;
  background: #ffffff;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}

.agenda-theme-option i {
  display: block;
  width: 100%;
  height: 30px;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.agenda-theme-option.fun i { background: linear-gradient(90deg, #ec4899 0 34%, #facc15 34% 67%, #22d3ee 67%); }
.agenda-theme-option.gentle i { background: linear-gradient(90deg, #fb7185 0 34%, #fdba74 34% 67%, #fde68a 67%); }
.agenda-theme-option.steady i { background: linear-gradient(90deg, #2563eb 0 50%, #14b8a6 50%); }
.agenda-theme-option.healing i { background: linear-gradient(90deg, #22c55e 0 34%, #a78bfa 34% 67%, #67e8f9 67%); }

.agenda-theme-option input:checked + span {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.agenda-theme-option input:focus-visible + span {
  outline: 3px solid rgba(59, 130, 246, 0.28);
  outline-offset: 2px;
}

.agenda-background-picker {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 9px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #f8fafc;
}

.agenda-background-preview {
  display: grid;
  width: 54px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  color: #94a3b8;
  background: #e2e8f0;
}

.agenda-background-preview::before {
  content: 'IMAGE';
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.agenda-background-preview:has(img:not([hidden]))::before {
  display: none;
}

.agenda-background-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agenda-background-picker > div:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.agenda-background-picker strong {
  color: #334155;
  font-size: 11px;
}

.agenda-background-picker span,
.agenda-background-picker small {
  overflow: hidden;
  color: #64748b;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-library {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #eef3f8;
}

.agenda-library-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.agenda-library-row select {
  grid-column: 1 / -1;
  width: 100%;
}

.agenda-file-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.agenda-file-row span {
  color: #64748b;
  font-size: 10px;
}

.button.agenda-sub-action,
.agenda-import.button {
  display: inline-grid;
  min-height: 34px;
  place-items: center;
  padding: 5px 10px;
  border-color: #94a3b8;
  color: #334155;
  background: #ffffff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.button.agenda-sub-action.save {
  border-color: #2563eb;
  color: #ffffff;
  background: #2563eb;
}

.button.agenda-sub-action.danger:not(:disabled) {
  border-color: #fca5a5;
  color: #b91c1c;
  background: #fff1f2;
}

.button.agenda-sub-action:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.agenda-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.agenda-table-head,
.agenda-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 34px;
  gap: 8px;
  align-items: center;
}

.agenda-table-head {
  margin-bottom: 5px;
  padding: 0 4px;
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.agenda-rows {
  display: grid;
  gap: 8px;
}

.agenda-row input {
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  color: #0f172a;
  background: #ffffff;
  font: 700 13px/1 system-ui, sans-serif;
}

.agenda-row input[type="number"] {
  text-align: right;
}

.agenda-row input:focus {
  border-color: #3b82f6;
  outline: 3px solid rgba(59, 130, 246, 0.18);
}

.agenda-remove {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  color: #64748b;
  background: #ffffff;
  cursor: pointer;
  font-size: 18px;
}

.agenda-remove:hover,
.agenda-remove:focus-visible {
  border-color: #ef4444;
  color: #dc2626;
  background: #fef2f2;
}

.agenda-setup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.button.agenda-add {
  border-color: #94a3b8;
  color: #334155;
  background: #ffffff;
}

.agenda-total {
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  color: #1e3a8a;
  background: #dbeafe;
  font-size: 13px;
  font-weight: 900;
}

.agenda-total.is-off-hour {
  color: #9a3412;
  background: #ffedd5;
}

.agenda-note {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 11px;
}

.agenda-note.is-success {
  color: #15803d;
  font-weight: 800;
}

.agenda-note.is-error {
  color: #dc2626;
  font-weight: 800;
}

.agenda-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.6fr) minmax(0, 1.4fr);
  gap: 10px;
  margin-top: 20px;
}

.button.agenda-cancel {
  border-color: #94a3b8;
  color: #334155;
  background: #e2e8f0;
}

.button.agenda-open {
  border-color: #2563eb;
  color: #ffffff;
  background: #2563eb;
}

.button.agenda-open:hover,
.button.agenda-open:focus-visible {
  background: #1d4ed8;
}

body[data-theme="dark"] .agenda-card {
  color: #f8fafc;
  background: #0f172a;
}

body[data-theme="dark"] .agenda-heading,
body[data-theme="dark"] .agenda-lead,
body[data-theme="dark"] .agenda-note,
body[data-theme="dark"] .agenda-table-head {
  color: #cbd5e1;
}

body[data-theme="dark"] .agenda-row input,
body[data-theme="dark"] .agenda-remove,
body[data-theme="dark"] .button.agenda-add,
body[data-theme="dark"] .agenda-name-field input,
body[data-theme="dark"] .agenda-library select,
body[data-theme="dark"] .button.agenda-sub-action,
body[data-theme="dark"] .agenda-import.button {
  border-color: #475569;
  color: #f8fafc;
  background: #1e293b;
}

body[data-theme="dark"] .agenda-name-field,
body[data-theme="dark"] .agenda-file-row span {
  color: #cbd5e1;
}

body[data-theme="dark"] .agenda-theme-picker legend,
body[data-theme="dark"] .agenda-background-picker strong,
body[data-theme="dark"] .agenda-background-picker span,
body[data-theme="dark"] .agenda-background-picker small {
  color: #cbd5e1;
}

body[data-theme="dark"] .agenda-theme-option > span,
body[data-theme="dark"] .agenda-background-picker {
  border-color: #475569;
  color: #e2e8f0;
  background: #1e293b;
}

body[data-theme="dark"] .agenda-theme-option input:checked + span {
  border-color: #60a5fa;
  color: #bfdbfe;
  background: #1e3a5f;
}

body[data-theme="dark"] .agenda-note.is-success {
  color: #86efac;
}

body[data-theme="dark"] .agenda-note.is-error {
  color: #fca5a5;
}

body[data-theme="dark"] .agenda-library {
  border-color: #334155;
  background: #111c2f;
}

body[data-theme="dark"] .button.agenda-sub-action.save {
  border-color: #60a5fa;
  color: #ffffff;
  background: #2563eb;
}

.pomodoro-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.64);
}

.pomodoro-overlay[hidden] {
  display: none;
}

body.standalone-pomodoro {
  min-width: 320px;
  min-height: 100vh;
  overflow: auto;
  background: #111827;
}

body.standalone-pomodoro #app,
body.standalone-pomodoro #agenda-overlay,
body.standalone-pomodoro #tutorial-overlay {
  display: none !important;
}

body.standalone-pomodoro .pomodoro-overlay {
  position: static;
  min-height: 100vh;
  padding: 22px;
  background:
    radial-gradient(circle at 12% 0%, rgba(239, 68, 68, 0.2), transparent 34%),
    #111827;
}

body.standalone-pomodoro .pomodoro-card {
  width: min(680px, 100%);
  max-height: none;
  margin: auto;
}

.pomodoro-card {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 24px;
  border: 2px solid #f87171;
  border-radius: 18px;
  color: #ffffff;
  background: #0f172a;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.66);
}

.pomodoro-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 38px 10px 0;
}

.pomodoro-mode-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 9px;
  border: 1px solid rgba(248, 113, 113, 0.78);
  border-radius: 999px;
  color: #fee2e2;
  background: rgba(220, 38, 38, 0.26);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.pomodoro-cycle-label {
  color: #fecaca;
  font-size: 11px;
  font-weight: 800;
}

.pomodoro-card h2 {
  margin: 0 32px 10px 0;
  font-size: 22px;
}

.pomodoro-start-panel {
  padding: 14px;
  border: 1px solid rgba(248, 113, 113, 0.46);
  border-radius: 13px;
  background: rgba(127, 29, 29, 0.2);
}

.pomodoro-explanation {
  margin-top: 18px;
}

.pomodoro-description {
  margin: 0 0 15px;
  color: #dbeafe;
  font-size: 13px;
  line-height: 1.65;
}

.pomodoro-benefit {
  margin: -4px 0 15px;
  padding: 9px 11px;
  border-left: 3px solid #ef4444;
  border-radius: 0 8px 8px 0;
  color: #fee2e2;
  background: rgba(185, 28, 28, 0.18);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.pomodoro-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.pomodoro-flow li {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 7px;
  min-height: 58px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.72);
}

.pomodoro-flow strong {
  color: #f87171;
  font-size: 20px;
  line-height: 1;
}

.pomodoro-flow span {
  color: #e2e8f0;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.35;
}

.pomodoro-field {
  display: grid;
  gap: 6px;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 800;
}

.pomodoro-field small {
  color: #fca5a5;
  font-size: 10px;
  font-weight: 750;
}

.pomodoro-field input,
.pomodoro-field select {
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid #64748b;
  border-radius: 10px;
  color: #0f172a;
  background: #ffffff;
  font: 700 14px/1.2 system-ui, sans-serif;
}

.pomodoro-field input:focus,
.pomodoro-field select:focus {
  outline: 3px solid rgba(248, 113, 113, 0.3);
  border-color: #f87171;
}

.pomodoro-options {
  display: grid;
  grid-template-columns: minmax(140px, 190px) 1fr;
  align-items: end;
  gap: 12px;
  margin-top: 12px;
}

.pomodoro-session {
  padding: 18px;
  border: 1px solid rgba(248, 113, 113, 0.5);
  border-radius: 14px;
  background: rgba(127, 29, 29, 0.2);
  text-align: center;
}

.pomodoro-phase {
  margin: 0 0 8px;
  color: #f87171;
  font-size: 24px;
  font-weight: 900;
}

.pomodoro-task-display {
  margin: 0 0 13px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.pomodoro-minute-blocks {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  width: min(390px, 100%);
  margin: 0 auto 16px;
}

.pomodoro-minute-block {
  min-height: 12px;
  border: 1px solid rgba(248, 113, 113, 0.72);
  border-radius: 3px;
  background: #ef4444;
  box-shadow: 0 2px 5px rgba(127, 29, 29, 0.28);
  transition: opacity 180ms ease, background 180ms ease, transform 180ms ease;
}

.pomodoro-minute-block.is-empty {
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(71, 85, 105, 0.45);
  box-shadow: none;
  opacity: 0.7;
}

.pomodoro-minute-block.is-next {
  animation: pomodoro-next-pulse 4s ease-in-out infinite;
  will-change: opacity, transform;
}

@keyframes pomodoro-next-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.18;
    transform: scale(0.95);
  }
}

.pomodoro-cycles {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 13px;
}

.pomodoro-cycle-dot {
  width: 14px;
  height: 14px;
  border: 2px solid #f87171;
  border-radius: 50%;
  background: transparent;
}

.pomodoro-cycle-dot.is-complete {
  background: #ef4444;
}

.pomodoro-cycle-dot.is-current {
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.2);
}

.pomodoro-message {
  min-height: 2.9em;
  margin: 0;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.45;
}

.pomodoro-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.6fr);
  gap: 10px;
  margin-top: 16px;
}

.button.pomodoro-primary {
  border-color: #ef4444;
  color: #ffffff;
  background: #dc2626;
}

.button.pomodoro-primary:hover,
.button.pomodoro-primary:focus-visible {
  background: #b91c1c;
}

.button.pomodoro-end {
  border-color: #64748b;
  color: #ffffff;
  background: #334155;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(2, 6, 23, 0.58);
}

.tutorial-card {
  position: absolute;
  right: 18px;
  width: min(420px, calc(100vw - 36px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 22px;
  border: 2px solid #60a5fa;
  border-radius: 18px;
  color: #ffffff;
  background: #0f172a;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.62);
}

.tutorial-overlay.card-top .tutorial-card {
  top: max(16px, env(safe-area-inset-top));
}

.tutorial-overlay.card-bottom .tutorial-card {
  bottom: max(16px, env(safe-area-inset-bottom));
}

.tutorial-overlay.is-centered .tutorial-card {
  left: 50%;
  top: 50%;
  right: auto;
  transform: translate(-50%, -50%);
}

.tutorial-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: rgba(71, 85, 105, 0.72);
  cursor: pointer;
  font: 700 20px/1 system-ui, sans-serif;
}

.tutorial-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 36px 9px 0;
}

.tutorial-mode {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 9px;
  border: 1px solid rgba(96, 165, 250, 0.7);
  border-radius: 999px;
  color: #dbeafe;
  background: rgba(37, 99, 235, 0.28);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.tutorial-progress {
  color: #93c5fd;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.tutorial-card h2 {
  margin: 0 32px 10px 0;
  font-size: 21px;
}

.tutorial-card p {
  margin: 0 0 12px;
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.6;
}

#tutorial-description {
  min-height: 4.8em;
}

.tutorial-instruction {
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid rgba(251, 191, 36, 0.58);
  border-radius: 10px;
  color: #fef3c7 !important;
  background: rgba(146, 64, 14, 0.32);
  font-size: 12px !important;
  font-weight: 800;
  line-height: 1.45 !important;
}

.tutorial-instruction.is-success {
  border-color: rgba(52, 211, 153, 0.62);
  color: #d1fae5 !important;
  background: rgba(6, 95, 70, 0.36);
}

.tutorial-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.button.tutorial-next {
  border-color: #3b82f6;
  color: #ffffff;
  background: #2563eb;
}

.button.tutorial-next:disabled {
  border-color: #475569;
  color: #94a3b8;
  background: #334155;
  box-shadow: none;
  cursor: not-allowed;
}

.button.tutorial-back {
  border-color: #64748b;
  color: #ffffff;
  background: #475569;
}

.tutorial-target {
  position: relative !important;
  z-index: 210 !important;
  border-radius: 10px;
  box-shadow: 0 0 0 4px #60a5fa, 0 0 28px 8px rgba(96, 165, 250, 0.75) !important;
}

body.tutorial-active .tutorial-launch {
  visibility: hidden;
}

body.pomodoro-popup-open .pomodoro-launch,
body.pomodoro-popup-open .tutorial-launch {
  visibility: hidden;
}

body.agenda-popup-open .agenda-launch,
body.agenda-popup-open .pomodoro-launch,
body.agenda-popup-open .tutorial-launch {
  visibility: hidden;
}

body.controls-hidden .top-pane {
  height: 100% !important;
  flex: 1 1 auto;
}

body.controls-hidden .left-clock-wrap {
  background: transparent;
  border-color: transparent;
}

body.click-through .click-through-hint {
  display: block !important;
}

@media (max-width: 820px) {
  .quick-settings-row,
  .time-settings-row {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 8px;
  }

  .compact-group {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }

  .add-group > .compact-label,
  .duration-group > .compact-label,
  .break-group > .compact-label,
  .compact-utility-row > .compact-label {
    width: auto;
    flex-basis: auto;
    text-align: left;
  }

  .segmented-control,
  .group-controls {
    grid-column: 2;
    width: 100%;
  }

  .break-controls-compact,
  .view-controls {
    flex-wrap: wrap;
  }

  .break-quick-buttons {
    flex: 1 1 200px;
  }

  .break-quick-buttons .button {
    flex: 1;
  }

}

@media (max-width: 720px), (max-height: 600px) {
  .row-label {
    display: none;
  }

  .control-row {
    gap: 0;
  }

  .left-clock-wrap {
    width: 22vw;
    flex-basis: 22vw;
    padding: 6px;
  }

  .controls {
    padding: 9px 10px 11px;
  }

  .button {
    min-height: 30px;
    padding: 5px 7px;
    font-size: 11px;
  }

  .manual-controls {
    grid-template-columns: repeat(3, minmax(72px, 1fr)) auto;
  }

  .break-controls {
    grid-template-columns: minmax(76px, 1fr) minmax(76px, 1fr) minmax(100px, 1fr) minmax(64px, 0.7fr);
  }

  .break-control-label {
    display: none;
  }

  .compact-row {
    gap: 6px;
  }

  .quick-settings-row,
  .time-settings-row {
    column-gap: 8px;
  }

  .compact-group {
    gap: 4px;
  }

  .button.segment,
  .button.compact-action {
    min-height: 30px;
    padding: 4px 5px;
    font-size: 10px;
  }

  .button.break-quick {
    min-width: 31px;
    min-height: 30px;
    padding: 3px 4px;
    font-size: 9px;
  }

  .compact-time-input {
    height: 30px;
    padding: 0 2px;
  }

  .compact-time-input select {
    width: 38px;
    height: 28px;
    font-size: 12px;
  }

  .compact-utility-row {
    flex-wrap: wrap;
  }

}

@media (max-width: 600px) {
  .main-controls .button-grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bottom-actions {
    flex-wrap: wrap;
  }

  .purpose-accordion {
    flex-basis: 100%;
  }

  .helper-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin-left: 0;
  }

  .icon-maker-launch,
  .agenda-launch,
  .pomodoro-launch,
  .tutorial-launch {
    width: 100%;
    min-height: 40px;
    padding: 7px 9px;
    line-height: 1.25;
    white-space: normal;
  }
}

@media (max-width: 470px) {
  .agenda-card {
    padding: 20px 14px;
  }

  .agenda-table-head,
  .agenda-row {
    grid-template-columns: minmax(0, 1fr) 72px 34px;
    gap: 6px;
  }

  .agenda-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .agenda-library-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .agenda-theme-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agenda-background-picker {
    grid-template-columns: 48px minmax(0, 1fr) auto;
  }

  .agenda-background-preview {
    width: 48px;
  }

  .agenda-background-picker > .agenda-sub-action:last-child {
    grid-column: 3;
  }

  .agenda-library-row select {
    grid-column: 1 / -1;
  }

  .agenda-file-row .agenda-sub-action {
    flex: 1 1 120px;
  }

  .pomodoro-launch {
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
  }

  .pomodoro-card {
    padding: 20px 16px;
  }

  .pomodoro-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pomodoro-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .left-clock-wrap {
    display: none;
  }

  .button-grid.six {
    grid-template-columns: repeat(3, minmax(48px, 1fr));
  }

  .button-grid.four {
    grid-template-columns: repeat(2, minmax(72px, 1fr));
  }

  .button-grid.five {
    grid-template-columns: repeat(3, minmax(62px, 1fr));
  }

  .manual-controls {
    grid-template-columns: repeat(3, 1fr);
  }

  .button.manual {
    grid-column: 1 / -1;
  }

  .break-controls {
    grid-template-columns: repeat(2, minmax(90px, 1fr));
  }

  .compact-row {
    align-items: stretch;
    flex-direction: column;
  }

  .quick-settings-row,
  .time-settings-row {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 7px;
  }

  .compact-group {
    width: 100%;
  }

  .break-group {
    flex-wrap: wrap;
  }
}

@media (max-width: 360px) {
  .compact-group {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 4px;
  }

  .segmented-control,
  .group-controls {
    grid-column: 1;
  }

  .compact-label {
    padding-left: 1px;
  }

  .controls {
    padding-inline: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  body.timer-ended .left-clock-wrap .clock-face,
  body.timer-ended .left-clock-wrap .clock-marks {
    animation: none;
    stroke: #ef4444;
  }

  body.timer-ended .left-clock-wrap .clock-numbers {
    animation: none;
    fill: #ef4444;
  }
}
