:root {
  color-scheme: dark;
  --bg: #080b10;
  --surface: rgb(17 22 31 / 82%);
  --surface-strong: #121823;
  --text: #f5f7fb;
  --muted: #8993a4;
  --line: rgb(255 255 255 / 11%);
  --blue: #59b8ff;
  --pink: #ff54bc;
  --glow: rgb(89 184 255 / 24%);
  --page-x: clamp(20px, 5vw, 76px);
  --header-height: 88px;
  --body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

:root[data-fw-theme="luckin"] {
  color-scheme: light;
  --bg: #f5f7ff;
  --surface: rgb(255 255 255 / 88%);
  --surface-strong: #ffffff;
  --text: #111827;
  --muted: #68748a;
  --line: rgb(27 77 255 / 14%);
  --blue: #1b4dff;
  --pink: #47b7ff;
  --glow: rgb(71 183 255 / 18%);
}

:root[data-fw-theme="oat"] {
  color-scheme: light;
  --bg: #f6f1e8;
  --surface: rgb(255 253 248 / 90%);
  --surface-strong: #fffdf8;
  --text: #292721;
  --muted: #756f64;
  --line: rgb(49 94 214 / 14%);
  --blue: #315ed6;
  --pink: #b9875d;
  --glow: rgb(185 135 93 / 17%);
}

:root[data-fw-theme="midnight"] {
  color-scheme: dark;
  --bg: #07101f;
  --surface: rgb(13 26 46 / 86%);
  --surface-strong: #11213a;
  --text: #f2f6ff;
  --muted: #97a7c2;
  --line: rgb(98 144 255 / 20%);
  --blue: #6290ff;
  --pink: #31c6ff;
  --glow: rgb(49 198 255 / 16%);
}

* { box-sizing: border-box; }

html, body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
}

body {
  overflow: hidden;
  color: var(--text);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

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

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

.ambient {
  position: fixed;
  z-index: 0;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(110px);
  opacity: .13;
}
.ambient-one { top: -24vw; right: -8vw; background: var(--blue); }
.ambient-two { bottom: -30vw; left: -12vw; background: var(--pink); }

.site-header {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--page-x);
  border-bottom: 1px solid var(--line);
  background: rgb(8 11 16 / 72%);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .22em;
  text-decoration: none;
}
.brand img { width: 44px; height: 44px; object-fit: cover; border-radius: 13px; }

.tabs { display: flex; gap: 8px; }
.tab {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  transition: 220ms ease;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  border-color: var(--line);
  background: rgb(255 255 255 / 7%);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgb(89 184 255 / 5%);
}

.site-main {
  position: fixed;
  z-index: 5;
  inset: var(--header-height) 0 42px;
}
.panel {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: clamp(34px, 5vh, 68px) var(--page-x) 70px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 360ms var(--ease), transform 360ms var(--ease);
}
.panel[hidden] { display: none; }
.panel.is-active { opacity: 1; transform: translateY(0); }

.panel-heading {
  display: grid;
  max-width: 980px;
  grid-template-columns: minmax(220px, .9fr) 1.25fr;
  column-gap: 48px;
  align-items: end;
  margin: 0 auto clamp(28px, 4vh, 46px);
}
.eyebrow {
  grid-column: 1 / -1;
  margin: 0 0 12px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
}
.panel-heading h1 {
  margin: 0;
  font-size: clamp(38px, 5vw, 70px);
  font-weight: 650;
  letter-spacing: -.055em;
  line-height: 1;
}
.panel-heading > p:last-child {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.tool-card,
.simulation-card,
.control-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgb(20 27 39 / 86%), rgb(10 14 21 / 90%));
  box-shadow: 0 22px 80px rgb(0 0 0 / 30%);
  backdrop-filter: blur(20px);
}
.tool-card { width: min(980px, 100%); margin: 0 auto; border-radius: 24px; }

.calendar-toolbar {
  display: flex;
  min-height: 84px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}
