/* Core shell: boot screen, theme dock, toast, theme transition. Themes style everything else. */

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.theme-root { min-height: 100vh; }

.core-info {
  position: relative;
  z-index: 2;
  padding: 28px 24px 100px;
  border-top: 1px solid rgba(127, 127, 127, .22);
  background: #f3f4f6;
  color: #495266;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}
.core-info nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 24px; }
.core-info a { color: inherit; text-underline-offset: 4px; }
.core-info p { margin: 14px 0 0; }
html[data-scheme="dark"] .core-info { background: #10131b; color: #bac2d0; }

.core-skip {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  font-size: 14px;
  text-decoration: none;
}
.core-skip:focus { top: 12px; }

.core-boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}
.core-boot img {
  border-radius: 14px;
  animation: core-breathe 1.4s ease-in-out infinite;
}
@keyframes core-breathe {
  50% { transform: scale(.92); opacity: .6; }
}

.core-noscript {
  max-width: 560px;
  margin: 80px auto;
  padding: 0 24px;
  color: #1f2937;
  line-height: 1.7;
}

/* ---------- theme dock ---------- */

.core-dock {
  --dock-bg: rgba(20, 22, 30, .78);
  --dock-ink: #f5f6f8;
  --dock-muted: rgba(245, 246, 248, .62);
  --dock-line: rgba(255, 255, 255, .12);
  --dock-hover: rgba(255, 255, 255, .08);
  position: fixed;
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom) + var(--dock-lift, 0px));
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  font-family: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  transition: bottom .3s ease;
}
html[data-scheme="light"] .core-dock {
  --dock-bg: rgba(255, 255, 255, .82);
  --dock-ink: #111827;
  --dock-muted: rgba(17, 24, 39, .58);
  --dock-line: rgba(17, 24, 39, .1);
  --dock-hover: rgba(17, 24, 39, .05);
}

.core-dock-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px 0 14px;
  border: 1px solid var(--dock-line);
  border-radius: 999px;
  background: var(--dock-bg);
  color: var(--dock-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .45);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}
.core-dock-toggle:hover { transform: translateY(-2px); }
.core-dock-toggle:focus-visible,
.core-theme-option:focus-visible { outline: 2px solid #8ab4ff; outline-offset: 2px; }
.core-dock-icon { width: 20px; height: 20px; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.core-dock.is-open .core-dock-icon { transform: rotate(-120deg); }

/* First-visit hint: rotating colour ring on the button plus a bubble that cycles through themes. */
.core-dock-toggle { position: relative; isolation: isolate; }
.core-dock.is-hinting .core-dock-toggle::before {
  content: "";
  position: absolute;
  inset: -3px;
  z-index: -1;
  border-radius: inherit;
  background: conic-gradient(from var(--hint-angle), var(--hint-stops));
  animation: core-spin 2.4s linear infinite;
}
.core-dock.is-hinting .core-dock-toggle::after {
  content: "";
  position: absolute;
  inset: -3px;
  z-index: -2;
  border-radius: inherit;
  background: conic-gradient(from var(--hint-angle), var(--hint-stops));
  filter: blur(14px);
  opacity: .7;
  animation: core-spin 2.4s linear infinite, core-glow 1.6s ease-in-out infinite alternate;
}
.core-dock.is-hinting .core-dock-icon { animation: core-wiggle 2.4s ease-in-out infinite; }
@property --hint-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes core-spin { to { --hint-angle: 360deg; } }
@keyframes core-glow { from { opacity: .35; transform: scale(.96); } to { opacity: .85; transform: scale(1.12); } }
@keyframes core-wiggle {
  0%, 70%, 100% { transform: rotate(0); }
  76% { transform: rotate(-18deg); }
  84% { transform: rotate(14deg); }
  92% { transform: rotate(-8deg); }
}

/* Centred theme hint, shown on every page load */
.core-hint-layer {
  --hint-accent: #8ab4ff;
  position: fixed;
  inset: 0;
  z-index: 960;
  display: grid;
  place-items: center;
  padding: 24px;
  font-family: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
}
.core-hint-layer[hidden] { display: none; }
.core-hint-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 60% at 50% 50%, rgba(10, 12, 20, .35), rgba(10, 12, 20, .62));
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  animation: core-fade .4s ease both;
}
.core-hint-layer.is-leaving .core-hint-backdrop { animation: core-fade-out .5s ease forwards; }
@keyframes core-fade { from { opacity: 0; } }
@keyframes core-fade-out { to { opacity: 0; } }

