/* 手记 · POSTER EDITION */
:root {
  color-scheme: dark;
  --bg: #070A16;
  --bg-2: #0A0E1C;
  --panel: #0C1124;
  --panel-2: #111832;
  --ink: #F2EFE4;
  --ink-2: #B9C0D8;
  --muted: #6E7691;
  --line: #1A2240;
  --black: #05060C;
  --cyan: #12D6F2;
  --cyan-d: #08A8C0;
  --red: #F5194B;
  --magenta: #12D6F2;
  --magenta-d: #08A8C0;
  --yellow: #FFD21E;
  --white: #FBF8EE;
  --green: #6BFFB0;
  --danger: #FF3D5A;
  --display: "Arial Black", "HarmonyOS Sans SC", "HarmonyOS Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --sans: -apple-system, "HarmonyOS Sans SC", "HarmonyOS Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "HarmonyOS Sans SC", "Microsoft YaHei", monospace;
  --star: polygon(50% 0%, 58% 33%, 92% 19%, 69% 47%, 100% 57%, 67% 65%, 79% 97%, 50% 76%, 21% 99%, 32% 65%, 0% 57%, 31% 47%, 8% 19%, 42% 33%);
  --app-h: 100dvh;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
}

body {
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(18, 214, 242, .06) 1px, transparent 1.6px);
  background-size: 9px 9px;
  pointer-events: none;
  z-index: 0;
}

button, input, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--magenta); color: var(--white); }
::-webkit-scrollbar { width: 0; height: 0; }

.app {
  position: relative;
  z-index: 1;
  height: var(--app-h);
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ------------------------------- 顶栏 ------------------------------- */
.top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  height: calc(52px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0 14px;
  background: var(--bg-2);
  border-bottom: 3px solid var(--black);
  position: relative;
  z-index: 6;
  overflow: hidden;
}
.top::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 86px;
  background: repeating-linear-gradient(102deg, transparent 0 9px, rgba(18, 214, 242, .06) 9px 11px);
  pointer-events: none;
}

.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; position: relative; z-index: 1; }

.seal {
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  background: var(--cyan);
  color: var(--black);
  font-family: var(--display);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  border: 2px solid var(--black);
  box-shadow: 3px 3px 0 var(--magenta);
  transform: rotate(-4deg);
}
.seal.big {
  width: 58px; height: 58px;
  font-size: 30px;
  margin: 0 auto 22px;
  color: var(--yellow);
  box-shadow: 5px 5px 0 var(--magenta);
}

.wordmark {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -.01em;
  color: var(--white);
  white-space: nowrap;
  transform: skewX(-6deg);
}

.tagline {
  font-family: var(--display);
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 3px;
  transform: skewX(-6deg);
}

.top-right { display: flex; align-items: center; gap: 1px; position: relative; z-index: 1; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--ink-2);
  max-width: 122px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 6px;
}
.status::before {
  content: "";
  flex: none;
  width: 6px; height: 6px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(18, 214, 242, .7);
}
.status:empty { display: none; }
.status.saving::before { background: var(--yellow); }
.status.error::before { background: var(--magenta); }
.status.warn::before { background: var(--yellow); }

