:root {
  --bg: #1e1e1e;
  --surface: #242424;
  --surface-2: #2a2a2a;
  --border: #333333;
  --border-strong: #3a3a3a;
  --fg: #e8e8e6;
  --muted: #8a8a8a;
  --muted-2: #6e6e6e;
  --accent: #f2f2f0;
  --accent-rgb: 242, 242, 240;
  --focus-color: #cd8c84;
  --focus-color-rgb: 181, 102, 92;
  --break-color: #7c9b7e;
  --break-color-rgb: 124, 155, 126;

  --font-sans: "Inter", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;
  --font-greek: "IBM Plex Sans", system-ui, sans-serif;
  --font-digital: "DSEG7-Classic", var(--font-mono);

  --glass-fill: color-mix(in srgb, var(--bg) 60%, transparent);
  --glass-border: transparent;
  --glass-blur: blur(2px);
  --glass-shadow: none;

  --retro-fill: color-mix(in srgb, var(--bg) 65%, var(--surface-2));
  --retro-border: color-mix(in srgb, var(--fg) 24%, transparent);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  color: var(--fg);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--bg);
}

.bg-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg-video-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 56.25vw;
  min-height: 100vh;
  min-width: 177.78vh;
  transform: translate(-50%, -50%);
}

.bg-video-wrap iframe {
  width: 100% !important;
  height: 100% !important;
  border: 0;
}

.bg-video-controls {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
}

.bg-video-controls[hidden] {
  display: none;
}

.icon-btn.small.video-ctrl-btn {
  width: 32px;
  height: 32px;
  border-radius: 0;
  background: transparent;
  border-color: transparent;
}

.ytmusic-card {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 320px;
  padding: 10px;
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.ytmusic-card[hidden] {
  display: none;
}

body.btn-profile-opaque .ytmusic-card {
  background: var(--surface);
  border-color: var(--border);
  backdrop-filter: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

body.btn-profile-retro .ytmusic-card {
  background-color: var(--retro-fill);
  border-color: var(--retro-border);
  backdrop-filter: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.ytmusic-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.ytmusic-card:hover .ytmusic-close {
  opacity: 1;
  pointer-events: auto;
}

.ytmusic-close:hover {
  color: var(--fg);
  background: color-mix(in srgb, var(--fg) 18%, transparent);
}

.ytmusic-thumb {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center;
}

.ytmusic-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.ytmusic-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ytmusic-artist {
  font-size: 11px;
  color: color-mix(in srgb, var(--fg) 65%, transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ytmusic-time {
  font-size: 10px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--fg) 65%, transparent);
  white-space: nowrap;
  margin-top: 2px;
}

.ytmusic-seek {
  height: 2px !important;
  margin-top: 8px !important;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--val, 0%),
    color-mix(in srgb, var(--fg) 20%, transparent) var(--val, 0%),
    color-mix(in srgb, var(--fg) 20%, transparent) 100%
  ) !important;
}

.ytmusic-seek::-webkit-slider-thumb {
  width: 0px !important;
  height: 0px !important;
}

.ytmusic-seek:hover::-webkit-slider-thumb {
  width: 8px !important;
  height: 8px !important;
}

.ytmusic-seek::-moz-range-thumb {
  width: 0px !important;
  height: 0px !important;
  border: none;
}

.ytmusic-seek:hover::-moz-range-thumb {
  width: 8px !important;
  height: 8px !important;
}

.ytmusic-controls {
  display: flex;
  align-items: center;
  gap: 2px;
}

.icon-btn.small.ytmusic-sub-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.icon-btn.small.ytmusic-sub-btn:hover {
  color: var(--fg);
  background: color-mix(in srgb, var(--fg) 18%, transparent);
}

.icon-btn.small.ytmusic-play-btn {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.icon-btn.small.ytmusic-play-btn:hover {
  color: var(--fg);
  background: color-mix(in srgb, var(--fg) 18%, transparent);
}

.ytmusic-player-clip {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  overflow: hidden;
}

.bg-video-seek {
  width: 140px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--val, 50%),
    rgba(255, 255, 255, 0.35) var(--val, 50%),
    rgba(255, 255, 255, 0.35) 100%
  );
}

.bg-video-seek::-webkit-slider-thumb {
  border-radius: 0;
}

