/*
 * 样式组织说明：基础布局在前，组件与响应式规则在后；废弃入口和被覆盖声明已清理。
 * 桌面为地球/城市双栏，760px 以下切换纵向布局和折叠菜单。
 * 城市列表、选择弹层、时区提示各自滚动，必须保留 min-height:0 和独立滚动槽。
 * 地球标签是长期保留的 DOM 图层：transform 更新位置，opacity 控制显隐。
 * 国家/城市标签背景保持透明；首都、选中、悬停样式需要注意选择器优先级。
 * 搜索型选择器用输入框+按钮，原生选择器用背景 SVG，两者共用箭头变量。
 * 生成的地图坐标与第三方库不在此处维护。
 */
:root {
  color-scheme: dark;
  --bg: #080f1d;
  --panel: #0b1726;
  --line: #20374c;
  --muted: #91a9c2;
  --cyan: #51e2ec;
  --text: #e9f2ff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  background: radial-gradient(ellipse at 25% 25%, #102237 0, transparent 50%), var(--bg);
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  color: var(--text);
}

header {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 65px;
  padding: 0 max(28px, calc((100vw - 1440px) / 2));
  border-bottom: 1px solid var(--line);
  background: #080f1def;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

a {
  color: inherit;
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 23px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-logo {
  display: block;
  flex: none;
  width: 36px;
  height: 36px;
}

nav {
  display: flex;
  gap: 35px;
  height: 100%;
  align-items: center;
}

nav a {
  color: var(--muted);
  height: 100%;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
}

nav a:hover,
nav a.active {
  color: var(--cyan);
  border-color: var(--cyan);
}

.badge {
  margin-left: auto;
  color: #72edb6;
  background: #103129;
  padding: 7px 13px;
  border-radius: 30px;
  font-size: 12px;
  white-space: nowrap;
}

main {
  max-width: 1500px;
  padding: 0 30px;
  margin: auto;
}

.eyebrow {
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 2px;
  margin: 0 0 12px;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(135deg, #0d1c2cbb, #09131fd9);
}

h2 {
  font-size: 20px;
  margin: 0;
}

p {
  line-height: 1.7;
}

.globe-panel {
  position: relative;
  min-height: 590px;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #12324980, transparent 68%), #07121f;
}

.panel-title {
  position: absolute;
  left: 23px;
  top: 24px;
  display: flex;
  gap: 20px;
  align-items: center;
  pointer-events: none;
}

.live {
  color: #8de8b5;
  font-size: 12px;
}

#globe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 590px;
  touch-action: none;
  cursor: grab;
}

#globe:active {
  cursor: grabbing;
}

.globe-bottom {
  position: absolute;
  bottom: 18px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.globe-bottom button {
  border-radius: 20px;
  padding: 7px 13px;
}

.tooltip {
  position: absolute;
  pointer-events: none;
  border: 1px solid var(--cyan);
  background: #0b2134ee;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  z-index: 2;
}

.cities-panel {
  padding: 20px;

  display: flex;
  flex-direction: column;
}

.search {
  display: flex;
  align-items: center;

  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 26px;
  color: var(--muted);
}

.search input {
  background: transparent;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin: 22px 0 15px;
}

.city-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  overflow: auto;
  padding: 2px;
}

.city-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #10203366;
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.city-card.selected {
  border-color: var(--cyan);
  background: linear-gradient(120deg, #0b3038, #0c1e2e);
}

.city-card:hover {
  border-color: #468098;
}

.city-card h3 {
  font-size: 19px;
  margin: 0 0 4px;
}

.city-card .english {
  font-size: 12px;
  color: #8cc7dc;
}

.clock {
  font-size: clamp(24px, 2.4vw, 36px);
  font-weight: 600;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  margin: 12px 0 8px;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #acc0d5;
  flex-wrap: wrap;
}

.star {
  position: absolute;
  right: 10px;
  top: 10px;
  border: 0;
  padding: 4px;
  color: var(--cyan);
  font-size: 19px;
  background: transparent;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button,
select,
input {
  border: 1px solid var(--line);
  background: #101f30;
  border-radius: 7px;
  padding: 10px 12px;
}

button {
  cursor: pointer;
}

button:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

input::placeholder {
  color: #8399b0;
}

.primary {
  background: var(--cyan);
  color: #06252c;
  border: 0;
  font-weight: 600;
  padding: 13px 23px;
}

.primary:hover {
  color: #06252c;
  background: #8af4fa;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

#searchCount {
  margin: 0 0 6px;
}

.workspace {
  padding: 30px;
  margin: 0 0 26px;
}

.workspace > .section-heading {
  margin-top: 0;
}

.workspace > h2 {
  margin-bottom: 20px;
}

.zone-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.zone-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  min-width: 0;
}

.zone-card strong {
  color: var(--cyan);
  font-size: 13px;
}

.zone-time {
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  margin: 9px 0;
}

.zone-card p {
  margin: 3px 0;
  font-size: 11px;
  color: var(--muted);
}

.form-row {
  gap: 18px;
  margin: 20px 0;
  flex-wrap: wrap;
}

label:not(.search) {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 13px;
  color: #b4c9df;
}

.form-row label {
  flex: 1;
}

label.small {
  flex-direction: row;
  align-items: center;
}

select {
  max-width: 100%;
  min-width: 0;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.result-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  position: relative;
}

.result-card h3 {
  font-size: 16px;
  margin: 0 0 10px;
}

.result-card .time {
  font-size: 27px;
  font-variant-numeric: tabular-nums;
}

.result-card p {
  color: var(--muted);
  font-size: 12px;
  margin: 5px 0;
}

.remove {
  position: absolute;
  right: 8px;
  top: 8px;
  border: 0;
  background: transparent;
  padding: 3px 8px;
  color: var(--muted);
}

.error {
  color: #ffa6a6;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 25px 0 40px;
  line-height: 2;
}

footer span {
  font-size: 11px;
  color: #617a93;
}

#ambiguity button {
  margin: 5px;
}

#globeFallback {
  padding: 100px 30px;
}