.iconbtn {
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  border: 2px solid transparent;
  background: transparent;
  color: var(--ink);
  padding: 0;
}
.iconbtn:active { border-color: var(--cyan); background: rgba(18, 214, 242, .08); }
.iconbtn svg {
  width: 18px; height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ------------------------------- 视图 ------------------------------- */
.main { flex: 1; min-height: 0; display: flex; position: relative; }
.view { display: none; flex: 1; min-width: 0; min-height: 0; flex-direction: column; }
.view.active { display: flex; animation: popIn .22s ease both; }

.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------- 日期 ------------------------------- */
.datebar {
  flex: none;
  display: grid;
  grid-template-columns: 28px 1fr 28px auto;
  align-items: center;
  gap: 2px;
  min-height: 82px;
  padding: 14px 10px 11px 4px;
  background-color: #0A0E1C;
  background-image: linear-gradient(90deg, rgba(18, 214, 242, .10), transparent 62%);
  border-bottom: 1px solid var(--line);
  position: relative;
  color: var(--ink);
  transition: min-height .2s ease, padding .2s ease, background-color .2s ease;
}
.datebar.compact {
  min-height: 48px;
  padding: 5px 8px 5px 2px;
  background-image: none;
  border-bottom-color: #161D33;
}
.datebar:not(.is-today) .daynum {
  color: var(--ink);
  text-shadow: none;
}
.datebar:not(.is-today) .daynum::before,
.datebar:not(.is-today) .daynum::after { display: none; }
.datebar:not(.is-today) .daynum { color: var(--ink); }

@keyframes dayFlip {
  from { opacity: .3; transform: translateY(-4px) rotateX(9deg); }
  to { opacity: 1; transform: none; }
}
.datebar.slide .dateMain { animation: dayFlip .2s ease; transform-origin: left center; }

.dateArrow {
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  display: grid;
  place-items: center;
  padding: 0;
  position: relative;
  z-index: 3;
  transition: color .18s ease, background-color .18s ease;
}
.dateArrow svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.dateArrow:active { background: rgba(18, 214, 242, .10); color: var(--cyan); }

.dateMain {
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 0 4px 0 8px;
  min-width: 0;
  text-align: left;
}

.daynum {
  position: relative;
  z-index: 1;
  width: 54px;
  height: 50px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 35px;
  font-style: italic;
  font-weight: 900;
  letter-spacing: -.06em;
  color: var(--black);
  flex: none;
  transition: width .18s ease, height .18s ease, font-size .18s ease;
}
.daynum::before {
  content: "";
  position: absolute;
  inset: -9px -10px;
  background: var(--yellow);
  clip-path: var(--star);
  z-index: -1;
  transform: rotate(7deg);
}
.daynum::after {
  content: "";
  position: absolute;
  inset: -12px -13px;
  background: var(--black);
  clip-path: var(--star);
  z-index: -2;
  transform: rotate(7deg);
}

.datemeta { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; min-width: 0; }
.month {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
  color: var(--black);
  background: var(--yellow);
  border: 2px solid var(--black);
  padding: 1px 7px;
  box-shadow: 2px 2px 0 var(--black);
  transform: rotate(-2deg);
  white-space: nowrap;
}
.week {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--ink-2);
  white-space: nowrap;
  text-shadow: none;
}

.todaySeal {
  margin-left: 4px;
  background: var(--red);
  color: var(--white);
  border: 2px solid var(--black);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  padding: 7px 7px;
  box-shadow: 3px 3px 0 rgba(5, 6, 12, .35);
  transform: rotate(2deg);
}
.todaySeal:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(5, 6, 12, .35); }

.datebar.compact .daynum {
  width: 30px;
  height: 30px;
  font-size: 21px;
  font-style: normal;
  color: var(--ink);
}
.datebar.compact.is-today .daynum { color: var(--black); }
.datebar.compact .daynum::before { inset: -3px -4px; transform: rotate(0); }
.datebar.compact .daynum::after { display: none; }
.datebar.compact .dateMain { gap: 8px; }
.datebar.compact .datemeta { gap: 3px; }
.datebar.compact .month { font-size: 9px; padding: 0 4px; border-width: 1px; box-shadow: none; transform: none; }
.datebar.compact .week { font-size: 9px; color: var(--muted); }
.datebar.compact .dateArrow { height: 30px; }
.datebar.compact .dateArrow svg { width: 16px; height: 16px; }
.datebar.compact .todaySeal { font-size: 9px; padding: 4px 5px; box-shadow: none; transform: none; }

.notebar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--black);
  border-bottom: 2px solid var(--black);
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--cyan);
  overflow: hidden;
  white-space: nowrap;
}
.notebar::before { content: "▸"; color: var(--yellow); }
.noteName { overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------- 编辑器 ------------------------------- */
.editor-wrap { flex: 1; min-width: 0; min-height: 0; display: flex; position: relative; background: #080B16; }
.editor-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  background-size: 120px 120px;
  opacity: .05;
  mix-blend-mode: soft-light;
}
.editor-wrap::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--cyan);
  pointer-events: none;
  z-index: 2;
}