.bg-video-seek::-moz-range-thumb {
  border-radius: 0;
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  user-select: none;
}

.header {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  padding: 20px 24px;
}

.wordmark {
  position: fixed;
  top: 0;
  left: 56px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: "Inter", var(--font-greek);
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--fg);
  padding: 12px 16px 12px 14px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-top: none;
  backdrop-filter: var(--glass-blur);
}

.wordmark-dot {
  width: 6px;
  height: 6px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--fg);
  box-shadow:
    0 0 3px color-mix(in srgb, var(--fg) 95%, transparent),
    0 0 8px color-mix(in srgb, var(--fg) 70%, transparent),
    0 0 16px color-mix(in srgb, var(--fg) 40%, transparent),
    0 0 28px color-mix(in srgb, var(--fg) 20%, transparent);
  flex-shrink: 0;
}

body[data-preset="paper"] .wordmark-dot {
  background: #2648cc;
  box-shadow:
    0 0 3px rgba(38, 72, 204, 0.95),
    0 0 8px rgba(38, 72, 204, 0.7),
    0 0 16px rgba(38, 72, 204, 0.4),
    0 0 28px rgba(38, 72, 204, 0.2);
}

body.btn-profile-opaque .wordmark {
  background: var(--surface);
  border-color: var(--border);
  backdrop-filter: none;
}

body.btn-profile-retro .wordmark {
  background-color: var(--retro-fill);
  background-image: radial-gradient(circle at 35% 25%, color-mix(in srgb, var(--fg) 5%, transparent), transparent 60%);
  border-color: var(--retro-border);
  backdrop-filter: none;
  box-shadow:
    inset 0 1px 1px color-mix(in srgb, var(--fg) 5%, transparent),
    inset 0 -2px 4px rgba(0, 0, 0, 0.5);
}

body.btn-profile-retro .wordmark-dot {
  box-shadow:
    0 0 4px color-mix(in srgb, var(--fg) 100%, transparent),
    0 0 10px color-mix(in srgb, var(--fg) 80%, transparent),
    0 0 20px color-mix(in srgb, var(--fg) 50%, transparent),
    0 0 34px color-mix(in srgb, var(--fg) 25%, transparent);
}

body[data-preset="paper"].btn-profile-retro .wordmark-dot {
  background: #2648cc;
  box-shadow:
    0 0 4px rgba(38, 72, 204, 1),
    0 0 10px rgba(38, 72, 204, 0.8),
    0 0 20px rgba(38, 72, 204, 0.5),
    0 0 34px rgba(38, 72, 204, 0.25);
}

.header-icons {
  display: flex;
  align-items: center;
}

.header-icons .icon-btn {
  background: var(--glass-fill);
  border-color: var(--glass-border);
  border-radius: 0;
  backdrop-filter: var(--glass-blur);
}

.header-icons .icon-btn:not(:last-child) {
  border-right: none;
}

body.btn-profile-opaque .header-icons .icon-btn {
  background: var(--surface);
  border-color: var(--border);
  backdrop-filter: none;
}

body.btn-profile-retro .header-icons .icon-btn {
  background-color: var(--retro-fill);
  background-image: radial-gradient(circle at 35% 25%, color-mix(in srgb, var(--fg) 5%, transparent), transparent 60%);
  border-color: var(--retro-border);
  backdrop-filter: none;
  box-shadow:
    inset 0 1px 1px color-mix(in srgb, var(--fg) 5%, transparent),
    inset 0 -2px 4px rgba(0, 0, 0, 0.5),
    0 2px 6px rgba(0, 0, 0, 0.4);
}

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: color-mix(in srgb, var(--fg) 55%, transparent);
  text-decoration: none;
}

.icon-btn.small {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.icon-btn.is-active {
  background: rgba(var(--accent-rgb), 0.08);
  border-color: #4a4a4a;
  color: var(--fg);
}

.icon-btn::after {
  content: attr(data-tip);
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  color: var(--fg);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 5px 9px;
  border-radius: 0;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.icon-btn.tip-above::after {
  top: auto;
  bottom: 48px;
}

.icon-btn:hover::after {
  opacity: 1;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vh, 40px) 24px 24px;
}

.main[hidden] {
  display: none;
}

.timer-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stage-gap {
  flex: none;
  height: clamp(28px, 4.5vh, 56px);
}

body.btn-profile-retro .stage-gap {
  height: clamp(16px, 3vh, 40px);
}

.tabs {
  display: flex;
  background: var(--glass-fill);
  border: none;
  backdrop-filter: var(--glass-blur);
  border-radius: 0;
}

.tab-btn {
  border: none;
  outline: none;
  border-radius: 0;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--fg) 55%, transparent);
  background: transparent;
  transition:
    color 0.15s,
    font-weight 0.1s,
    background-color 0.15s ease;
}

