/* QPal dedicated Focus Timer page. Presentation only; no data/network behavior. */
:root {
  --qpal-focus-page-bg:
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, .58), transparent 24%),
    linear-gradient(155deg, #fff3e7 0%, #ffc27f 36%, #ff7a36 72%, #ee571e 100%);
  --qpal-focus-page-text: #20130c;
  --qpal-focus-page-muted: rgba(63, 35, 22, .72);
  --qpal-focus-page-glass: rgba(255, 255, 255, .38);
  --qpal-focus-page-glass-strong: rgba(255, 255, 255, .64);
  --qpal-focus-page-border: rgba(255, 255, 255, .55);
  --qpal-focus-page-ring: rgba(255, 255, 255, .92);
  --qpal-focus-page-ring-rest: rgba(76, 35, 18, .18);
  --qpal-focus-page-ring-progress: #9f310c;
  --qpal-focus-page-shadow: 0 26px 70px rgba(110, 38, 8, .22);
}

html.dark-mode {
  --qpal-focus-page-bg:
    radial-gradient(circle at 50% 8%, rgba(255, 112, 54, .22), transparent 26%),
    linear-gradient(155deg, #120907 0%, #4e160d 36%, #9c2e11 68%, #ef641f 100%);
  --qpal-focus-page-text: #fff8f3;
  --qpal-focus-page-muted: rgba(255, 239, 229, .72);
  --qpal-focus-page-glass: rgba(30, 17, 12, .34);
  --qpal-focus-page-glass-strong: rgba(24, 14, 10, .58);
  --qpal-focus-page-border: rgba(255, 255, 255, .16);
  --qpal-focus-page-ring: rgba(255, 255, 255, .96);
  --qpal-focus-page-ring-rest: rgba(255, 255, 255, .18);
  --qpal-focus-page-ring-progress: #ff7a3f;
  --qpal-focus-page-shadow: 0 28px 80px rgba(0, 0, 0, .32);
}

body.qpal-focus-page-open {
  overflow: hidden !important;
}

body.qpal-focus-page-open .qpal-dashboard-dock {
  display: none !important;
}

.qpal-focus-page {
  --qpal-focus-page-progress: 0;
  position: fixed;
  inset: 0;
  z-index: 5200;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--qpal-focus-page-text);
  background: var(--qpal-focus-page-bg);
  font-family: var(--app-font);
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

.qpal-focus-page-shell {
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 4vh, 38px);
  box-sizing: border-box;
}

.qpal-focus-page-header {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 12px;
}

.qpal-focus-page-heading {
  min-width: 0;
  text-align: center;
}

.qpal-focus-page-heading > span,
.qpal-focus-page-settings-header span,
.qpal-focus-page-session span {
  display: block;
  color: var(--qpal-focus-page-muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.qpal-focus-page-heading h1,
.qpal-focus-page-settings-header h2 {
  margin: 3px 0 0;
  color: var(--qpal-focus-page-text);
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -.035em;
}

.qpal-focus-page-back,
.qpal-focus-page-settings-trigger,
.qpal-focus-page-control,
.qpal-focus-page-settings-header button {
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--qpal-focus-page-text);
  background: var(--qpal-focus-page-glass);
  border: 1px solid var(--qpal-focus-page-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.qpal-focus-page-back,
.qpal-focus-page-settings-trigger {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.qpal-focus-page-back svg,
.qpal-focus-page-settings-trigger svg,
.qpal-focus-page-control svg,
.qpal-focus-page-settings-header button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qpal-focus-page button:focus-visible,
.qpal-focus-page input:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.qpal-focus-page-stage {
  display: grid;
  justify-items: center;
  gap: clamp(20px, 3.5vh, 30px);
}

.qpal-focus-page-dial {
  position: relative;
  display: grid;
  place-items: center;
  width: min(76vw, 330px);
  aspect-ratio: 1;
  border-radius: 50%;
  isolation: isolate;
  filter: drop-shadow(0 24px 38px rgba(90, 28, 7, .18));
}

.qpal-focus-page-dial::before,
.qpal-focus-page-dial::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.qpal-focus-page-dial::before {
  inset: 0;
  background:
    conic-gradient(
      from -90deg,
      var(--qpal-focus-page-ring-progress) calc(var(--qpal-focus-page-progress) * 1turn),
      var(--qpal-focus-page-ring-rest) 0
    );
  box-shadow:
    inset 0 0 0 1px var(--qpal-focus-page-border),
    0 0 0 1px rgba(255, 255, 255, .06);
}

.qpal-focus-page-dial::after {
  inset: 18px;
  background: var(--qpal-focus-page-ring);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .68),
    0 12px 30px rgba(90, 30, 6, .12);
  z-index: 1;
}

html.dark-mode .qpal-focus-page-dial::after {
  background: color-mix(in srgb, #1a110d 88%, white 12%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .12),
    0 16px 36px rgba(0, 0, 0, .28);
}

.qpal-focus-page-dial-track {
  position: absolute;
  inset: 34px;
  z-index: 2;
  border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--qpal-focus-page-text) 28%, transparent);
  pointer-events: none;
}

.qpal-focus-page-dial-core {
  position: relative;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 5px;
  text-align: center;
}

.qpal-focus-page-dial-core > span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.qpal-focus-page-dial-core > strong {
  color: var(--qpal-focus-page-text);
  font-size: clamp(46px, 14vw, 72px);
  font-weight: 900;
  line-height: .98;
  letter-spacing: -.06em;
  font-variant-numeric: tabular-nums;
}

.qpal-focus-page-dial-core > small {
  color: var(--qpal-focus-page-muted);
  font-size: 12px;
  font-weight: 700;
}

.qpal-focus-page-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 560px);
}