.stamp {
  position: absolute;
  right: 18px;
  top: 16px;
  z-index: 4;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(18, 214, 242, .12);
  opacity: 0;
  pointer-events: none;
}
.stamp.show { animation: dotFade .95s ease-out both; }
@keyframes dotFade {
  0% { opacity: 0; transform: scale(.4); }
  16% { opacity: 1; transform: scale(1); }
  65% { opacity: 1; }
  100% { opacity: 0; transform: scale(.82); }
}
.wordcount {
  position: absolute;
  right: 14px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 3;
  padding: 2px 6px;
  border: 1px solid #1A2240;
  border-radius: 3px;
  background: rgba(8, 11, 22, .86);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  pointer-events: none;
}

.onbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 10px;
  background: var(--black);
  border-bottom: 2px solid var(--line);
}
.onlab {
  flex: none;
  background: var(--yellow);
  color: var(--black);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
  padding: 3px 8px;
  transform: skewX(-6deg);
}
.onlink {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: .01em;
  padding: 3px 0;
}
.onmore {
  flex: none;
  border: 1px solid var(--magenta);
  background: transparent;
  color: var(--magenta);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 900;
  padding: 3px 7px;
}
.onclose {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}


/* 编辑模式标题导航：默认窄栏，展开后竖排 */
.write-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}
.headingbar {
  flex: none;
  width: 64px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px 5px 6px;
  background: #0A0E1C;
  border-right: 1px solid #161D33;
  overflow: hidden;
  transition: width .18s ease;
}
.headingbar.open { width: 168px; }
.headingbar-tag {
  flex: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 3px;
  border: 1px solid #1A2240;
  background: #0C1124;
  color: var(--cyan);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  text-align: center;
}
.headingbar-chev {
  font-size: 14px;
  line-height: 1;
  color: var(--yellow);
  transition: transform .18s ease;
}
.headingbar.open .headingbar-chev { transform: rotate(90deg); }
.headingbar-list {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 1px 8px;
  scrollbar-width: none;
}
.headingbar-list::-webkit-scrollbar { display: none; }
.headingbar:not(.open) .headingbar-list { flex: none; overflow: hidden; padding-bottom: 0; }
.headingbar:not(.open) .hchip:not(.current) { display: none; }
.hchip {
  width: 100%;
  max-width: none;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  padding: 5px 6px;
  border: 1px solid #1A2240;
  border-radius: 4px;
  background: #080B16;
  color: #C9C3B2;
  font-family: var(--sans);
  font-size: 10.5px;
  line-height: 1.2;
  text-align: left;
  white-space: normal;
}
.hchip b {
  flex: none;
  margin-top: 1px;
  padding: 1px 4px;
  border-radius: 2px;
  background: var(--cyan);
  color: #06121A;
  font-family: var(--display);
  font-size: 8px;
  font-weight: 900;
  line-height: 1.3;
}
.hchip.h2 b { background: var(--yellow); color: var(--black); }
.hchip.h3 b { background: #5C6580; color: var(--white); }
.hchip.h4 b, .hchip.h5 b, .hchip.h6 b { background: #2A3454; color: var(--ink-2); }
.hchip .t {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  line-height: 1.35;
}
.hchip.current {
  border-color: var(--cyan);
  background: #111832;
  box-shadow: 0 0 0 1px rgba(18, 214, 242, .18);
}
.heading-dots {
  flex: 1;
  min-height: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.heading-dots::-webkit-scrollbar { display: none; }
.headingbar:not(.open) .heading-dots { display: flex; }
.headingbar.open .heading-dots { display: none; }
.heading-dot {
  flex: none;
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--cyan);
  opacity: .55;
  transition: opacity .15s ease, transform .15s ease, box-shadow .15s ease;
}
.heading-dot.h2 { background: var(--yellow); }
.heading-dot.h3 { background: #5C6580; }
.heading-dot.h4, .heading-dot.h5, .heading-dot.h6 { background: #2A3454; }
.heading-dot.current { opacity: 1; transform: scale(1.35); box-shadow: 0 0 0 3px rgba(18, 214, 242, .18); }

.editor {
  position: relative;
  z-index: 1;
  overflow-wrap: break-word;
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  padding: 20px 20px calc(32px + env(safe-area-inset-bottom)) 24px;
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.9;
  letter-spacing: .01em;
  color: var(--ink);
  caret-color: var(--magenta);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.editor::placeholder { color: #59617C; font-weight: 600; }



.preview {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px calc(36px + env(safe-area-inset-bottom)) 24px;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.9;
  letter-spacing: .01em;
  color: var(--ink);
}
.preview h1, .preview h2, .preview h3, .preview h4 {
  font-family: var(--display);
  line-height: 1.35;
  margin: 1.55em 0 .6em;
  font-weight: 900;
  letter-spacing: -.01em;
}
.preview h1 {
  font-size: 26px;
  color: var(--yellow);
  text-shadow: 3px 3px 0 var(--black);
}
.preview h2 {
  display: inline-block;
  font-size: 17px;
  color: var(--white);
  background: var(--magenta);
  border: 2px solid var(--black);
  padding: 1px 9px 2px;
  box-shadow: 3px 3px 0 var(--black);
  transform: rotate(-.7deg);
}
.preview h3 { font-size: 17px; color: var(--cyan); }
.preview h4 { font-size: 15.5px; color: var(--ink-2); }
.preview p { margin: .85em 0; }
.preview hr { border: 0; border-top: 3px solid var(--line); margin: 2em 0; }
.preview blockquote {
  margin: 1.1em 0;
  padding: 8px 12px;
  border-left: 5px solid var(--yellow);
  background: var(--panel);
  color: var(--ink-2);
  font-weight: 500;
}
.preview ul, .preview ol { margin: .7em 0; padding-left: 1.4em; }
.preview li { margin: .3em 0; }
.preview li::marker { color: var(--magenta); font-weight: 900; }
.preview code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--black);
  border: 1px solid var(--line);
  padding: .08em .35em;
  color: var(--cyan);
}
.preview pre {
  background: var(--black);
  border: 2px solid var(--line);
  padding: 13px 15px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.65;
}
.preview pre code { border: 0; padding: 0; background: none; font-size: inherit; color: var(--ink); }
.preview img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 16px 0;
  border: 3px solid var(--white);
  box-shadow: 6px 6px 0 var(--black);
}
.preview a { color: var(--cyan); font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--magenta); }
.preview .wiki { color: var(--cyan); border-bottom: 2px dashed var(--cyan); }
.preview .tag {
  color: var(--black);
  background: var(--yellow);
  border: 1px solid var(--black);
  padding: .02em .35em;
  font-size: .86em;
  font-weight: 800;
}
.preview .imgcap { font-size: 10px; color: var(--muted); margin: -10px 0 14px; }
.preview .ph {
  display: inline-grid; place-items: center;
  min-width: 120px; height: 80px;
  background: var(--panel);
  border: 2px dashed var(--line);
  color: var(--muted);
  font-size: 10px;
  margin: 10px 0;
}

/* ------------------------------- 工具栏 ------------------------------- */
.toolbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px 8px;
  background: var(--black);
  border-top: 3px solid var(--black);
  overflow-x: auto;
  scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }

.toolbar button {
  flex: 0 0 auto;
  min-width: 42px;
  height: 38px;
  padding: 0 9px;
  border: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  transition: transform .1s, background .1s;
}
.toolbar button svg {
  width: 19px; height: 19px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.toolbar button:active, .toolbar button.on {
  background: var(--yellow);
  border-color: var(--black);
  color: var(--black);
  box-shadow: 3px 3px 0 var(--magenta);
  transform: translate(-1px, -1px);
}
.toolbar .txt {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -.02em;
}
.toolbar .bold { font-size: 14px; }

/* ------------------------------- 底部标签 ------------------------------- */
.tabbar {
  flex: none;
  display: flex;
  background: var(--black);
  border-top: 3px solid var(--black);
  padding-bottom: env(safe-area-inset-bottom);
}
body.kb .tabbar { display: none; }

.tab {
  position: relative;
  flex: 1;
  height: 56px;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #6E7691;
  font-family: var(--display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  transition: background .12s, color .12s;
}
.tab svg {
  width: 19px; height: 19px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.tab.active { background: transparent; color: var(--cyan); }
.tab.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background: var(--cyan);
  box-shadow: 3px 0 12px rgba(18, 214, 242, .45);
}
.tab.active svg { stroke-width: 2.4; }

/* ------------------------------- 笔记列表 ------------------------------- */
.subbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--black);
  border-bottom: 2px solid var(--line);
}
.crumb {
  flex: 1;
  text-align: center;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini {
  border: 2px solid transparent;
  background: transparent;
  color: var(--yellow);
  font-family: var(--display);
  font-size: 10.5px;
  font-weight: 800;
  padding: 6px 4px;
  white-space: nowrap;
}
.mini:active { border-color: var(--yellow); }
.mini[hidden] { display: none; }
.mini.clear { font-size: 18px; line-height: 1; padding: 2px 6px; }

.sect {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 20px 16px 8px;
  font-family: var(--display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--yellow);
}
.sect::before {
  content: "";
  width: 9px; height: 9px;
  background: var(--magenta);
  border: 1px solid var(--black);
}
.sect::after {
  content: "";
  flex: 1;
  height: 3px;
  background: var(--line);
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.item:active { background: var(--panel); }
.item .ico {
  flex: none;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  background: var(--cyan);
  border: 2px solid var(--black);
  box-shadow: 2px 2px 0 var(--magenta);
  color: var(--black);
}
.item[data-type="dir"] .ico { background: var(--yellow); }
.item .ico svg {
  width: 14px; height: 14px;
  fill: none; stroke: currentColor;
  stroke-width: 2.2; stroke-linejoin: round;
}
.item .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item .name {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item .sub {
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item .chev { color: var(--magenta); font-size: 17px; font-weight: 900; }

.empty {
  padding: 48px 26px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.95;
}
.empty b { color: var(--yellow); }

/* ------------------------------- 搜索 ------------------------------- */
.searchbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  background: var(--black);
  border-bottom: 2px solid var(--line);
}
.searchIcon {
  width: 17px; height: 17px;
  flex: none;
  fill: none;
  stroke: var(--cyan);
  stroke-width: 2.4;
  stroke-linecap: round;
}
.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-bottom: 3px solid var(--cyan);
  border-radius: 0;
  background: transparent;
  padding: 6px 1px 7px;
  font-family: var(--sans);
  font-size: 15.5px;
  font-weight: 700;
  outline: 0;
  color: var(--ink);
  caret-color: var(--magenta);
}
.searchbar input::placeholder { color: var(--muted); font-weight: 600; }
.searchbar input::-webkit-search-cancel-button { display: none; }

.scope {
  flex: none;
  border: 2px solid var(--yellow);
  background: transparent;
  color: var(--yellow);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .02em;
  padding: 5px 7px;
}
.scope.all { background: var(--yellow); color: var(--black); }

.hits-note {
  padding: 10px 16px;
  background: var(--panel);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
  line-height: 1.8;
}
.hit {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  border-left: 4px solid var(--magenta);
}
.hit:active { background: var(--panel); }
.hit .t {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 5px;
  color: var(--ink);
}
.hit .s {
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hit mark { background: var(--yellow); color: var(--black); padding: 0 1px; }

/* ------------------------------- 设置 ------------------------------- */
.settings { padding: 12px 0 34px; }
.card {
  position: relative;
  margin: 0 16px 18px;
  padding: 16px 14px;
  background: var(--panel);
  border: 2px solid var(--black);
  box-shadow: 5px 5px 0 var(--magenta);
}
.card h3 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--black);
  background: var(--yellow);
  display: inline-block;
  padding: 2px 7px;
  transform: skewX(-6deg);
}
.row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 0;
  font-size: 11.5px;
  border-bottom: 1px solid var(--line);
}
.row .k { color: var(--muted); flex: none; font-weight: 700; }
.row .v {
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
}
.bigbtn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  border: 2px solid var(--black);
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 3px 3px 0 var(--black);
}
.bigbtn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--black); }
.bigbtn.primary { background: var(--cyan); color: var(--black); }
.tip {
  font-size: 10px;
  line-height: 1.85;
  color: var(--muted);
  margin-top: 10px;
  font-weight: 600;
}