.control-unit:not(:last-child) .tab-btn {
  border-right: none;
}

.tab-btn.is-active {
  color: var(--fg);
  background-color: color-mix(in srgb, var(--fg) 10%, transparent);
}

.ring-wrap {
  position: relative;
  width: clamp(240px, 48vh, 460px);
  height: clamp(240px, 48vh, 460px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--glass-fill);
  backdrop-filter: var(--glass-blur);
}

.ring-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

@keyframes rim-deplete {
  50% { stroke-dashoffset: var(--circ); }
}

.rim-deplete {
  animation: rim-deplete 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ring-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  -webkit-user-drag: none;
  user-drag: none;
}

.digits {
  position: relative;
  font-family: var(--font-mono);
  font-size: clamp(52px, 10vh, 96px);
  font-weight: 500;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  user-drag: none;
  cursor: pointer;
}

.session-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--fg) 55%, transparent);
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  user-drag: none;
}

.controls {
  display: flex;
  align-items: center;
}

.control-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.btn-start {
  border-radius: 0;
  padding: 14px 32px;
  background-color: color-mix(in srgb, var(--fg) 10%, var(--glass-fill));
  border: none;
  backdrop-filter: var(--glass-blur);
  color: var(--fg);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.btn-reset {
  border-radius: 0;
  padding: 14px 32px;
  background-color: var(--glass-fill);
  border: none;
  backdrop-filter: var(--glass-blur);
  color: color-mix(in srgb, var(--fg) 55%, transparent);
  font-size: 14px;
  font-weight: 400;
}

.indicator-light {
  display: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--fg) 10%, transparent);
  box-shadow: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.reset-light {
  background: #e5534b;
  box-shadow: 0 0 4px rgba(229, 83, 75, 0.8);
}

.tab-light.is-lit[data-tone="focus"] {
  background: #e5534b;
  box-shadow: 0 0 4px rgba(229, 83, 75, 0.8);
}

.tab-light.is-lit[data-tone="break"] {
  background: #4cd964;
  box-shadow: 0 0 4px rgba(76, 217, 100, 0.8);
}

.settings-scrim {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 8, 0.6);
  z-index: 40;
  transition: background-color 0.15s ease;
}

.settings-scrim.is-previewing {
  background: transparent;
}

.preview-badge {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 46;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  color: var(--fg);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  pointer-events: none;
}

.preview-badge[hidden] {
  display: none;
}

.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  height: 100vh;
  width: 400px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  font-family: var(--font-sans);
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  display: flex;
  flex-direction: column;
  padding: 26px 24px;
  gap: 24px;
  overflow-y: auto;
  z-index: 41;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  user-drag: none;
}

.settings-panel input {
  user-select: auto;
  -webkit-user-select: auto;
}

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

.settings-top {
  justify-content: space-between;
}

.settings-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
}

.close-btn {
  width: 30px;
  height: 30px;
  border-radius: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background-color 0.15s ease;
}

.close-btn:hover {
  background: color-mix(in srgb, var(--fg) 5%, var(--bg));
}

.settings-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--border);
}

