@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&family=Noto+Serif+SC:wght@500;600;700&display=swap');

:root {
  --paper: #f5f1e9;
  --paper-deep: #eae3d7;
  --ink: #272621;
  --muted: #8a877e;
  --line: #dfd8cb;
  --green: #3f7054;
  --green-deep: #2f563f;
  --orange: #e27b3c;
  --white: #fffdf8;
  --radius: 18px;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #d7d0c6; color: var(--ink); font-family: 'Noto Sans SC', sans-serif; -webkit-font-smoothing: antialiased; }
button { border: 0; cursor: pointer; font: inherit; color: inherit; background: none; }
button:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }

.phone-shell { width: min(100%, 430px); min-height: 100dvh; margin: 0 auto; background: var(--paper); box-shadow: 0 0 60px rgb(38 31 25 / 12%); overflow: hidden; }
.status-bar { height: 30px; padding: 9px 22px 0; display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.status-bar span:last-child { letter-spacing: 3px; font-size: 10px; }
.app-view { min-height: calc(100dvh - 30px); padding: 0 22px 98px; position: relative; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding-top: 21px; }
.topbar h1 { font: 700 31px/1 'Noto Serif SC', serif; letter-spacing: -.08em; margin: 5px 0 0; }
.kicker, .eyebrow { margin: 0; color: var(--muted); font-size: 10px; letter-spacing: .13em; font-weight: 600; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 13px; }

.greeting { padding-top: 54px; }
.greeting h2 { font: 600 25px/1.42 'Noto Serif SC', serif; letter-spacing: -.05em; margin: 9px 0 7px; }
.greeting h2 em { font-style: normal; color: var(--orange); }
.lede { color: #747168; font-size: 13px; margin: 0 0 24px; }
.scan-card { background: #2f302c; border-radius: var(--radius); padding: 19px; color: var(--paper); box-shadow: 0 12px 26px rgb(48 40 32 / 13%); }
.scan-card-top { display: flex; align-items: center; gap: 11px; }.scan-mark { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid rgb(245 241 233 / 35%); color: #eee8dd; font: 600 18px 'Noto Serif SC', serif; }
.scan-card h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; }.scan-card-top p { margin: 0; color: #aaa89f; font-size: 11px; }
.scan-window { height: 142px; margin: 17px 0 15px; display: grid; place-items: center; position: relative; border: 1px solid rgb(255 255 255 / 8%); background: radial-gradient(circle at center, #40413b 0, #343530 58%, #2b2c29 100%); overflow: hidden; }
.scan-window::before { content: ''; position: absolute; inset: 20% 26%; background: repeating-linear-gradient(180deg, rgb(244 239 228 / 5%) 0 1px, transparent 1px 14px); transform: rotate(-7deg); }.scan-char { z-index: 1; color: #f6f0e5; font: 500 68px/1 'Noto Serif SC', serif; opacity: .95; }
.scan-line { position: absolute; width: 70%; height: 1px; background: var(--orange); box-shadow: 0 0 12px var(--orange); animation: scan 3s ease-in-out infinite; }.scan-helper { position: absolute; right: 10px; bottom: 9px; color: #8e9189; font-size: 10px; }
.scan-corner { width: 17px; height: 17px; position: absolute; border-color: var(--orange); border-style: solid; }.corner-tl { top: 11px; left: 11px; border-width: 2px 0 0 2px; }.corner-tr { top: 11px; right: 11px; border-width: 2px 2px 0 0; }.corner-bl { bottom: 11px; left: 11px; border-width: 0 0 2px 2px; }.corner-br { bottom: 11px; right: 11px; border-width: 0 2px 2px 0; }
@keyframes scan { 0%, 100% { top: 30%; } 50% { top: 70%; } }

.primary-btn { width: 100%; height: 44px; border-radius: 12px; background: var(--green); color: #fffaf4; font-size: 13px; font-weight: 600; box-shadow: 0 5px 12px rgb(63 112 84 / 20%); transition: transform .18s, background .18s; }.primary-btn:hover { background: var(--green-deep); }.primary-btn:active { transform: scale(.98); }.btn-icon { font-size: 18px; vertical-align: -1px; margin-right: 4px; font-weight: 400; }
.quick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 11px; }.quick-card { padding: 15px 13px; text-align: left; background: #ebe5da; border-radius: 14px; display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; column-gap: 9px; transition: background .2s, transform .2s; }.quick-card:hover { background: #e3dbce; transform: translateY(-2px); }.quick-icon { grid-row: 1 / span 2; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #b6aea1; border-radius: 50%; color: var(--orange); font: 600 11px Georgia, serif; }.quick-icon.seal { border-radius: 9px; font-size: 16px; }.quick-card strong { font-size: 12px; font-weight: 600; align-self: end; }.quick-card small { font-size: 10px; color: var(--muted); margin-top: 3px; }

.recent-section { padding-top: 34px; }.section-heading { display: flex; justify-content: space-between; align-items: end; }.section-heading h3 { margin: 6px 0 0; font: 600 18px 'Noto Serif SC', serif; }.text-btn { color: var(--orange); font-size: 11px; padding: 3px 0; }.recent-list { margin-top: 14px; }.recent-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 0; text-align: left; border-bottom: 1px solid var(--line); }.result-glyph { width: 39px; height: 39px; display: grid; place-items: center; background: #e9e1d5; color: #403c34; font: 600 21px 'Noto Serif SC', serif; }.recent-item strong { display: block; font-size: 13px; font-weight: 600; }.recent-item small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }.chevron { margin-left: auto; color: #aaa398; font-size: 20px; font-weight: 300; }

.tabbar { position: fixed; bottom: 0; left: 50%; z-index: 10; transform: translateX(-50%); width: min(100%, 430px); height: 76px; padding: 8px 36px max(12px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, 1fr); background: rgb(245 241 233 / 96%); border-top: 1px solid var(--line); backdrop-filter: blur(16px); }.tab { display: flex; flex-direction: column; gap: 3px; align-items: center; justify-content: center; color: #aaa59b; }.tab span { font-size: 21px; line-height: 1; }.tab small { font-size: 10px; }.tab.active { color: var(--orange); }
.recognize-screen, .handwriting-screen, .detail-screen, .poem-screen, .history-screen { display: none; padding-top: 21px; }.recognize-screen.visible, .handwriting-screen.visible, .detail-screen.visible, .poem-screen.visible, .history-screen.visible { display: block; }.greeting.hidden, .recent-section.hidden { display: none; }.back-btn { color: var(--muted); font-size: 13px; display: flex; gap: 5px; align-items: center; margin-bottom: 35px; }.back-btn:first-letter { font-size: 23px; }
.handwriting-screen h2 { margin: 8px 0 7px; font: 600 24px 'Noto Serif SC', serif; }.handwriting-lede { margin: 0 0 20px; color: #747168; font-size: 12px; line-height: 1.6; }.writing-tabs { display: flex; gap: 22px; margin-bottom: 13px; border-bottom: 1px solid var(--line); }.writing-tab { padding: 0 0 10px; color: var(--muted); font-size: 12px; }.writing-tab.active { color: var(--orange); border-bottom: 2px solid var(--orange); }.writing-board { height: 284px; position: relative; overflow: hidden; border: 1px solid #d5cec1; border-radius: 14px; background: var(--white); }.writing-board canvas { display: block; width: 100%; height: 100%; touch-action: none; }.writing-guide { position: absolute; top: 12px; left: 0; right: 0; color: #c5beb2; text-align: center; font-size: 11px; pointer-events: none; }.guide-cross { position: absolute; inset: 50% 0 auto; transform: translateY(-50%); color: #c5beb2; font: 230px/1 'Noto Serif SC', serif; opacity: .13; text-align: center; pointer-events: none; }.writing-actions { display: flex; gap: 9px; margin-top: 13px; }.writing-actions button { flex: 1; }.secondary-btn { height: 44px; border: 1px solid #d5cec1; border-radius: 12px; background: #faf7f1; color: var(--green); font-size: 13px; }.keyboard-panel[hidden] { display: none; }.writing-input { width: 100%; height: 44px; margin: 0 0 13px; padding: 0 13px; border: 1px solid #d5cec1; border-radius: 12px; background: var(--white); font: inherit; font-size: 14px; }.writing-tip { display: flex; gap: 10px; margin-top: 20px; padding: 13px; border-radius: 12px; background: #eae2d6; }.tip-mark { width: 25px; height: 25px; flex: none; display: grid; place-items: center; border: 1px solid #d9ad8f; border-radius: 50%; color: var(--orange); font: 14px 'Noto Serif SC', serif; }.writing-tip strong, .writing-tip small { display: block; }.writing-tip strong { font-size: 12px; }.writing-tip small { margin-top: 4px; color: #6b675e; font-size: 10px; line-height: 1.6; }

.recognize-screen .back-btn { margin-bottom: 28px; }.recognize-screen h2 { margin: 8px 0 7px; font: 600 24px 'Noto Serif SC', serif; }.recognize-lede { margin: 0 0 20px; color: #747168; font-size: 12px; }.ocr-preview { position: relative; display: flex; flex-wrap: wrap; gap: 8px 7px; padding: 22px 17px 19px; background: #e9e1d5; font: 500 16px/1.8 'Noto Serif SC', serif; }.ocr-preview span { position: relative; z-index: 1; }.ocr-highlight { color: var(--orange); border-bottom: 2px solid var(--orange); }.ocr-badge { position: absolute; right: 12px; bottom: 9px; color: var(--green); font: 600 9px 'Noto Sans SC', sans-serif; letter-spacing: .08em; }.selection-label { display: flex; justify-content: space-between; align-items: end; margin-top: 24px; }.selection-count { color: var(--muted); font-size: 10px; }
.recognition-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; margin-top: 11px; }.recognition-char { aspect-ratio: 1; display: grid; place-items: center; border: 1px solid #d5cec1; background: #faf7f1; border-radius: 9px; font: 500 18px 'Noto Serif SC', serif; }.recognition-char.selected { background: var(--green); color: #fffaf4; border-color: var(--green); }.recognize-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 23px 0 13px; padding: 4px; background: #e9e1d5; border-radius: 10px; }.mode-btn { height: 32px; border-radius: 7px; color: var(--muted); font-size: 11px; }.mode-btn.active { background: var(--paper); color: var(--green); box-shadow: 0 2px 5px rgb(39 38 33 / 8%); }

.detail-head { display: grid; grid-template-columns: 80px 1fr 36px; align-items: center; gap: 17px; }.detail-glyph { width: 80px; height: 80px; display: grid; place-items: center; background: #e6ddd0; font: 600 45px 'Noto Serif SC', serif; }.detail-head h2 { margin: 7px 0 0; font: 600 25px 'Noto Serif SC', serif; }.save-btn { color: var(--orange); font-size: 25px; padding: 5px; }.pronounce { display: flex; align-items: center; margin-top: 28px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }.pinyin { font-size: 27px; letter-spacing: .02em; }.tone { color: var(--muted); font-size: 11px; margin-left: 10px; }.sound-btn { margin-left: auto; color: var(--orange); font-size: 22px; }
.meaning-block { padding: 25px 0 22px; border-bottom: 1px solid var(--line); }.meaning-block > p:not(.eyebrow) { font: 500 17px/1.7 'Noto Serif SC', serif; margin: 10px 0 18px; }.example-line { display: flex; align-items: flex-start; gap: 9px; color: #6b675e; }.example-line span { color: var(--orange); font-size: 11px; border: 1px solid #d9ad8f; padding: 2px 4px; }.example-line p { margin: 0; font-size: 12px; line-height: 1.7; }.word-family { padding: 21px 0; border-bottom: 1px solid var(--line); }.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }.chips button { border: 1px solid #d5cec1; padding: 7px 11px; border-radius: 8px; font-size: 11px; background: #f8f4ed; }.context-callout { margin-top: 22px; padding: 17px; background: #eae2d6; border-left: 3px solid var(--orange); }.context-label { color: var(--orange); font-size: 10px; letter-spacing: .1em; }.context-callout > p { margin: 10px 0 8px; font: 500 15px/1.8 'Noto Serif SC', serif; }.context-callout small { display: block; color: #79746a; font-size: 10px; line-height: 1.6; }.inline-btn { margin-top: 14px; color: var(--orange); font-size: 11px; padding: 0; }.inline-btn span { margin-left: 5px; font-size: 16px; }

.poem-screen { position: relative; }.poem-title { position: relative; }.poem-title h2 { margin: 10px 0 8px; font: 600 23px/1.45 'Noto Serif SC', serif; letter-spacing: -.04em; }.poem-author { margin: 0; color: var(--muted); font-size: 11px; }.poem-title .save-btn { position: absolute; top: 8px; right: 0; }.poem-paper { position: relative; margin: 27px 0 24px; padding: 26px 19px 22px; background: #e9e1d5; min-height: 196px; overflow: hidden; }.poem-paper::before { content: '诗'; position: absolute; right: -11px; top: 7px; color: rgb(226 123 60 / 12%); font: 600 130px/1 'Noto Serif SC', serif; }.poem-line { position: relative; margin: 0 0 12px; font: 500 16px/1.5 'Noto Serif SC', serif; letter-spacing: .02em; }.poem-line.faded { color: #999186; font-size: 13px; }.poem-line mark { background: transparent; color: var(--orange); border-bottom: 1px solid rgb(226 123 60 / 50%); }.paper-note { position: absolute; right: 17px; bottom: 10px; color: #9b9488; font-size: 9px; }.interpretation { padding: 1px 0 23px; border-bottom: 1px solid var(--line); }.interpretation h3 { margin: 10px 0 8px; font: 600 17px 'Noto Serif SC', serif; }.interpretation p:not(.eyebrow) { margin: 0; color: #625e56; font-size: 12px; line-height: 1.85; }.allusion { display: flex; gap: 13px; padding: 22px 0; }.allusion-seal { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border: 1px solid #d9ad8f; color: var(--orange); font: 600 17px 'Noto Serif SC', serif; border-radius: 8px; }.allusion h3 { font: 600 16px 'Noto Serif SC', serif; margin: 7px 0; }.allusion p { margin: 0; color: #6b675e; font-size: 11px; line-height: 1.75; }.wide { margin-top: 4px; }

.history-screen h2 { margin: 8px 0 25px; font: 600 25px 'Noto Serif SC', serif; }.history-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); }.history-tabs button { padding: 0 0 10px; color: var(--muted); font-size: 12px; }.history-tabs .active { color: var(--orange); border-bottom: 2px solid var(--orange); }.history-group { padding-top: 22px; }.history-date { color: var(--muted); font-size: 10px; margin: 0 0 9px; }.history-row { width: 100%; display: flex; align-items: center; gap: 11px; padding: 11px 0; text-align: left; border-bottom: 1px solid var(--line); }.history-char { width: 38px; height: 38px; display: grid; place-items: center; background: #e9e1d5; font: 600 20px 'Noto Serif SC', serif; }.poem-mini { color: var(--orange); }.history-row strong { font-size: 13px; display: block; }.history-row small { color: var(--muted); font-size: 10px; margin-top: 3px; display: block; }.history-row > span:last-child { margin-left: auto; color: #aaa398; font-size: 20px; }
.toast { position: fixed; z-index: 20; bottom: 92px; left: 50%; transform: translate(-50%, 10px); opacity: 0; pointer-events: none; background: #2f302c; color: #f6f0e5; padding: 10px 16px; border-radius: 22px; font-size: 11px; transition: opacity .2s, transform .2s; white-space: nowrap; }.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 431px) { .phone-shell { margin: 22px auto; border-radius: 30px; min-height: calc(100dvh - 44px); } .tabbar { bottom: 22px; border-radius: 0 0 30px 30px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
