/* 毫秒时钟 · styles.css */
:root {
  --bg: #06080c;
  --bg-2: #0a0d13;
  --panel: #10141c;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #eef1f7;
  --muted: #8b93a6;
  --muted-2: #5f687a;
  --gold: #f3b544;
  --green: #3ddc97;
  --red: #ff6b6b;
  --blue: #5b9cff;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(58% 42% at 8% -8%, rgba(243, 181, 68, 0.13), transparent 62%),
    radial-gradient(50% 40% at 102% -2%, rgba(91, 156, 255, 0.11), transparent 62%),
    radial-gradient(70% 60% at 50% 120%, rgba(61, 220, 151, 0.05), transparent 70%),
    linear-gradient(180deg, #070a10 0%, #05070a 60%, #040609 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(80% 60% at 50% 0%, #000 0%, transparent 78%);
  mask-image: radial-gradient(80% 60% at 50% 0%, #000 0%, transparent 78%);
}

button, input, select, textarea { font: inherit; }
button { color: inherit; touch-action: manipulation; }
button, .clock-line, .card-more, .icon-btn, .sync-pill, .preset, .swatch {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.clock-line {
  -webkit-appearance: none;
  appearance: none;
}
a { color: var(--gold); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
  display: block;
}

/* ---------------- 布局 ---------------- */

.app {
  width: 100%;
  max-width: 1280px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(14px + var(--safe-top))
    calc(clamp(14px, 3.2vw, 32px) + var(--safe-right))
    calc(20px + var(--safe-bottom))
    calc(clamp(14px, 3.2vw, 32px) + var(--safe-left));
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: var(--gold);
  background: linear-gradient(155deg, rgba(243, 181, 68, 0.2), rgba(243, 181, 68, 0.035));
  border: 1px solid rgba(243, 181, 68, 0.3);
  box-shadow: 0 0 34px -10px rgba(243, 181, 68, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  flex: none;
}
.brand-mark .icon { width: 23px; height: 23px; }

.brand-copy { min-width: 0; }
.brand-copy h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.15;
  white-space: nowrap;
}
.brand-copy p {
  margin: 4px 0 0;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--muted-2);
  white-space: nowrap;
}

.topbar-actions { display: flex; align-items: center; gap: 7px; }

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.icon-btn .icon { width: 19px; height: 19px; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn--accent {
  color: var(--gold);
  background: rgba(243, 181, 68, 0.1);
  border-color: rgba(243, 181, 68, 0.28);
}
.icon-btn--accent:hover { background: rgba(243, 181, 68, 0.17); color: #ffd27a; }

.icon.is-spinning { animation: spin 1s linear infinite; transform-origin: 50% 50%; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 状态栏 ---------------- */

.statusline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 17px 2px 12px;
  min-height: 28px;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}
.status-left[hidden] { display: none; }

.session-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.session-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.session-pill[data-tone="live"] {
  color: var(--green);
  background: rgba(61, 220, 151, 0.09);
  border-color: rgba(61, 220, 151, 0.24);
}
.session-pill[data-tone="warn"] {
  color: var(--gold);
  background: rgba(243, 181, 68, 0.09);
  border-color: rgba(243, 181, 68, 0.24);
}
.session-pill[data-tone="off"] { color: var(--muted); }

.status-note {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.sync-pill:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.055); }
.sync-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sync-pill[data-tone="ok"] { color: var(--green); border-color: rgba(61, 220, 151, 0.2); background: rgba(61, 220, 151, 0.06); }
.sync-pill[data-tone="warn"] { color: var(--gold); border-color: rgba(243, 181, 68, 0.22); background: rgba(243, 181, 68, 0.06); }
.sync-pill[data-tone="busy"] { color: var(--blue); border-color: rgba(91, 156, 255, 0.22); background: rgba(91, 156, 255, 0.06); }
.sync-pill[data-tone="manual"] { color: #c7a6ff; border-color: rgba(167, 139, 250, 0.22); background: rgba(167, 139, 250, 0.06); }
.sync-pill[data-tone="busy"] .dot { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

.ios-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid rgba(243, 181, 68, 0.18);
  background: rgba(243, 181, 68, 0.07);
  color: #dec28b;
  font-size: 11px;
  line-height: 1.45;
}
.ios-tip[hidden] { display: none; }
.ios-tip > span { flex: 1; }
.tip-close {
  flex: none;
  width: 22px;
  height: 22px;
  margin: -2px -4px 0 0;
  border: 0;
  background: transparent;
  color: #dec28b;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}

/* ---------------- 时钟网格 ---------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
  gap: 12px;
  align-content: start;
  margin-top: auto;
  margin-bottom: auto;
}

.clock-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 14px 16px 13px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.016));
  background:
    radial-gradient(130% 120% at 100% 0%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.016));
  box-shadow: 0 22px 48px -32px #000, inset 0 1px 0 rgba(255, 255, 255, 0.06);
  container-type: inline-size;
  transition: border-color 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.clock-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 58%, transparent), transparent);
  opacity: 0.7;
}
@media (hover: hover) {
  .clock-card:hover { border-color: rgba(255, 255, 255, 0.13); transform: translateY(-1px); }
}

.card-top { display: flex; align-items: center; gap: 7px; min-height: 22px; }

.card-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 75%, transparent);
  flex: none;
}

.card-name {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 10px;
  font-weight: 550;
  line-height: 1.2;
  white-space: nowrap;
}
.chip--offset {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: -0.02em;
  color: var(--accent);
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  border-color: color-mix(in srgb, var(--accent) 20%, transparent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.chip--offset[data-zero="true"] {
  color: var(--muted-2);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.card-more {
  flex: none;
  width: 26px;
  height: 26px;
  margin-right: -4px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease;
}
.card-more .icon { width: 18px; height: 18px; }
.card-more:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }

.clock-line {
  display: flex;
  align-items: baseline;
  width: 100%;
  margin: 5px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font-family: var(--mono);
  font-size: 46px;
  font-size: clamp(28px, 11.5vw, 46px);
  font-size: clamp(30px, 14cqw, 60px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow: hidden;
}
.clock-line .t-hms { flex: none; }
.t-ms {
  font-size: 0.56em;
  letter-spacing: -0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-left: 0.05em;
  opacity: 0.95;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted-2);
  min-height: 18px;
}
.card-date { font-variant-numeric: tabular-nums; white-space: nowrap; }

.chip--session {
  margin-left: auto;
  padding: 2px 7px 2px 6px;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}
.chip--session::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  margin-right: 5px;
  vertical-align: 1px;
}
.chip--session[data-tone="live"] {
  color: var(--green);
  border-color: rgba(61, 220, 151, 0.2);
  background: rgba(61, 220, 151, 0.06);
}
.chip--session[data-tone="warn"] {
  color: var(--gold);
  border-color: rgba(243, 181, 68, 0.2);
  background: rgba(243, 181, 68, 0.06);
}

.no-session .chip--session { display: none; }
.no-session .focus-date .focus-sep,
.no-session .focus-date [data-bind="session"] { display: none; }
.no-session .focus-foot { display: none; }

.second-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}
.second-bar b {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 15%, transparent), var(--accent));
  transform-origin: left center;
  opacity: 0.65;
  will-change: transform;
}

.empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 44px 20px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
}
.empty-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.empty p { margin: 0; font-size: 13px; }

.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 0;
  padding-top: 22px;
  font-size: 10.5px;
  color: var(--muted-2);
}
.kbd-hint { white-space: nowrap; opacity: 0.8; letter-spacing: 0.02em; }

/* ---------------- 专注模式 ---------------- */

.focus {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding:
    calc(14px + var(--safe-top))
    calc(clamp(16px, 4vw, 40px) + var(--safe-right))
    calc(18px + var(--safe-bottom))
    calc(clamp(16px, 4vw, 40px) + var(--safe-left));
  background: #04060a;
}
.focus[hidden] { display: none; }

.focus-glow {
  position: absolute;
  inset: -25%;
  pointer-events: none;
  background: radial-gradient(42% 42% at 50% 55%, color-mix(in srgb, var(--accent) 19%, transparent), transparent 70%);
  opacity: 0.9;
}

.focus-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: opacity 0.45s ease;
}
.focus-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.focus-name .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
  flex: none;
}
.focus-actions { display: flex; gap: 7px; }

.focus-center {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  min-height: 0;
}

.focus-time {
  display: flex;
  align-items: baseline;
  justify-content: center;
  max-width: 100%;
  font-family: var(--mono);
  font-size: clamp(40px, 14vw, 190px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.focus-time .t-ms { font-size: 0.5em; }

.focus-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.focus-sep { color: var(--muted-2); }

.focus-foot {
  position: relative;
  text-align: center;
  font-size: 10.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  transition: opacity 0.45s ease;
}

.focus.is-idle .focus-top,
.focus.is-idle .focus-foot { opacity: 0.12; }
.focus.is-idle .focus-actions { pointer-events: none; }

body.has-focus { overflow: hidden; }

/* ---------------- 弹层 ---------------- */

body.sheet-open { overflow: hidden; }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(2, 4, 8, 0.66);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.18s ease both;
  overscroll-behavior: contain;
}
@keyframes fadeIn { from { opacity: 0; } }

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 6px 18px calc(22px + var(--safe-bottom));
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background: linear-gradient(180deg, #11151e 0%, #080b10 100%);
  box-shadow: 0 -30px 90px -20px #000, inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: sheetUp 0.28s cubic-bezier(0.2, 1, 0.3, 1) both;
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0.6; } }

.sheet-handle {
  width: 38px;
  height: 4px;
  margin: 6px auto 14px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.sheet-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0.01em;
}
.sheet-sub {
  margin: 5px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted-2);
}
.sheet-close { width: 34px; height: 34px; border-radius: 10px; flex: none; }
.sheet-close .icon { width: 17px; height: 17px; }

@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; padding: 24px; }
  .sheet {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 6px 22px 24px;
    max-height: 84vh;
    animation: modalIn 0.22s cubic-bezier(0.2, 1, 0.3, 1) both;
  }
  .sheet-handle { display: none; }
  @keyframes modalIn { from { transform: translateY(10px) scale(0.99); opacity: 0.5; } }
}