/* ------------------------------- 浮层 ------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 8px);
  background: var(--yellow);
  border: 2px solid var(--black);
  color: var(--black);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 800;
  padding: 9px 15px;
  max-width: 84vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  box-shadow: 4px 4px 0 var(--black);
  z-index: 95;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.sheet-wrap { position: fixed; inset: 0; z-index: 70; }
.sheet-wrap[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(3, 4, 8, .78); animation: fade .16s ease; }
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg-2);
  border-top: 5px solid var(--yellow);
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 0 rgba(245, 25, 75, .35);
  animation: up .22s cubic-bezier(.2, .8, .3, 1);
}
.sheet h3 {
  margin: 0 0 7px;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--yellow);
}
.sheet h3::before { content: "▸ "; color: var(--magenta); }
.sheet p { margin: 0 0 14px; font-size: 11px; font-weight: 600; line-height: 1.8; color: var(--ink-2); }
.sheet .opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 13px;
  margin-bottom: 8px;
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 800;
}
.sheet .opt small {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.6;
}
.sheet .opt.primary { background: var(--magenta); border-color: var(--black); color: var(--white); box-shadow: 4px 4px 0 var(--black); }
.sheet .opt.primary small { color: rgba(255, 255, 255, .7); }
.sheet .opt:active { transform: translate(1px, 1px); }
.sheet .pane {
  max-height: 96px;
  overflow: hidden;
  white-space: pre-wrap;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.7;
  color: var(--ink-2);
  background: var(--black);
  border-left: 4px solid var(--cyan);
  padding: 9px 11px;
  margin-bottom: 12px;
}
.sheet input[type=text] {
  width: 100%;
  border: 2px solid var(--line);
  background: var(--black);
  padding: 10px 11px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  outline: 0;
  margin-bottom: 14px;
  color: var(--ink);
  caret-color: var(--magenta);
}
.sheet input[type=text]:focus { border-color: var(--cyan); }
.sheet .row2 { display: flex; gap: 8px; }
.sheet .row2 .opt { margin-bottom: 0; text-align: center; }

@keyframes up { from { transform: translateY(26px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------- 配对令牌 ------------------------------- */
.gate {
  position: fixed; inset: 0;
  z-index: 99;
  background: var(--cyan);
  background-image: radial-gradient(rgba(5, 6, 12, .14) 1px, transparent 1.5px);
  background-size: 8px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  overflow: hidden;
}
.gate::before {
  content: "";
  position: absolute;
  width: 360px; height: 360px;
  border-radius: 50%;
  background: var(--magenta);
  border: 4px solid var(--black);
  top: -120px; right: -120px;
}
.gate[hidden] { display: none; }
.gate-card {
  position: relative;
  width: 100%;
  max-width: 330px;
  text-align: center;
  background: var(--black);
  border: 3px solid var(--black);
  box-shadow: 8px 8px 0 var(--yellow);
  padding: 28px 22px;
}
.gate-card h1 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: .02em;
  color: var(--cyan);
  transform: skewX(-6deg);
}
.gate-card p { font-size: 10.5px; font-weight: 600; color: var(--ink-2); line-height: 1.8; margin: 0 0 18px; }
.gate-card input {
  width: 100%;
  border: 2px solid var(--line);
  background: var(--bg-2);
  padding: 10px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  outline: 0;
  margin-bottom: 12px;
  text-align: center;
  color: var(--ink);
  caret-color: var(--magenta);
}
.gate-card input:focus { border-color: var(--yellow); }
.gate-card .primary {
  width: 100%;
  border: 3px solid var(--black);
  background: var(--yellow);
  color: var(--black);
  padding: 11px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
  box-shadow: 4px 4px 0 var(--magenta);
}
.gate-hint { margin-top: 12px; font-size: 9.5px; font-weight: 700; color: var(--magenta); min-height: 16px; line-height: 1.6; }

