:root {
  --ink: #27313d;
  --deep: #1d2735;
  --muted: #748092;
  --line: rgba(255,255,255,.72);
  --glass: rgba(255,255,255,.58);
  --glass-strong: rgba(255,255,255,.78);
  --shadow: 0 24px 70px rgba(75, 68, 105, .14), inset 0 1px 0 rgba(255,255,255,.82);
  --pink: #ffc9dc;
  --peach: #ffd7bd;
  --lemon: #fff0b8;
  --mint: #bfead9;
  --blue: #bfdcff;
  --lavender: #d7c9ff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 6% 8%, rgba(255,201,220,.78), transparent 27rem),
    radial-gradient(circle at 91% 2%, rgba(215,201,255,.78), transparent 28rem),
    radial-gradient(circle at 78% 85%, rgba(191,234,217,.62), transparent 30rem),
    radial-gradient(circle at 18% 92%, rgba(255,215,189,.58), transparent 27rem),
    linear-gradient(145deg, #fff9fb 0%, #f7f4ff 48%, #f1fbf8 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}
body::before, body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 45% 55% 58% 42%;
  filter: blur(4px);
  opacity: .68;
  animation: float 16s ease-in-out infinite alternate;
}
body::before { width: 270px; height: 270px; left: -80px; top: 30%; background: linear-gradient(135deg, var(--lemon), var(--peach)); }
body::after { width: 320px; height: 320px; right: -100px; top: 38%; background: linear-gradient(135deg, var(--blue), var(--lavender)); animation-delay: -7s; }
@keyframes float { to { transform: translate3d(18px,-24px,0) rotate(9deg) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; } }

a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
.glass, .hero, .panel, .login-card {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(145%);
  -webkit-backdrop-filter: blur(26px) saturate(145%);
}

.page { max-width: 1580px; margin: 0 auto; padding: 20px 20px 48px; }
.portal-page { width: min(1120px,100%); min-height: 100vh; margin: 0 auto; padding: clamp(28px,7vw,96px) 20px 48px; }
.portal-hero { padding: 34px; border-radius: 34px; }
.portal-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; margin-top: 22px; }
.portal-card { min-height: 330px; padding: 34px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; border: 1px solid rgba(255,255,255,.84); border-radius: 34px; text-align: left; box-shadow: var(--shadow); transition: transform .2s ease, box-shadow .2s ease; }
.portal-card:hover { transform: translateY(-5px); box-shadow: 0 32px 90px rgba(75,68,105,.2); }
.portal-card.research { background: linear-gradient(145deg,rgba(255,255,255,.76),rgba(191,220,255,.7),rgba(215,201,255,.72)); }
.portal-card.books { background: linear-gradient(145deg,rgba(255,255,255,.76),rgba(255,240,184,.72),rgba(191,234,217,.72)); }
.portal-card span { color: #766c8e; font-size: 11px; font-weight: 900; letter-spacing: .16em; }
.portal-card h2 { margin: 9px 0 10px; color: var(--deep); font-size: clamp(30px,5vw,48px); }
.portal-card p { max-width: 28ch; margin: 0 0 24px; color: #596575; font-size: 15px; line-height: 1.7; }
.portal-card b { color: #635a73; font-size: 12px; }
.portal-logout { display: block; margin: 24px auto 0; border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.library-switch { width: fit-content; margin: 14px 0 0; padding: 5px; display: flex; gap: 4px; border-radius: 999px; }
.library-switch button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: #7a718b; font-size: 11px; font-weight: 820; }
.library-switch button.active { color: #443b53; background: linear-gradient(135deg,var(--pink),var(--lavender)); }
.hero {
  min-height: 116px;
  border-radius: 34px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  width: 410px; height: 180px; right: -85px; top: -78px;
  border-radius: 50%;
  background: linear-gradient(120deg, rgba(255,201,220,.78), rgba(191,220,255,.72), rgba(215,201,255,.8));
  filter: blur(3px);
}
.hero-copy, .hero-stats { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 7px; color: #756c91; font-size: 11px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; color: var(--deep); font-size: clamp(28px,4vw,46px); letter-spacing: -.035em; line-height: 1.05; }
.desc { margin: 9px 0 0; color: var(--muted); line-height: 1.65; font-size: 14px; }
.hero-stats { display: flex; gap: 8px; }
.hero-stats div { min-width: 82px; padding: 10px 13px; border-radius: 20px; background: rgba(255,255,255,.52); border: 1px solid rgba(255,255,255,.72); }
.hero-stats b { display: block; font-size: 20px; color: var(--deep); }
.hero-stats span { color: var(--muted); font-size: 11px; }

.workspace { display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 16px; margin-top: 16px; align-items: start; }
.panel { border-radius: 28px; }
.index-panel { position: sticky; top: 16px; max-height: calc(100vh - 32px); padding: 15px; overflow: auto; scrollbar-width: thin; }
.index-tools { position: sticky; top: -15px; z-index: 3; margin: -15px -15px 10px; padding: 15px 15px 12px; background: rgba(255,255,255,.72); backdrop-filter: blur(22px); border-radius: 28px 28px 18px 18px; }
.search-wrap { position: relative; }
.search-wrap::before { content: "⌕"; position: absolute; left: 13px; top: 9px; color: #958ca9; font-size: 20px; }
#query { width: 100%; height: 42px; padding: 0 12px 0 38px; border-radius: 16px; border: 1px solid rgba(147,135,174,.16); outline: none; background: rgba(255,255,255,.78); color: var(--deep); }
#query:focus { border-color: rgba(154,126,214,.42); box-shadow: 0 0 0 4px rgba(215,201,255,.34); }
.category-tabs { display: flex; gap: 6px; margin-top: 9px; overflow-x: auto; scrollbar-width: none; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab { flex: 0 0 auto; min-height: 30px; padding: 0 10px; border: 0; border-radius: 999px; background: rgba(255,255,255,.58); color: #817893; font-size: 11px; font-weight: 780; }
.category-tab.active { color: #493f60; background: linear-gradient(135deg, var(--pink), var(--lavender)); box-shadow: inset 0 1px 0 rgba(255,255,255,.72); }
.topic-list { display: grid; gap: 7px; }
.topic-button { width: 100%; min-height: 58px; border: 1px solid transparent; border-radius: 18px; padding: 10px 11px; display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; text-align: left; background: rgba(255,255,255,.38); transition: .2s ease; }
.topic-button:hover { transform: translateX(2px); background: rgba(255,255,255,.68); }
.topic-button.active { border-color: rgba(255,255,255,.88); background: linear-gradient(135deg, rgba(255,255,255,.86), color-mix(in srgb,var(--card-color) 20%, white)); box-shadow: 0 12px 28px color-mix(in srgb,var(--card-color) 18%, transparent); }
.topic-dot { width: 10px; height: 34px; border-radius: 99px; background: var(--card-color); box-shadow: 0 0 18px color-mix(in srgb,var(--card-color) 65%, transparent); }
.topic-copy { min-width: 0; }
.topic-copy strong { display: block; color: var(--deep); font-size: 13px; line-height: 1.35; }
.topic-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.interest-tag { display: inline-flex; align-items: center; min-height: 18px; padding: 1px 7px; border-radius: 999px; color: #6b5176; background: linear-gradient(135deg, rgba(242,184,203,.55), rgba(199,181,235,.55)); font-size: 10px; font-weight: 850; vertical-align: middle; }
.topic-count { min-width: 25px; height: 25px; display: grid; place-items: center; border-radius: 99px; color: #756c83; background: rgba(255,255,255,.62); font-size: 10px; font-weight: 850; }
.index-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding: 6px 4px 0; color: var(--muted); font-size: 10px; }
#logout { border: 0; background: transparent; color: #867b98; font-size: 10px; font-weight: 760; }

.reader-panel { min-width: 0; overflow: hidden; }
.preview-head { min-height: 102px; padding: 20px 24px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid rgba(255,255,255,.72); background: linear-gradient(120deg, rgba(255,255,255,.68), color-mix(in srgb,var(--card-color) 13%, white)); }
.preview-kicker { margin: 0 0 5px; color: #847a92; font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.preview-head h2 { margin: 0; color: var(--deep); font-size: clamp(19px,2.4vw,28px); line-height: 1.25; letter-spacing: -.02em; }
.preview-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.preview-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.version-pill, .primary-link { min-height: 36px; border: 1px solid rgba(255,255,255,.8); border-radius: 999px; padding: 7px 12px; background: rgba(255,255,255,.55); color: #71687e; text-decoration: none; font-size: 11px; font-weight: 820; }
.version-pill small { display: none; }
.version-pill.active { color: #40384d; background: linear-gradient(135deg, color-mix(in srgb,var(--card-color) 65%, white), rgba(255,255,255,.8)); box-shadow: 0 8px 20px color-mix(in srgb,var(--card-color) 20%, transparent); }
.primary-link { color: white; border-color: transparent; background: linear-gradient(135deg, #776b91, #4f647d); }
.reader-body { width: 100%; height: calc(100vh - 154px); min-height: 700px; overflow: auto; background: rgba(255,255,255,.48); scroll-behavior: smooth; }
.markdown-body { max-width: 920px; margin: 0 auto; padding: 56px 58px 90px; color: #303846; line-height: 1.82; }
.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4 { color: var(--deep); line-height: 1.32; scroll-margin-top: 24px; }
.markdown-body h1 { margin: 0 0 28px; font-size: clamp(30px,4vw,44px); letter-spacing: -.04em; }
.markdown-body h2 { margin: 58px 0 24px; padding: 22px 24px; border: 1px solid rgba(255,255,255,.78); border-radius: 24px; font-size: 24px; background: linear-gradient(120deg, rgba(255,201,220,.58), rgba(255,240,184,.48), rgba(191,220,255,.56), rgba(215,201,255,.56)); box-shadow: 0 18px 42px rgba(90,75,120,.12), inset 0 1px 0 rgba(255,255,255,.9); backdrop-filter: blur(16px); }
.markdown-body h3 { margin: 34px 0 12px; font-size: 18px; }
.markdown-body h3::before { content: ""; display: inline-block; width: 7px; height: 18px; margin-right: 9px; border-radius: 99px; vertical-align: -2px; background: linear-gradient(180deg, var(--pink), var(--lavender)); }
.markdown-body h4 { margin: 24px 0 10px; font-size: 16px; }
.markdown-body p,.markdown-body li { max-width: 76ch; font-size: 15.5px; }
.markdown-body p { margin: 10px 0 16px; }
.markdown-body ul,.markdown-body ol { padding-left: 1.45rem; margin: 12px 0 22px; }
.markdown-body li { margin: 8px 0; }
.markdown-body strong { color: #293441; }
.markdown-body blockquote { margin: 24px 0; padding: 20px 22px; border: 1px solid rgba(255,255,255,.84); border-left: 6px solid #d6b5e8; border-radius: 20px; background: linear-gradient(135deg, rgba(255,255,255,.76), rgba(255,218,230,.42)); box-shadow: 0 14px 34px rgba(93,74,112,.09); color: #515766; }
.markdown-body .callout,.markdown-body .data-closure { margin: 24px 0; padding: 18px 20px; border: 1px solid rgba(255,255,255,.84); border-radius: 20px; background: linear-gradient(135deg,rgba(255,255,255,.78),rgba(229,220,255,.42)); box-shadow: 0 14px 34px rgba(93,74,112,.09); }
.markdown-body .data-closure summary { cursor: pointer; color: #514763; font-weight: 850; }
.markdown-body .data-closure[open] summary { margin-bottom: 14px; }
.markdown-body .callout > strong { display: block; margin-bottom: 8px; color: #514763; }
.markdown-body pre,.mermaid-wrap { margin: 22px 0; padding: 20px; border: 1px solid rgba(255,255,255,.88); border-radius: 22px; overflow: auto; background: linear-gradient(135deg, rgba(244,252,249,.88), rgba(245,241,255,.88)); box-shadow: inset 0 1px 0 white, 0 14px 36px rgba(83,91,120,.08); color: #33475a; white-space: pre-wrap; }
.mermaid-wrap { display: grid; place-items: center; min-height: 180px; }
.mermaid { width: 100%; text-align: center; }
.markdown-body table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 20px 0 28px; overflow: hidden; border: 1px solid rgba(153,143,177,.14); border-radius: 18px; background: rgba(255,255,255,.64); box-shadow: 0 14px 34px rgba(86,79,106,.08); font-size: 13px; }
.markdown-body th,.markdown-body td { padding: 11px 12px; border-right: 1px solid rgba(153,143,177,.12); border-bottom: 1px solid rgba(153,143,177,.12); vertical-align: top; }
.markdown-body tr:last-child td { border-bottom: 0; }
.markdown-body th:last-child,.markdown-body td:last-child { border-right: 0; }
.markdown-body th { color: #4c465b; font-weight: 850; background: linear-gradient(135deg, rgba(255,215,189,.48), rgba(215,201,255,.4)); }
.markdown-body tr:nth-child(even) td { background: rgba(250,249,255,.5); }
.markdown-body a { color: #6b5ca5; font-weight: 760; text-decoration-color: rgba(107,92,165,.3); text-underline-offset: 3px; }
.iros-divider { border: 0; height: 1px; margin: 34px 0; background: linear-gradient(90deg, transparent, rgba(122,106,154,.22), transparent); }
.empty { padding: 28px; color: var(--muted); text-align: center; }

.note-fab { position: fixed; z-index: 30; right: 28px; bottom: 26px; min-height: 52px; padding: 0 15px 0 11px; display: flex; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,.88); border-radius: 999px; color: #4f465e; background: linear-gradient(135deg,rgba(255,255,255,.82),rgba(255,201,220,.75),rgba(215,201,255,.8)); box-shadow: 0 18px 46px rgba(77,60,102,.22),inset 0 1px 0 white; backdrop-filter: blur(20px) saturate(150%); transition: transform .2s ease; }
.note-fab:hover { transform: translateY(-3px); }
.note-fab span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.7); font-size: 16px; }
.note-fab b { font-size: 13px; }
.note-fab i { min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 99px; color: #756a85; background: rgba(255,255,255,.7); font-size: 10px; font-style: normal; }
.quote-action { position: fixed; z-index: 45; display: none; min-height: 36px; padding: 0 13px; border: 1px solid rgba(255,255,255,.82); border-radius: 99px; color: white; background: linear-gradient(135deg,#736783,#596d83); box-shadow: 0 12px 34px rgba(53,48,71,.28); font-size: 12px; font-weight: 800; }
.quote-action.show { display: block; animation: note-pop .16s ease-out; }
@keyframes note-pop { from { opacity: 0; transform: translateY(5px) scale(.96); } }
.note-backdrop { position: fixed; z-index: 48; inset: 0; pointer-events: none; opacity: 0; background: rgba(56,48,67,.16); backdrop-filter: blur(3px); transition: opacity .25s ease; }
.note-backdrop.open { pointer-events: auto; opacity: 1; }
.note-drawer { position: fixed; z-index: 50; top: 16px; right: 16px; bottom: 16px; width: min(420px,calc(100vw - 32px)); display: flex; flex-direction: column; overflow: hidden; transform: translateX(calc(100% + 32px)); border: 1px solid rgba(255,255,255,.86); border-radius: 30px; background: linear-gradient(155deg,rgba(255,255,255,.88),rgba(255,245,249,.78),rgba(244,241,255,.82)); box-shadow: 0 30px 90px rgba(53,43,71,.28),inset 0 1px 0 white; backdrop-filter: blur(30px) saturate(155%); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.note-drawer.open { transform: translateX(0); }
.note-drawer > header { padding: 23px 24px 17px; display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px solid rgba(145,127,167,.12); background: linear-gradient(120deg,rgba(255,201,220,.35),rgba(215,201,255,.35)); }
.note-drawer header p { margin: 0 0 4px; color: #8a7b9a; font-size: 9px; font-weight: 900; letter-spacing: .15em; }
.note-drawer header h2 { margin: 0; color: var(--deep); font-size: 23px; }
.note-drawer header small { display: block; margin-top: 5px; color: var(--muted); }
.note-drawer header > button { width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.8); border-radius: 50%; background: rgba(255,255,255,.55); color: #756a82; font-size: 22px; }
.note-compose { margin: 16px; padding: 14px; border: 1px solid rgba(255,255,255,.9); border-radius: 22px; background: rgba(255,255,255,.64); box-shadow: 0 12px 30px rgba(77,62,98,.08); }
.note-quote { position: relative; margin-bottom: 10px; padding: 11px 34px 11px 12px; border-left: 4px solid #d0b9e8; border-radius: 12px; background: linear-gradient(135deg,rgba(255,220,231,.52),rgba(229,220,255,.52)); }
.note-quote span { color: #887594; font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.note-quote p { max-height: 84px; margin: 4px 0 0; overflow: auto; color: #5b5363; font-size: 12px; line-height: 1.55; }
.note-quote button { position: absolute; right: 7px; top: 7px; border: 0; background: transparent; color: #95879e; font-size: 18px; }
#noteInput { width: 100%; min-height: 94px; padding: 4px; resize: vertical; border: 0; outline: 0; color: #3d4550; background: transparent; font: inherit; font-size: 14px; line-height: 1.65; }
.note-compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.note-compose-foot span { color: #9a91a4; font-size: 9px; }
.note-compose-foot span[data-state="synced"] { color: #4f9178; }
.note-compose-foot span[data-state="offline"] { color: #b07662; }
.note-compose-foot span[data-state="syncing"]::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #bca4d7; animation: sync-pulse 1s ease-in-out infinite alternate; }
@keyframes sync-pulse { to { opacity: .3; transform: scale(.72); } }
.note-compose-foot button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 99px; color: white; background: linear-gradient(135deg,#7a6b90,#647c8f); font-size: 11px; font-weight: 850; }
.note-list { padding: 0 16px 22px; overflow: auto; }
.note-card { margin-bottom: 10px; padding: 14px; border: 1px solid rgba(255,255,255,.84); border-radius: 18px; background: rgba(255,255,255,.54); box-shadow: 0 9px 24px rgba(79,66,98,.07); }
.note-card blockquote { margin: 0 0 10px; padding: 9px 11px; border-left: 3px solid #d5badd; border-radius: 10px; color: #746a79; background: rgba(245,233,250,.58); font-size: 11px; line-height: 1.55; }
.note-card > p { margin: 0; color: #444b55; font-size: 13px; line-height: 1.65; }
.note-card footer { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; }
.note-card time { color: #a096a7; font-size: 9px; }
.note-card footer button { margin-left: 4px; border: 0; background: transparent; color: #85768f; font-size: 10px; }
.note-empty { padding: 36px 10px; color: #9a91a4; text-align: center; font-size: 12px; line-height: 1.8; }
.mobile-back-button { display: none; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(440px,100%); padding: 34px; border-radius: 34px; position: relative; overflow: hidden; }
.login-card::before { content: ""; position: absolute; width: 250px; height: 190px; right: -60px; top: -70px; border-radius: 50%; background: linear-gradient(135deg,var(--pink),var(--blue),var(--lavender)); opacity: .72; }
.login-card > * { position: relative; z-index: 1; }
.login-form { display: grid; grid-template-columns: 1fr 90px; gap: 8px; margin-top: 20px; }
.login-form input,.login-form button { height: 44px; border-radius: 16px; border: 1px solid rgba(255,255,255,.8); }
.login-form input { padding: 0 13px; background: rgba(255,255,255,.68); }
.login-form button { color: white; font-weight: 820; background: linear-gradient(135deg,#756a8d,#5c7389); }
.login-error { color: #bd526e; font-weight: 800; }

@media (max-width: 900px) {
  body { background-attachment: scroll; }
  body::before, body::after { display: none; }
  .glass, .hero, .panel, .login-card, .index-tools, .note-fab, .note-drawer, .markdown-body h2 {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .glass, .hero, .panel, .login-card { box-shadow: 0 12px 34px rgba(75,68,105,.12); }
  .page { padding: 12px 12px 36px; }
  .hero { align-items: flex-start; padding: 20px; border-radius: 26px; }
  .hero-stats { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .index-panel { position: static; max-height: none; border-radius: 24px; }
  .index-tools { position: static; }
  .topic-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .reader-panel { border-radius: 24px; scroll-margin-top: 12px; }
  .reader-body { height: auto; min-height: 70vh; overflow: visible; }
  .mobile-reader-open .index-panel { display: none; }
  .mobile-reader-open .reader-panel { display: block; }
  .mobile-back-button { display: inline-flex; align-items: center; justify-content: center; align-self: flex-start; min-height: 44px; padding: 0 14px; border: 1px solid rgba(117,106,141,.22); border-radius: 14px; color: #655d79; background: rgba(255,255,255,.8); font-weight: 760; }
  .preview-head { padding: 17px; flex-direction: column; }
  .preview-actions { justify-content: flex-start; }
  .markdown-body { padding: 38px 24px 70px; }
}
@media (max-width: 560px) {
  .portal-page { padding: 18px 12px 36px; }
  .portal-hero { padding: 24px; border-radius: 26px; }
  .portal-grid { grid-template-columns: 1fr; gap: 12px; }
  .portal-card { min-height: 240px; padding: 26px; border-radius: 26px; }
  .library-switch { width: 100%; overflow-x: auto; }
  .library-switch button { min-height: 44px; padding: 0 13px; }
  .topic-list { grid-template-columns: 1fr; }
  .topic-button { min-height: 64px; }
  .hero { min-height: 105px; }
  .preview-head h2, .topic-copy strong, .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body p, .markdown-body li { overflow-wrap: anywhere; word-break: break-word; }
  .markdown-body { padding: 30px 18px 60px; }
  .markdown-body h2 { margin-top: 42px; padding: 18px; font-size: 21px; }
  .markdown-body table { display: block; overflow-x: auto; white-space: nowrap; }
  .login-page { min-height: 100svh; padding: max(14px,env(safe-area-inset-top)) 12px max(14px,env(safe-area-inset-bottom)); }
  .login-card { padding: 26px 20px; border-radius: 26px; }
  .login-form { grid-template-columns: 1fr; }
  .login-form input,.login-form button { min-height: 48px; }
  .note-fab { right: 16px; bottom: 16px; }
  .note-drawer { top: 8px; right: 8px; bottom: 8px; width: calc(100vw - 16px); border-radius: 24px; }
}