.settings-tab-btn {
  padding: 0 0 10px;
  margin-bottom: -1px;
  background: transparent;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.settings-tab-btn.is-active {
  font-weight: 600;
  color: var(--fg);
  border-bottom-color: var(--accent);
}

.profile-toggle {
  display: inline-flex;
  align-self: flex-start;
  border: 1px solid var(--border);
  border-radius: 0;
}

.profile-btn {
  padding: 7px 14px;
  border-radius: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
}

.profile-btn:last-child {
  border-right: none;
}

.profile-btn.is-active {
  background: color-mix(in srgb, var(--fg) 10%, transparent);
  font-weight: 600;
  color: var(--fg);
}

body.btn-profile-opaque .tabs {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: none;
  border-radius: 0;
  gap: 0;
}

body.btn-profile-opaque .tab-btn {
  background-color: transparent;
  border-radius: 0;
  border: none;
  box-shadow: none;
  transition: background-color 0.15s ease;
}

body.btn-profile-opaque .control-unit:not(:last-child) .tab-btn {
  border-right: 1px solid var(--border);
}

body.btn-profile-opaque .tab-btn.is-active {
  background-color: color-mix(in srgb, var(--fg) 10%, var(--surface));
  box-shadow: none;
}

body.btn-profile-opaque .controls {
  gap: 0;
}

body.btn-profile-opaque .btn-start {
  border-radius: 0;
  background-color: color-mix(in srgb, var(--fg) 10%, var(--surface));
  border: 1px solid var(--border);
  border-right: none;
  box-shadow: none;
  backdrop-filter: none;
  color: var(--fg);
}

body.btn-profile-opaque .btn-reset {
  border-radius: 0;
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: none;
  color: var(--muted);
}

body.btn-profile-retro .tabs {
  display: flex;
  gap: 10px;
  background: transparent;
  border: none;
  backdrop-filter: none;
}

body.btn-profile-retro .control-unit .tab-btn {
  padding: 10px 22px;
  background-color: var(--retro-fill);
  background-image: radial-gradient(circle at 35% 25%, color-mix(in srgb, var(--fg) 5%, transparent), transparent 60%);
  border: 1px solid var(--retro-border);
  backdrop-filter: none;
  box-shadow:
    inset 0 1px 1px color-mix(in srgb, var(--fg) 5%, transparent),
    inset 0 -2px 4px rgba(0, 0, 0, 0.5),
    0 1px 3px rgba(0, 0, 0, 0.4);
}

body.btn-profile-retro .tab-btn.is-active {
  background-color: var(--retro-fill);
}

body.btn-profile-retro .indicator-light {
  display: block;
}

body.btn-profile-retro .controls {
  align-items: flex-start;
  gap: 20px;
}

body.btn-profile-retro .btn-start {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--retro-fill);
  background-image: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--fg) 6%, transparent), transparent 60%);
  border: 1px solid var(--retro-border);
  backdrop-filter: none;
  box-shadow:
    inset 0 1px 1px color-mix(in srgb, var(--fg) 6%, transparent),
    inset 0 -3px 5px rgba(0, 0, 0, 0.55),
    0 3px 10px rgba(0, 0, 0, 0.5);
}

body.btn-profile-retro .btn-reset {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
  background-color: var(--retro-fill);
  background-image: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--fg) 5%, transparent), transparent 60%);
  border: 1px solid var(--retro-border);
  backdrop-filter: none;
  box-shadow:
    inset 0 1px 1px color-mix(in srgb, var(--fg) 6%, transparent),
    inset 0 -3px 5px rgba(0, 0, 0, 0.55),
    0 3px 10px rgba(0, 0, 0, 0.5);
}

body.btn-profile-retro .ring-wrap {
  background-color: var(--retro-fill);
  background-image: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--fg) 3%, transparent), transparent 55%);
  border: 4px solid color-mix(in srgb, var(--fg) 16%, transparent);
  box-shadow:
    inset 0 3px 10px rgba(0, 0, 0, 0.6),
    inset 0 -2px 6px color-mix(in srgb, var(--fg) 3%, transparent),
    0 1px 1px color-mix(in srgb, var(--fg) 14%, transparent),
    0 0 10px color-mix(in srgb, var(--fg) 7%, transparent),
    0 0 28px rgba(0, 0, 0, 0.55);
}

body.btn-profile-retro .digits {
  font-family: var(--font-digital);
  font-weight: bold;
  letter-spacing: 0.02em;
}

body.btn-profile-retro .digits::before {
  content: var(--ghost-text, "88:88");
  position: absolute;
  inset: 0;
  color: color-mix(in srgb, var(--fg) 5%, transparent);
  pointer-events: none;
}

.digits.is-long {
  font-size: clamp(36px, 7vh, 72px); /* scale down dynamically */
}

.settings-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-card.is-disabled {
  opacity: 0.4;
  filter: grayscale(1);
  pointer-events: none;
}

