*{ box-sizing:border-box; margin:0; padding:0; }

:root{
  color-scheme:light;
  --page:#eef1f5;
  --surface:#ffffff;
  --surface-soft:#f4f6f8;
  --text:#20242c;
  --muted:#747d8c;
  --line:#e1e5eb;
  --action:#14766f;
  --action-soft:#e2f2ef;
  --danger:#c84747;
  --accent:#10ddd2;
  --watch-bg:#000000;
  --watch-primary:#ffffff;
  --watch-muted:#888888;
  --watch-grid:#7e8788;
  --watch-indicator:#0a2e2c;
  --heart-guide:#0a3d3a;
}

html{ height:100%; }
body{
  width:100%;
  height:100vh;
  height:100dvh;
  overflow:hidden;
  background:var(--page);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
}
button,input,select,textarea{ font:inherit; }
button{ cursor:pointer; }

.mobile-shell{
  width:min(100%, 430px);
  max-width:430px;
  height:100%;
  margin:0;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  background:#f7f8fa;
  box-shadow:0 0 34px rgba(29,36,48,.09);
}

.topbar{
  flex:0 0 auto;
  min-height:64px;
  padding:11px 14px 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border-bottom:1px solid var(--line);
  background:rgba(250,251,252,.95);
  backdrop-filter:blur(14px);
  z-index:10;
}
.brand-block{ min-width:0; }
.brand-block h1{ font-size:17px; line-height:1.15; letter-spacing:0; white-space:nowrap; }
.brand-block p{ margin-top:3px; color:var(--muted); font-size:11px; }
.topbar-actions{ flex:0 0 auto; display:flex; align-items:center; gap:7px; }
.lang-button{
  width:34px;
  height:34px;
  border:1px solid var(--line);
  border-radius:50%;
  background:#fff;
  color:var(--text);
  font-size:12px;
  font-weight:750;
}
.topbar select{
  width:126px;
  max-width:31vw;
  height:36px;
  border:1px solid var(--line);
  border-radius:6px;
  padding:0 9px;
  background:#fff;
  color:var(--text);
  font-size:12px;
}

