/* 纸 · 线稿 · 缎带 — pink with butter yellow, warm-brown sketch lines */
@font-face { font-family: "Kuaile"; src: url("fonts/ZCOOLKuaiLe-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "LongCang"; src: url("fonts/LongCang-Regular.ttf") format("truetype"); font-display: swap; }

:root {
  --ground: #FFF8F2;
  --dots: #F4DCE0;
  --card: #FFFDFB;
  --line: #F0C3CC;
  --stitch: #F3CDD5;
  --sketch: #A08273;
  --ink: #5A4545;
  --ink-2: #4A3838;
  --muted: #876F6F;
  --faint: #C9B3AE;
  --pink: #F4B3C2;
  --pink-press: #E39AAD;
  --pink-soft: #FCE6EB;
  --pink-ink: #8F4152;
  --pink-text: #B85A6E;
  --rose: #6E2E3E;
  --butter: #FFF3D1;
  --butter-line: #E3C27A;
  --butter-ink: #7A5A2C;
  --star: #F2C96B;
  --warm: #F3A98F;
  --hot: #DE6F86;
  --cold: #9FB6D3;
  --still: #A9C7A4;
  --display: "Kuaile", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --hand: "LongCang", "Kuaile", "Kaiti SC", "STKaiti", "KaiTi", cursive;
  --ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  background-color: var(--ground);
  background-image: radial-gradient(var(--dots) 1.2px, transparent 1.3px);
  background-size: 16px 16px;
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--pink-text); }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.err { color: #B04A5E; font-size: 13px; }
.sr { position: absolute; left: -9999px; }

/* ---------- shell ---------- */
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.page { position: relative; padding: calc(22px + env(safe-area-inset-top)) 18px 20px; min-height: 70vh; }
.page-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; }
.ribbon-title { position: relative; display: inline-flex; align-items: center; height: 46px; padding: 0 34px 0 20px; }
.ribbon-title svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ribbon-title h1 { position: relative; margin: 0; font-family: var(--display); font-weight: 400; font-size: 24px; letter-spacing: 5px; }
.head-note { font-size: 12.5px; color: var(--muted); }
.head-tools { display: flex; gap: 6px; align-items: center; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 14px;
  border: 1.6px solid var(--sketch); background: var(--pink); color: var(--rose); font-weight: 600; box-shadow: 0 3px 0 var(--pink-press); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--pink-press); }