.empty {
  color: var(--muted);
  grid-column: 1/-1;
  padding: 25px 10px;
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

@media (min-width: 1400px) {
  .city-card {
    padding: 20px;
  }

  .clock {
    margin: 16px 0;
  }
}

@media (max-width: 1050px) {
  header {
    gap: 25px;
    padding: 0 20px;
  }

  nav {
    gap: 20px;
  }

  .hero {
    grid-template-columns: 1fr 1fr;
  }

  .globe-panel,
  #globe {
    min-height: 550px;
  }

  .clock {
    font-size: 25px;
  }

  .city-card {
    padding: 13px;
  }

  .zone-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 760px) {
  header {
    height: auto;
    min-height: 68px;
    flex-wrap: wrap;
    gap: 0;
    padding: 12px 18px;
  }

  .brand {
    font-size: 19px;
  }

  .badge {
    font-size: 10px;
  }

  nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 0;
    margin-top: 14px;
    font-size: 13px;
  }

  nav a {
    padding-bottom: 10px;
  }

  main {
    padding: 0 15px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .globe-panel,
  #globe {
    min-height: 410px;
    height: 410px;
  }

  .cities-panel {
    max-height: 620px;
    padding: 15px;
  }

  .city-card {
    padding: 18px;
  }

  .clock {
    font-size: 30px;
  }

  .workspace {
    padding: 20px 16px;
  }

  .zone-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-heading h2 {
    font-size: 18px;
  }

  .form-row {
    gap: 12px;
  }

  .form-row button {
    width: 100%;
  }

  .globe-bottom {
    font-size: 10px;
    left: 12px;
    right: 12px;
  }

  .globe-bottom button {
    padding: 7px 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

:root .search input {
  font-size: 16px;
}

.city-grid {
  grid-auto-rows: 143px;
  min-height: 0;
}

.city-card {
  padding: 15px 17px;
}

.city-card .clock {
  font-size: 32px;
  margin: 10px 0 8px;
  line-height: 1.25;
}

.city-card .card-meta {
  font-size: 11px;
}

.cities-panel .section-heading {
  margin: 18px 0 12px;
}

.city-card .english {
  max-width: 85%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city-card h3 {
  max-width: 85%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .city-card .clock {
    font-size: clamp(21px, 6.3vw, 30px);
  }
}

:root .globe-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  contain: layout style;
  z-index: 1;
}

.globe-label {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  pointer-events: none;
}

.globe-label-content {
  display: block;
  opacity: 0;
  transition: opacity 180ms ease;
  will-change: opacity;
}

.globe-label.visible .globe-label-content {
  opacity: 1;
}

.globe-label-text {
  position: absolute;
  white-space: nowrap;
  font:
    12px/22px 'Segoe UI',
    'Microsoft YaHei',
    sans-serif;
  pointer-events: none;
}

.globe-country .globe-label-text {
  color: #b7d8dd;
  transform: translate(-50%, -50%);
  text-shadow: 0 1px 3px #061421;
}

.globe-city .globe-label-text {
  color: #d8f7fa;
  background: #071726c9;
  border-radius: 3px;
}

.globe-city-dot {
  position: absolute;

  border-radius: 50%;
  background: #63f3e8;
}

.globe-city.selected .globe-city-dot {
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  background: #ffdb7a;
  box-shadow: 0 0 12px #ffdb7a88;
}

.globe-panel .panel-title,
.globe-panel .globe-bottom {
  z-index: 3;
}

.globe-panel .tooltip {
  z-index: 4;
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .globe-label-content {
    transition: none;
  }
}

/* Form controls share one border box and one focus treatment. */
.search {
  height: 50px;
  min-height: 50px;
  flex-shrink: 0;
  gap: 10px;
  background: #101f30;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.search:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px #51e2ec20;
}

.search input {
  flex: 1;
  width: 0;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  line-height: normal;
}

.search input:focus,
.search input:focus-visible {
  outline: none;
  box-shadow: none;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
}

.form-row label {
  min-width: 0;
  gap: 9px;
}

.workspace input:not([type='checkbox']),
.workspace select,
.form-row > .primary {
  width: 100%;
  height: 48px;
  min-height: 48px;
  margin: 0;
  border-radius: 8px;
  font-size: 14px;
  line-height: normal;
}

.workspace input:not([type='checkbox']),
.workspace select {
  padding: 0 14px;
  border: 1px solid var(--line);
}

.form-row > .primary {
  width: auto;
  padding: 0 23px;
  border: 1px solid transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.workspace input::-webkit-datetime-edit {
  padding: 0;
}

.workspace input::-webkit-calendar-picker-indicator {
  margin: 0;
  padding: 4px;
  opacity: 0.8;
  cursor: pointer;
}

@media (max-width: 760px) {
  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-row > .primary {
    width: 100%;
  }

  .workspace input:not([type='checkbox']),
  .workspace select {
    font-size: 16px;
  }
}

.rotation-status {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  color: #80dbb0;
  font-size: 11px;
  white-space: nowrap;
}

.globe-bottom > div {
  display: flex;
  align-items: center;
  gap: 4px;
}

.globe-city .globe-label-text {
  font-size: 11px;
  line-height: 18px;
  left: 7px;
  top: -10px;
  padding: 0 4px;
}

.globe-country .globe-label-text {
  font-size: 11px;
  line-height: 18px;
}

.globe-city-dot {
  width: 4px;
  height: 4px;
  left: -2px;
  top: -2px;
  box-shadow: 0 0 4px #63f3e855;
}

.globe-city.capital .globe-city-dot {
  width: 5px;
  height: 5px;
  left: -2.5px;
  top: -2.5px;
  background: #9df2e6;
}

.globe-city.hovered .globe-city-dot {
  width: 9px;
  height: 9px;
  left: -4.5px;
  top: -4.5px;
  background: #fff0a4;
  box-shadow: 0 0 14px #ffe08099;
}

.globe-label.hovered .globe-label-text {
  color: #fff3bb;
  background: #163e4df2;

  border-radius: 3px;
}

.globe-hover-tip {
  z-index: 6 !important;
  width: 245px;
  max-width: calc(100% - 20px);
  box-shadow: 0 8px 25px #0005;
}

.globe-panel .tooltip strong {
  display: block;
  color: var(--cyan);
  font-size: 14px;
  margin-bottom: 5px;
}

.globe-panel .tooltip div {
  line-height: 1.65;
}

.globe-panel .tooltip small {
  display: block;
  color: #adc6dc;
  font-size: 11px;
  line-height: 1.7;
}

.globe-panel #cityTooltip {
  max-width: calc(100% - 36px);
  box-shadow: 0 6px 20px #0004;
}

.globe-bottom > span {
  max-width: 60%;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .globe-bottom > span {
    max-width: 47%;
    font-size: 9px;
  }

  .rotation-status {
    font-size: 10px;
    padding: 6px;
  }

  .globe-country .globe-label-text {
    font-size: 10px;
  }
}

.globe-label-text {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.globe-country .globe-label-text,
.globe-country.hovered .globe-label-text {
  color: #a9d9ed;
}

.globe-city .globe-label-text,
.globe-city.selected .globe-label-text,
.globe-city.hovered .globe-label-text {
  color: #c3e9df;
}

.globe-label .globe-label-text,
.globe-label.hovered .globe-label-text {
  background: transparent;
  background-image: none;
  box-shadow: none;
  text-shadow: 0 1px 3px #03101dcc;
}

.globe-label.hovered .globe-label-text {
  text-shadow:
    0 0 7px currentColor,
    0 1px 3px #03101d;
}

.zone-id {
  font-size: 11px;
  line-height: 1.4;
  color: #8bbbc9;
  overflow-wrap: anywhere;
}

.cities-panel {
  max-height: 740px;
}

.zone-card .zone-id {
  color: #8bbbc9;
}

.globe-panel .tooltip small {
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .cities-panel {
    max-height: 720px;
  }
}

.zone-name-hint {
  position: relative;
  display: inline-block;
  margin-top: 7px;
}

.zone-name-trigger {
  padding: 3px 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #8bbbc9;
  font-size: 11px;
}

.zone-name-trigger:hover,
.zone-name-trigger:focus-visible {
  color: var(--cyan);
}

.zone-name-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  width: 320px;
  max-width: calc(100vw - 24px);
  padding: 12px 14px;
  border: 1px solid #375c70;
  border-radius: 8px;
  background: #102437;
  box-shadow: 0 8px 24px #0006;
  line-height: 1.8;
  overflow: hidden;
  pointer-events: auto;
}

.zone-name-heading {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--cyan);
  padding-bottom: 7px;
}