.core-hint-card {
  --dock-bg: rgba(255, 255, 255, .9);
  --dock-ink: #111827;
  --dock-muted: rgba(17, 24, 39, .58);
  --dock-line: rgba(17, 24, 39, .1);
  --dock-hover: rgba(17, 24, 39, .05);
  position: relative;
  width: min(560px, 100%);
  padding: 30px 30px 24px;
  overflow: hidden;
  border-radius: 28px;
  background: var(--dock-bg);
  color: var(--dock-ink);
  box-shadow: 0 0 0 1px var(--dock-line), 0 40px 120px -30px rgba(0, 0, 0, .65), 0 0 90px -30px var(--hint-accent);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  animation: core-card-in .7s cubic-bezier(.2, .9, .2, 1.15) both;
  transition: box-shadow .5s ease;
  isolation: isolate;
  will-change: transform, opacity;
}
html[data-scheme="dark"] .core-hint-card {
  --dock-bg: rgba(22, 24, 34, .88);
  --dock-ink: #f5f6f8;
  --dock-muted: rgba(245, 246, 248, .62);
  --dock-line: rgba(255, 255, 255, .12);
  --dock-hover: rgba(255, 255, 255, .08);
}
/* A slow colour wash behind the content, tinted by the theme being previewed */
.core-hint-card::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto;
  height: 120%;
  z-index: -1;
  background: radial-gradient(50% 50% at 50% 50%, color-mix(in srgb, var(--hint-accent) 32%, transparent), transparent 70%);
  animation: core-wash 6s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes core-wash { to { transform: translate(8%, 6%) scale(1.1); } }
@keyframes core-card-in { from { opacity: 0; transform: translateY(26px) scale(.92); } }

.core-hint-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--dock-hover);
  color: var(--dock-muted);
  cursor: pointer;
}
.core-hint-close:hover { color: var(--dock-ink); }
.core-hint-close .icon { width: 16px; height: 16px; }

.core-hint-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 5px 12px 5px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hint-accent) 16%, transparent);
  color: color-mix(in srgb, var(--hint-accent) 70%, var(--dock-ink));
  font-size: 13px;
  font-weight: 700;
  transition: background-color .5s ease, color .5s ease;
}
.core-hint-kicker .icon { width: 18px; height: 18px; animation: core-wiggle 2.4s ease-in-out infinite; }
.core-hint-title { margin: 14px 0 0; font-size: clamp(22px, 4vw, 28px); line-height: 1.25; font-weight: 800; letter-spacing: -.01em; }
.core-hint-line { display: grid; gap: 2px; min-height: 48px; margin: 10px 0 18px; }
.core-hint-name { color: color-mix(in srgb, var(--hint-accent) 75%, var(--dock-ink)); font-size: 16px; transition: color .4s ease; }
.core-hint-desc { color: var(--dock-muted); font-size: 14px; line-height: 1.55; }

.core-hint-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.core-hint-tile {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 8px 8px 10px;
  border: 0;
  border-radius: 16px;
  background: var(--dock-hover);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  animation: core-tile-in .5s cubic-bezier(.2, .9, .3, 1.3) both;
  animation-delay: calc(.18s + var(--i) * 45ms);
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), box-shadow .25s ease, background-color .25s ease;
}
@keyframes core-tile-in { from { opacity: 0; transform: translateY(12px) scale(.9); } }
.core-hint-swatch {
  position: relative;
  display: block;
  height: 54px;
  overflow: hidden;
  border-radius: 11px;
  background: var(--hc-a);
  box-shadow: inset 0 0 0 1px var(--dock-line);
}
.core-hint-swatch i { position: absolute; border-radius: 50%; }
.core-hint-swatch i:nth-child(1) { width: 34px; height: 34px; left: 10%; top: 18%; background: var(--hc-b); }
.core-hint-swatch i:nth-child(2) { width: 18px; height: 18px; right: 12%; bottom: 14%; background: var(--hc-c); }
.core-hint-swatch i:nth-child(3) { inset: auto 0 0; height: 30%; border-radius: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--hc-c) 30%, transparent)); }
.core-hint-tile-name { padding-left: 2px; font-size: 13px; font-weight: 700; }
.core-hint-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  display: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}
.core-hint-tile.is-current .core-hint-tag { display: block; }
.core-hint-tile:hover, .core-hint-tile.is-on {
  transform: translateY(-4px);
  background: color-mix(in srgb, var(--hc-c) 14%, var(--dock-hover));
  box-shadow: 0 0 0 2px var(--hc-c), 0 14px 30px -14px var(--hc-c);
}
.core-hint-tile:focus-visible { outline: 2px solid #8ab4ff; outline-offset: 2px; }

.core-hint-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 22px; }
.core-hint-primary {
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--dock-ink);
  color: var(--dock-bg);
  font: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
}
.core-hint-primary:focus-visible { outline: 2px solid #8ab4ff; outline-offset: 3px; }
.core-hint-foot { color: var(--dock-muted); font-size: 13px; }

/* Countdown bar along the bottom edge; pauses while the pointer is on the card */
.core-hint-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--dock-line); }
.core-hint-timer i {
  display: block;
  height: 100%;
  background: var(--hint-accent);
  transform-origin: left;
  animation: core-countdown var(--hint-ms) linear forwards;
  transition: background-color .4s ease;
}
.core-hint-layer.is-paused .core-hint-timer i { animation-play-state: paused; }
.core-hint-layer.is-sticky .core-hint-timer { display: none; }
@keyframes core-countdown { to { transform: scaleX(0); } }

