@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif&family=Inter:wght@400;500;600&display=swap');
:root {
  --bg: #f4efec; --paper: #fbf8f6; --ink: #1d1a18; --muted: #6f6863; --line: #d9d1cb; --line-soft: #e8e1dc;
  --accent: #2f6f5e; --danger: #b3261e; --radius: 12px;
  --serif: 'Instrument Serif', Georgia, serif; --sans: 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, .brand { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
h1 { font-size: clamp(34px, 7vw, 44px); line-height: 1.05; margin: 0 0 12px; }
h2 { font-size: 28px; margin: 0; }
.sub { color: var(--muted); margin: 2px 0 0; font-size: 14px; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 20px 80px; }
.center { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; }

header.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; height: 56px; padding: 0 8px; border-bottom: 1px solid var(--line-soft); }
header.top .brand { text-align: center; font-size: 26px; text-decoration: none; }
.icon-btn { width: 44px; height: 44px; border: 0; background: none; text-decoration: none; font-size: 22px; display: grid; place-items: center; cursor: pointer; border-radius: 10px; color: var(--ink); }
.icon-btn:hover { background: var(--line-soft); }
.drawer { position: fixed; inset: 0; z-index: 20; display: none; }
.drawer.open { display: block; }
.drawer .scrim { position: absolute; inset: 0; background: rgba(29, 26, 24, .28); animation: fade .2s; }
.drawer nav { position: absolute; top: 0; left: 0; bottom: 0; width: min(300px, 84vw); background: var(--paper); padding: 20px 12px;
  box-shadow: 8px 0 30px rgba(0,0,0,.12); animation: slide .22s cubic-bezier(.16,1,.3,1); display: flex; flex-direction: column; gap: 2px; }
.drawer nav .brand { font-size: 28px; padding: 4px 12px 16px; }
.drawer nav a { padding: 11px 12px; border-radius: 10px; text-decoration: none; font-weight: 500; }
.drawer nav a:hover, .drawer nav a[aria-current] { background: var(--line-soft); }
.drawer nav .spacer { flex: 1; }
@keyframes slide { from { transform: translateX(-100%); } }
@keyframes fade { from { opacity: 0; } }

section.block { margin-top: 44px; }
section.block > .head { padding-bottom: 14px; border-bottom: 1.5px solid var(--ink); margin-bottom: 4px; }
.row { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.row .ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px; }
.row .ico img { width: 26px; height: 26px; }
.row .txt { flex: 1; min-width: 0; }
.row .t { font-weight: 600; }
.row .d { color: var(--muted); font-size: 14px; line-height: 1.4; }
.row .mono { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.row.sub-row { padding-left: 54px; }
.chips { display: flex; gap: 6px; margin-top: 6px; color: var(--accent); font-size: 12px; flex-wrap: wrap; }
.chips span { border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 6px; padding: 1px 6px; }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; margin-left: 6px; font-weight: 500; }

.btn { appearance: none; border: 0; border-radius: 10px; padding: 10px 16px; font: 600 14px var(--sans); cursor: pointer; white-space: nowrap;
  background: var(--ink); color: #fff; transition: transform .12s, box-shadow .12s, opacity .12s; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.14); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.ghost { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.btn.big { width: 100%; padding: 15px; font-size: 16px; border-radius: 14px; }
.btn.danger { background: var(--danger); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: 500 15px var(--sans); padding: 12px; }

input, textarea, select { width: 100%; font: 15px var(--sans); padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); }
label { display: block; font-weight: 500; font-size: 14px; margin: 14px 0 6px; }
.stack { display: grid; gap: 12px; margin-top: 24px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.feature { display: flex; gap: 14px; padding: 14px 0; }
.feature b { display: block; }
.feature .d { color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); }
.qr { width: 190px; height: 190px; margin: 8px auto 0; display: block; border-radius: 12px; background: #fff; padding: 10px; }

.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: 40px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12);
  min-width: 190px; padding: 6px; z-index: 10; display: none; }
.menu-list.open { display: block; }
.menu-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 8px; font: 500 14px var(--sans); cursor: pointer; color: var(--ink); }
.menu-list button:hover { background: var(--line-soft); }
.menu-list button.danger { color: var(--danger); }

dialog { border: 0; border-radius: 18px; padding: 24px; width: min(440px, calc(100vw - 32px)); background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(29,26,24,.35); }
dialog h2 { font-size: 26px; margin-bottom: 6px; }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px;
  font-weight: 500; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: rise .25s cubic-bezier(.16,1,.3,1); max-width: calc(100vw - 32px); }
@keyframes rise { from { transform: translate(-50%, 12px); opacity: 0; } }

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100svh - 56px); max-width: 720px; margin: 0 auto; }
.chat .log { flex: 1; overflow-y: auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.bubble.user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 6px; }
.bubble a { color: inherit; text-decoration: underline; }
.bubble.assistant { align-self: flex-start; background: var(--paper); border: 1px solid var(--line-soft); border-bottom-left-radius: 6px; }
.bubble .src { display: block; font-size: 11px; opacity: .55; margin-top: 4px; }
.bubble.thinking { color: var(--muted); font-style: italic; }
.chat form { display: flex; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); background: var(--bg); }
.chat textarea { resize: none; height: 46px; max-height: 160px; }

.doc { max-width: 720px; margin: 0 auto; padding: 24px 20px 80px; line-height: 1.65; }
.doc h1, .doc h2, .doc h3 { font-family: var(--serif); font-weight: 400; }
.doc table { border-collapse: collapse; width: 100%; } .doc td, .doc th { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; }
footer.small { text-align: center; color: var(--muted); font-size: 12px; padding: 30px 0; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