.zone-name-list {
  min-height: 0;
  overflow-y: auto;
  white-space: pre-line;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 6px;
}

.zone-name-scroll-hint {
  flex-shrink: 0;
  padding-top: 7px;
  margin-top: 5px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--muted);
}

.zone-name-tooltip[hidden] {
  display: none;
}

.globe-city .globe-label-text {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.globe-place-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.globe-capital-star {
  flex: none;
  color: inherit;
  font-size: 10px;
}

#home {
  padding-top: 24px;
  margin-bottom: 28px;
}

.search .search-clear {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 23px;
  line-height: 1;
}

.search .search-clear:hover {
  color: var(--cyan);
  background: #51e2ec12;
}

.search .search-clear[hidden] {
  display: none;
}

.city-picker {
  position: relative;
  width: 100%;
  min-width: 0;
}

.workspace .city-picker input {
  text-overflow: ellipsis;
  scroll-margin: 100px 16px;
}

.city-picker .city-picker-toggle {
  position: absolute;

  top: 50%;
  transform: translateY(-50%);

  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.city-picker-options {
  position: fixed;
  z-index: 1001;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;

  border: 1px solid #375c70;
  border-radius: 9px;
  background: #102033;
  box-shadow: 0 10px 30px #0007;
}

.city-picker-options[hidden] {
  display: none;
}

.city-picker-option {
  padding: 10px 12px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.city-picker-option small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.city-picker-option.active,
.city-picker-option:hover {
  background: #173b48;
  color: #a4f5ef;
}

.city-picker-empty {
  padding: 15px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

@media (min-width: 761px) {
  .hero {
    height: clamp(520px, calc(100svh - 124px), 740px);
  }

  .hero .globe-panel,
  .hero #globe {
    min-height: 0;
    height: 100%;
  }

  .hero .cities-panel {
    min-height: 0;
    height: 100%;
    max-height: none;
  }
}

@media (max-width: 760px) {
  #home {
    padding-top: 16px;
    margin-bottom: 20px;
  }
}

/* Let card contents determine row height; reserve a separate scrollbar lane. */
.cities-panel {
  min-height: 0;
}

.cities-panel > .search,
.cities-panel > .section-heading,
.cities-panel > #searchCount {
  flex-shrink: 0;
}