.btn.butter { background: var(--butter); color: var(--butter-ink); box-shadow: 0 3px 0 #EBD7A6; }
.btn.ghost { background: transparent; border: 0; box-shadow: none; color: var(--muted); font-weight: 400; padding: 0 10px; }
.btn.dashed { background: rgba(252,230,235,.5); border: 1.6px dashed #D79AA9; box-shadow: none; color: var(--pink-ink); font-weight: 400; }
.btn.danger { color: #9E3B4F; }
.btn.block { width: 100%; }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }

.field { display: grid; gap: 6px; margin-top: 12px; }
.field > label, .field-label { font-size: 12.5px; color: var(--muted); }
.input, textarea.input, select.input { width: 100%; min-height: 44px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card);
  padding: 10px 14px; outline: none; transition: border-color .15s; -webkit-appearance: none; }
.input:focus { border-color: #E78DA0; }
textarea.input { line-height: 1.8; resize: vertical; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }

.search { position: relative; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 8px 0 16px; background: var(--card);
  border: 1.5px solid var(--line); border-radius: 999px; box-shadow: 0 2px 0 #F7DDE2; margin-top: 12px; }
.search input { flex: 1; border: 0; outline: none; background: transparent; min-width: 0; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--pink-soft); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 12.5px; color: var(--pink-ink); }
.seg button.on { background: var(--card); box-shadow: 0 1px 0 var(--line); font-weight: 600; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 13px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-size: 13px; white-space: nowrap; }
.chip.on { background: var(--pink-soft); border-color: #E78DA0; color: var(--pink-ink); font-weight: 600; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--sketch); background: var(--still); }
.dot.暖 { background: var(--warm); } .dot.烫 { background: var(--hot); } .dot.冷 { background: var(--cold); } .dot.静 { background: var(--still); }

/* ---------- cards ---------- */
.cards { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 18px; }
.card { position: relative; background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; padding: 16px 18px 13px;
  box-shadow: 0 3px 0 #F7DDE2; animation: rise .3s ease both; }
.card::before { content: ""; position: absolute; inset: 5px; border: 1.2px dashed var(--stitch); border-radius: 14px; pointer-events: none; }
.card.butter { background: #FFFBEF; border-color: #EBD39A; box-shadow: 0 3px 0 #F4E6BF; }
.card.butter::before { border-color: #F0DFAE; }
.card.faded { opacity: .62; }
.card > :not(.cover):not(.tape) { position: relative; z-index: 0; }
.card button.cover { position: absolute; inset: 0; z-index: 1; width: 100%; background: transparent; border: 0; border-radius: 18px; z-index: 1; }
.tape { position: absolute !important; top: -9px; right: 26px; width: 70px; height: 19px; transform: rotate(5deg); z-index: 2;
  background: repeating-linear-gradient(90deg, rgba(242,201,107,.55) 0 7px, rgba(255,243,209,.75) 7px 14px);
  border-left: 1px dashed rgba(160,130,115,.35); border-right: 1px dashed rgba(160,130,115,.35); }
.tape.pink { background: repeating-linear-gradient(90deg, rgba(247,198,208,.7) 0 7px, rgba(252,230,235,.85) 7px 14px); right: auto; left: 26px; transform: rotate(-4deg); }
.meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 10px 0 8px; font-size: 12px; color: var(--pink-ink); background: var(--pink-soft);
  border-radius: 4px 11px 11px 4px; border: 1px solid #EDB3C0; }
.tag.butter { background: var(--butter); border-color: var(--butter-line); color: var(--butter-ink); }
.tag.grey { background: #F4EEEC; border-color: #DCCDC8; color: var(--muted); }
.body { margin: 10px 0 12px; font-size: 15px; line-height: 1.85; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.foot { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.stars { display: inline-flex; gap: 2px; }
.empty { text-align: center; color: var(--faint); margin: 54px 0; font-family: var(--display); font-size: 16px; letter-spacing: 2px; }

/* ---------- section ribbons ---------- */
.ribbon { position: relative; height: 30px; margin: 24px 0 12px -18px; }
.ribbon svg { position: absolute; left: 0; top: 0; }
.ribbon span { position: absolute; left: 22px; top: 6px; font-size: 13px; font-weight: 600; letter-spacing: 2px; color: var(--pink-ink); }
.ribbon.butter span { color: var(--butter-ink); }

/* ---------- window modules ---------- */
.budget { margin-top: 14px; padding: 14px 16px; background: var(--card); border: 1.5px solid var(--sketch); border-radius: 16px; box-shadow: 0 3px 0 #EDD3D0; }
.bar { position: relative; margin-top: 10px; height: 14px; border-radius: 999px; background: #F7EDE9; border: 1.2px solid #D9C1B8; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: repeating-linear-gradient(-45deg, #F2A9B9 0 6px, #F7C6D0 6px 12px); }
.bar.over i { background: repeating-linear-gradient(-45deg, #E7A15E 0 6px, #F2C96B 6px 12px); }
.slips { display: grid; gap: 10px; }
.slip { position: relative; display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 8px 8px 8px 6px; background: var(--card);
  border: 1.5px solid var(--line); border-radius: 12px; box-shadow: 0 2px 0 #F7DDE2; }
.slip.butter { background: #FFFBEF; border-color: #EBD39A; box-shadow: 0 2px 0 #F4E6BF; }
.slip.off { opacity: .55; }
.slip .main { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 6px 4px; min-height: 44px; }
.slip .name { display: flex; align-items: center; gap: 6px; font-size: 14.5px; font-weight: 600; }
.slip .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.order { display: flex; flex-direction: column; }
.order button { width: 30px; height: 24px; border: 0; background: transparent; color: var(--faint); padding: 0; }
.kind { font-size: 10.5px; font-weight: 400; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--butter-line); background: var(--butter); color: var(--butter-ink); }
.kind.list { border-color: #C7D3E3; background: #EFF3F9; color: #46607F; }
.kind.auto { border-color: #C9D7C5; background: #F1F6EE; color: #4F6A4B; }
.sw { position: relative; flex: none; width: 50px; height: 30px; border-radius: 999px; border: 1.5px solid var(--sketch); background: #EFE6E2; padding: 0; }
.sw::after { content: ""; position: absolute; top: 4px; left: 4px; width: 19px; height: 19px; border-radius: 50%; background: var(--card); border: 1.2px solid var(--sketch); transition: left .15s; }
.sw[aria-pressed="true"] { background: #E78DA0; }
.sw[aria-pressed="true"]::after { left: 24px; }

/* ---------- diary ---------- */
.calendar { position: relative; margin-top: 10px; padding: 26px 18px 18px; background: var(--butter); border: 1.5px solid var(--sketch); border-radius: 16px; box-shadow: 0 4px 0 #EDDDB2; }
.rings { position: absolute; top: -9px; left: 0; right: 0; display: flex; justify-content: center; gap: 78px; }
.rings i { width: 12px; height: 20px; border-radius: 7px; border: 1.5px solid var(--sketch); background: var(--card); }
.bignum { font-family: var(--display); font-size: 46px; line-height: 1; margin-top: 6px; }
.note { position: relative; display: flex; gap: 6px; align-items: flex-start; padding: 12px 6px 12px 14px; background: var(--card); border: 1.4px solid #EBD3CC; border-radius: 4px 14px 14px 4px; box-shadow: 0 2px 0 #F2E2DC; }
.notebook { position: relative; margin-top: 14px; padding: 22px 16px 26px 46px; background-color: var(--card);
  background-image: linear-gradient(transparent 31px, #F3D9DF 31px, #F3D9DF 32px); background-size: 100% 32px; background-position: 0 14px;
  border: 1.5px solid var(--sketch); border-radius: 6px 18px 18px 6px; box-shadow: 0 4px 0 #EDD3D0; min-height: 300px; }
.notebook::before { content: ""; position: absolute; left: 34px; top: 0; bottom: 0; width: 1.5px; background: #EFA3B3; }
.notebook .holes { position: absolute; left: 10px; top: 24px; bottom: 24px; display: flex; flex-direction: column; justify-content: space-between; }
.notebook .holes i { width: 12px; height: 12px; border-radius: 50%; background: var(--ground); border: 1.4px solid #C9AFA6; }
.notebook .text { font-family: var(--hand); font-size: 21px; line-height: 32px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.notebook textarea { width: 100%; min-height: 360px; border: 0; background: transparent; outline: none; resize: vertical; font-family: var(--hand); font-size: 21px; line-height: 32px; padding: 0; }

/* ---------- now ---------- */
.polaroids { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 14px; margin-top: 22px; }
.polar { position: relative; background: var(--card); border: 1.4px solid #E2CFC8; border-radius: 6px; padding: 14px 12px; box-shadow: 0 3px 8px rgba(160,130,115,.12); text-align: left; min-height: 96px; }
.polar:nth-child(odd) { transform: rotate(-1.4deg); } .polar:nth-child(even) { transform: rotate(1.2deg); }
.polar .t { position: absolute; top: -10px; left: 50%; width: 56px; height: 18px; margin-left: -28px; background: rgba(247,198,208,.7); border-left: 1px dashed rgba(160,130,115,.35); border-right: 1px dashed rgba(160,130,115,.35); }
.polar:nth-child(3n+2) .t { background: rgba(242,201,107,.55); }
.polar .lab { font-size: 11.5px; color: var(--pink-text); font-weight: 600; }
.polar .txt { margin-top: 6px; font-size: 14px; line-height: 1.6; }
.exp { display: inline-block; margin-top: 8px; font-size: 11px; color: var(--butter-ink); background: var(--butter); border: 1px solid var(--butter-line); border-radius: 999px; padding: 1px 8px; }
.tickets { display: grid; gap: 14px; }
.ticket { position: relative; display: flex; align-items: stretch; width: 100%; padding: 0; text-align: left; background: var(--card); border: 1.5px solid var(--sketch); border-radius: 14px; box-shadow: 0 3px 0 #EDD3D0; overflow: hidden; }
.ticket.soon { background: var(--butter); }
.ticket .stub { width: 86px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; border-right: 1.6px dashed #D9B9B2; padding: 10px 0; }
.ticket .stub b { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.1; }
.ticket .notch { position: absolute; left: 79px; width: 16px; height: 16px; border-radius: 50%; background: var(--ground); border: 1.5px solid var(--sketch); }
.ticket .info { flex: 1; padding: 14px 14px 14px 18px; }

/* ---------- settings ---------- */
.panel { margin-top: 14px; padding: 16px; background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; box-shadow: 0 3px 0 #F7DDE2; }
.panel h2 { margin: 0 0 4px; font-size: 15px; }
.icon-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.icon-cell { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1.4px solid var(--line); border-radius: 14px; background: var(--ground); text-align: left; min-height: 60px; }
.icon-cell .ic { width: 36px; height: 36px; flex: none; display: flex; align-items: center; justify-content: center; }
.icon-cell .ic img, .navi img { width: 100%; height: 100%; object-fit: contain; }
.sticker-lib { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.sticker-lib button { aspect-ratio: 1; border: 1.4px dashed var(--line); border-radius: 14px; background: var(--ground); padding: 6px; }
.sticker-lib img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- nav ---------- */
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); width: min(448px, calc(100vw - 24px)); height: 70px; z-index: 30;
  border-radius: 22px; border: 1.5px solid var(--sketch); background-color: #F9D7DE; background-image: radial-gradient(rgba(255,255,255,.75) 1.4px, transparent 1.5px);
  background-size: 12px 12px; display: flex; align-items: center; justify-content: space-around; box-shadow: 0 4px 0 #EDB8C4; }
.navi { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 56px; min-height: 56px; justify-content: center; border: 0; background: transparent; font-size: 11px; color: #6E5656; }
.navi .ic { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.navi.on { color: var(--pink-ink); font-weight: 700; }
.navi.on .ic { transform: translateY(-2px) scale(1.08); }
.fab { position: fixed; right: max(18px, calc(50vw - 222px)); bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 29; width: 58px; height: 58px; border-radius: 50%;
  border: 1.6px solid var(--sketch); background: var(--pink); box-shadow: 0 4px 0 var(--pink-press); display: flex; align-items: center; justify-content: center; padding: 8px; }
.fab img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- sheet & toast ---------- */
dialog.sheet { width: min(480px, 100vw); max-width: 100vw; max-height: 92vh; margin: auto auto 0; padding: 0; border: 1.5px solid var(--sketch); border-bottom: 0;
  border-radius: 20px 20px 0 0; background-color: var(--ground); background-image: radial-gradient(var(--dots) 1.2px, transparent 1.3px); background-size: 16px 16px; color: var(--ink); }
@media (min-width: 700px) { dialog.sheet { margin: auto; border-radius: 20px; border-bottom: 1.5px solid var(--sketch); } }
dialog.sheet::backdrop { background: rgba(90, 69, 69, .3); }
.sheet-inner { padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; gap: 8px; }
.sheet-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 21px; letter-spacing: 2px; flex: 1; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
.actions .spacer { flex: 1; }
.weights { display: flex; gap: 8px; }
.weights button { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); }
.weights button.on { background: var(--pink); border-color: var(--sketch); color: var(--rose); font-weight: 700; }
.pre { white-space: pre-wrap; font-size: 13px; line-height: 1.75; background: var(--card); border: 1.4px solid var(--line); border-radius: 14px; padding: 14px; max-height: 60vh; overflow: auto; }
.msg { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; line-height: 1.7; }
.msg b { color: var(--pink-text); font-weight: 600; }
.msg.hit { background: var(--pink-soft); border-radius: 8px; padding: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--ground);
  padding: 10px 18px; border-radius: 999px; font-size: 13.5px; animation: rise .25s ease both; max-width: 86vw; text-align: center; }

/* ---------- login ---------- */
.login { max-width: 360px; margin: 0 auto; padding: 18vh 24px 40px; text-align: center; }
.login .brand { width: 84px; height: 84px; margin: 0 auto; display: flex; align-items: center; justify-content: center; }
.login .brand img { width: 100%; height: 100%; object-fit: contain; }
.login h1 { font-family: var(--display); font-weight: 400; letter-spacing: 8px; font-size: 30px; margin: 16px 0 4px; }
.login form { margin-top: 30px; display: grid; gap: 12px; }

/* ---------- accents & stickers ---------- */
.accent { position: absolute; pointer-events: none; z-index: 0; }
.deco-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.sticker { position: absolute; pointer-events: none; transform-origin: center; user-select: none; -webkit-user-select: none; }
.sticker img { width: 100%; display: block; pointer-events: none; }
.sticker.outline img { filter: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff) drop-shadow(0 2px 3px rgba(160,130,115,.25)); }
.sticker.multiply { mix-blend-mode: multiply; }
.decorating .deco-layer { pointer-events: auto; background: rgba(252,230,235,.12); outline: 2px dashed #E8B4C0; outline-offset: -6px; }
.decorating .sticker { pointer-events: auto; cursor: grab; touch-action: none; }
.decorating .sticker.sel { outline: 1.6px dashed var(--pink-text); outline-offset: 4px; }
.handle { position: absolute; right: -14px; bottom: -14px; width: 26px; height: 26px; border-radius: 50%; background: var(--card); border: 1.5px solid var(--pink-text); touch-action: none; display: none; }
.decorating .sticker.sel .handle { display: block; }
.deco-bar { position: fixed; left: 50%; transform: translateX(-50%); top: calc(10px + env(safe-area-inset-top)); z-index: 40; display: flex; gap: 6px; align-items: center;
  padding: 6px 8px; background: var(--card); border: 1.5px solid var(--sketch); border-radius: 999px; box-shadow: 0 3px 0 #EDD3D0; font-size: 13px; }
.deco-bar button { min-height: 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--ground); padding: 0 12px; font-size: 13px; }
.deco-bar button.primary { background: var(--pink); border-color: var(--sketch); color: var(--rose); font-weight: 600; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.deco-bar button, .deco-bar span { white-space: nowrap; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
