/* Stopwatch card visuals extracted from temp.html; shared workspace uses world-time.css. */
.group-tab.is-sounding,
.fullscreen-group-tab.is-sounding {
  color: #fa2577;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  animation: groupSoundPulse 0.72s ease-in-out infinite;
}

.group-tab.active.is-sounding,
.fullscreen-group-tab.active.is-sounding {
  box-shadow: inset 0 -3px 0 #f59e0b;
}

@keyframes groupSoundPulse {
  0%,
  100% {
    background: rgba(251, 36, 36, 0.16);
  }
  50% {
    background: rgba(252, 10, 10, 0.34);
  }
}

.widget-grid.stopwatch-grid {
  --stopwatch-card-width: 300px;
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(min(var(--stopwatch-card-width), 100%), var(--stopwatch-card-width))
  );
  justify-content: center;
  justify-items: stretch;
  align-content: start;
  gap: 16px;
  min-height: 320px;
  padding-top: 0;
}

.clock-box.is-target-reached {
  border-width: 3px;
  border-color: var(--time-red);
  animation: targetPulse 1s infinite;
}

@keyframes targetPulse {
  50% {
    box-shadow:
      0 0 0 4px rgba(239, 68, 68, 0.13),
      var(--time-shadow-soft);
  }
}

.clock-box.settings-panel-open,
.clock-box:has(.settings-panel.active) {
  z-index: 10020;
  overflow: visible !important;
  contain: none;
}

.settings-panel {
  position: absolute;
  left: calc(100% + 12px);
  right: auto;
  top: 0;
  z-index: 10021;
  width: min(360px, calc(100vw - 32px));
  max-height: min(78vh, 520px);
  display: none;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--time-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 42px rgba(16, 24, 40, 0.22);
  backdrop-filter: blur(18px);
}

.clock-box.settings-panel-open-left .settings-panel {
  left: auto;
  right: calc(100% + 12px);
}

.clock-box.settings-panel-open-below .settings-panel {
  left: 0;
  right: auto;
  top: calc(100% + 10px);
}

.settings-panel.active {
  display: block;
}

.settings-panel h3 {
  margin: 0 0 8px;
  font-size: 12px;
  color: #1f2a3d;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.setting-field {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.setting-field.full {
  grid-column: 1 / -1;
}

.custom-icon-field[hidden] {
  display: none !important;
}