.settings-card.is-locked .audio-gate {
  opacity: 0.4;
  filter: grayscale(1);
  pointer-events: none;
}

.settings-tab-panel[hidden] {
  display: none;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.row-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
}

.mono-val {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--muted-2);
}

.hint {
  font-size: 10px;
  color: var(--muted-2);
}

.link-action {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  user-select: none;
}

#bg-image-clear {
  color: #b5665c;
}

.shaded-list {
  display: flex;
  flex-direction: column;
}

.shaded-list > *:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.shaded-row {
  padding: 16px 14px;
  background: var(--bg);
  transition: background-color 0.15s ease;
}

.shaded-row:hover {
  background: color-mix(in srgb, var(--fg) 5%, var(--bg));
}

.preset-list {
  display: flex;
  flex-direction: column;
}

.preset-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.color-list {
  display: flex;
  flex-direction: column;
}

.color-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.preset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 0;
  background: var(--bg);
  font-size: 13px;
  color: var(--fg);
  transition: background-color 0.15s ease;
}

.preset-row:hover {
  background: color-mix(in srgb, var(--fg) 5%, var(--bg));
}

.preset-row.is-active {
  background: transparent;
}

.preset-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
}

.preset-row.is-active .preset-status {
  color: var(--fg);
}

.color-row {
  padding: 12px 14px;
  border-radius: 0;
  background: var(--bg);
  transition: background-color 0.15s ease;
}

.color-row:hover {
  background: color-mix(in srgb, var(--fg) 5%, var(--bg));
}

.color-row .mono-val {
  color: var(--fg);
}

.color-val {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  padding: 0;
  background: none;
  cursor: pointer;
  overflow: hidden;
}

.color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input::-webkit-color-swatch {
  border: none;
  border-radius: 999px;
}

.color-input::-moz-color-swatch {
  border: none;
  border-radius: 999px;
}

.media-upload-label {
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px dashed #444444;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-2);
  font-style: normal;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.text-input {
  height: 38px;
  border-radius: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0 10px;
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  transition: background-color 0.15s ease;
}

.text-input:hover,
.text-input:focus {
  background: color-mix(in srgb, var(--fg) 5%, var(--bg));
  outline: none;
}

.text-input::placeholder {
  color: #5a5a5a;
}

.text-input:disabled {
  color: var(--muted-2);
  cursor: not-allowed;
}

.label-input {
  width: 140px;
  height: 32px;
  text-align: right;
}

.bare-input {
  width: 100%;
  height: auto;
  background: none;
  border: none;
  padding: 0;
}

.bare-input:hover,
.bare-input:focus {
  background: none;
}

#bg-media-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.range-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  outline: none;
  cursor: pointer;
  margin: 0;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--fg);
  cursor: pointer;
}

.range-input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 999px;
  background: var(--fg);
  cursor: pointer;
}

.range-input::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: transparent;
}

.range-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.slider-row:has(.range-input:disabled),
.shaded-row:has(.toggle:disabled),
.shaded-row:has(input[type="text"]:disabled) {
  opacity: 0.4;
  filter: grayscale(1);
}

.slider-row:has(.range-input:disabled) .range-input,
.shaded-row:has(.toggle:disabled) .toggle,
.shaded-row:has(input[type="text"]:disabled) input[type="text"] {
  opacity: 1; /* parent handles opacity */
}

.slider-row:has(.range-input:disabled):hover,
.shaded-row:has(.toggle:disabled):hover,
.shaded-row:has(input[type="text"]:disabled):hover {
  background: var(--bg);
  cursor: not-allowed;
}

.track-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle {
  width: 38px;
  height: 20px;
  border-radius: 0;
  background: var(--border);
  border: 1px solid var(--border-strong);
  position: relative;
  padding: 0;
}

.toggle:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: var(--muted);
  transition: left 0.15s ease;
}