.qpal-focus-page-presets button {
  min-width: 0;
  padding: 10px 8px;
  display: grid;
  gap: 2px;
  text-align: center;
  color: var(--qpal-focus-page-text);
  background: var(--qpal-focus-page-glass);
  border: 1px solid var(--qpal-focus-page-border);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
  cursor: pointer;
}

.qpal-focus-page-presets button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 850;
}

.qpal-focus-page-presets button span {
  color: var(--qpal-focus-page-muted);
  font-size: 10px;
  font-weight: 700;
}

.qpal-focus-page-presets button.is-selected {
  background: var(--qpal-focus-page-glass-strong);
  border-color: color-mix(in srgb, var(--accent) 60%, white 20%);
  box-shadow:
    0 8px 24px color-mix(in srgb, var(--accent) 14%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, .32);
}

.qpal-focus-page-controls {
  display: grid;
  grid-template-columns: 54px 74px 54px;
  align-items: center;
  gap: 16px;
}

.qpal-focus-page-control {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.qpal-focus-page-start {
  width: 74px;
  height: 74px;
  color: #231108;
  background: rgba(255, 255, 255, .9);
  border-color: rgba(255, 255, 255, .86);
  box-shadow:
    0 14px 30px rgba(100, 31, 6, .22),
    inset 0 1px 0 #fff;
}

html.dark-mode .qpal-focus-page-start {
  color: #1d0d07;
  background: #fff4ed;
}

.qpal-focus-page-start svg {
  width: 30px;
  height: 30px;
  stroke-width: 2.2;
}

.qpal-focus-page-session {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 16px;
  background: var(--qpal-focus-page-glass);
  border: 1px solid var(--qpal-focus-page-border);
  border-radius: 22px;
  box-shadow: var(--qpal-focus-page-shadow), inset 0 1px 0 rgba(255, 255, 255, .18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-sizing: border-box;
}

.qpal-focus-page-session > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.qpal-focus-page-session strong {
  overflow: hidden;
  color: var(--qpal-focus-page-text);
  font-size: 15px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.qpal-focus-page-settings {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 10px;
  color: var(--qpal-focus-page-text);
  background: var(--qpal-focus-page-glass-strong);
  border: 1px solid var(--qpal-focus-page-border);
  border-radius: 24px;
  box-shadow: var(--qpal-focus-page-shadow), inset 0 1px 0 rgba(255, 255, 255, .2);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-sizing: border-box;
}

.qpal-focus-page-settings[hidden] {
  display: none !important;
}

.qpal-focus-page-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 2px;
}

.qpal-focus-page-settings-header h2 {
  font-size: 22px;
}

.qpal-focus-page-settings-header button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

.qpal-focus-page-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--qpal-focus-page-border) 72%, transparent);
}

.qpal-focus-page-toggle span {
  display: grid;
  gap: 3px;
}

.qpal-focus-page-toggle strong,
.qpal-focus-page-custom label {
  font-size: 13px;
  font-weight: 850;
}

.qpal-focus-page-toggle small {
  color: var(--qpal-focus-page-muted);
  font-size: 11px;
  line-height: 1.4;
}

.qpal-focus-page-toggle input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.qpal-focus-page-custom {
  display: grid;
  gap: 8px;
  padding-top: 6px;
}

.qpal-focus-page-custom > div {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
}

.qpal-focus-page-custom input,
.qpal-focus-page-custom button {
  min-height: 44px;
  box-sizing: border-box;
  border-radius: 13px;
}

.qpal-focus-page-custom input {
  width: 100%;
  min-width: 0;
  padding: 0 12px;
  color: var(--qpal-focus-page-text);
  background: color-mix(in srgb, var(--qpal-focus-page-glass-strong) 78%, transparent);
  border: 1px solid var(--qpal-focus-page-border);
  font: 750 14px/1 var(--app-font);
}

.qpal-focus-page-custom span {
  color: var(--qpal-focus-page-muted);
  font-size: 11px;
  font-weight: 700;
}

.qpal-focus-page-custom button {
  padding: 0 16px;
  color: var(--accent-contrast);
  background: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 80%, black 8%);
  font: 850 12px/1 var(--app-font);
  cursor: pointer;
}

@media (max-width: 520px) {
  .qpal-focus-page-shell {
    gap: 20px;
  }

  .qpal-focus-page-header {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  .qpal-focus-page-back,
  .qpal-focus-page-settings-trigger {
    width: 44px;
    height: 44px;
  }

  .qpal-focus-page-dial {
    width: min(80vw, 310px);
  }

  .qpal-focus-page-presets {
    gap: 6px;
  }

  .qpal-focus-page-presets button {
    padding-inline: 5px;
  }

  .qpal-focus-page-session {
    padding: 14px;
  }
}

@media (max-width: 390px) {
  .qpal-focus-page-presets button strong {
    font-size: 11px;
  }

  .qpal-focus-page-session {
    grid-template-columns: 1fr 1fr;
  }

  .qpal-focus-page-session > div:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-height: 700px) and (orientation: landscape) {
  .qpal-focus-page-shell {
    min-height: auto;
    gap: 14px;
  }

  .qpal-focus-page-stage {
    grid-template-columns: minmax(220px, .9fr) minmax(260px, 1.1fr);
    align-items: center;
    gap: 18px;
  }

  .qpal-focus-page-dial {
    grid-row: 1 / span 3;
    width: min(58vh, 280px);
  }

  .qpal-focus-page-presets,
  .qpal-focus-page-controls {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .qpal-focus-page *,
  .qpal-focus-page *::before,
  .qpal-focus-page *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