.hidden-date {
  position: fixed;
  left: -999px; top: 0;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 820px) {
  .app { border-left: 3px solid var(--black); border-right: 3px solid var(--black); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ------------------------------- 草稿箱 ------------------------------- */
#viewDrafts { background: var(--bg); }
.draft-top {
  flex: none;
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin: 12px 14px 0;
}
.draft-arrow {
  flex: none;
  width: 36px;
  border: 2px solid var(--line);
  background: var(--black);
  color: var(--paper);
  font-family: var(--display);
  font-size: 20px;
  line-height: 1;
  padding: 0;
}
.draft-date {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 5px 10px;
  border: 2px solid var(--line);
  background: var(--black);
  color: var(--paper);
  text-align: left;
}
#draftDateLabel {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 900;
  color: var(--paper);
}
#draftDateSub {
  font-family: var(--sans);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: .02em;
}
.draft-ai {
  flex: none;
  min-width: 66px;
  padding: 0 8px;
  background: var(--magenta);
  color: var(--paper);
  border: 2px solid var(--black);
  box-shadow: 3px 3px 0 var(--yellow);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .02em;
}
.draft-ai:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--yellow); }
.draft-meta {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 7px 16px 0;
  font-family: var(--sans);
  font-size: 9px;
  color: var(--muted);
}
.draft-meta b { color: var(--cyan); font-weight: 800; }
.draft-meta .off { color: var(--yellow); }
.draft-scroll { padding: 8px 14px 4px; }
.frag {
  position: relative;
  background: var(--black);
  border: 2px solid var(--line);
  border-left: 4px solid var(--cyan);
  padding: 9px 11px 7px;
  margin-bottom: 10px;
}
.frag::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 14px;
  width: 4px;
  height: 16px;
  background: var(--cyan);
  box-shadow: 2px 0 8px rgba(18, 214, 242, .35);
}
.frag.pending { border-left-color: var(--yellow); }
.frag.pending::before { background: var(--yellow); box-shadow: none; }
.frag.after-target { border-color: var(--yellow); }
.frag-time {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--cyan);
}
.frag.pending .frag-time { color: var(--yellow); }
.frag-flag {
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 600;
  color: var(--yellow);
  border: 1px solid var(--yellow);
  padding: 0 4px;
}
.frag-text {
  margin: 5px 0 7px;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.frag-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.frag-actions button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 9px;
  padding: 3px 7px;
}
.frag-actions button:active { border-color: var(--cyan); color: var(--cyan); }
.draft-empty { padding: 40px 18px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.9; }
.draft-empty b { color: var(--yellow); }
.draft-compose {
  flex: none;
  margin: 0 14px 8px;
  padding-top: 8px;
  border-top: 2px solid var(--paper);
}
.draft-after {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  padding: 4px 8px;
  background: rgba(255, 210, 30, .12);
  border-left: 3px solid var(--yellow);
  color: var(--yellow);
  font-size: 10px;
}
.draft-after b { color: var(--paper); }
.draft-after button { border: 0; background: transparent; color: var(--yellow); font-size: 16px; line-height: 1; padding: 0 2px; }
.draft-row { display: flex; gap: 8px; align-items: stretch; }
#draftInput {
  flex: 1;
  min-width: 0;
  height: 58px;
  resize: none;
  border: 2px solid var(--line);
  background: var(--black);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  padding: 8px 9px;
  outline: 0;
  caret-color: var(--cyan);
}
#draftInput:focus { border-color: var(--cyan); }
#draftInput::placeholder { color: #5E6878; }
.draft-send {
  flex: none;
  width: 62px;
  border: 2px solid var(--black);
  background: var(--cyan);
  color: var(--black);
  box-shadow: 3px 3px 0 var(--magenta);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 900;
}
.draft-send:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--magenta); }
.draft-send[disabled] { opacity: .55; }