.setting-field input,
.setting-field select {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #d9e4f2;
  border-radius: 8px;
  background: #fff;
  color: #182235;
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.setting-field input[type='color'] {
  padding: 2px;
}

.setting-field.custom-icon-disabled {
  opacity: 0.58;
}

.setting-field.custom-icon-disabled input {
  border-color: #b8c5d6 !important;
  background: repeating-linear-gradient(135deg, #edf3fa 0 6px, #e3ebf5 6px 12px) !important;
  color: #7b8798 !important;
  cursor: not-allowed;
  box-shadow: inset 0 0 0 1px rgba(100, 116, 139, 0.18) !important;
}

.setting-field.custom-icon-disabled input::placeholder {
  color: #8b98aa;
}

.settings-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}

.mini-action.primary {
  border-color: #1769d8;
  background: #1769d8;
  color: #fff;
}

.setting-field.is-disabled {
  opacity: 0.48;
}

.setting-field.is-disabled input {
  background: #edf2f7;
  border-color: #cbd5e1;
  color: #64748b;
  cursor: not-allowed;
}

.mini-action {
  flex: 1;
  height: 29px;
  border: 1px solid #d9e4f2;
  border-radius: 8px;
  background: #f8fbff;
  color: #1769d8;
  font-size: 11px;
  font-weight: 850;
}

.mini-action.danger {
  color: #dc2626;
}

.ring-main {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 0;
}

.ring-gauge {
  position: relative;
  width: 92px;
  height: 92px;
}

.ring-clock {
  display: block;
  font-size: clamp(21px, 2.4vw, 29px);
  font-weight: 900;
}

.card-analog .analog-main {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.analog-clock {
  display: block;
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 900;
}

.split-top .card-title,
.split-top .status-text,
.split-top .time-text,
.split-top .icon-btn {
  color: #fff;
}

.pro-progress span {
  display: block;
  width: calc(var(--progress, 0) * 100%);
  height: 100%;
  border-radius: inherit;
  background: var(--card-accent, #2f80ed);
}

.clock-box {
  position: relative;
  grid-column: span 1;
  aspect-ratio: 1.36 / 1;
  min-height: 206px;
  border: 1px solid var(--card-line, #d8e5f6);
  color: var(--card-text, #0b1730);
  isolation: isolate;
  --card-muted: #66758d;
  --card-line: #dbe7f5;
  --card-soft: rgba(245, 248, 252, 0.86);
  overflow: visible;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 252, 255, 0.94));
  box-shadow: 0 10px 24px rgba(30, 55, 90, 0.07);
}

.clock-box::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--card-bg, #fff);
  overflow: hidden;
}

.widget-actions {
  position: absolute;
  z-index: 8;
  display: inline-flex;
  top: 9px;
  right: 10px;
  gap: 6px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(211, 224, 242, 0.9);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--card-control, #52637a);
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 6px 12px rgba(30, 55, 90, 0.055);
  backdrop-filter: blur(8px);
}

.icon-btn:hover {
  border-color: color-mix(in srgb, var(--card-accent, #2f80ed) 34%, #dbe7f5);
  color: var(--card-accent, #2f80ed);
  background: #fff;
}

.card-inner {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 28px minmax(0, 1fr) 30px;
  gap: 8px;
  padding: 12px 14px 11px;
}

.card-title {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--card-title, currentColor);
  font-weight: 900;
  height: 28px;
  gap: 7px;
  padding-right: 78px;
  line-height: 1;
}

.card-title-icon {
  display: grid;
  place-items: center;
  color: var(--card-accent, #2f80ed);
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 9px;
  font-size: 14px;
  background: color-mix(in srgb, var(--card-accent, #2f80ed) 14%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--card-accent, #2f80ed) 18%, transparent);
}

.card-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--card-title, #132033);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.status-text {
  margin-left: auto;
  text-transform: uppercase;
  position: absolute;
  top: 14px;
  right: 72px;
  max-width: 58px;
  overflow: hidden;
  color: var(--card-muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: right;
  white-space: nowrap;
}

.time-text {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--card-time, #111827);
  font-weight: 950;
  letter-spacing: 0;
}

.fraction {
  opacity: 0.68;
  margin-left: 2px;
  color: color-mix(in srgb, var(--card-time, #111827) 58%, #94a3b8);
  font-size: 0.52em;
  font-weight: 850;
}

.stopwatch-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 0;
  align-self: end;
}

.tool-btn {
  min-width: 0;
  border: 1px solid var(--card-line, #d8e5f6);
  height: 30px;
  border-color: #d9e5f4;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  color: #172033;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 5px 10px rgba(30, 55, 90, 0.035);
}

.tool-btn.primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(
    180deg,
    var(--card-accent, #2f80ed),
    color-mix(in srgb, var(--card-accent, #2f80ed) 78%, #0f172a)
  );
  box-shadow: 0 8px 14px color-mix(in srgb, var(--card-accent, #2f80ed) 20%, transparent);
}

.ring-main,
.card-analog .analog-main {
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-self: center;
  min-height: 112px;
}

.ring-gauge,
.analog-dial {
  width: 82px;
  height: 82px;
}

.ring-gauge svg {
  transform: rotate(-90deg);
  width: 82px;
  height: 82px;
}

.ring-gauge .track {
  fill: none;
  stroke-width: 9;
  stroke: #e7ebf1;
}

.ring-gauge .value {
  fill: none;
  stroke: var(--card-accent, #2f80ed);
  stroke-linecap: round;
  stroke-dasharray: 339.29;
  stroke-dashoffset: calc(339.29 * (1 - var(--progress, 0)));
  stroke-width: 9;
}

.ring-percent {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  font-weight: 950;
  color: var(--card-time, #111827);
  font-size: 14px;
}

.ring-percent small {
  text-transform: uppercase;
  margin-top: 2px;
  color: var(--card-muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.ring-clock,
.analog-clock {
  font-size: 25px;
  line-height: 1;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.pill {
  border-radius: 999px;
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--card-accent, #2f80ed) 22%, #dbe7f5);
  background: color-mix(in srgb, var(--card-accent, #2f80ed) 7%, #fff);
  color: #596a82;
  font-size: 9px;
  font-weight: 900;
}

.analog-dial {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  position: relative;
  border: 8px solid #e7ebf1;
  background: radial-gradient(circle, #fff 0 45%, #f7f9fc 46% 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.analog-hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  border-radius: 999px;
  background: var(--card-accent, #2f80ed);
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(var(--second-deg, 0deg));
  width: 3px;
  height: 31px;
}

.analog-hand.minute {
  transform: translateX(-50%) rotate(var(--minute-deg, 0deg));
  width: 3px;
  height: 24px;
  background: color-mix(in srgb, var(--card-accent, #2f80ed) 60%, #1f2937);
}

.analog-hub {
  position: absolute;
  inset: 50% auto auto 50%;
  border-radius: 50%;
  background: var(--card-accent, #2f80ed);
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--card-accent, #2f80ed) 14%, transparent);
}

.card-ring {
  background:
    radial-gradient(
      circle at 84% 18%,
      color-mix(in srgb, var(--card-accent, #2f80ed) 7%, transparent),
      transparent 36%
    ),
    linear-gradient(145deg, color-mix(in srgb, var(--card-accent, #2f80ed) 3%, #fff), #fff);
}

.card-split {
  background: #fff;
}

.card-split .card-inner {
  grid-template-rows: 105px minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: inherit;
}

.split-top {
  color: #fff;
  position: relative;
  padding: 12px 14px 10px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--card-accent, #f97316) 92%, #fff),
    color-mix(in srgb, var(--card-accent, #f97316) 70%, #111827)
  );
}

.split-top .card-title {
  height: 26px;
  padding-right: 76px;
}

.split-top .card-title-icon {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.split-top .widget-actions {
  top: 8px;
  right: 10px;
}

.split-top .icon-btn {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: none;
}

.split-top .status-text {
  top: 14px;
  right: 74px;
  color: rgba(255, 255, 255, 0.88);
}

.split-time {
  display: block;
  font-weight: 950;
  margin-top: 20px;
  font-size: 29px;
  line-height: 1;
  color: #fff;
}

.split-body {
  display: grid;
  align-content: space-between;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) 30px;
  gap: 7px;
  padding: 10px 14px 11px;
}

.split-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.split-stat {
  min-width: 0;
  border-radius: 10px;
  padding: 0;
  background: transparent;
}

.split-stat span {
  display: block;
  font-weight: 850;
  text-transform: uppercase;
  color: #7a89a1;
  font-size: 8px;
  letter-spacing: 0.05em;
}

.split-stat strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #172033;
  font-size: 10px;
}

.card-pro .card-inner {
  grid-template-rows: 28px minmax(0, 1fr) 30px;
  gap: 8px;
  padding: 12px 14px 11px;
}

.pro-time {
  display: block;
  font-weight: 950;
  margin-top: 14px;
  font-size: 30px;
  line-height: 1;
}

.pro-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
}

.pro-progress {
  overflow: hidden;
  border-radius: 999px;
  height: 7px;
  margin-top: 10px;
  background: #e7ebf1;
}

.widget-grid.stopwatch-grid .clock-box.settings-panel-open,
.widget-grid.stopwatch-grid .clock-box:has(.settings-panel.active) {
  z-index: 10020;
  overflow: visible !important;
  contain: none;
}

.widget-grid.stopwatch-grid .widget-actions {
  top: 8px;
  right: 9px;
  gap: 5px;
}

.widget-grid.stopwatch-grid .icon-btn {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: none;
}

.widget-grid.stopwatch-grid .card-title {
  height: 26px;
  gap: 7px;
  padding-right: 70px;
  overflow: hidden;
}

.widget-grid.stopwatch-grid .card-title-icon {
  width: 24px;
  height: 24px;
  border-radius: 9px;
  font-size: 14px;
}

.widget-grid.stopwatch-grid .card-title-text {
  font-size: 14px;
  line-height: 1;
}

.widget-grid.stopwatch-grid .status-text {
  top: 15px;
  right: 61px;
  width: 34px;
  max-width: 34px;
  font-size: 7px;
  line-height: 1;
  opacity: 0.9;
}

.widget-grid.stopwatch-grid .ring-gauge .track,
.widget-grid.stopwatch-grid .ring-gauge .value {
  stroke-width: 8;
}

.widget-grid.stopwatch-grid .analog-dial {
  border-width: 7px;
}

.widget-grid.stopwatch-grid .analog-hand {
  height: 28px;
}

.widget-grid.stopwatch-grid .analog-hand.minute {
  height: 21px;
}

.widget-grid.stopwatch-grid .analog-hub {
  width: 11px;
  height: 11px;
}

.widget-grid.stopwatch-grid .ring-clock,
.widget-grid.stopwatch-grid .analog-clock,
.widget-grid.stopwatch-grid .pro-time,
.widget-grid.stopwatch-grid .split-time {
  font-size: 22px;
  line-height: 1;
  white-space: nowrap;
}

.widget-grid.stopwatch-grid .fraction {
  font-size: 0.45em;
}

.widget-grid.stopwatch-grid .ring-percent {
  font-size: 13px;
  line-height: 1;
}

.widget-grid.stopwatch-grid .ring-percent small {
  font-size: 7px;
}

.widget-grid.stopwatch-grid .tool-btn.primary {
  border: 0;
  background-color: var(--card-accent, #2f80ed);
  background-image: none;
  box-shadow: none;
}

.widget-grid.stopwatch-grid .split-top .status-text {
  top: 14px;
  right: 61px;
  color: rgba(255, 255, 255, 0.9);
}

.widget-grid.stopwatch-grid .split-stat span {
  font-size: 7px;
}

.widget-grid.stopwatch-grid .split-stat strong {
  font-size: 9px;
}

.widget-grid.stopwatch-grid .card-pro .card-inner {
  height: 100%;
  grid-template-rows: 26px minmax(0, 1fr) 32px;
  gap: 6px;
  padding: 10px 12px 10px;
}

.widget-grid.stopwatch-grid .card-lap-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-grid.stopwatch-grid .settings-panel {
  left: calc(100% + 12px);
  right: auto;
  top: 0;
  width: min(360px, calc(100vw - 32px));
  max-height: min(78vh, 520px);
}

.widget-grid.stopwatch-grid .clock-box > .widget-actions {
  top: 9px;
  right: 10px;
  z-index: 7;
}

.widget-grid.stopwatch-grid .clock-box > .settings-panel {
  z-index: 10021;
}

.widget-grid.stopwatch-grid .clock-box > .card-title .status-text {
  display: none;
}

.widget-grid.stopwatch-grid .card-inner {
  grid-template-rows: 26px minmax(0, 1fr) 32px;
  gap: 6px;
  position: absolute;
  inset: 0;
  display: block;
  height: auto;
  padding: 0;
}

.widget-grid.stopwatch-grid .card-inner > div:first-child {
  display: none;
}

.widget-grid.stopwatch-grid .ring-main > div:last-child,
.widget-grid.stopwatch-grid .analog-main > div:last-child {
  min-width: 0;
  overflow: hidden;
}

.widget-grid.stopwatch-grid .ring-gauge,
.widget-grid.stopwatch-grid .analog-dial {
  width: 70px;
  height: 70px;
}

.widget-grid.stopwatch-grid .ring-gauge svg {
  width: 70px;
  height: 70px;
}

.widget-grid.stopwatch-grid .stopwatch-controls {
  align-self: stretch;
  gap: 7px;
  overflow: hidden;
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 11px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  height: 32px;
}

.widget-grid.stopwatch-grid .tool-btn {
  min-height: 0;
  padding: 0 8px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  background-clip: padding-box;
  width: 100%;
  height: 32px;
  transform: none;
}

.widget-grid.stopwatch-grid .card-split .card-inner {
  height: 100%;
  gap: 0;
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr);
  padding: 0;
}

.widget-grid.stopwatch-grid .split-top {
  position: relative;
  min-height: 0;
  height: auto;
  padding: 8px 12px 6px;
  overflow: hidden;
}

.widget-grid.stopwatch-grid .split-top .card-title {
  position: absolute;
  top: 8px;
  left: 12px;
  right: 94px;
  height: 24px;
  padding-right: 0;
}

.widget-grid.stopwatch-grid .split-top .card-title .status-text {
  display: none;
}

.widget-grid.stopwatch-grid .split-top .widget-actions {
  top: 7px;
  right: 10px;
}

.widget-grid.stopwatch-grid .split-time {
  display: block;
  margin-top: 18px;
  color: #fff;
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 5px;
  margin: 0;
  overflow: hidden;
  font-size: 23px;
  line-height: 1;
}

.widget-grid.stopwatch-grid .split-body {
  position: relative;
  display: grid;
  grid-template-rows: 18px minmax(0, 1fr) 28px;
  gap: 3px;
  min-height: 0;
  padding: 4px 14px 8px;
  overflow: hidden;
}

.widget-grid.stopwatch-grid .split-stats {
  align-self: start;
  gap: 8px;
  position: static;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 0;
  overflow: hidden;
}

.widget-grid.stopwatch-grid .card-split .card-lap-list {
  position: relative;
  margin-top: 0;
  max-height: none;
  min-height: 0;
  gap: 2px;
  align-content: start;
}

.widget-grid.stopwatch-grid .card-split .card-lap-row {
  min-height: 11px;
  font-size: 8px;
  line-height: 1.1;
}

.widget-grid.stopwatch-grid .card-split .card-lap-row strong {
  font-size: 9px;
}

.widget-grid.stopwatch-grid .card-split .card-lap-more {
  font-size: 6px;
}

.widget-grid.stopwatch-grid .card-split .stopwatch-controls {
  position: static;
  height: 28px;
}

.widget-grid.stopwatch-grid .card-split .tool-btn {
  height: 28px;
}

.widget-grid.stopwatch-grid .clock-box::before {
  display: none;
  background: transparent;
}

.widget-grid.stopwatch-grid .card-ring {
  background:
    radial-gradient(
      circle at 84% 18%,
      color-mix(in srgb, var(--card-accent, #2f80ed) 7%, transparent),
      transparent 36%
    ),
    var(--card-bg, #fff);
}

.widget-grid.stopwatch-grid .card-split {
  background: var(--card-bg, #fff);
}

.status-left,
.status-right,
.status-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-left {
  gap: 18px;
  flex: 1 1 auto;
  min-width: 0;
}

.status-item {
  white-space: nowrap;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.stat-card {
  min-height: 78px;
  padding: 13px;
  border: 1px solid var(--time-line);
  border-radius: 15px;
  background: var(--time-surface-soft);
}

.stat-label {
  display: block;
  color: var(--time-muted);
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
}

.stat-value {
  display: block;
  margin-top: 7px;
  color: #172033;
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -0.03em;
  text-align: right;
}

.recent-list,
.preset-row {
  display: grid;
  gap: 8px;
}

.recent-row,
.preset-btn {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid #e3ecf7;
  border-radius: 12px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 750;
}

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

.preset-btn {
  justify-content: center;
}

[data-theme='dark'] .dashboard-panel-title,
[data-theme='dark'] .stat-value {
  color: var(--time-text);
}

[data-theme='dark'] .dashboard-panel-subtitle,
[data-theme='dark'] .stat-label {
  color: var(--time-muted);
}

[data-theme='dark'] .stat-card,
[data-theme='dark'] .recent-row,
[data-theme='dark'] .preset-btn {
  border-color: var(--time-line);
  background: rgba(15, 23, 42, 0.72);
  color: var(--time-text-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

[data-theme='dark'] .preset-btn:hover {
  border-color: var(--time-blue);
  background: rgba(47, 128, 237, 0.16);
  color: var(--time-text);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  width: min(720px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}

.modal-head,
.modal-body,
.modal-actions {
  padding: 18px 20px;
}

.modal-head {
  border-bottom: 1px solid var(--time-line);
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.modal-head p {
  margin: 5px 0 0;
  color: var(--time-muted);
  font-size: 13px;
  font-weight: 650;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.type-option {
  min-height: 200px;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid #dfe8f5;
  border-radius: 16px;
  background: #f8fbff;
  text-align: left;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.type-option:hover {
  transform: translateY(-1px);
  border-color: #c8d9f1;
  background: #fbfdff;
}

.type-option.active {
  border-color: #3b82f6;
  background: #eef5ff;
  box-shadow: inset 0 0 0 1px #3b82f6;
}

.type-option-preview {
  min-height: 112px;
  padding: 8px;
  border: 1px solid #e1eaf6;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 14px rgba(30, 55, 90, 0.05);
  overflow: hidden;
}

.type-option strong {
  display: block;
  margin: 0;
  color: #1f2937;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.25;
}

.type-option span {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.type-preview-card {
  height: 100%;
  display: grid;
  grid-template-rows: 18px 1fr 18px;
  gap: 6px;
  border-radius: 10px;
  background: var(--preview-bg, transparent);
  color: var(--preview-text, #1f2937);
  font-family: inherit;
}

.type-preview-card.split {
  grid-template-rows: 42px minmax(0, 1fr);
  gap: 0;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--preview-bg, #fff);
}

.type-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.type-preview-chip {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--preview-title, #1f2937);
  font-size: 9px;
  font-weight: 900;
}

.type-preview-icons {
  flex: 0 0 auto;
  color: var(--preview-control, #94a3b8);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.type-preview-main {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 0;
}

.type-preview-dial,
.type-preview-ring {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f8fafc;
  border: 4px solid #e5edf7;
  overflow: hidden;
}

.type-preview-dial .hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 2px;
  border-radius: 999px;
  transform-origin: 50% 100%;
}

.type-preview-dial .hand.minute {
  height: 12px;
  background: #0f172a;
  transform: translateX(-50%) rotate(28deg);
}

.type-preview-dial .hand.second {
  height: 16px;
  background: var(--preview-accent, #3b82f6);
  transform: translateX(-50%) rotate(0deg);
}

.type-preview-dial .hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--preview-accent, #3b82f6);
  transform: translate(-50%, -50%);
}

.type-preview-ring {
  border-color: #dbe7f4;
  background: conic-gradient(var(--preview-accent, #10a37f) 0 62%, #e8eef6 62% 100%);
}

.type-preview-ring::after {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #fff;
}

.type-preview-ring-label {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: #0f172a;
  font-size: 9px;
  font-weight: 900;
}

.type-preview-copy {
  min-width: 0;
  overflow: hidden;
}

.type-preview-time {
  display: block;
  overflow: hidden;
  color: var(--preview-time, #111827);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.type-preview-time span {
  color: #94a3b8;
  font-size: 0.8em;
  font-weight: 800;
}

.type-preview-pills,
.type-preview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.type-preview-pills em,
.type-preview-stats em {
  display: inline-flex;
  align-items: center;
  min-height: 14px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-style: normal;
  font-size: 8px;
  font-weight: 850;
  white-space: nowrap;
}

.type-preview-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.type-preview-controls b {
  display: grid;
  place-items: center;
  height: 16px;
  border: 1px solid #dce6f3;
  border-radius: 6px;
  background: #fff;
  color: #1f2937;
  font-size: 8px;
  font-weight: 900;
}

.type-preview-controls b.primary {
  border-color: transparent;
  background: var(--preview-accent, #3b82f6);
  color: #fff;
}

.type-preview-split-top {
  position: relative;
  padding: 5px 8px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--preview-accent, #ea7624) 92%, #fff),
    color-mix(in srgb, var(--preview-accent, #ea7624) 70%, #111827)
  );
  color: #fff;
}

.type-preview-split-top .type-preview-chip,
.type-preview-split-top .type-preview-icons,
.type-preview-split-top .type-preview-time {
  color: #fff;
}

.type-preview-split-time {
  display: block;
  margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.type-preview-split-body {
  display: grid;
  grid-template-rows: 1fr 18px;
  gap: 3px;
  padding: 4px 8px;
  background: var(--preview-bg, #fff);
}

.type-preview-split-body .type-preview-stats {
  align-items: center;
  margin-top: 0;
}

.type-preview-pro {
  display: grid;
  grid-template-rows: 18px 1fr 18px;
  gap: 6px;
  height: 100%;
  border-radius: 10px;
  background: var(--preview-bg, transparent);
  color: var(--preview-text, #1f2937);
}

.type-preview-progress {
  height: 6px;
  margin-top: 7px;
  border-radius: 999px;
  background: #e7edf5;
  overflow: hidden;
}

.type-preview-progress span {
  display: block;
  width: 58%;
  height: 100%;
  border-radius: inherit;
  background: var(--preview-accent, #6d5dfc);
}

.modal-form {
  display: grid;
  grid-template-columns: 1fr 160px 140px;
  gap: 10px;
  margin-top: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--time-line);
}

#addModal.modal-backdrop {
  z-index: 100000;
  padding: 24px;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(6px);
}

#addModal .modal-dialog {
  width: min(960px, calc(100vw - 48px));
  max-height: min(86vh, 820px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #dce7f3;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 26px 72px rgba(15, 23, 42, 0.26);
}

#addModal .modal-head {
  display: block;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #e7eef8;
  background:
    radial-gradient(circle at 92% 0%, rgba(47, 128, 237, 0.12), transparent 34%),
    linear-gradient(145deg, #ffffff 0%, #f7fbff 100%);
}

#addModal .modal-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #172033;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

#addModal .modal-head p {
  max-width: 720px;
  margin: 8px 0 0;
  color: #667085;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.55;
}

#addModal .modal-body {
  min-height: 0;
  overflow: auto;
  padding: 20px 24px 22px;
  background: #f7f9fc;
}

#addModal .type-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

#addModal .type-option {
  display: grid;
  grid-template-rows: auto auto 1fr;
  align-content: start;
  min-height: 190px;
  padding: 10px;
  border: 1px solid #dce7f3;
  border-radius: 16px;
  background: #fff;
  color: #182235;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(37, 65, 102, 0.055);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

#addModal .type-option:hover {
  transform: translateY(-2px);
  border-color: #b9d6ff;
  background: #fbfdff;
  box-shadow: 0 14px 26px rgba(37, 65, 102, 0.1);
}

#addModal .type-option.active {
  border-color: #2f80ed;
  background: linear-gradient(180deg, #f5faff 0%, #eaf4ff 100%);
  box-shadow:
    0 0 0 3px rgba(47, 128, 237, 0.13),
    0 12px 24px rgba(47, 128, 237, 0.13);
}

#addModal .type-option-preview {
  height: 108px;
  min-height: 108px;
  margin: 0 0 10px;
  overflow: hidden;
  border-radius: 13px;
  background: #eef4ff;
}

#addModal .type-option > strong {
  display: block;
  margin: 0 0 4px;
  color: #172033;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
}

#addModal .type-option > span {
  display: block;
  color: #667085;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

#addModal .modal-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px 150px;
  align-items: end;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #e2ebf8;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(37, 65, 102, 0.045);
}

#addModal .modal-form .setting-field.full {
  grid-column: auto;
}

@media (min-width: 1025px) {
  #addModal .modal-form:has(#newCustomIconField[hidden]) .icon-setting-field {
    grid-column: 2 / -1;
  }
}

#addModal .setting-field {
  display: grid;
  gap: 6px;
  margin: 0;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

#addModal .setting-field[hidden] {
  display: none !important;
}

#addModal .setting-field input,
#addModal .setting-field select {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d8e3ef;
  border-radius: 12px;
  background: #fbfdff;
  color: #182235;
  font-size: 14px;
  font-weight: 750;
}

#addModal .setting-field input:focus,
#addModal .setting-field select:focus {
  border-color: #76a8ef;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.13);
  outline: none;
}

#addModal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #e7eef8;
  background: #fff;
}

#addModal .modal-actions .time-btn {
  width: auto;
  min-width: 126px;
  height: 42px;
  border-radius: 12px;
  box-shadow: none;
}

#addModal .modal-actions .time-btn-primary {
  border-color: transparent;
  background: linear-gradient(180deg, #1cc8ad, #0fb49b);
  color: #fff;
  box-shadow: 0 12px 22px rgba(15, 180, 155, 0.22);
}

[data-theme='dark'] #addModal .modal-head h2,
[data-theme='dark'] #addModal .type-option > strong,
[data-theme='dark'] #addModal .setting-field,
[data-theme='dark'] #addModal .setting-field input,
[data-theme='dark'] #addModal .setting-field select {
  color: #f1f5f9;
}

[data-theme='dark'] #addModal .modal-head p,
[data-theme='dark'] #addModal .type-option > span {
  color: #94a3b8;
}

[data-theme='dark'] #addModal .type-option,
[data-theme='dark'] #addModal .modal-form,
[data-theme='dark'] #addModal .setting-field input,
[data-theme='dark'] #addModal .setting-field select {
  border-color: #26364c;
  background: #111c2d;
}

[data-theme='dark'] #addModal .type-option.active {
  border-color: #60a5fa;
  background: linear-gradient(180deg, rgba(47, 128, 237, 0.18), rgba(47, 128, 237, 0.1));
}

body.time-fullscreen-mode .clock-board-shell,
body.time-fullscreen-mode .widget-grid.stopwatch-grid {
  flex: 1 1 auto;
  min-height: 0;
}

body.time-fullscreen-mode .widget-grid.stopwatch-grid {
  overflow: auto;
  padding: 26px 32px 40px;
  gap: 24px;
}

.widget-grid.stopwatch-grid .clock-box {
  height: auto;
  border-radius: 16px;
  position: relative;
  contain: paint;
  background: var(--card-bg, #fff);
  min-height: 206px !important;
  overflow: hidden !important;
}

.widget-grid.stopwatch-grid .clock-box[draggable='true'] {
  cursor: grab;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.widget-grid.stopwatch-grid .clock-box.is-dragging {
  cursor: grabbing;
  opacity: 0.48;
  transform: scale(0.985);
}

.widget-grid.stopwatch-grid .clock-box.is-drag-over {
  outline: 3px solid color-mix(in srgb, var(--card-accent, #2f80ed) 62%, #fff);
  outline-offset: -4px;
  box-shadow: 0 18px 38px rgba(47, 128, 237, 0.18);
}

.widget-grid.stopwatch-grid .clock-box.is-touch-dragging {
  position: fixed !important;
  z-index: 10030 !important;
  pointer-events: none;
  cursor: grabbing;
  box-shadow: 0 26px 58px rgba(15, 23, 42, 0.32) !important;
  transform: scale(1.035) rotate(-0.35deg);
  transition: none !important;
}

.clock-drag-placeholder {
  min-height: 206px;
  border-radius: 16px;
  border: 2px dashed rgba(47, 128, 237, 0.45);
  background: rgba(47, 128, 237, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.widget-grid.stopwatch-grid .clock-box > .card-title {
  position: absolute !important;
  top: 10px !important;
  left: 12px !important;
  right: 88px !important;
  height: 26px !important;
  z-index: 6 !important;
  padding-right: 0 !important;
}

.widget-grid.stopwatch-grid .clock-box > .widget-actions,
.widget-grid.stopwatch-grid .split-top .widget-actions {
  position: absolute !important;
  top: 9px !important;
  right: 10px !important;
  z-index: 7 !important;
}

.widget-grid.stopwatch-grid .card-ring > .card-inner,
.widget-grid.stopwatch-grid .card-analog > .card-inner,
.widget-grid.stopwatch-grid .card-pro > .card-inner {
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) 30px !important;
  gap: 8px !important;
  height: auto !important;
  padding: 50px 14px 10px !important;
}

.widget-grid.stopwatch-grid .ring-main,
.widget-grid.stopwatch-grid .card-analog .analog-main {
  align-self: stretch;
  left: 14px;
  right: 14px;
  top: 58px;
  bottom: 58px;
  position: static !important;
  display: grid !important;
  grid-template-columns: 68px minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 12px !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: hidden !important;
}

.widget-grid.stopwatch-grid .ring-gauge,
.widget-grid.stopwatch-grid .analog-dial,
.widget-grid.stopwatch-grid .ring-gauge svg {
  width: 66px !important;
  height: 66px !important;
}

.widget-grid.stopwatch-grid .ring-clock,
.widget-grid.stopwatch-grid .analog-clock {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  font-size: 21px !important;
  line-height: 1.1 !important;
}

.widget-grid.stopwatch-grid .pills {
  max-width: 100%;
  overflow: hidden;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 38px 34px !important;
  gap: 4px !important;
  margin-top: 6px !important;
}

.widget-grid.stopwatch-grid .pill {
  min-width: 0;
  justify-content: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  min-height: 17px !important;
  padding: 0 5px !important;
  font-size: 10px !important;
  line-height: 17px !important;
}

.widget-grid.stopwatch-grid .card-pro .card-inner > div:nth-child(2) {
  left: 14px;
  right: 14px;
  top: 64px;
  bottom: 58px;
  position: static !important;
  display: grid !important;
  grid-template-rows: 26px 13px 6px minmax(0, 1fr) !important;
  gap: 5px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.widget-grid.stopwatch-grid .pro-time {
  display: block;
  margin-top: 16px;
  max-width: 100%;
  overflow: hidden;
  margin: 0 !important;
  font-size: 25px !important;
  line-height: 1 !important;
}

.widget-grid.stopwatch-grid .pro-meta {
  overflow: hidden;
  margin-top: 7px;
  margin: 0 !important;
  font-size: 10px !important;
  line-height: 1.2 !important;
}

.widget-grid.stopwatch-grid .pro-progress {
  margin-top: 6px;
  height: 6px !important;
  margin: 0 !important;
}

.widget-grid.stopwatch-grid .card-split > .card-inner {
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  grid-template-rows: 72px minmax(0, 1fr) !important;
  height: auto !important;
  padding: 0 !important;
}

.widget-grid.stopwatch-grid .card-split .split-top {
  position: relative !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 8px 12px 6px !important;
  overflow: hidden !important;
}

.widget-grid.stopwatch-grid .card-split .split-time {
  position: absolute !important;
  left: 14px !important;
  right: 14px !important;
  bottom: 5px !important;
  margin: 0 !important;
  font-size: 23px !important;
  line-height: 1.1 !important;
}

.widget-grid.stopwatch-grid .card-split .split-body {
  position: relative !important;
  display: grid !important;
  grid-template-rows: 31px minmax(46px, 1fr) 30px !important;
  gap: 4px !important;
  min-height: 0 !important;
  padding: 6px 14px 8px !important;
  overflow: hidden !important;
}

.widget-grid.stopwatch-grid .card-split .split-stats {
  position: static !important;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 6px !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.widget-grid.stopwatch-grid .card-split .split-stat {
  display: grid !important;
  align-content: center !important;
  gap: 3px !important;
  min-height: 0 !important;
  padding: 3px 6px !important;
  border-radius: 8px !important;
}

.widget-grid.stopwatch-grid .card-split .split-stat span {
  font-size: 10px !important;
  line-height: 1 !important;
}

.widget-grid.stopwatch-grid .card-split .split-stat strong {
  font-size: 12px !important;
  line-height: 1.05 !important;
}

.widget-grid.stopwatch-grid .card-lap-list {
  position: relative !important;
  display: grid !important;
  align-content: end !important;
  gap: 2px !important;
  min-height: 0 !important;
  max-height: none !important;
  margin-top: 5px !important;
  overflow: visible !important;
}

.widget-grid.stopwatch-grid .card-split .card-lap-list,
.widget-grid.stopwatch-grid .card-pro .card-lap-list {
  margin-top: 0 !important;
}

.widget-grid.stopwatch-grid .card-lap-row {
  color: var(--card-muted, #748096);
  font-weight: 850;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  min-height: 15px !important;
  font-size: 9px !important;
  line-height: 1.32 !important;
}

.widget-grid.stopwatch-grid .card-lap-row span,
.widget-grid.stopwatch-grid .card-lap-row strong {
  line-height: 1.32 !important;
}

.widget-grid.stopwatch-grid .card-lap-row strong {
  color: var(--card-text, #0b1730);
  font-family: var(--mono);
  font-weight: 900;
  flex: 0 0 auto !important;
  font-size: 10px !important;
}

.widget-grid.stopwatch-grid .card-lap-empty {
  color: var(--card-muted, #748096);
  font-weight: 850;
  font-size: 9px !important;
  line-height: 1.32 !important;
}

.widget-grid.stopwatch-grid .card-lap-row span,
.widget-grid.stopwatch-grid .card-lap-empty {
  color: var(--card-complement, var(--card-accent, #2f80ed)) !important;
}

.widget-grid.stopwatch-grid .card-lap-more {
  display: inline-flex;
  align-items: center;
  margin-left: 3px;
  padding: 0 4px 1px;
  border-radius: 999px;
  font-style: normal;
  font-weight: 950;
  white-space: nowrap;
  font-size: 7px !important;
  line-height: 1.2 !important;
  background: var(--card-complement, var(--card-accent, #2f80ed)) !important;
  color: var(--card-complement-text, #fff) !important;
}

.widget-grid.stopwatch-grid .stopwatch-controls,
.widget-grid.stopwatch-grid .card-split .stopwatch-controls {
  position: static !important;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 8px !important;
  height: 30px !important;
  min-height: 0 !important;
  margin: 0 !important;
}

.widget-grid.stopwatch-grid .tool-btn,
.widget-grid.stopwatch-grid .card-split .tool-btn {
  height: 30px !important;
  min-height: 0 !important;
  padding: 0 8px !important;
  font-size: 10px !important;
  line-height: 1 !important;
}

[data-theme='dark'] #addModal .modal-dialog,
[data-theme='dark'] #addModal .modal-actions {
  border-color: #26364c !important;
  background: #0f172a !important;
}

[data-theme='dark'] #addModal .modal-head {
  border-bottom-color: #26364c;
  background: linear-gradient(145deg, #111c2d 0%, #0f172a 100%) !important;
}

[data-theme='dark'] #addModal .modal-body {
  background: #0b1422 !important;
}

.time-feedback-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 10020;
  max-width: min(320px, calc(100vw - 48px));
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 18px;
  background: rgba(205, 250, 233, 0.92);
  color: #394b7e;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  box-sizing: border-box;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.96);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.time-feedback-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

@media (max-width: 1024px) {
  .widget-grid.stopwatch-grid .clock-box.settings-panel-open,
  .widget-grid.stopwatch-grid .clock-box:has(.settings-panel.active) {
    z-index: 10020;
  }

  .widget-grid.stopwatch-grid .settings-panel,
  .widget-grid.stopwatch-grid .clock-box.settings-panel-open-left .settings-panel,
  .widget-grid.stopwatch-grid .clock-box.settings-panel-open-below .settings-panel {
    position: fixed !important;
    z-index: 10021;
    left: 12px !important;
    right: 12px !important;
    top: auto !important;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    width: auto !important;
    max-height: min(70vh, 520px);
    border-radius: 18px;
    transform: none;
  }

  #addModal .modal-form {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  #addModal .modal-form .setting-field.full {
    grid-column: 1 / -1;
  }

  #addModal .modal-actions .time-btn {
    width: 100%;
    min-width: 0;
  }

  .widget-grid.stopwatch-grid {
    grid-template-columns: repeat(
      auto-fit,
      minmax(min(var(--stopwatch-card-width, 240px), 100%), var(--stopwatch-card-width, 240px))
    );
  }

  #addModal .type-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    justify-content: stretch !important;
    align-items: start !important;
    gap: 12px !important;
  }

  #addModal .type-option {
    align-items: center;
    width: 100% !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-areas:
      'preview'
      'title'
      'desc' !important;
    grid-template-rows: auto auto auto !important;
    align-content: start !important;
    gap: 8px !important;
    padding: 10px !important;
  }

  #addModal .type-option-preview {
    grid-area: preview !important;
    width: 100% !important;
    min-height: 92px !important;
    margin: 0 !important;
  }

  #addModal .type-option > strong {
    grid-area: title !important;
    margin: 0 !important;
    align-self: start !important;
    font-size: 12px !important;
  }

  #addModal .type-option > span {
    grid-area: desc !important;
    align-self: start !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  #addModal.modal-backdrop {
    overflow: auto;
    padding: 10px !important;
    align-items: flex-start !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: rgba(15, 23, 42, 0.54) !important;
  }

  #addModal .modal-dialog {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(100%, 680px) !important;
    height: min(760px, calc(100dvh - 20px));
    max-height: calc(100dvh - 20px) !important;
    margin: 0 auto !important;
    border: 1px solid #dce7f3 !important;
    border-radius: 18px !important;
    background: #fff !important;
    overflow: hidden !important;
    isolation: isolate !important;
    background-clip: padding-box !important;
    box-shadow: 0 20px 54px rgba(15, 23, 42, 0.26) !important;
  }

  #addModal .modal-head {
    border-radius: 0 !important;
    background: linear-gradient(145deg, #ffffff 0%, #f7fbff 100%) !important;
  }

  #addModal .modal-body {
    min-height: 0;
    padding: 16px;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: #f7f9fc !important;
  }

  #addModal .modal-actions {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px 16px;
    border-radius: 0 !important;
    background: #fff !important;
  }

  .mobile-group-tabs .group-tab.is-sounding {
    color: #9a4f00;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
    animation: groupSoundPulse 0.72s ease-in-out infinite;
  }
}

@media (max-width: 720px) {
  @keyframes mobileTipFlow {
    0%,
    20% {
      transform: translateX(0);
    }
    100% {
      transform: translateX(var(--mobile-tip-flow-distance, -40px));
    }
  }

  .widget-grid.stopwatch-grid {
    --stopwatch-card-width: 100%;
    gap: 13px;
  }

  .clock-box {
    min-height: 214px;
    box-shadow: none;
  }

  .type-grid,
  .modal-form,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .time-dashboard-aside .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ring-main,
  .card-analog .analog-main {
    grid-template-columns: 90px minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .calculator-page.time-dashboard-page,
  .calculator-grid.time-dashboard-shell,
  .calculator-main,
  .time-dashboard-main,
  .stopwatch-tool,
  .clock-board-shell {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .widget-grid.stopwatch-grid {
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: minmax(0, 1fr) !important;
    justify-content: stretch !important;
    margin-inline: 0 !important;
  }

  .widget-grid.stopwatch-grid .clock-box {
    aspect-ratio: auto !important;
    min-height: 230px !important;
    height: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    justify-self: stretch !important;
  }

  .widget-grid.stopwatch-grid .clock-box > .card-title {
    top: 9px !important;
    left: 11px !important;
    right: 86px !important;
    height: 25px !important;
  }

  .widget-grid.stopwatch-grid .clock-box > .widget-actions,
  .widget-grid.stopwatch-grid .split-top .widget-actions {
    top: 8px !important;
    right: 9px !important;
  }

  .widget-grid.stopwatch-grid .card-ring > .card-inner,
  .widget-grid.stopwatch-grid .card-analog > .card-inner,
  .widget-grid.stopwatch-grid .card-pro > .card-inner {
    grid-template-rows: minmax(0, 1fr) 34px !important;
    gap: 10px !important;
    padding: 48px 14px 13px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .widget-grid.stopwatch-grid .ring-main,
  .widget-grid.stopwatch-grid .card-analog .analog-main {
    grid-template-columns: 68px minmax(0, 1fr) !important;
    gap: 12px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .widget-grid.stopwatch-grid .ring-main > div:last-child,
  .widget-grid.stopwatch-grid .analog-main > div:last-child,
  .widget-grid.stopwatch-grid .card-pro .card-inner > div:nth-child(2) {
    min-width: 0 !important;
    width: 100% !important;
  }

  .widget-grid.stopwatch-grid .ring-gauge,
  .widget-grid.stopwatch-grid .analog-dial,
  .widget-grid.stopwatch-grid .ring-gauge svg {
    width: 66px !important;
    height: 66px !important;
  }

  .widget-grid.stopwatch-grid .ring-clock,
  .widget-grid.stopwatch-grid .analog-clock {
    font-size: 25px !important;
  }

  .widget-grid.stopwatch-grid .pills {
    grid-template-columns: minmax(0, 1fr) 44px 40px !important;
    gap: 5px !important;
    margin-top: 7px !important;
    width: 100% !important;
  }

  .widget-grid.stopwatch-grid .pill {
    min-height: 20px !important;
    line-height: 20px !important;
    font-size: 8px !important;
  }

  .widget-grid.stopwatch-grid .card-analog .pill,
  .widget-grid.stopwatch-grid .card-ring .pill {
    font-size: 10px !important;
  }

  .widget-grid.stopwatch-grid .card-pro .card-inner > div:nth-child(2) {
    grid-template-rows: 29px 15px 7px minmax(0, 1fr) !important;
    gap: 6px !important;
  }

  .widget-grid.stopwatch-grid .pro-time {
    font-size: 30px !important;
  }

  .widget-grid.stopwatch-grid .pro-meta {
    font-size: 10px !important;
  }

  .widget-grid.stopwatch-grid .pro-progress {
    height: 7px !important;
  }

  .widget-grid.stopwatch-grid .card-split > .card-inner {
    grid-template-rows: 78px minmax(0, 1fr) !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .widget-grid.stopwatch-grid .card-split .split-top {
    padding: 9px 13px 7px !important;
  }

  .widget-grid.stopwatch-grid .card-split .split-time {
    left: 14px !important;
    right: 14px !important;
    bottom: 8px !important;
    font-size: 28px !important;
  }

  .widget-grid.stopwatch-grid .card-split .split-body {
    grid-template-rows: 36px minmax(54px, auto) 34px !important;
    align-content: start !important;
    gap: 5px !important;
    padding: 7px 14px 10px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .widget-grid.stopwatch-grid .card-split .split-stats {
    gap: 5px !important;
  }

  .widget-grid.stopwatch-grid .card-split .split-stat {
    gap: 2px !important;
    padding: 2px 5px !important;
  }

  .widget-grid.stopwatch-grid .card-split .split-stat span {
    font-size: 9px !important;
  }

  .widget-grid.stopwatch-grid .card-split .split-stat strong {
    font-size: 12px !important;
  }

  .widget-grid.stopwatch-grid .card-lap-list {
    align-content: end !important;
    gap: 2px !important;
    margin-top: 5px !important;
  }

  .widget-grid.stopwatch-grid .card-split .card-lap-list {
    align-content: start !important;
    margin-top: 0 !important;
  }

  .widget-grid.stopwatch-grid .card-lap-row {
    min-height: 16px !important;
    font-size: 11px !important;
    line-height: 1.24 !important;
  }

  .widget-grid.stopwatch-grid .card-lap-row span,
  .widget-grid.stopwatch-grid .card-lap-row strong {
    line-height: 1.24 !important;
  }

  .widget-grid.stopwatch-grid .card-lap-row strong {
    font-size: 11px !important;
  }

  .widget-grid.stopwatch-grid .card-lap-empty {
    font-size: 11px !important;
  }

  .widget-grid.stopwatch-grid .card-lap-more {
    padding: 1px 5px 2px !important;
    font-size: 9px !important;
  }

  .widget-grid.stopwatch-grid .stopwatch-controls,
  .widget-grid.stopwatch-grid .card-split .stopwatch-controls {
    gap: 8px !important;
    height: 34px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .widget-grid.stopwatch-grid .tool-btn,
  .widget-grid.stopwatch-grid .card-split .tool-btn {
    width: 100% !important;
    min-width: 0 !important;
    height: 34px !important;
    font-size: 12px !important;
  }
}

@media (max-width: 560px) {
  #addModal.modal-backdrop {
    padding: 8px;
  }

  #addModal .modal-dialog {
    border-radius: 16px;
  }

  #addModal .modal-head {
    padding: 18px 16px 15px;
  }

  #addModal .type-option-preview {
    min-height: 102px;
    margin-bottom: 8px;
  }

  #addModal .modal-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  #addModal.modal-backdrop {
    padding: 8px !important;
  }

  #addModal .modal-dialog {
    max-height: calc(100dvh - 16px) !important;
    border-radius: 16px !important;
  }

  #addModal .modal-body {
    max-height: none !important;
  }
}

@media (max-width: 1024px) {
  [data-theme='dark'] #addModal .modal-dialog,
  [data-theme='dark'] #addModal .modal-actions {
    border-color: #33465f !important;
    background: #0f172a !important;
  }

  [data-theme='dark'] #addModal .modal-head {
    background: linear-gradient(145deg, #111c2d, #0f172a) !important;
  }

  [data-theme='dark'] #addModal .modal-body {
    background: #08111f !important;
  }
}
.stopwatch-page {
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.stopwatch-page .clock-box {
  display: block;
  grid-template-rows: none;
}

.stopwatch-page .clock-box::after {
  content: none;
}

.stopwatch-page .time-toolbar {
  flex-wrap: wrap;
}

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

.stopwatch-page .mobile-group-tabs,
.stopwatch-page .fullscreen-group-tabs,
.stopwatch-page .fullscreen-brand,
.stopwatch-page .fullscreen-toolbar-title {
  display: none;
}

.stopwatch-page.time-fullscreen-mode .site-header,
.stopwatch-page.time-fullscreen-mode .tool-hero,
.stopwatch-page.time-fullscreen-mode funify-site-footer {
  display: none;
}

.stopwatch-page.time-fullscreen-mode .time-dashboard-shell {
  grid-template-columns: minmax(0, 1fr);
}

.stopwatch-page.time-fullscreen-mode .fullscreen-group-tabs {
  display: flex;
}

.stopwatch-page.time-fullscreen-mode .time-dashboard-page {
  width: calc(100% - 32px);
  margin: 16px auto;
}

.stopwatch-page .widget-grid.stopwatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 300px));
  justify-content: center;
  gap: 18px;
  min-height: 320px;
}

.stopwatch-page #mobileResetGroupButton {
  display: none;
}

@media (max-width: 640px) {
  .stopwatch-page .time-dashboard-page {
    width: calc(100% - 24px);
    margin: 20px auto;
  }

  .stopwatch-page .time-toolbar {
    gap: 8px;
  }

  .stopwatch-page .group-tabs {
    display: flex;
    flex: 1 1 100%;
    min-width: 0;
    overflow-x: auto;
  }

  .stopwatch-page .group-tab {
    flex: 1 0 auto;
  }
}

/* Keep controls, cards, tips, and status in the same order at every viewport. */
.stopwatch-page .time-bottom-status {
  order: 4;
  margin-top: 0;
}

/* Reuse the World Time toolbar, with stopwatch actions in place of city search. */
.stopwatch-page .time-toolbar {
  order: 1;
  display: flex;
  align-items: center;
}

.stopwatch-page .group-tabs {
  flex: 1 1 420px;
  width: auto;
  min-width: 0;
  margin: 0;
}

.stopwatch-page .time-toolbar #addButton,
.stopwatch-page .time-toolbar #fullscreen-button {
  flex: 0 0 120px;
  width: 120px;
  margin: 0;
}

.stopwatch-page .time-toolbar #fullscreen-button {
  display: inline-flex !important;
}

.stopwatch-page .clock-board-shell {
  order: 2;
  margin-top: 0;
}

.stopwatch-page .time-tip {
  order: 3;
  margin: 26px 0 0;
}

.stopwatch-page .time-tip-actions {
  display: inline-flex;
}

@media (max-width: 640px) {
  .stopwatch-page .time-tip {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
  }

  .stopwatch-page .time-tip-actions {
    margin-left: auto;
  }
}

@media (max-width: 640px) {
  .stopwatch-page .group-tabs {
    flex-basis: 100%;
  }
}

@media (max-width: 768px) {
  .stopwatch-page .tool-hero-features {
    min-width: 0;
    flex-wrap: wrap;
  }
}

/* Match the World Time card controls without adding a favorite action. */
.stopwatch-page .widget-grid.stopwatch-grid .clock-box > .widget-actions,
.stopwatch-page .widget-grid.stopwatch-grid .split-top .widget-actions {
  top: 4px !important;
  right: 6px !important;
  gap: 2px;
}

.stopwatch-page .widget-grid.stopwatch-grid .widget-actions .icon-btn {
  width: 25px;
  height: 25px;
  min-width: 25px;
  min-height: 25px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--card-complement, #102033);
  box-shadow: none;
  backdrop-filter: none;
  font-size: 0;
  font-weight: 400;
  cursor: pointer;
  transition: transform 0.18s ease;
}

.stopwatch-page .widget-actions .icon-btn svg {
  display: block;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stopwatch-page .widget-actions [data-action='remove'] svg {
  width: 25px;
  height: 25px;
}

.stopwatch-page .widget-grid.stopwatch-grid .widget-actions .icon-btn:hover {
  transform: translateY(-1px);
}

.stopwatch-page .card-lap-row strong {
  cursor: zoom-in;
}

.stopwatch-lap-popup {
  --lap-accent: var(--color-primary);
  position: fixed;
  z-index: 20050;
  width: min(320px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--lap-accent) 24%, var(--color-border));
  border-radius: 16px;
  background: var(--color-surface, #fff);
  color: var(--color-text, #182235);
  box-shadow:
    0 18px 50px #10284024,
    0 3px 10px #1028400c;
  font-family: var(--font-family-title);
  animation: lap-popup-appear 140ms ease-out;
}

.stopwatch-lap-popup[hidden] {
  display: none;
}

.stopwatch-lap-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 10px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 4px;
}

.stopwatch-lap-popup-heading {
  min-width: 0;
  padding-left: 9px;
  border-left: 3px solid var(--lap-accent);
}

.stopwatch-lap-popup-caption {
  margin: 0 0 3px;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.03em;
}

.stopwatch-lap-popup-head h2 {
  margin: 0;
  color: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.stopwatch-lap-popup-head button {
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  height: 26px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-muted);
  box-shadow: none;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition:
    background 140ms ease,
    color 140ms ease;
}

.stopwatch-lap-popup-head button:hover {
  background: color-mix(in srgb, var(--lap-accent) 12%, var(--color-surface));
  color: var(--color-text);
}

.stopwatch-lap-popup-list {
  max-height: min(260px, calc(100dvh - 140px));
  padding: 0 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--lap-accent) 45%, var(--color-border)) transparent;
}

.stopwatch-lap-popup-list::-webkit-scrollbar {
  width: 6px;
}

.stopwatch-lap-popup-list::-webkit-scrollbar-thumb {
  border-radius: 6px;
  background: color-mix(in srgb, var(--lap-accent) 45%, var(--color-border));
}

.stopwatch-lap-popup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 2px 0;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.stopwatch-lap-popup-row:nth-child(even) {
  background: color-mix(in srgb, var(--color-muted) 5%, var(--color-surface));
}

.stopwatch-lap-popup-row:first-child {
  background: color-mix(in srgb, var(--lap-accent) 13%, var(--color-surface));
}

.stopwatch-lap-popup-row > span {
  color: var(--color-muted);
  white-space: nowrap;
}

.stopwatch-lap-popup-row strong {
  color: var(--color-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.stopwatch-lap-popup-list > p {
  margin: 0;
  padding: 18px 10px;
  color: var(--color-muted);
  font-size: 14px;
  text-align: center;
}

.stopwatch-lap-popup :focus-visible,
.stopwatch-page .card-lap-row strong:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

@keyframes lap-popup-appear {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stopwatch-lap-popup {
    animation: none;
  }
}