/* The theme button bumps when the card lands in it */
.core-dock-toggle.is-landed { animation: core-land .6s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes core-land { 30% { transform: scale(1.22); } 60% { transform: scale(.94); } }

@media (max-width: 680px) {
  .core-hint-layer { padding: 16px; }
  .core-hint-card { padding: 24px 18px 20px; border-radius: 24px; }
  .core-hint-grid { gap: 7px; }
  .core-hint-tile { padding: 6px 6px 8px; border-radius: 13px; }
  .core-hint-swatch { height: 40px; border-radius: 9px; }
  .core-hint-swatch i:nth-child(1) { width: 24px; height: 24px; }
  .core-hint-swatch i:nth-child(2) { width: 12px; height: 12px; }
  .core-hint-tile-name { padding: 0; font-size: 11.5px; text-align: center; }
  .core-hint-tag { top: 8px; left: 8px; font-size: 9.5px; }
  .core-hint-actions { flex-direction: column; align-items: stretch; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .core-hint-card, .core-hint-card::before, .core-hint-backdrop, .core-hint-tile, .core-hint-kicker .icon, .core-dock-toggle.is-landed { animation: none; }
  .core-hint-tile { transition: none; }
  .core-hint-timer i { animation-duration: var(--hint-ms); }
}


.core-theme-panel {
  width: min(340px, calc(100vw - 40px));
  padding: 14px;
  border: 1px solid var(--dock-line);
  border-radius: 22px;
  background: var(--dock-bg);
  color: var(--dock-ink);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .55);
  transform-origin: bottom right;
  animation: core-pop .32s cubic-bezier(.2, .9, .25, 1.15);
}
.core-theme-panel[hidden] { display: none; }
@keyframes core-pop {
  from { opacity: 0; transform: translateY(10px) scale(.94); }
}

.core-theme-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 8px 10px;
}
.core-theme-head p { margin: 0; font-size: 15px; font-weight: 700; }
.core-theme-head span { color: var(--dock-muted); font-size: 12px; }

.core-theme-list { display: grid; gap: 4px; }

.core-theme-option {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s ease;
}
.core-theme-option:hover { background: var(--dock-hover); }
.core-theme-option.is-active { background: var(--dock-hover); }

.core-theme-swatch {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--a);
  box-shadow: inset 0 0 0 1px var(--dock-line);
}
.core-theme-swatch::before,
.core-theme-swatch::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.core-theme-swatch::before { width: 26px; height: 26px; left: 6px; top: 9px; background: var(--b); }
.core-theme-swatch::after { width: 14px; height: 14px; right: 6px; bottom: 6px; background: var(--c); }

.core-theme-text { display: grid; min-width: 0; }
.core-theme-text b { font-size: 14px; line-height: 1.4; }
.core-theme-text small {
  color: var(--dock-muted);
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.core-theme-check { width: 18px; height: 18px; opacity: 0; }
.core-theme-option.is-active .core-theme-check { opacity: 1; }

.core-theme-hint {
  margin: 10px 8px 4px;
  color: var(--dock-muted);
  font-size: 12px;
  line-height: 1.6;
}

/* ---------- toast ---------- */

.core-toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 950;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(17, 24, 39, .92);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.core-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- theme transition ---------- */

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-new(root) { z-index: 2; }

@media (max-width: 680px) {
  .core-dock-label { display: none; }
  .core-dock-toggle { width: 46px; padding: 0; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .core-boot img,
  .core-theme-panel,
  .core-dock.is-hinting .core-dock-icon,
  .core-dock.is-hinting .core-dock-toggle::before,
  .core-dock.is-hinting .core-dock-toggle::after { animation: none; }
  .core-dock-icon, .core-dock-toggle { transition: none; }
}