.select-field { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.select-field select {
  min-width: 150px;
  padding: 6px 28px 6px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}
.month-switcher { display: grid; grid-template-columns: 38px minmax(116px, auto) 38px; align-items: center; text-align: center; }
.month-switcher strong { font-size: 16px; font-weight: 550; }
.month-switcher button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.month-switcher button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.month-switcher button:disabled { opacity: .28; cursor: default; }

.calendar-layout { display: grid; grid-template-columns: minmax(0, 1fr) 230px; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(44px, 1fr));
  padding: 18px;
  border-right: 1px solid var(--line);
}
.weekday, .calendar-day { min-height: 48px; }
.weekday {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}
.calendar-day {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 13px;
  color: #cdd3df;
  font-family: var(--mono);
  font-size: 12px;
}
.calendar-day.is-empty { visibility: hidden; }
.calendar-day.is-weekend { color: #697386; }
.calendar-day.is-today { border-color: rgb(89 184 255 / 55%); }
.calendar-day.is-holiday {
  background: linear-gradient(135deg, rgb(255 84 188 / 18%), rgb(89 184 255 / 17%));
  color: white;
}
.calendar-day.is-holiday::after {
  position: absolute;
  bottom: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--pink);
  content: "";
  box-shadow: 0 0 8px var(--pink);
}
.holiday-list { padding: 24px 22px; }
.holiday-list > p { margin: 0 0 20px; color: var(--muted); font-size: 11px; }
.holiday-item { display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.holiday-item time { color: var(--blue); font-family: var(--mono); font-size: 12px; }
.holiday-item span { font-size: 13px; line-height: 1.5; }
.holiday-empty { margin: 28px 0; color: var(--muted); font-size: 13px; }
.data-note { margin: 0; padding: 14px 22px; border-top: 1px solid var(--line); color: #606a7a; font-size: 10px; }

.physics-heading { margin-bottom: 28px; }
.physics-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(250px, .65fr); gap: 18px; width: min(1100px, 100%); margin: 0 auto; }
.simulation-card { position: relative; min-height: 420px; overflow: hidden; border-radius: 24px; }
#drop-canvas { display: block; width: 100%; height: 420px; }
.simulation-readout {
  position: absolute;
  right: 18px;
  bottom: 16px;
  left: 18px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  pointer-events: none;
}
.control-card { display: flex; flex-direction: column; gap: 28px; padding: 24px; border-radius: 24px; }
.preset-group > p { margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.preset-buttons { display: grid; gap: 8px; }
.preset {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
}
.preset:hover, .preset.is-active { border-color: rgb(89 184 255 / 55%); background: rgb(89 184 255 / 9%); color: var(--text); }
.range-field { display: grid; gap: 14px; }
.range-field > span { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.range-field output { color: var(--text); font-family: var(--mono); }
input[type="range"] { width: 100%; accent-color: var(--blue); cursor: pointer; }
.restart-button { min-height: 44px; margin-top: auto; border: 0; border-radius: 12px; background: linear-gradient(100deg, var(--blue), #8d7cff); color: #07101a; cursor: pointer; font-weight: 650; }
.restart-button:hover { filter: brightness(1.08); }
.physics-note { margin: -14px 0 0; color: #697386; font-size: 11px; line-height: 1.6; }

.site-footer {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--page-x);
  border-top: 1px solid var(--line);
  background: rgb(8 11 16 / 84%);
  color: #626c7c;
  font-family: var(--mono);
  font-size: 9px;
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--blue); }

@media (max-width: 760px) {
  :root { --header-height: 76px; --page-x: 18px; }
  body { overflow: auto; }
  .site-header { padding: 0 var(--page-x); }
  .brand span { display: none; }
  .brand img { width: 38px; height: 38px; }
  .tabs { gap: 2px; }
  .tab { padding: 0 12px; font-size: 13px; }
  .site-main { position: relative; inset: auto; min-height: 100vh; padding-top: var(--header-height); }
  .panel { position: relative; inset: auto; min-height: calc(100vh - var(--header-height)); padding: 34px var(--page-x) 80px; }
  .panel-heading { display: block; margin-bottom: 26px; }
  .panel-heading h1 { font-size: 44px; }
  .panel-heading > p:last-child { margin-top: 14px; }
  .calendar-toolbar { align-items: end; }
  .month-switcher { grid-template-columns: 34px minmax(92px, auto) 34px; }
  .calendar-layout { display: block; }
  .calendar-grid { padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .weekday, .calendar-day { min-height: 42px; }
  .holiday-list { padding: 20px; }
  .physics-layout { display: block; }
  .simulation-card { min-height: 360px; }
  #drop-canvas { height: 360px; }
  .control-card { margin-top: 16px; }
  .site-footer { position: fixed; }
}

@media (max-width: 420px) {
  .calendar-toolbar { display: grid; }
  .month-switcher { justify-self: stretch; }
  .calendar-day, .weekday { min-height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 1ms !important; }
}

html[data-fw-ui="1"] .site-header,
html[data-fw-ui="1"] .site-footer {
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  color: var(--muted);
  backdrop-filter: blur(20px) saturate(1.2);
}

html[data-fw-ui="1"] :where(.tool-card,.simulation-card,.control-card) {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 18px 60px color-mix(in srgb, var(--blue) 8%, transparent);
  backdrop-filter: blur(20px);
  animation: anya-rise 420ms var(--ease) both;
}

html[data-fw-ui="1"] .calendar-day { color: var(--text); }
html[data-fw-ui="1"] .calendar-day.is-weekend { color: var(--muted); }
html[data-fw-ui="1"] .calendar-day.is-holiday { color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--pink) 78%, var(--blue)), var(--blue)); }
html[data-fw-ui="1"] :where(.restart-button,.tab,.preset,.month-switcher button,a) { transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, transform 150ms ease; }
html[data-fw-ui="1"] :where(.restart-button,.preset,.month-switcher button,a):active { transform: scale(.98); }
@keyframes anya-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