@media (min-width: 760px) {
  .focus-time { letter-spacing: -0.06em; }
}
/* ---------------- 表单与按钮 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, filter 0.15s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn--primary {
  color: #171104;
  border-color: rgba(243, 181, 68, 0.55);
  background: linear-gradient(180deg, #f8c862, #e7a72d);
  font-weight: 650;
  box-shadow: 0 10px 26px -14px rgba(243, 181, 68, 0.7);
}
.btn--primary:hover { background: linear-gradient(180deg, #ffd27a, #efb03a); }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.05); }
.btn--danger {
  color: #ff9a9a;
  border-color: rgba(255, 107, 107, 0.24);
  background: rgba(255, 107, 107, 0.06);
}
.btn--danger:hover { background: rgba(255, 107, 107, 0.12); }
.btn--sm { height: 34px; padding: 0 11px; border-radius: 9px; font-size: 12px; }
.btn--nudge {
  height: 38px;
  padding: 0;
  border-radius: 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: -0.03em;
  color: var(--muted);
}
.btn--nudge:hover { color: var(--text); }

.field { display: block; margin: 14px 0; }
.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px;
  font-weight: 550;
  color: var(--muted);
}
.field--tight { margin: 0 0 10px; }
.field .hint { margin-top: 6px; }

input[type="text"],
input[type="number"],
input[type="url"],
input:not([type]),
select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
select {
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input:focus, select:focus {
  border-color: rgba(243, 181, 68, 0.5);
  box-shadow: 0 0 0 3px rgba(243, 181, 68, 0.11);
  background: rgba(255, 255, 255, 0.06);
}
input::placeholder { color: var(--muted-2); }

.inline { display: flex; align-items: center; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.inline .btn { flex: none; }

.row { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.hint {
  margin: 6px 0 0;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--muted-2);
}
.hint b { color: var(--muted); font-weight: 550; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
  cursor: pointer;
}
.switch-row:last-child { border-bottom: 0; }
.switch-row em { font-style: normal; }
.switch-row input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  position: relative;
  width: 44px;
  height: 26px;
  margin: 0;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  border: 0;
  cursor: pointer;
  transition: background 0.18s ease;
}
.switch-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s cubic-bezier(0.2, 1, 0.3, 1);
}
.switch-row input[type="checkbox"]:checked { background: var(--gold); }
.switch-row input[type="checkbox"]:checked::after { transform: translateX(18px); }

/* ---------------- 添加时钟 ---------------- */

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
}
.preset {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 11px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.032);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.preset:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--line-strong); }
.preset-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 9px var(--c);
}
.preset-name {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preset-state { flex: none; font-size: 9.5px; color: var(--muted-2); }
.preset.is-added .preset-state { color: var(--green); }

@media (min-width: 520px) {
  .preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------------- 调节时钟 ---------------- */

.edit-preview {
  position: relative;
  overflow: hidden;
  margin: 2px 0 14px;
  padding: 13px 14px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  background:
    radial-gradient(130% 140% at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    rgba(255, 255, 255, 0.025);
  container-type: inline-size;
}
.preview-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
.preview-name .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.preview-name .name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-name .chip { margin-left: auto; }
.preview-time {
  display: flex;
  align-items: baseline;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 38px;
  font-size: clamp(30px, 15cqw, 50px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.preview-time .t-ms { font-size: 0.56em; color: var(--accent); }

.offset-box {
  margin: 14px 0;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}
.offset-box .row { font-size: 11.5px; color: var(--muted); }
.offset-box .row strong { font-size: 12.5px; color: var(--accent); }
.offset-box .field { margin: 0 0 10px; }

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

.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--c);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}
.swatch:active { transform: scale(0.92); }
.swatch.is-on { outline: 2px solid var(--c); outline-offset: 3px; }

.sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.sheet-actions .btn { flex: 1; }

/* ---------------- 对时面板 ---------------- */

.sync-hero {
  margin-bottom: 10px;
  padding: 15px 16px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(243, 181, 68, 0.12), transparent 60%),
    rgba(255, 255, 255, 0.028);
}
.sync-hero-time {
  font-family: var(--mono);
  font-size: clamp(26px, 8vw, 34px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.sync-hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 7px;
  font-size: 10.5px;
  color: var(--muted);
}
.sync-hero-meta b { color: var(--muted); font-weight: 550; font-family: var(--mono); }
.sync-actions { margin: 0 0 10px; }
.sync-actions .hint { max-width: 66%; }

.sources {
  margin: 4px 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}
.source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}
.source-row:last-child { border-bottom: 0; }
.source-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0;
  flex: none;
  accent-color: var(--gold);
}
.source-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  font-size: 12px;
  font-weight: 550;
}
.source-name em {
  font-style: normal;
  font-size: 9.5px;
  font-weight: 400;
  color: var(--muted-2);
}
.source-stat {
  margin-left: auto;
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-align: right;
}
.source-stat.is-bad { color: #ff9a9a; }

.details {
  margin: 14px 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.details summary {
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.details summary::-webkit-details-marker { display: none; }
.details summary::before {
  content: "＋";
  color: var(--muted-2);
  font-size: 12px;
}
.details[open] summary::before { content: "−"; }
.details .inline { margin: 10px 0 8px; }

/* ---------------- 设置 ---------------- */

.settings-group {
  padding: 13px 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}
.settings-group:last-child { border-bottom: 0; }
.settings-group h4 {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.manage { display: flex; flex-direction: column; margin: 6px 0 10px; }
.manage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}
.manage-row:last-child { border-bottom: 0; }
.manage-row.is-off { opacity: 0.55; }
.manage-name {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.manage-hidden {
  display: none;
  margin-left: 6px;
  font-style: normal;
  font-size: 9.5px;
  color: var(--muted-2);
}
.manage-row.is-off .manage-hidden { display: inline; }

.mini-btn {
  flex: none;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 10.5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.mini-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }

.cloud-actions { margin: 6px 0 2px; }
.cloud-status { margin-top: 8px; min-height: 16px; }
.cloud-status.is-bad { color: #ff9a9a; }
.pair-box {
  margin: 8px 0 2px;
  padding: 10px;
  border: 1px solid rgba(243, 181, 68, 0.2);
  border-radius: 12px;
  background: rgba(243, 181, 68, 0.055);
}
.pair-box[hidden] { display: none; }
.pair-box input {
  height: 38px;
  font-family: var(--mono);
  font-size: 11px;
  color: #e8d3a5;
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(243, 181, 68, 0.16);
}
.pair-box .hint { margin: 7px 0 0; }

/* ---------------- 帮助 ---------------- */

.help-block {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}
.help-block:last-child { border-bottom: 0; }
.help-block h4 { margin: 0 0 7px; font-size: 12.5px; font-weight: 600; }
.help-block ol {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.help-block ol b { color: var(--text); font-weight: 600; }
.help-block .hint { margin-top: 8px; }

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  z-index: 100;
  max-width: min(86vw, 420px);
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(23, 28, 38, 0.96);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 18px 50px -18px #000;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 画中画文档 ---------------- */

.pip-doc {
  margin: 0;
  padding: 10px;
  min-height: 100vh;
  background: #06080c;
  color: var(--text);
  font-family: var(--sans);
  overflow: hidden;
}
.pip-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: calc(100vh - 20px);
}
.pip-row {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 8px 11px 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  background:
    radial-gradient(110% 120% at 100% 0%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 62%),
    rgba(255, 255, 255, 0.03);
  container-type: inline-size;
}
.pip-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--muted);
}
.pip-name {
  font-weight: 600;
  color: #cdd4e2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pip-off {
  margin-left: auto;
  flex: none;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--accent);
}
.pip-time {
  display: flex;
  align-items: baseline;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 24px;
  font-size: clamp(24px, 12cqw, 42px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pip-time .t-ms { font-size: 0.56em; }
.pip-more {
  flex: none;
  padding: 2px 0;
  color: var(--muted-2);
  font-size: 10px;
  text-align: center;
}
.pip-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 24px; }

.pip-video,
.pip-canvas {
  position: fixed;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  opacity: 0.01;
  pointer-events: none;
  /* 必须高于专注层/弹层：被不透明层完全遮住时，iOS 可能不再渲染视频帧，
     画中画就会变成黑色。 */
  z-index: 2147483647;
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 759px) {
  .grid { margin-top: 0; margin-bottom: 0; }
  .foot { margin-top: auto; }
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .brand-copy p { display: none; }
  .statusline { margin-top: 14px; }
  .focus-time { font-size: clamp(38px, 14vw, 100px); }
}

@media (max-width: 400px) {
  .topbar-actions { gap: 5px; }
  .icon-btn { width: 36px; height: 36px; border-radius: 11px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
  .brand-copy h1 { font-size: 15px; }
  .card-name { font-size: 12.5px; }
  .kbd-hint { display: none; }
  .foot { justify-content: center; text-align: center; }
}

@media (max-width: 440px) {
  .status-note { display: none; }
}

@media (pointer: coarse) {
  .kbd-hint { display: none; }
  .foot { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