:root .city-grid {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 3px 10px 10px 3px;
  scrollbar-gutter: stable;
  scroll-padding-block: 6px;
  overscroll-behavior: contain;
}

.city-grid .city-card {
  display: flex;
  flex-direction: column;
  min-height: 174px;
  height: auto;
  padding: 16px;
}

.city-card > h3,
.city-card > .english,
.city-card > .clock,
.city-card > .card-meta,
.city-card > .zone-id {
  flex-shrink: 0;
}

.city-card > h3 {
  line-height: 1.4;
}

.city-card > .english {
  line-height: 1.5;
}

.city-card > .card-meta {
  line-height: 1.6;
  row-gap: 3px;
}

.city-card > .zone-id {
  margin-top: 7px;
  line-height: 1.5;
}

.city-picker-options {
  scrollbar-gutter: stable;
  padding: 6px 10px 6px 6px;
}

html,
.city-grid,
.city-picker-options,
.zone-name-list {
  scrollbar-width: thin;
  scrollbar-color: #496d80 #0b1827;
}

html {
  scrollbar-gutter: stable;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: #0b1827;
  border-radius: 8px;
}

::-webkit-scrollbar-thumb {
  background: #496d80;
  border: 2px solid #0b1827;
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6bafbd;
}

::-webkit-scrollbar-corner {
  background: #0b1827;
}