.toggle.is-on {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle.is-on::after {
  left: 20px;
  background: var(--bg);
}

.pill-btn {
  padding: 6px 16px;
  border-radius: 0;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stepper-btn {
  width: 22px;
  height: 22px;
  border-radius: 0;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.stepper-btn:hover {
  background: color-mix(in srgb, var(--fg) 8%, var(--surface-2));
  color: var(--fg);
}

.stepper-val {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg);
  min-width: 48px;
  text-align: center;
  white-space: nowrap;
}

.stepper-input {
  background: transparent;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  text-align: center;
  width: 4.5ch;
  padding: 0;
  -moz-appearance: textfield;
}

.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper-input:focus {
  outline: none;
  border-bottom: 1px solid var(--fg);
  margin-bottom: -1px;
}

.layout-editable {
  outline: 2px dashed var(--accent);
  outline-offset: 8px;
  border-radius: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.layout-editable:active {
  cursor: grabbing;
}

.layout-edit-bar {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: 0;
  padding: 8px 10px 8px 18px;
  font-size: 12px;
  color: var(--muted);
  backdrop-filter: var(--glass-blur);
}

.layout-edit-bar[hidden] {
  display: none;
}

.layout-edit-bar button {
  padding: 6px 16px;
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
}

#layout-reset {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--glass-border);
}

#layout-done {
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  color: var(--fg);
}

.notes-widget {
  position: absolute;
  top: 100px;
  left: 60px;
  width: 320px;
  height: 400px;
  background: var(--glass-fill);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 30;
  overflow: hidden;
  resize: both;
  min-width: 200px;
  min-height: 200px;
  color: var(--fg);
  font-family: var(--font-sans);
}

.notes-widget[hidden] {
  display: none !important;
}

.notes-header {
  padding: 12px 14px;
  background: color-mix(in srgb, var(--surface) 30%, transparent);
  border-bottom: 1px solid var(--border);
  cursor: grab;
  user-select: none;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  display: flex;
  align-items: center;
}

.notes-header:active {
  cursor: grabbing;
}

.notes-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.notes-content p {
  margin: 0;
}

.notes-content strong {
  font-weight: 600;
  color: var(--accent, var(--fg));
}

.notes-content em {
  font-style: italic;
  color: inherit;
}

.notes-content del {
  text-decoration: line-through;
  color: var(--muted);
}

.notes-content blockquote {
  border-left: 2px solid var(--border);
  margin: 0;
  padding-left: 12px;
  color: var(--muted);
}

.notes-content ul {
  margin: 0;
  padding-left: 20px;
}

.notes-content li {
  margin-bottom: 4px;
}

.notes-content input[type="checkbox"] {
  accent-color: var(--fg);
  margin-right: 8px;
  vertical-align: middle;
  transform: translateY(-1px);
  cursor: pointer;
}

@media (max-width: 600px) {
  .wordmark {
    left: 20px;
  }

  .ring-wrap {
    width: clamp(200px, 75vw, 300px);
    height: clamp(200px, 75vw, 300px);
  }

  .digits {
    font-size: clamp(48px, 15vw, 72px);
  }

  .ytmusic-card {
    width: calc(100vw - 40px);
    right: 20px;
    bottom: 20px;
  }
  
  body:has(.ytmusic-card:not([hidden])) .bg-video-controls {
    bottom: 110px;
  }

  .bg-video-controls {
    width: calc(100vw - 40px);
    justify-content: center;
  }
  
  .bg-video-seek {
    flex: 1;
    width: auto;
  }

  .tab-btn {
    padding: 10px 14px;
    font-size: 12px;
  }

  .btn-start,
  .btn-reset {
    padding: 12px 24px;
  }

  .settings-panel {
    width: 100vw;
    border-left: none;
    padding: 24px 16px;
  }

  .layout-edit-bar {
    top: auto;
    bottom: 20px;
    width: calc(100vw - 40px);
    flex-wrap: wrap;
    justify-content: center;
    padding: 12px;
    gap: 8px;
  }

  .layout-edit-bar span {
    width: 100%;
    text-align: center;
    margin-bottom: 4px;
  }

  .layout-edit-bar button {
    flex: 1;
  }
}

.onload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 8, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.onload-modal {
  background: var(--glass-fill);
  border: 1px solid var(--border);
  padding: 32px;
  font-family: var(--font-sans);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  width: 100%;
  max-width: 580px;
  margin: 20px;
}

.onload-modal a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 4px;
}

.onload-modal a:hover {
  text-decoration-color: var(--fg);
}

.onload-close {
  margin-top: 32px;
  background: transparent;
  border: none;
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  display: block;
  width: 100%;
  text-align: right;
}

.onload-close:hover {
  color: #fff;
}
