:root {
  color-scheme: light;
  --paper: #f9f1e3;
  --ink: #302925;
  --muted: #695646;
  --edge: #a8896a;
  --active: #823c24;
  --active-ink: #fff5e7;
  --halo: #dbc1a9;
  --corner: #e9cdb5;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #161a25;
  --ink: #f4e9db;
  --muted: #c7b6a5;
  --edge: #806657;
  --active: #f3bf9a;
  --active-ink: #25202a;
  --halo: #273244;
  --corner: #332020;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: system-ui, 'Microsoft YaHei', sans-serif; }
h1, p { margin: 0; }
.portal-page {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  padding: clamp(68px, 11svh, 118px) 20px max(16px, env(safe-area-inset-bottom));
  background:
    radial-gradient(ellipse at 52% 50%, var(--halo), transparent 61%),
    radial-gradient(ellipse at 17% 92%, var(--corner), transparent 55%),
    var(--paper);
}
.portal-brand {
  position: absolute;
  inset-block-start: max(17px, env(safe-area-inset-top));
  inset-inline-start: max(20px, env(safe-area-inset-left));
  display: flex;
  align-items: baseline;
  gap: 10px;
  z-index: 2;
  color: var(--ink);
  text-decoration: none;
}
.portal-brand small { color: var(--muted); font-size: 12px; margin-inline-start: 3px; }
.portal-brand:hover small { text-decoration: underline; text-underline-offset: 3px; }
.portal-brand b, .portal-title {
  font-family: "Songti SC", "Noto Serif CJK SC", SimSun, Georgia, serif;
}
.portal-brand b { font-size: 24px; font-weight: 650; letter-spacing: .13em; }
.portal-brand span { color: var(--active); font: 14px/1 Georgia, serif; }
.portal-title {
  position: relative;
  z-index: 1;
  margin-inline: auto;
  text-align: center;
  font-size: clamp(35px, 7vw, 68px);
  line-height: 1.14;
  font-weight: 650;
  letter-spacing: .035em;
  text-wrap: balance;
  transition: opacity .3s ease;
}
.portal-heading { position: relative; z-index: 1; display: grid; gap: 17px; justify-items: center; }
.portal-page .roam-mode-links {
  --roam-tabs-ink: var(--ink);
  --roam-tabs-line: var(--edge);
  --roam-tabs-fill: color-mix(in srgb, var(--paper) 68%, transparent);
  --roam-tabs-active: var(--active);
  --roam-tabs-active-ink: var(--active-ink);
}
.portal-field { position: absolute; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.portal-center { position: relative; display: grid; place-items: center; }
.portal-orb {
  appearance: none;
  display: grid;
  place-items: center;
  width: clamp(148px, 23vw, 238px);
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #e4a071;
  border-radius: 50%;
  background: radial-gradient(circle at 47% 40%, #1b2f40, #101827 43%, #0b101b 76%, #392220);
  color: #fff1df;
  box-shadow: 0 0 29px #ec976571, 0 12px 43px #100b1850, inset 0 0 22px #be6c474a;
  cursor: pointer;
  touch-action: manipulation;
  transition: box-shadow .23s ease, transform .16s ease;
}
.portal-orb, .portal-mood { -webkit-tap-highlight-color: transparent; }
.portal-orb:disabled { cursor: wait; }
.portal-orb:focus-visible { outline: 3px solid var(--active); outline-offset: 8px; }
.portal-orb:active { transform: scale(.97); }
@media (hover: hover) {
  .portal-orb:hover {
    box-shadow: 0 0 52px #edaa79a9, 0 12px 48px #1d172665, inset 0 0 28px #d17b5562;
  }
}
.portal-orb-label { display: grid; justify-items: center; gap: 6px; font-size: clamp(16px, 2vw, 19px); font-weight: 600; }
.portal-arrow { color: #ffc094; font: clamp(34px, 4vw, 45px)/1 Georgia, serif; }
.portal-page[data-crossing] .portal-title { opacity: .24; }
.portal-page[data-crossing] .portal-orb { border-color: transparent; background: transparent; box-shadow: none; }
.portal-page[data-crossing] .portal-orb-label { opacity: 0; }
.portal-bottom { position: relative; display: grid; justify-items: center; min-height: 64px; padding: 8px 0 12px; }
.portal-page[data-mode="mood"] .portal-bottom { min-height: 108px; }
.portal-page .roam-extension-link { margin-block: 6px 0; align-self: end; color: var(--muted); }
.portal-page[data-crossing] .portal-moods { opacity: .68; }
.portal-moods {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  border: 0;
  margin: 0;
  padding: 0;
  align-self: center;
}
.portal-mood { position: relative; display: flex; align-items: center; }
.portal-mood input, .portal-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.portal-mood span {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  color: var(--ink);
  background: var(--paper);
  font-size: 13px;
  cursor: pointer;
  touch-action: manipulation;
}
.portal-mood input:checked + span { color: var(--active-ink); background: var(--active); border-color: var(--active); }
.portal-mood input:focus-visible + span { outline: 2px solid var(--active); outline-offset: 3px; }
.portal-status { margin: 4px 0 0; text-align: center; color: var(--muted); font-size: 14px; }
.portal-status:empty { margin-top: 0; }
@media (max-width: 600px) {
  .portal-page { padding-inline: 14px; grid-template-rows: auto minmax(205px, 1fr) auto; }
  .portal-moods { max-width: 390px; gap: 7px; }
  .portal-mood span { padding-inline: 10px; }
  .portal-page[data-mode="mood"] .portal-bottom { min-height: 123px; }
}
.roam-install { width: min(740px, calc(100% - 34px)); margin: auto; padding: 26px 0 64px; }
.roam-install nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 22px; }
.roam-install nav a { color: var(--active); text-decoration: none; padding-block: 10px; }
.roam-install nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.roam-install header { margin: 36px 0 29px; padding: clamp(24px,5vw,44px); border-radius: 13px; color: #fff0dd; background: radial-gradient(ellipse at 88% 18%, #3a3e52, #191c29 64%); }
.roam-install h1 { font-family: "Songti SC", "Noto Serif CJK SC", SimSun, Georgia, serif; font-size: clamp(31px,6.5vw,51px); margin: .2em 0; line-height: 1.23; }
.roam-install header p { color: #f0d4c3; }
.roam-install .roam-install-platform { color: #f1af88; font-size: 13px; }
.roam-install-download { display: inline-flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 15px; margin-top: 20px; border-radius: 6px; background: #f0b88e; color: #27202a; font-weight: 650; text-decoration: none; }
.roam-install-download:hover { background: #ffcdab; }
.roam-install section { border-top: 1px solid var(--edge); margin-block: 24px; padding-block-start: 8px; }
.roam-install section li, .roam-install section p { line-height: 1.7; margin-block-end: 11px; }
.roam-install code { padding: 1px 4px; background: var(--halo); border-radius: 4px; overflow-wrap: anywhere; }
.roam-install-shortcut { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 11px; margin-block: 7px 1px; }
.roam-install-shortcut small, .roam-install-shortcut [role="status"] { color: var(--muted); font-size: 13px; }
.roam-install-copy { appearance: none; min-height: 38px; padding: 5px 10px; border: 1px solid var(--edge); border-radius: 6px; background: transparent; color: var(--active); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.roam-install-copy[hidden] { display: none; }
.roam-install-copy:hover { background: var(--halo); }
.roam-install-copy:focus-visible { outline: 2px solid var(--active); outline-offset: 3px; }
.roam-install-fallback summary { width: fit-content; color: var(--muted); font-size: 14px; cursor: pointer; }
@media (max-height: 520px) and (orientation: landscape) {
  .portal-page { padding-block-start: 50px; grid-template-rows: auto minmax(186px, 1fr) auto; }
  .portal-title { font-size: clamp(30px, 5vw, 44px); }
  .portal-orb { width: 146px; }
  .portal-bottom, .portal-page[data-mode="mood"] .portal-bottom { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .portal-title, .portal-orb { transition: none; }
}
:root[data-motion="off"] .portal-title,
:root[data-motion="off"] .portal-orb { transition: none; }