.zone-name-list::-webkit-scrollbar {
  width: 9px;
}

.zone-name-list::-webkit-scrollbar-thumb {
  background: #496d80;
  border: 2px solid #0b1827;
  border-radius: 8px;
}

.city-card .region-detail-link {
  align-self: flex-start;
  margin-top: 10px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-size: 12px;
}

.city-card .city-country {
  margin-top: 5px;
  color: #a9d9ed;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  flex-shrink: 0;
}

.shift-description {
  margin-bottom: 24px;
  line-height: 1.7;
}

.shift-base-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.shift-base-grid > *,
.shift-base-field,
.shift-base-control > input {
  min-width: 0;
}

.shift-base-field > label {
  margin-bottom: 9px;
}

.shift-base-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

#shiftNow {
  padding: 0 16px;
  white-space: nowrap;
  border-color: #315369;
  color: #bde6ed;
}

.shift-duration-group {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #10213180;
}

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

.shift-amounts input {
  width: 100%;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

/* 保留 number 语义与方向键行为，使用统一控件替代各浏览器的原生小箭头。 */
input[type='number'] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.number-stepper {
  position: relative;
  min-width: 0;
}

#shift .number-stepper input {
  padding-right: 48px;
}

.number-stepper-actions {
  position: absolute;
  top: 1px;
  bottom: 1px;
  right: 1px;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  width: 36px;
  border-left: 1px solid var(--line);
  border-radius: 0 6px 6px 0;
  overflow: hidden;
  background: #162b3d;
}

.number-stepper-button {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  touch-action: manipulation;
}