.tab-badge {
  position: absolute;
  top: 4px;
  right: 50%;
  transform: translateX(18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  background: var(--magenta);
  color: var(--paper);
  border: 1px solid var(--black);
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}
.tab-badge[hidden] { display: none; }

/* AI 结果 / 编辑草稿 */
.sheet textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 2px solid var(--line);
  background: #04060B;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.8;
  padding: 10px 11px;
  outline: 0;
  margin-bottom: 12px;
}
.sheet textarea:focus { border-color: var(--cyan); }
.sheet textarea.ai-result { min-height: 230px; font-size: 14px; }
.sheet .ai-note { margin-top: -6px; margin-bottom: 12px; }
.sheet .ai-loading { padding: 16px 4px; color: var(--ink-2); font-size: 12px; line-height: 1.9; }


/* 密码输入框沿用 sheet 的输入样式 */
.sheet input[type="password"] {
  width: 100%;
  border: 2px solid var(--line);
  background: #04060B;
  padding: 10px 11px;
  font-size: 14px;
  font-weight: 700;
  outline: 0;
  margin-bottom: 14px;
  color: var(--paper);
  caret-color: var(--cyan);
}
.sheet input[type="password"]:focus { border-color: var(--cyan); }

.netbar {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 58px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100vw - 24px);
  padding: 8px 10px;
  border: 1px solid rgba(75, 225, 255, 0.55);
  border-radius: 8px;
  background: #16121f;
  color: #dffbff;
  font-size: 12px;
  line-height: 1.2;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 12px rgba(75, 225, 255, 0.18);
}
.netbar[hidden] { display: none; }
.netbar button {
  flex: none;
  padding: 5px 8px;
  border: 0;
  border-radius: 5px;
  background: linear-gradient(135deg, #4be1ff, #b36bff);
  color: #06121a;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

/* ------------------------------ CodeMirror 编辑面 ------------------------------ */
.editor.cm-hidden {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}
.editor-mount {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  min-height: 0;
  background: transparent;
}
.editor-mount[hidden] { display: none; }
.editor-mount .cm-editor {
  flex: 1;
  min-height: 0;
  height: 100%;
  background: transparent;
}
.editor-mount .cm-scroller {
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom);
}
.editor-mount .cm-content { letter-spacing: .01em; }
.cm-line.cm-md-h1 { font-size: 1.55em; line-height: 1.4; font-weight: 900; color: var(--ink); padding: .45em 0 .12em; letter-spacing: -.01em; }
.cm-line.cm-md-h2 { font-size: 1.3em; line-height: 1.45; font-weight: 800; color: var(--yellow); padding: .35em 0 .08em; }
.cm-line.cm-md-h3 { font-size: 1.15em; line-height: 1.5; font-weight: 800; color: var(--cyan); padding: .25em 0 .05em; }
.cm-line.cm-md-h4, .cm-line.cm-md-h5, .cm-line.cm-md-h6 { font-size: 1.04em; line-height: 1.6; font-weight: 800; color: var(--ink-2); }
.cm-line.cm-md-quote {
  border-left: 2px solid var(--cyan);
  padding-left: 12px !important;
  color: var(--ink-2);
  background: linear-gradient(90deg, rgba(18, 214, 242, .06), transparent 55%);
}
.cm-image-wrap { display: inline-block; max-width: 100%; vertical-align: middle; margin: 4px 0; }
.cm-image {
  display: block;
  max-width: min(320px, 100%);
  max-height: 300px;
  height: auto;
  border-radius: 6px;
  border: 1px solid #1A2240;
}
.cm-placeholder { color: #59617C !important; font-weight: 600; }

/* 轻动效 */
.view.active { animation: viewIn .18s ease-out; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
