:root {
  --ink: #243c38;
  --muted: #7b8178;
  --paper: #f8f3e9;
  --cream: #eee4d3;
  --coral: #dc765e;
  --coral-dark: #bd5d49;
  --sage: #9bac9b;
  --line: rgba(36, 60, 56, .15);
  --shadow: 0 22px 65px rgba(62, 50, 38, .13);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); font-family: "Noto Serif TC", "Songti TC", Georgia, serif; }
button, input, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.paper-noise { position: fixed; inset: 0; pointer-events: none; z-index: 20; opacity: .22; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E"); }
.eyebrow { margin: 0 0 12px; color: var(--coral); font: 700 .72rem/1.2 system-ui, sans-serif; letter-spacing: .2em; }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; background: radial-gradient(circle at 20% 25%, rgba(220,118,94,.12), transparent 30%), radial-gradient(circle at 80% 75%, rgba(155,172,155,.2), transparent 33%); }
.login-card { position: relative; width: min(100%, 510px); padding: 56px 58px 38px; background: rgba(255,253,248,.86); border: 1px solid rgba(255,255,255,.9); border-radius: 3px 30px 3px 30px; box-shadow: var(--shadow); }
.login-card::before { content: ""; position: absolute; inset: 14px; border: 1px solid var(--line); border-radius: 2px 22px 2px 22px; pointer-events: none; }
.login-card h1 { margin: 0; font-size: clamp(2.5rem, 7vw, 4.15rem); line-height: 1.12; letter-spacing: -.05em; font-weight: 500; }
em { color: var(--coral); font-style: normal; }
.login-intro { color: var(--muted); line-height: 1.8; margin: 23px 0 30px; }
.stamp { position: absolute; right: 38px; top: 38px; width: 72px; height: 72px; padding-top: 15px; border: 2px solid var(--coral); border-radius: 50%; color: var(--coral); text-align: center; font-size: .78rem; line-height: 1.4; transform: rotate(8deg); }
.identity-picker { border: 0; padding: 0; margin: 0 0 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.identity-picker legend, .field > span { display: block; width: 100%; margin-bottom: 9px; color: var(--muted); font: 600 .78rem system-ui, sans-serif; letter-spacing: .08em; }
.identity-picker label input { position: absolute; opacity: 0; }
.identity-picker label span { display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: .2s; }
.identity-picker label input:checked + span { border-color: var(--coral); background: rgba(220,118,94,.08); box-shadow: inset 0 0 0 1px var(--coral); }
.identity-picker b { font-size: 1.05rem; }
.identity-picker small { color: var(--muted); font: 600 .6rem system-ui; letter-spacing: .12em; margin-top: 4px; }
.field { display: block; margin-bottom: 20px; }
.field input, .field textarea, .search input { width: 100%; border: 1px solid var(--line); outline: 0; color: var(--ink); background: rgba(255,255,255,.55); border-radius: 10px; transition: border .2s, box-shadow .2s; }
.field input { height: 50px; padding: 0 15px; }
.field textarea { min-height: 310px; padding: 16px; line-height: 1.9; resize: vertical; }
.field input:focus, .field textarea:focus, .search input:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(220,118,94,.12); }
.primary, .secondary, .danger, .icon-button, .nav-link, .dialog-close, .reaction-button { border: 0; cursor: pointer; }
.primary { padding: 13px 20px; border-radius: 10px; background: var(--coral); color: white; box-shadow: 0 8px 22px rgba(220,118,94,.22); transition: .2s; }
.primary:hover { background: var(--coral-dark); transform: translateY(-1px); }
.primary.wide { position: relative; width: 100%; display: flex; justify-content: space-between; z-index: 1; }
.primary.small { padding: 10px 15px; box-shadow: none; }
.secondary, .danger { padding: 12px 17px; border-radius: 9px; background: transparent; }
.secondary { border: 1px solid var(--line); }
.danger { color: #ae423a; }
.form-error { min-height: 20px; margin: -9px 0 10px; color: #b6453e; font: .8rem system-ui; }
.privacy-note { text-align: center; color: var(--muted); font: .72rem system-ui; margin: 22px 0 0; }
.site-header { height: 86px; padding: 0 clamp(20px, 6vw, 84px); display: flex; align-items: center; gap: 55px; border-bottom: 1px solid var(--line); background: rgba(248,243,233,.9); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 1.15rem; white-space: nowrap; }
.brand small { display: block; color: var(--muted); font: 600 .5rem system-ui; letter-spacing: .14em; margin-top: 4px; }
.brand-mark { width: 38px; height: 55px; border: 1px solid var(--ink); border-radius: 50%; display: grid; place-content: center; text-align: center; font-size: .65rem; line-height: .75rem; }
.brand-mark i { color: var(--coral); font-style: normal; }
nav { display: flex; align-self: stretch; gap: 26px; }
.nav-link { position: relative; background: none; color: var(--muted); font-size: .86rem; }
.nav-link.active { color: var(--ink); }
.nav-link.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--coral); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-badge { width: 35px; height: 35px; display: grid; place-items: center; background: var(--cream); border-radius: 50%; font-weight: 700; }
.icon-button, .dialog-close { background: transparent; color: var(--muted); font-size: 1.25rem; }
.page { width: min(1160px, calc(100% - 40px)); margin: 0 auto; }
.hero { min-height: 370px; padding: 70px 5%; display: flex; align-items: center; justify-content: space-between; position: relative; }
.hero::after { content: "交換"; position: absolute; left: 45%; top: 40px; color: rgba(36,60,56,.035); font-size: 12rem; line-height: 1; pointer-events: none; }
.hero h2 { margin: 0; font-size: clamp(2.9rem, 6vw, 5.3rem); line-height: 1.08; font-weight: 400; letter-spacing: -.05em; }
.hero > div > p:last-child { color: var(--muted); margin-top: 22px; }
.exchange-card { min-width: 270px; padding: 24px; display: flex; gap: 17px; background: #e9dfce; border-radius: 2px 22px 2px 22px; box-shadow: 10px 12px 0 rgba(155,172,155,.22); transform: rotate(1.3deg); z-index: 1; }
.exchange-card .moon { width: 42px; height: 42px; display: grid; place-items: center; background: var(--ink); color: var(--paper); border-radius: 50%; font-size: 1.5rem; }
.exchange-card small { display: block; color: var(--muted); font: .68rem system-ui; letter-spacing: .08em; }
.exchange-card strong { display: block; margin: 5px 0; }
.exchange-card p { margin: 0; color: var(--coral-dark); font: 600 .78rem system-ui; }
.toolbar { padding: 30px 0 20px; border-top: 1px solid var(--line); display: flex; align-items: end; justify-content: space-between; }
.toolbar h3 { margin: 0; font-size: 2rem; font-weight: 500; }
.search { position: relative; width: 230px; }
.search span { position: absolute; left: 13px; top: 9px; color: var(--muted); }
.search input { height: 40px; padding: 0 12px 0 37px; }
.entries-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; min-height: 250px; padding: 12px 0 80px; }
.entry-card { min-height: 288px; padding: 26px; background: rgba(255,253,248,.72); border: 1px solid rgba(36,60,56,.11); border-radius: 2px 18px 2px 18px; box-shadow: 0 11px 35px rgba(62,50,38,.07); cursor: pointer; transition: transform .25s, box-shadow .25s; display: flex; flex-direction: column; }
.entry-card:nth-child(3n+2) { transform: translateY(16px) rotate(.5deg); }
.entry-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.entry-top { display: flex; justify-content: space-between; align-items: center; }
.owner-chip { padding: 5px 9px; border-radius: 20px; background: rgba(155,172,155,.2); color: var(--ink); font: 700 .67rem system-ui; letter-spacing: .05em; }
.owner-chip.mine { background: rgba(220,118,94,.13); color: var(--coral-dark); }
.entry-date { color: var(--muted); font: .7rem system-ui; }
.entry-card h4 { margin: 24px 0 13px; font-size: 1.42rem; font-weight: 500; }
.entry-card .excerpt { margin: 0; color: #65706b; line-height: 1.75; font-size: .9rem; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.entry-meta { margin-top: auto; padding-top: 20px; border-top: 1px dashed var(--line); color: var(--muted); display: flex; gap: 13px; font: .72rem system-ui; }
.empty-state { grid-column: 1/-1; padding: 70px 20px; text-align: center; color: var(--muted); }
.empty-state b { display: block; color: var(--ink); font-size: 1.4rem; margin-bottom: 10px; }
footer { border-top: 1px solid var(--line); padding: 38px max(20px, 6vw); display: flex; gap: 11px; align-items: center; font: 700 .7rem system-ui; letter-spacing: .15em; }
footer i { color: var(--coral); }
footer small { margin-left: auto; color: var(--muted); font-weight: 400; letter-spacing: .08em; }
dialog { border: 0; padding: 0; color: var(--ink); background: transparent; }
dialog::backdrop { background: rgba(31,45,42,.56); backdrop-filter: blur(5px); }
.editor-dialog { width: min(850px, calc(100% - 24px)); max-height: calc(100vh - 30px); }
.editor-shell { background: var(--paper); border-radius: 4px 26px 4px 26px; padding: 36px clamp(22px, 5vw, 58px); }
.editor-shell > header { display: flex; justify-content: space-between; margin-bottom: 25px; }
.editor-shell h2 { margin: 0; font-size: 2rem; font-weight: 500; }
.dialog-close { font-size: 2rem; align-self: start; }
.date-field { max-width: 260px; }
.editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.editor-footer > div { display: flex; gap: 8px; }
.save-status { color: var(--muted); font: .75rem system-ui; }
.draft-notice { background: rgba(155,172,155,.18); padding: 10px 13px; margin-bottom: 18px; border-radius: 8px; font: .8rem system-ui; }
.reader-dialog { width: min(820px, calc(100% - 24px)); max-height: calc(100vh - 30px); }
.reader-page { background: var(--paper); padding: 46px clamp(24px, 7vw, 75px); border-radius: 3px 26px 3px 26px; }
.reader-head { display: flex; justify-content: space-between; gap: 20px; }
.reader-page h2 { margin: 10px 0 8px; font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 500; }
.reader-byline { color: var(--muted); font-size: .82rem; }
.reader-body { min-height: 180px; margin: 35px 0; white-space: pre-wrap; font-size: 1.04rem; line-height: 2; }
.reader-actions { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 18px; }
.reactions { display: flex; flex-wrap: wrap; gap: 7px; }
.reaction-button { background: rgba(155,172,155,.14); border: 1px solid transparent; padding: 7px 10px; border-radius: 20px; font-size: .78rem; }
.reaction-button.active { border-color: var(--coral); background: rgba(220,118,94,.1); }
.comments { margin-top: 35px; }
.comments h3 { font-size: 1rem; }
.comment { padding: 14px 0; border-top: 1px dashed var(--line); }
.comment-head { display: flex; justify-content: space-between; color: var(--muted); font: .7rem system-ui; }
.comment p { margin: 8px 0 0; white-space: pre-wrap; line-height: 1.6; }
.text-button { border: 0; background: none; color: var(--coral-dark); cursor: pointer; }
.comment-form { display: flex; gap: 8px; margin-top: 18px; }
.comment-form textarea { flex: 1; min-height: 72px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; resize: vertical; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 99; transform: translate(-50%, 20px); background: var(--ink); color: white; padding: 11px 17px; border-radius: 30px; opacity: 0; pointer-events: none; transition: .25s; font: .8rem system-ui; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 820px) {
  .site-header { gap: 15px; padding: 0 18px; }
  nav { display: none; }
  .brand > span:last-child { display: none; }
  .hero { padding: 50px 3%; flex-direction: column; align-items: flex-start; gap: 42px; }
  .exchange-card { align-self: flex-end; }
  .entries-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .login-card { padding: 48px 28px 30px; }
  .stamp { display: none; }
  .site-header { height: 72px; padding: 0 12px; padding-top: env(safe-area-inset-top); }
  .user-badge { display: none; }
  .icon-button { display: block; padding: 6px; }
  nav { display: flex; position: fixed; left: 12px; right: 12px; bottom: max(10px, env(safe-area-inset-bottom)); height: 56px; padding: 4px; gap: 4px; border: 1px solid var(--line); border-radius: 18px; background: rgba(248,243,233,.96); box-shadow: 0 12px 35px rgba(36,60,56,.2); backdrop-filter: blur(14px); z-index: 30; }
  .nav-link { flex: 1; border-radius: 14px; }
  .nav-link.active { background: var(--ink); color: var(--paper); }
  .nav-link.active::after { display: none; }
  .page { width: calc(100% - 24px); }
  .hero { min-height: 430px; padding-top: 45px; }
  .exchange-card { min-width: 250px; }
  .toolbar { align-items: flex-start; gap: 16px; flex-direction: column; }
  .search { width: 100%; }
  .entries-grid { grid-template-columns: 1fr; }
  .entry-card:nth-child(3n+2) { transform: none; }
  .editor-shell { padding: 28px 18px; }
  .field textarea { min-height: 260px; }
  .editor-footer { align-items: flex-start; flex-direction: column; }
  .editor-footer > div { width: 100%; flex-wrap: wrap; }
  .editor-footer .primary { flex: 1; }
  .reader-page { padding: 34px 20px 28px; }
  .reader-actions { align-items: flex-start; flex-direction: column; gap: 14px; }
  .comment-form { flex-direction: column; }
  .comment-form .primary { align-self: flex-end; }
  footer { margin-bottom: calc(76px + env(safe-area-inset-bottom)); }
  footer small { display: none; }
  .toast { bottom: calc(82px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 32px); text-align: center; }
}