.number-stepper-button + .number-stepper-button {
  border-top: 1px solid var(--line);
}

.number-stepper-button span {
  width: 16px;
  height: 16px;
  background: var(--select-chevron) center / 16px no-repeat;
}

.number-stepper-up span {
  transform: rotate(180deg);
}

.number-stepper-button:hover,
.number-stepper-button:focus-visible {
  background: #24495b;
}

.number-stepper-button:hover span,
.number-stepper-button:focus-visible span {
  background-image: var(--select-chevron-active);
}

.number-stepper-button:active {
  background: #306375;
}

.number-stepper-button:focus-visible {
  outline-offset: -3px;
}

#shift .shift-amounts input {
  height: 56px;
  font-size: 22px;
  padding: 12px 16px;
}

.shift-amount-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.shift-amount-toolbar h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.shift-amount-toolbar h3 span {
  margin-left: 12px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.shift-amount-toolbar button {
  padding: 7px 10px;
  font-size: 12px;
  background: transparent;
  white-space: nowrap;
}

.shift-duration-hint,
.shift-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.shift-duration-hint {
  margin: 14px 0 0;
}

.shift-actions {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 180px;
  align-items: end;
  justify-content: end;
  gap: 16px;
  margin-top: 24px;
}

.shift-actions .primary {
  height: 48px;
}

/* PC 端主要操作使用统一宽度；手机端仍沿用各工具的自适应布局。 */
@media (min-width: 761px) {
  :root {
    --action-button-width: 180px;
  }

  #convertNow,
  #shiftNow,
  #shiftForm button[type='submit'],
  #reverseNow {
    width: var(--action-button-width);
    min-width: var(--action-button-width);
    padding-inline: 16px;
  }

  .shift-actions {
    grid-template-columns: minmax(220px, 320px) var(--action-button-width);
  }
}

.shift-note {
  margin: 18px 0 0;
}

#shiftAmbiguity:not(:empty),
#shiftResult:not(:empty) {
  margin-top: 20px;
}

@media (max-width: 900px) {
  .shift-base-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
}

@media (max-width: 760px) {
  .shift-duration-group {
    padding: 16px;
  }
  .shift-amount-toolbar h3 span {
    display: block;
    margin: 5px 0 0;
    font-size: 11px;
  }
  .shift-actions {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-top: 20px;
  }
  #shiftNow {
    padding: 0 12px;
    font-size: 13px;
  }
  #shift .shift-amounts input {
    height: 52px;
  }
}

#shiftResult:empty,
#shiftAmbiguity:empty {
  display: none;
}

.shift-result {
  padding: 20px;
  border: 1px solid #386d76;
  border-radius: 10px;
  background: #102733;
  overflow-wrap: anywhere;
}

.shift-result h3 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--muted);
}

.shift-result p {
  color: #aff4ed;
  font-size: clamp(19px, 3vw, 28px);
  font-variant-numeric: tabular-nums;
  margin: 10px 0;
}

.shift-result small {
  display: block;
  line-height: 1.9;
  color: var(--muted);
}

#shiftAmbiguity button {
  margin: 0 8px 12px 0;
  white-space: normal;
  text-align: left;
}

#shiftAmbiguity button[aria-pressed='true'] {
  border-color: var(--cyan);
  color: var(--cyan);
}

@media (max-width: 760px) {
  header nav {
    overflow-x: auto;
    justify-content: flex-start;
    white-space: nowrap;
    scrollbar-width: thin;
  }

  header nav a {
    flex-shrink: 0;
  }

  .shift-amounts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

.globe-city.selected .globe-city-dot,
.globe-city.capital.selected .globe-city-dot {
  width: 9px;
  height: 9px;
  left: -4.5px;
  top: -4.5px;
  background: #ffdb7a;
  box-shadow: 0 0 14px #ffdb7aaa;
}

.globe-city.selected .globe-label-text {
  color: #fff1bf;
  background: transparent;
  text-shadow:
    0 0 7px #ffdb7a77,
    0 1px 3px #03101d;
}

#regionDetails {
  scroll-margin-top: 100px;
}

