:root {
  color-scheme: light;
  --page-a: #dceeff;
  --page-b: #f4f8fd;
  --page-c: #ffffff;
  --surface: rgba(255,255,255,.68);
  --surface-strong: rgba(255,255,255,.88);
  --surface-subtle: rgba(246,249,253,.8);
  --border: rgba(255,255,255,.78);
  --line: rgba(28,41,66,.1);
  --line-strong: rgba(28,41,66,.16);
  --text: #182033;
  --muted: #657087;
  --accent: #0969da;
  --accent-hover: #075cbf;
  --accent-soft: rgba(9,105,218,.1);
  --success: #14895e;
  --success-soft: rgba(20,137,94,.1);
  --shadow: 0 28px 90px rgba(50,73,112,.18), 0 8px 28px rgba(50,73,112,.1);
  --small-shadow: 0 10px 35px rgba(50,73,112,.11);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page-a: #10253a;
  --page-b: #0d1622;
  --page-c: #080d14;
  --surface: rgba(27,35,49,.72);
  --surface-strong: rgba(26,34,47,.9);
  --surface-subtle: rgba(35,44,59,.76);
  --border: rgba(255,255,255,.1);
  --line: rgba(217,228,247,.09);
  --line-strong: rgba(217,228,247,.17);
  --text: #f3f6fc;
  --muted: #a9b4c5;
  --accent: #60b2ff;
  --accent-hover: #8ac5ff;
  --accent-soft: rgba(96,178,255,.13);
  --success: #55d99f;
  --success-soft: rgba(85,217,159,.12);
  --shadow: 0 34px 100px rgba(0,0,0,.5), 0 10px 35px rgba(0,0,0,.28);
  --small-shadow: 0 12px 42px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: linear-gradient(135deg,var(--page-a),var(--page-b) 48%,var(--page-c));
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Noto Sans", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .55s ease, color .35s ease;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  opacity: .38;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb,var(--text) 10%,transparent) 1px, transparent 0);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom,black,transparent 78%);
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(4px); pointer-events: none; }
.ambient-one { width: 520px; height: 520px; right: -120px; top: -170px; background: radial-gradient(circle,rgba(64,145,255,.23),transparent 68%); }
.ambient-two { width: 480px; height: 480px; left: -170px; bottom: -210px; background: radial-gradient(circle,rgba(127,88,231,.16),transparent 70%); }

.top-controls { position: fixed; z-index: 20; top: max(20px,env(safe-area-inset-top)); right: max(22px,env(safe-area-inset-right)); display: flex; gap: 10px; }
.control-button {
  height: 42px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  backdrop-filter: blur(26px) saturate(145%);
  -webkit-backdrop-filter: blur(26px) saturate(145%);
  box-shadow: var(--small-shadow), inset 0 1px rgba(255,255,255,.22);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.control-button:hover { transform: translateY(-2px); background: var(--surface-strong); border-color: var(--line-strong); }
.control-button:active { transform: translateY(1px) scale(.94); background: var(--accent-soft); transition-duration: .05s; }
.theme-button { width: 42px; display: grid; place-items: center; border-radius: 13px; }
.theme-button svg { width: 20px; height: 20px; }
.sun-icon { display: none; }
html[data-theme="dark"] .sun-icon { display: block; }
html[data-theme="dark"] .moon-icon { display: none; }
.language-control { position: relative; }
.language-button { display: flex; align-items: center; gap: 8px; min-width: 142px; padding: 0 11px; border-radius: 13px; }
.language-button > svg { width: 19px; height: 19px; flex: none; }
.language-button .chevron { width: 15px; height: 15px; margin-left: auto; transition: transform .18s ease; }
.language-button[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.language-button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.language-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 224px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  box-shadow: var(--shadow);
  animation: menu-in .14s ease-out;
}
.language-menu[hidden] { display: none; }
.language-menu button { width: 100%; min-height: 40px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; border: 0; border-radius: 9px; color: var(--text); background: transparent; cursor: pointer; text-align: left; }
.language-menu button:hover, .language-menu button[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); }
.language-menu button:active { transform: scale(.97); transition: transform .05s ease; }
.language-menu button span:first-child { font-size: 13px; }
.language-menu button span:last-child { font-size: 15px; font-weight: 700; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-5px) scale(.98); } }

.page-shell { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: max(94px,calc(env(safe-area-inset-top) + 78px)) 20px max(42px,env(safe-area-inset-bottom)); }
.dialog {
  width: min(520px,100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  backdrop-filter: blur(38px) saturate(145%);
  -webkit-backdrop-filter: blur(38px) saturate(145%);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.2);
  animation: dialog-in .68s cubic-bezier(.16,1,.3,1);
}
@keyframes dialog-in { from { opacity: 0; transform: translateY(18px) scale(.95); } }
.dialog-content { padding: 34px 36px 35px; text-align: center; }
.ghost-wrap { position: relative; width: 112px; height: 112px; margin: 0 auto 12px; }
.little-ghost { position: relative; z-index: 2; width: 112px; height: 112px; object-fit: contain; filter: drop-shadow(0 12px 16px rgba(43,79,137,.13)); }
.ghost-halo { position: absolute; z-index: 1; inset: 18px; border-radius: 50%; background: var(--accent-soft); filter: blur(13px); }
h1 { margin: 16px 0 12px; font-size: 25px; line-height: 1.2; letter-spacing: -.035em; font-weight: 680; }
.message { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.72; text-align: left; }
.text-link { color: var(--accent); font-weight: 650; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.button-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0 18px; border-radius: 10px; border: 0; font-size: 13px; font-weight: 620; cursor: pointer; user-select: none; transition: transform .16s ease,background .16s ease,box-shadow .16s ease,filter .16s ease; }
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(2px) scale(.96); box-shadow: inset 0 2px 7px rgba(0,0,0,.18); filter: brightness(.94); transition-duration: .05s; }
.secondary-button { color: var(--text); border: 1px solid var(--line-strong); background: var(--surface-subtle); }
.secondary-button:hover { background: var(--surface-strong); }
.primary-button { color: #fff; background: linear-gradient(135deg,#0878e6,#4c65e8); box-shadow: 0 9px 22px rgba(27,105,217,.22),inset 0 1px rgba(255,255,255,.25); }
html[data-theme="dark"] .primary-button { color: #07121d; background: linear-gradient(135deg,#62baff,#6ad4ff); }
.noscript { position: fixed; inset: auto 20px 20px; z-index: 50; padding: 12px; border-radius: 10px; color: var(--text); background: var(--surface-strong); box-shadow: var(--small-shadow); text-align: center; font-size: 13px; }
.noscript a { color: var(--accent); font-weight: 650; }

@media (max-width: 600px) {
  .top-controls { top: max(14px,env(safe-area-inset-top)); right: max(14px,env(safe-area-inset-right)); }
  .language-button { min-width: 42px; width: 42px; justify-content: center; padding: 0; }
  .language-button > span,.language-button .chevron { display: none; }
  .page-shell { padding-inline: 14px; padding-top: max(78px,calc(env(safe-area-inset-top) + 66px)); }
  .dialog { border-radius: 16px; }
  .dialog-content { padding: 27px 22px 25px; }
  .ghost-wrap,.little-ghost { width: 96px; height: 96px; }
  h1 { font-size: 24px; }
  .message { font-size: 13px; }
  .button-row { flex-direction: column-reverse; }
  .button { width: 100%; }
}

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

:focus-visible { outline: 3px solid color-mix(in srgb,var(--accent) 46%,transparent); outline-offset: 3px; }
::selection { color: var(--text); background: var(--accent-soft); }