.preview-panel{ flex:0 0 auto; background:#edf1f3; border-bottom:1px solid #dfe4e8; }
.preview-toolbar{
  height:43px;
  padding:7px 12px 4px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.segmented{
  display:inline-grid;
  grid-auto-flow:column;
  grid-auto-columns:1fr;
  gap:2px;
  padding:3px;
  border:1px solid #d9dee5;
  border-radius:7px;
  background:#e4e8ec;
}
.segment{
  min-width:58px;
  height:28px;
  padding:0 9px;
  border:0;
  border-radius:4px;
  background:transparent;
  color:#657080;
  font-size:12px;
  font-weight:700;
}
.segment.active{ background:#fff; color:#1d2a30; box-shadow:0 1px 4px rgba(24,32,40,.14); }
.icon-segments .segment{ min-width:35px; width:35px; padding:0; display:grid; place-items:center; }
.shape-icon{ display:block; width:14px; height:14px; border:1.5px solid currentColor; }
.shape-icon.shape-round{ border-radius:50%; }
.shape-icon.shape-rectangle{ width:12px; height:15px; border-radius:2px; }
.full-width{ display:grid; width:100%; grid-template-columns:repeat(3,1fr); }
.full-width .segment{ min-width:0; }

.watch-stage{
  height:302px;
  display:grid;
  place-items:center;
  overflow:hidden;
  padding-bottom:8px;
}
.watch-frame{
  position:relative;
  width:286px;
  height:286px;
  padding:8px;
  background:#252a2e;
  box-shadow:0 10px 22px rgba(25,31,37,.24), inset 0 0 0 1px #43494e;
  transition:width .2s ease,height .2s ease,border-radius .2s ease;
}
.watch-frame.shape-round{ border-radius:50%; }
.watch-frame.shape-rectangle{ width:244px; height:286px; border-radius:18px; }
.watchface{
  position:relative;
  width:100%;
  height:100%;
  overflow:hidden;
  border-radius:inherit;
  background:var(--watch-bg);
  color:var(--watch-primary);
  font-family:"Arial Narrow","Roboto Condensed","DIN Condensed",Arial,sans-serif;
  transition:background-color .18s ease;
}
.tick-layer{ position:absolute; inset:0; width:100%; height:100%; z-index:1; pointer-events:none; }
.normal-face,.aod-face{ position:absolute; inset:0; z-index:2; }
.normal-face[hidden],.aod-face[hidden]{ display:none; }

.grid-line,.aod-grid{ position:absolute; background:var(--watch-grid); opacity:.92; }
.line-v{ left:20%; top:14%; width:1px; height:60%; }
.line-date{ left:3.8%; right:3.8%; top:28%; height:1px; }
.line-short{ left:3.8%; width:16.2%; top:50%; height:1px; }
.line-heart-top{ left:20%; right:3.8%; top:58%; height:1px; }
.line-bottom{ left:3.8%; right:3.8%; top:74%; height:1px; }
.grid-dot,.aod-dot{ position:absolute; width:6px; height:6px; margin:-3px 0 0 -3px; border-radius:50%; background:var(--accent); }
.dot-date{ left:20%; top:28%; }
.dot-short{ left:20%; top:50%; }
.dot-heart{ left:20%; top:58%; }
.dot-bottom{ left:20%; top:74%; }

.date-text{
  position:absolute;
  left:50%;
  top:14.5%;
  transform:translate(-50%,-50%);
  font-size:15px;
  line-height:1;
  font-weight:650;
  white-space:nowrap;
}
.date-weather{ position:absolute; top:14.5%; transform:translate(-50%,-50%); font-size:12px; font-weight:700; }
.weather-date-left{ left:30%; margin-top:-2px; }
.weather-date-right{ left:70%; color:var(--watch-primary); }
.degree{ font-size:.8em; }
.weekday-row{
  position:absolute;
  left:20.5%;
  right:15.5%;
  top:19.3%;
  display:grid;
  grid-template-columns:repeat(7,1fr);
  align-items:center;
  color:var(--watch-muted);
  font-size:10px;
  font-weight:700;
}
.weekday-row span{ width:18px; height:18px; display:grid; place-items:center; justify-self:center; }
.weekday-row .today{ border:1px solid var(--accent); border-radius:4px; color:var(--accent); }

.pic-icon{
  width:22px;
  height:22px;
  background:var(--accent);
  -webkit-mask-image:url("font_pic_web.png");
  -webkit-mask-repeat:no-repeat;
  -webkit-mask-size:242px 66px;
  mask-image:url("font_pic_web.png");
  mask-repeat:no-repeat;
  mask-size:242px 66px;
}
.weather-font-icon{
  width:22px;
  height:22px;
  background:var(--accent);
  -webkit-mask-image:url("weather_font_web.png");
  -webkit-mask-repeat:no-repeat;
  -webkit-mask-size:242px 66px;
  mask-image:url("weather_font_web.png");
  mask-repeat:no-repeat;
  mask-size:242px 66px;
}
.weather-font-icon[data-weather="a"]{ -webkit-mask-position:0 0; mask-position:0 0; }
.weather-font-icon[data-weather="b"]{ -webkit-mask-position:-22px 0; mask-position:-22px 0; }
.weather-font-icon[data-weather="c"]{ -webkit-mask-position:-44px 0; mask-position:-44px 0; }
.weather-font-icon[data-weather="d"]{ -webkit-mask-position:-66px 0; mask-position:-66px 0; }
.weather-font-icon[data-weather="e"]{ -webkit-mask-position:-88px 0; mask-position:-88px 0; }
.weather-font-icon[data-weather="f"]{ -webkit-mask-position:-110px 0; mask-position:-110px 0; }
.weather-font-icon[data-weather="g"]{ -webkit-mask-position:-132px 0; mask-position:-132px 0; }
.weather-font-icon[data-weather="h"]{ -webkit-mask-position:-154px 0; mask-position:-154px 0; }
.weather-font-icon[data-weather="i"]{ -webkit-mask-position:-176px 0; mask-position:-176px 0; }
.weather-font-icon[data-weather="j"]{ -webkit-mask-position:-198px 0; mask-position:-198px 0; }
.weather-font-icon[data-weather="k"]{ -webkit-mask-position:-220px 0; mask-position:-220px 0; }
.weather-font-icon[data-weather="l"]{ -webkit-mask-position:0 -22px; mask-position:0 -22px; }
.weather-font-icon[data-weather="m"]{ -webkit-mask-position:-22px -22px; mask-position:-22px -22px; }
.top-left-field{ position:absolute; left:15%; top:19%; width:calc(10% - 4px); height:22px; transform:translate(-50%,-50%); display:grid; place-items:center; color:var(--accent); font-size:12px; font-weight:700; line-height:1; white-space:nowrap; }
.top-left-field.is-runner{ top:21%; }
.top-left-label{ position:absolute; top:100%; left:50%; transform:translateX(-50%); color:var(--watch-muted); font-size:9px; line-height:1; white-space:nowrap; }
.top-left-field > .weather-font-icon{ transform:none; }
.top-left-field .compact-wind{ width:18px; height:18px; }
.shape-round .top-left-field:not(.is-runner){ top:calc(19% + 2px); }
.shape-round .top-left-label{ top:calc(100% - 2px); }

.battery-block{
  position:absolute;
  left:10%;
  top:38.5%;
  transform:translate(-50%,-50%);
  display:grid;
  justify-items:center;
  gap:6px;
  color:var(--accent);
}
.battery-block strong{ font-size:13px; line-height:1; }
.battery-icon{ position:relative; width:27px; height:14px; border:1px solid var(--accent); border-radius:2px; }
.battery-icon::after{ content:""; position:absolute; left:100%; top:4px; width:2px; height:6px; background:var(--accent); }
.battery-icon span{ position:absolute; inset:2px; background:repeating-linear-gradient(90deg,var(--accent) 0 3px,transparent 3px 4px); }

.time-block{ position:absolute; left:24.8%; right:2%; top:28%; height:30%; display:flex; align-items:center; }
.time-hour,.time-minute{ font-family:"Arial Narrow","DIN Condensed",Impact,sans-serif; font-size:69px; line-height:1; font-weight:800; letter-spacing:0; }
.time-hour{ color:var(--watch-primary); }
.time-minute{ color:var(--accent); }
.time-seconds{ position:absolute; right:7.3%; bottom:17%; color:var(--watch-muted); font-size:23px; font-weight:700; }
.time-indicator{ position:absolute; right:7.3%; top:16%; padding:2px 4px; border:1px solid var(--accent); border-radius:4px; color:var(--accent); background:var(--watch-indicator); font-size:9px; font-weight:700; }

.distance-block{
  position:absolute;
  left:10%;
  top:62%;
  width:18%;
  transform:translate(-50%,-50%);
  display:grid;
  justify-items:center;
  gap:1px;
}
.distance-block .metric-icon{ transform:scale(.88); }
.distance-block strong{ font-size:12px; line-height:1; }
.distance-block span{ color:var(--watch-muted); font-size:9px; font-weight:700; }

.heart-block{ position:absolute; left:21%; right:2.8%; top:58%; height:16%; display:flex; align-items:center; }
.heart-icon{ flex:0 0 auto; margin:0 5px 0 3px; }
.heart-chart{ flex:1 1 auto; min-width:0; height:70%; overflow:visible; }
.chart-guide{ fill:none; stroke:var(--heart-guide); stroke-width:1; stroke-dasharray:3 4; }
.chart-wave{ fill:none; stroke:var(--accent); stroke-width:2.2; vector-effect:non-scaling-stroke; }
.heart-value{ flex:0 0 34px; display:grid; justify-items:center; gap:2px; }
.heart-value strong{ font-size:21px; line-height:1; }
.heart-value span{ color:var(--watch-muted); font-size:8px; font-weight:700; }

.bottom-fields{ position:absolute; left:15%; right:15%; top:76%; bottom:4%; display:grid; grid-template-columns:repeat(3,1fr); }
.bottom-field{ position:relative; display:grid; place-content:center; justify-items:center; grid-template-rows:22px 17px 13px; min-width:0; border-left:1px solid transparent; }
.bottom-field + .bottom-field{ border-left-color:var(--watch-grid); }
.bottom-field .pic-icon{ transform:translateY(-2px) scale(.73); transform-origin:center; }
.weather-font-icon{ transform:translateY(-2px) scale(.73); transform-origin:center; }
.bottom-field .small-battery{ transform:translateY(-2px) scale(.66); transform-origin:center; margin-top:4px; }
.field-value{ color:var(--watch-primary); font-size:14px; line-height:1; font-weight:700; white-space:nowrap; }
.field-label{ max-width:100%; overflow:hidden; text-overflow:ellipsis; color:var(--watch-muted); font-size:9px; line-height:1; font-weight:700; white-space:nowrap; }

.aod-grid-top{ left:4%; right:4%; top:24%; height:1px; }
.aod-grid-left{ left:18%; top:24%; width:1px; height:32%; }
.aod-grid-short{ left:4%; width:14%; top:50%; height:1px; }
.aod-grid-bottom{ left:18%; right:4%; top:64%; height:1px; }
.aod-dot-top{ left:18%; top:24%; }
.aod-dot-short{ left:18%; top:50%; }
.aod-dot-bottom{ left:18%; top:64%; }
.aod-time{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; gap:8px; font-size:67px; font-weight:800; }
.aod-time span{ color:#b7b7b7; }
.aod-time strong{ color:var(--accent); }
.aod-minimal .aod-grid,.aod-minimal .aod-dot{ display:none; }
.aod-matrix .aod-grid-bottom,.aod-matrix .aod-dot-bottom{ display:none; }
.aod-full .aod-grid-left{ height:40%; }

.shape-rectangle .line-v{ left:18%; top:10%; height:64%; }
.shape-rectangle .line-date{ top:24%; }
.shape-rectangle .line-short{ left:4%; width:14%; }
.shape-rectangle .line-heart-top{ left:18%; top:56%; }
.shape-rectangle .dot-date{ left:18%; top:24%; }
.shape-rectangle .dot-short{ left:18%; }
.shape-rectangle .dot-heart{ left:18%; top:56%; }
.shape-rectangle .dot-bottom{ left:18%; }
.shape-rectangle .date-text,.shape-rectangle .date-weather{ top:10.5%; }
.shape-rectangle .weather-date-left{ left:20%; }
.shape-rectangle .weather-date-right{ left:80%; }
.shape-rectangle .weekday-row{ left:18%; right:4%; top:17%; }
.shape-rectangle .top-left-field{ left:9%; top:17%; width:calc(18% - 4px); }
.shape-rectangle .top-left-field.is-runner{ left:13.5%; top:19%; }
.shape-rectangle .time-block{ left:19%; top:24%; height:32%; }
.shape-rectangle .time-hour,.shape-rectangle .time-minute{ font-size:59px; }
.shape-rectangle .time-seconds{ font-size:20px; }
.shape-rectangle .battery-block,.shape-rectangle .distance-block{ left:9%; }
.shape-rectangle .heart-block{ left:19%; top:56%; height:18%; }
.shape-rectangle .bottom-fields{ left:0; right:0; }

.settings-sheet{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:9px 14px calc(24px + env(safe-area-inset-bottom));
  background:var(--surface);
  -webkit-overflow-scrolling:touch;
}
.sheet-handle{ width:38px; height:4px; margin:0 auto 14px; border-radius:4px; background:#d5dae0; }
.control-section{ padding-bottom:19px; margin-bottom:19px; border-bottom:1px solid var(--line); }
.control-section:last-child{ border-bottom:0; margin-bottom:0; }
.section-heading{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:11px; }
.section-heading h2{ font-size:15px; line-height:1.25; letter-spacing:0; }
.section-heading p{ margin-top:3px; color:var(--muted); font-size:11px; line-height:1.35; }
.select-setting{ min-height:52px; display:grid; grid-template-columns:1fr 164px; align-items:center; gap:12px; border-top:1px solid var(--line); font-size:13px; font-weight:700; }
.select-setting select,.field-control select{
  width:100%;
  min-width:0;
  height:36px;
  border:1px solid #d8dde4;
  border-radius:5px;
  padding:0 9px;
  background:#f8f9fa;
  color:#273038;
  font-size:12px;
}
.stack-setting{ grid-template-columns:1fr; align-items:stretch; gap:7px; padding-top:10px; }
.select-setting[hidden]{ display:none; }
.custom-theme-editor{ padding:0 0 4px; }
.custom-theme-editor[hidden]{ display:none; }
.custom-theme-heading{ display:grid; gap:2px; margin-bottom:9px; }
.custom-theme-heading strong{ font-size:13px; }
.custom-theme-heading span{ color:var(--muted); font-size:10px; }
.theme-code-setting{ display:grid; gap:5px; }
.theme-code-setting > span{ color:#3f4955; font-size:11px; font-weight:700; }
.theme-code-setting input,.custom-color-item input[type="text"]{
  min-width:0;
  height:36px;
  border:1px solid #d8dde4;
  border-radius:5px;
  padding:0 9px;
  background:#f8f9fa;
  color:#273038;
  font:11px/1.2 "SFMono-Regular",Consolas,monospace;
}
.theme-code-setting input.invalid,.custom-color-item input[type="text"].invalid{ border-color:var(--danger); background:#fff7f7; }
.theme-code-setting small{ min-height:26px; color:var(--muted); font-size:9px; line-height:1.35; }
.theme-code-setting small.error{ color:var(--danger); }
.custom-color-grid{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; margin-top:8px; }
.custom-color-item{ min-width:0; display:grid; grid-template-areas:"color" "label" "hex"; gap:3px; align-items:center; padding:5px; border:1px solid var(--line); border-radius:5px; background:#fafbfc; }
.custom-color-item label{ grid-area:label; overflow:hidden; color:#596370; font-size:8px; font-weight:700; text-align:center; text-overflow:ellipsis; white-space:nowrap; }
.custom-color-item input[type="color"]{ grid-area:color; width:100%; height:24px; padding:0; border:0; border-radius:4px; background:transparent; }
.custom-color-item input[type="text"]{ grid-area:hex; width:100%; height:20px; padding:0; border:0; background:transparent; font-size:8px; text-align:center; text-transform:uppercase; }
.field-grid{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.field-control{ min-width:0; display:grid; gap:6px; }
.field-control span{ color:var(--muted); font-size:10px; font-weight:700; }
.field-control select{ padding:0 5px; font-size:11px; }

.scheme-actions{ display:grid; grid-template-columns:1fr 64px 64px; gap:7px; }
.scheme-actions input{ min-width:0; height:38px; border:1px solid #d8dde4; border-radius:5px; padding:0 10px; background:#f8f9fa; font-size:13px; }
.scheme-actions button,.summary-row button{ min-height:38px; border:0; border-radius:5px; padding:0 10px; background:var(--action); color:#fff; font-size:12px; font-weight:750; }
.scheme-actions .danger-button{ background:var(--danger); }
.scheme-actions button:disabled{ background:#cbd1d8; color:#eef1f4; cursor:not-allowed; }
.summary-row{ margin-top:9px; display:grid; grid-template-columns:1fr 64px; gap:7px; }
.summary-row textarea{ height:58px; min-width:0; resize:none; border:1px solid #d8dde4; border-radius:5px; padding:9px; background:#f8f9fa; color:#46505d; font:10px/1.4 "SFMono-Regular",Consolas,monospace; }
.apply-note{ margin-top:8px; color:var(--muted); font-size:10px; line-height:1.4; }

.toast{ position:fixed; left:50%; bottom:calc(18px + env(safe-area-inset-bottom)); transform:translateX(-50%); z-index:40; max-width:320px; padding:9px 14px; border-radius:5px; background:#222a31; color:#fff; box-shadow:0 8px 24px rgba(0,0,0,.24); font-size:12px; font-weight:700; text-align:center; }
.toast[hidden]{ display:none; }

@media (max-width:370px){
  .watch-stage{ height:282px; }
  .watch-frame{ transform:scale(.92); }
  .topbar select{ width:112px; }
  .brand-block h1{ font-size:15px; }
  .field-grid{ gap:5px; }
}

@media (min-width:720px){
  body{ padding:18px 0; }
  .mobile-shell{ height:calc(100dvh - 36px); margin:0 auto; border:1px solid #dde2e7; border-radius:8px; }
}

.body-battery-icon{ display:block; position:relative; width:22px; height:22px; }
.body-battery-icon .pic-icon{ display:block; transform:none; }
.body-battery-icon svg{ position:absolute; inset:0; width:100%; height:100%; }
.bottom-field .body-battery-icon{ transform:translateY(-2px) scale(.73); transform-origin:center; }
