/**
 * 浅色简洁横屏时钟样式
 * 面向手机横屏：左侧天气标签化展示、中央大时钟
 */
:root {
  --bg-1: #eef3f8;
  --bg-2: #f7fafc;
  --ink: #1d2a36;
  --ink-soft: #5b6b7a;
  --line: rgba(29, 42, 54, 0.1);
  --accent: #2f6fed;
  --warn: #c45c1a;
  --warn-bg: rgba(196, 92, 26, 0.1);
  --panel: rgba(255, 255, 255, 0.72);
  --tag-bg: rgba(255, 255, 255, 0.88);
  --shadow: 0 10px 30px rgba(40, 70, 100, 0.08);
  --radius: 18px;
  --font-cn: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-ui: "IBM Plex Sans", var(--font-cn);
  --font-clock: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-ui);
  background:
    radial-gradient(1200px 600px at 15% 10%, #dce9f7 0%, transparent 55%),
    radial-gradient(900px 500px at 90% 90%, #e4eef8 0%, transparent 50%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
}

.page {
  display: grid;
  grid-template-columns: minmax(240px, 30vw) 1fr;
  gap: clamp(12px, 2vw, 24px);
  width: 100%;
  height: 100%;
  padding: clamp(12px, 2.2vw, 24px);
  padding-left: max(clamp(12px, 2.2vw, 24px), env(safe-area-inset-left));
  padding-right: max(clamp(12px, 2.2vw, 24px), env(safe-area-inset-right));
  padding-top: max(clamp(12px, 2.2vw, 24px), env(safe-area-inset-top));
  padding-bottom: max(clamp(12px, 2.2vw, 24px), env(safe-area-inset-bottom));
}

.weather {
  align-self: center;
  max-height: 100%;
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
}

.weather-loading,
.weather-error {
  font-size: 13px;
  color: var(--ink-soft);
}

.weather-error {
  color: var(--warn);
}

.weather-place {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.weather-main {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.weather-icon-wrap {
  display: inline-flex;
  flex-shrink: 0;
}

.weather-icon-wrap .wx-icon {
  width: 34px;
  height: 34px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.weather-temp {
  font-family: var(--font-clock);
  font-size: clamp(32px, 4.8vw, 44px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.weather-text {
  font-size: 16px;
  font-weight: 600;
}

.weather-feels {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-soft);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag-row-alert,
.tag-row-forecast {
  margin-top: 8px;
}

.wx-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--tag-bg);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
}

.wx-tag .wx-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke: var(--ink-soft);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wx-tag-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.wx-tag.is-alert {
  color: var(--warn);
  border-color: rgba(196, 92, 26, 0.28);
  background: var(--warn-bg);
}

.wx-tag.is-alert .wx-icon {
  stroke: var(--warn);
}

.wx-tag.is-forecast {
  padding-right: 10px;
}

.weather-meta {
  margin-top: 10px;
  font-size: 11px;
  color: var(--ink-soft);
}

.clock-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  text-align: center;
}

.clock-date {
  font-size: clamp(20px, 3.2vw, 30px);
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.clock-time {
  margin-top: 8px;
  font-family: var(--font-clock);
  font-size: clamp(48px, 10.5vw, 120px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.clock-time .colon {
  display: inline-block;
  width: 0.28em;
  animation: blink 1s steps(1, end) infinite;
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.28;
  }
}

.clock-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.clock-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-soft);
}

.install-btn {
  appearance: none;
  border: 1px solid rgba(47, 111, 237, 0.35);
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(47, 111, 237, 0.1);
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.install-btn:active {
  transform: scale(0.98);
}

.install-tip {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-soft);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aa8b5;
}

.status-dot.on {
  background: #2f9e6b;
}

.status-dot.warn {
  background: #d29a2f;
}

.wake-video {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  left: -10px;
  top: -10px;
}

.rotate-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(238, 243, 248, 0.96);
}

.rotate-gate[hidden] {
  display: none !important;
}

.rotate-gate-card {
  max-width: 280px;
  text-align: center;
}

.rotate-gate-title {
  font-size: 20px;
  font-weight: 600;
}

.rotate-gate-desc {
  margin: 10px 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/*
 * 华为等浏览器常忽略 orientation 锁定：
 * 竖屏时用 CSS 旋转整页，强制按横屏构图展示
 */
html.force-landscape,
html.force-landscape body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

html.force-landscape .page {
  position: fixed;
  top: 0;
  left: 100%;
  width: 100vh;
  height: 100vw;
  transform: rotate(90deg);
  transform-origin: top left;
  padding: clamp(12px, 2.2vw, 24px);
}

html.force-landscape .rotate-gate {
  display: none !important;
}

@media (orientation: portrait) {
  .clock-time {
    font-size: clamp(48px, 10.5vw, 120px);
  }

  .clock-date {
    font-size: clamp(20px, 3.2vw, 30px);
  }
}
