:root {
  --ink: #2B1723;
  --ink-2: #3A2130;
  --ink-line: #5A3A4B;
  --accent: #FF8A5B;
  --paper: #F7F0E6;
  --card: #FFFDF9;
  --muted: #6E5F63;
  --muted-dark: #C4AEB7;
  --text-2: #3B2A31;
  --line: #EFE5D8;
  --green: #146B47;
  --green-bg: #E4F1E4;
  --amber: #9A5B00;
  --amber-bg: #FBF1E2;
  --red: #B3261E;
  --red-bg: #FCEBE9;
  --display: Fraunces, Inter, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: Inter, system-ui, sans-serif; font-feature-settings: 'tnum' 1, 'cv11' 1; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.press { transition: transform .16s cubic-bezier(.2,.8,.2,1), background-color .16s ease; cursor: pointer; }
.press:active { transform: scale(.975); }
.press:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rise { animation: rise .42s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ring { from { stroke-dashoffset: 126; } }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } .press { transition: none; } .ring circle.val { animation: none !important; } }

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; padding-bottom: 96px; }

/* Hero */
.hero { background: var(--ink); color: #fff; padding: 20px 22px 28px; border-radius: 0 0 28px 28px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -0.03em; }
.loc-chip { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px 0 10px; border-radius: 999px; border: 1px solid var(--ink-line); background: transparent; color: #F1E4E9; font-size: 13px; font-weight: 600; max-width: 60%; }
.loc-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(255,138,91,.22); }
.hero-body { display: flex; flex-direction: column; gap: 12px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-dark); }
.hero h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 36px; line-height: 1; letter-spacing: -0.035em; }
.accent { color: var(--accent); }
.lede { margin: 0; font-size: 15px; line-height: 1.5; color: #D3C0C8; }
.where { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.btn-accent { display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; border: 0; border-radius: 999px; background: var(--accent); color: var(--ink); font-size: 16px; font-weight: 700; }
.place-form { display: flex; gap: 8px; }
.place-form input { flex: 1 1 auto; min-width: 0; height: 46px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--ink-line); background: var(--ink-2); color: #fff; font-size: 15px; }
.place-form input::placeholder { color: #A58F99; }
.btn-ghost { height: 46px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--ink-line); background: transparent; color: #F1E4E9; font-weight: 600; }
.area-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.area-chips:empty { display: none; }
.area-chip { flex: 0 0 auto; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--ink-line); background: transparent; color: #F1E4E9; font-size: 13px; font-weight: 600; }
.radius { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; margin-top: 6px; padding: 14px 16px; border-radius: 18px; background: var(--ink-2); }
.radius label { font-size: 13px; font-weight: 600; color: #F1E4E9; }
.radius output { font-family: var(--display); font-size: 20px; font-weight: 800; color: var(--accent); }
.radius input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); height: 28px; }
.ticks { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted-dark); }
.back { align-self: flex-start; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 10px; border-radius: 999px; border: 1px solid var(--ink-line); background: transparent; color: #F1E4E9; font-size: 14px; font-weight: 600; }
.detail-head { display: flex; align-items: flex-start; gap: 16px; }
.detail-head > div:first-child { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-width: 0; }
.detail-name { font-size: 30px !important; }

/* Main */
main { padding: 20px 18px 8px; display: flex; flex-direction: column; gap: 14px; }
.status:empty { display: none; }
.status { padding: 12px 14px; border-radius: 14px; background: var(--card); font-size: 14px; color: var(--text-2); line-height: 1.5; }
.status.warn { background: var(--amber-bg); color: #6B4000; }
.status.error { background: var(--red-bg); color: var(--red); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.note { margin: 4px 4px 0; font-size: 12px; color: var(--muted); line-height: 1.55; }
.note a { color: #B4411F; }

.card { display: flex; flex-direction: column; gap: 12px; width: 100%; padding: 16px; border: 0; border-radius: 22px; background: var(--card); text-align: left; box-shadow: 0 1px 2px rgba(43,23,35,.05), 0 10px 30px rgba(43,23,35,.06); }
.pair { display: flex; align-items: stretch; gap: 14px; }
.rail { display: flex; flex-direction: column; align-items: center; padding-top: 5px; flex: 0 0 12px; }
.rail .from { width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--ink); }
.rail .line { flex: 1 1 auto; width: 0; border-left: 2px dotted #CDBFB4; margin: 4px 0; }
.rail .to { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1.5px var(--ink); }
.names { display: flex; flex-direction: column; gap: 14px; flex: 1 1 auto; min-width: 0; }
.small-cap { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.from-name { font-size: 14px; font-weight: 500; color: #4A3840; }
.to-name { font-family: var(--display); font-size: 21px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.meta { font-size: 13px; color: var(--muted); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.tier { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tier.strong { background: var(--green-bg); color: var(--green); }
.tier.good { background: #F3E6EE; color: #6B2D55; }
.tier.partial { background: var(--amber-bg); color: var(--amber); }
.tier.none { background: var(--line); color: var(--muted); }
.tier.dark { align-self: flex-start; background: #45283A; color: var(--accent); }
.conf { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1.5px solid currentColor; }
.conf.high { color: var(--green); }
.conf.medium { color: var(--amber); }
.conf.low { color: var(--red); }
.scorecard { gap: 10px; }
.dim { display: grid; grid-template-columns: minmax(0, 1fr) 72px 30px; gap: 10px; align-items: center; font-size: 13px; }
.dim small { color: var(--muted); }
.dim .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.dim .bar i { display: block; height: 100%; border-radius: 3px; }
.dim .bar i.ok { background: #D9603A; }
.dim .bar i.low { background: #B08968; }
.dim .v { color: var(--muted); text-align: right; }
.closest { font-size: 13px; color: #4A3840; }
.closest b { font-weight: 600; }

.ring { position: relative; width: 58px; height: 58px; flex: 0 0 58px; align-self: center; }
.ring.big { width: 88px; height: 88px; flex-basis: 88px; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring circle.val { animation: ring 1s cubic-bezier(.2,.8,.2,1) both; }
.ring .num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--display); font-size: 19px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.ring.big .num { font-size: 28px; }
.ring.big .num small { font-family: Inter, sans-serif; font-size: 10px; font-weight: 600; letter-spacing: .1em; color: var(--muted-dark); margin-top: 3px; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 22px; border-radius: 22px; background: var(--card); text-align: center; }
.empty h2 { margin: 0; font-family: var(--display); font-size: 20px; letter-spacing: -0.02em; }
.empty p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; }
.btn-dark { height: 46px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }

.facts { display: grid; gap: 1px; border-radius: 22px; overflow: hidden; background: #E8DDCF; }
.fact { background: var(--card); padding: 16px 18px; display: flex; gap: 14px; }
.fact .ico { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.fact h3 { margin: 0 0 3px; font-size: 13px; font-weight: 700; }
.fact p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.flag { display: flex; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--amber-bg); color: #6B4000; font-size: 14px; line-height: 1.45; }
.actions { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 10px; }
.btn-save { height: 54px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-save.on { background: var(--accent); border-color: var(--accent); }
.actions .btn-dark { height: 54px; font-size: 15px; }

.fav { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; background: var(--card); }
.fav .ico { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px; background: #F3E9DC; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 18px; }
.fav .body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fav .title { font-size: 16px; font-weight: 600; }
.fav .why { font-size: 13px; color: var(--muted); line-height: 1.45; }
.icon-btn { width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.add-form { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 22px; background: var(--card); }
.add-form h2 { margin: 0 0 4px; font-family: var(--display); font-size: 20px; letter-spacing: -0.02em; }
.add-form label { font-size: 13px; font-weight: 600; color: #4A3840; display: flex; flex-direction: column; gap: 6px; }
.add-form input, .add-form select { height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid #DDCFC0; background: #FFFBF5; font-size: 15px; }
.add-form .hint { font-weight: 400; color: var(--muted); }

.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; width: min(492px, calc(100% - 28px)); display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px; border-radius: 999px; background: var(--ink); box-shadow: 0 12px 30px rgba(43,23,35,.25); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; border: 0; border-radius: 999px; background: transparent; color: #C4AEB7; font-size: 11px; font-weight: 600; }
.tab.active { background: #45283A; color: var(--accent); }

.skeleton { height: 150px; border-radius: 22px; background: linear-gradient(90deg, #EFE6DA 0%, #F8F2E9 50%, #EFE6DA 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---- Kindred: warm paper, plum ink, ember accent; a pair of overlapping circles is the mark ---- */
:root { --accent-deep: #B4411F; }
.brand { font-weight: 600; font-size: 24px; letter-spacing: -0.02em; font-variation-settings: 'opsz' 60; }
.hero { position: relative; overflow: hidden; background: radial-gradient(120% 90% at 100% 0%, #4A2438 0%, var(--ink) 58%); }
.hero::before, .hero::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }
.hero::before { width: 260px; height: 260px; right: -70px; top: -96px; border: 1.5px solid rgba(255,246,236,.13); }
.hero::after { width: 260px; height: 260px; right: -180px; top: -40px; background: rgba(255,138,91,.13); }
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-weight: 600; font-size: 34px; line-height: 1.06; letter-spacing: -0.02em; font-variation-settings: 'opsz' 144; color: #FFF6EC; }
.hero h1 .accent { font-style: italic; font-weight: 500; }
.detail-name { font-size: 30px !important; }
.eyebrow { color: #D9B9A6; letter-spacing: .16em; }
.to-name { font-weight: 600; font-size: 22px; letter-spacing: -0.015em; }
.empty h2, .add-form h2 { font-weight: 600; font-size: 22px; letter-spacing: -0.015em; }
.radius output, .ring .num, .fav .ico { font-weight: 600; }
.small-cap { letter-spacing: .1em; }
.card, .empty, .add-form, .fav { box-shadow: 0 1px 2px rgba(43,23,35,.05), 0 12px 32px rgba(43,23,35,.07); }
.btn-accent { box-shadow: 0 8px 22px rgba(255,138,91,.28); }
.note a, .status a { color: var(--accent-deep); }
.press:focus-visible, input:focus-visible { outline-color: var(--accent); }