.region-selector {
  width: min(100%, 390px);
  font-size: 12px;
  color: var(--muted);
}

.region-summary {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0e2130;
}

.region-clock {
  margin-top: 10px;
  color: #aff4ed;
  font-size: clamp(32px, 5vw, 56px);
  font-variant-numeric: tabular-nums;
}

.region-date {
  color: var(--muted);
  margin-bottom: 0;
}

.region-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  align-content: center;
}

.region-facts dt {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
}

.region-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.region-guide {
  line-height: 1.9;
  color: #b6cddd;
}

.region-guide h3 {
  color: var(--text);
  margin: 26px 0 8px;
  font-size: 17px;
}

.region-guide p {
  margin: 8px 0 16px;
}

.region-changes {
  padding-left: 22px;
  overflow-wrap: anywhere;
}

.region-related {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.region-related button {
  white-space: normal;
  text-align: left;
  overflow-wrap: anywhere;
}

.region-related button[aria-pressed='true'] {
  border-color: var(--cyan);
  color: var(--cyan);
}

.region-guide details {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.region-guide summary {
  cursor: pointer;
  color: var(--text);
}

/* Shared chevron for native and searchable selectors. */
:root {
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%2391a9c2' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --select-chevron-active: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%2351e2ec' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.workspace select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
  cursor: pointer;
}

.workspace select:hover,
.workspace select:focus-visible {
  background-image: var(--select-chevron-active);
}

.city-picker .city-picker-toggle {
  right: 8px;
  width: 28px;
  height: 28px;
  font-size: 0;
  border-radius: 5px;
}

.city-picker .city-picker-toggle::after {
  content: '';
  display: block;
  width: 16px;
  height: 16px;
  margin: auto;
  background: var(--select-chevron) center / 16px 16px no-repeat;
  transition: transform 150ms ease;
}

.city-picker:hover .city-picker-toggle::after,
.city-picker:focus-within .city-picker-toggle::after {
  background-image: var(--select-chevron-active);
}

.city-picker:has(input[aria-expanded='true']) .city-picker-toggle::after {
  transform: rotate(180deg);
}

.workspace .city-picker input {
  padding-right: 44px;
}

@media (prefers-reduced-motion: reduce) {
  .city-picker .city-picker-toggle::after {
    transition: none;
  }
}

.mobile-nav-toggle {
  display: none;
}

@media (max-width: 760px) {
  header {
    height: 68px;
    min-height: 68px;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
  }

  header .badge {
    display: none;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 9px 12px;
    color: var(--cyan);
    font-size: 13px;
    background: #102333;
    border: 1px solid #2a4b60;
    border-radius: 9px;
  }

  .mobile-nav-icon {
    display: block;
    width: 16px;
    height: 16px;
    background: var(--select-chevron-active) center/16px no-repeat;
    transition: transform 150ms ease;
  }

  header.nav-open .mobile-nav-icon {
    transform: rotate(180deg);
  }

  header nav {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 12px;
    right: 12px;
    width: auto;
    height: auto;
    margin: 0;
    padding: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    white-space: normal;
    border: 1px solid #2a4b60;
    border-radius: 12px;
    background: #0d1c2b;
    box-shadow: 0 14px 35px #0008;
  }

  header.nav-open nav {
    display: grid;
  }

  header nav a {
    min-height: 46px;
    height: auto;
    justify-content: center;
    padding: 12px 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #b4c9df;
    font-size: 14px;
  }

  header nav a.active {
    color: var(--cyan);
    border-color: #356574;
    background: #153a46;
  }

  header nav a:hover {
    background: #15303f;
    border-color: #356574;
  }

  #regionDetails {
    scroll-margin-top: 90px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav-icon {
    transition: none;
  }
}

@media (max-width: 760px) {
  #regionDetails > .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .region-selector {
    width: 100%;
  }

  .region-summary {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  #regionDetails {
    scroll-margin-top: 130px;
  }

  header nav {
    gap: 16px;
  }
}
