/* SVARA · design tokens + components · handmade paper observatory */
:root {
  --canvas: #FBF8F1;
  --panel: #FFFDF8;
  --wash: #F6F1E6;
  --ink: #2B2534;
  --dim: #8A8494;
  --gold: #B0913F;
  --gold-line: #C5B48C;
  --rose: #C98A94;
  --rose-deep: #B95F77;
  --blush: #F8E7EC;
  --fire: #B95F5F;
  --earth: #5D8A5E;
  --air: #B9944A;
  --water: #4A6B8A;
  --lavender: #ECE7F3;
  --sage: #E7EFE4;
  --line: rgba(43,37,52,.1);
  --line-soft: rgba(43,37,52,.07);
  --shadow: 0 2px 10px rgba(43,37,52,.07);
  --r: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--canvas);
  color: var(--ink);
  font-family: 'Spectral', Georgia, serif;
  font-size: 14px;
  line-height: 1.5;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
/* paper grain over everything */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: var(--gold); text-decoration: none; }
::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

/* ---------- type ---------- */
.serif { font-family: 'Marcellus', serif; }
.mono { font-family: 'IBM Plex Mono', monospace; letter-spacing: .14em; }
.sec-title {
  font-family: 'Marcellus', serif; letter-spacing: .22em; text-transform: uppercase;
  font-size: 12px; margin-top: 2px; display: flex; align-items: center; gap: 8px;
  min-height: 30px; cursor: default;
}
.sec-title .chev { color: var(--dim); font-size: 11px; }
.voice { font-style: italic; color: var(--ink); }
.dimtxt { color: var(--dim); }
.tech {
  font-family: 'IBM Plex Mono', monospace; font-size: 9px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--dim);
}

/* ---------- motion ---------- */
@keyframes svDawn { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: none; } }
@keyframes svFade { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes svGlyphIn { 0% { opacity: 0; transform: translateY(4px); } 30% { opacity: 1; transform: none; } 100% { opacity: 1; } }
@keyframes svBreathe { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes svRose { 0% { transform: rotate(0); } 100% { transform: rotate(360deg); } }
@keyframes svHello { 0% { opacity: 0; } 14% { opacity: 1; } 86% { opacity: 1; } 100% { opacity: 0; } }
@keyframes svSheetUp { 0% { transform: translate(-50%, 26px); opacity: 0; } 100% { transform: translate(-50%, 0); opacity: 1; } }
/* animate only the content: a transform on .page would unpin the fixed tab bar mid-animation */
.page { animation: svFade .16s ease-out; }
.page .content { animation: svDawn .22s ease-out; }

/* ---------- layout ---------- */
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }
.header {
  padding: calc(14px + env(safe-area-inset-top)) 22px 11px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,253,248,.92);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.header .h-left { display: flex; align-items: center; gap: 8px; }
.header .h-title { font-family: 'Marcellus', serif; letter-spacing: .3em; text-transform: uppercase; font-size: 12px; }
.header .h-right { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .14em; color: var(--dim); }
.content { flex: 1; overflow-x: hidden; padding: 18px 22px 14px; display: flex; flex-direction: column; gap: 15px; }
.foot {
  text-align: center; padding: 18px 0 calc(10px + 66px + env(safe-area-inset-bottom));
  font-family: 'IBM Plex Mono', monospace; font-size: 8px; letter-spacing: .3em;
  text-transform: lowercase; color: var(--dim); opacity: .75;
}
.backlink {
  font-family: 'Marcellus', serif; font-size: 15px; color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; min-height: 44px; letter-spacing: .04em;
}

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255,253,248,.95); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
.tabbar .tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 48px; justify-content: center; cursor: pointer; color: var(--dim);
}
.tabbar .tab .tg { font-size: 19px; line-height: 1; }
.tabbar .tab .tl { font-family: 'IBM Plex Mono', monospace; font-size: 8px; letter-spacing: .22em; text-transform: uppercase; }
.tabbar .tab.active { color: var(--gold); }

/* ---------- cards ---------- */
.card {
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
  box-shadow: var(--shadow); padding: 14px 16px; position: relative; overflow: hidden;
}
.card.tappable { cursor: pointer; }
.card-label {
  font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--dim); margin-bottom: 8px;
}
.card-label .more { color: var(--gold); }
.gold-card { border: 1px solid var(--gold-line); background: linear-gradient(165deg, #F5EDDA 0%, var(--panel) 65%); }
.soft-card { border: none; border-radius: 16px; box-shadow: var(--shadow); padding: 14px 16px; position: relative; overflow: hidden; cursor: pointer; }
.watermark { position: absolute; font-size: 64px; opacity: .09; pointer-events: none; right: 8px; top: 6px; line-height: 1; }

.dinkus { text-align: center; color: var(--gold); font-size: 11px; letter-spacing: .3em; opacity: .8; padding: 2px 0; }

.chip {
  font-family: 'IBM Plex Mono', monospace; font-size: 9px; letter-spacing: .14em;
  padding: 6px 12px; border-radius: 99px; border: 1px solid rgba(43,37,52,.18);
  color: var(--dim); cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  background: transparent; text-transform: uppercase;
}
.chip.on { background: var(--blush); border-color: var(--rose); color: var(--rose-deep); }
.chip.gold { border-color: var(--gold-line); color: var(--gold); }
.pill-cta {
  min-height: 52px; border-radius: 99px; background: var(--ink); color: var(--canvas);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Marcellus', serif; letter-spacing: .22em; text-transform: uppercase;
  font-size: 13px; cursor: pointer;
}

/* rows */
.row {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 2px;
  border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.row:last-child { border-bottom: none; }
.row .r-glyph { width: 26px; text-align: center; font-size: 17px; flex: none; }
.row .r-main { flex: 1; min-width: 0; }
.row .r-meta { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .12em; color: var(--dim); white-space: nowrap; }
.row .r-chev { color: var(--gold); flex: none; }

/* form fields */
.field {
  min-height: 50px; border: 1px solid rgba(43,37,52,.14); border-radius: 12px; background: var(--panel);
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px; gap: 10px;
}
.field .f-label { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); flex: none; }
.field input, .field select {
  border: none; background: transparent; font-family: 'Spectral', Georgia, serif; font-size: 14.5px;
  color: var(--ink); text-align: right; flex: 1; min-width: 0; outline: none; padding: 12px 0;
}
.field input::placeholder { color: rgba(138,132,148,.55); font-style: italic; }

/* icon circle buttons */
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); box-shadow: var(--shadow); display: flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: 15px; color: var(--ink);
}

/* wheel readout */
.wheel-readout {
  text-align: center; min-height: 20px; font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: .14em; color: var(--dim);
}

/* moon calendar */
.mooncal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mooncal .mc-day {
  border-radius: 10px; padding: 6px 2px 5px; text-align: center; cursor: default;
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px;
}
.mooncal .mc-day.today { outline: 1.5px solid var(--gold); outline-offset: -1.5px; }
.mooncal .mc-day.sel { background: linear-gradient(165deg, #F5EDDA, transparent); }
.mooncal .mc-num { font-family: 'IBM Plex Mono', monospace; font-size: 9px; color: var(--dim); }
.mooncal .mc-sub { font-family: 'IBM Plex Mono', monospace; font-size: 7.5px; color: var(--dim); letter-spacing: 0; }
.mooncal .mc-head { font-family: 'IBM Plex Mono', monospace; font-size: 8px; letter-spacing: .1em; color: var(--dim); text-align: center; text-transform: uppercase; }

/* hora table */
.hora-row { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 2px 10px; border-radius: 10px; }
.hora-row.now { background: linear-gradient(90deg, #F5EDDA, transparent); }

/* bottom sheet */
.sheet-veil { position: fixed; inset: 0; background: rgba(43,37,52,.25); z-index: 40; animation: svDawn .18s ease-out; }
.sheet {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px;
  background: var(--panel); border-radius: 18px 18px 0 0; z-index: 41; padding: 16px 22px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 30px rgba(43,37,52,.18); animation: svSheetUp .25s ease-out;
  max-height: 76dvh; overflow-y: auto;
}
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }

/* empty states: small drawing + one voice line, never a gray box */
.empty { text-align: center; padding: 18px 0 8px; color: var(--dim); }
.empty .art { font-size: 26px; color: var(--gold-line); letter-spacing: .3em; }
.empty .line { font-style: italic; font-size: 12.5px; margin-top: 8px; }

/* transit soft cards */
.transit-card { border-radius: 16px; box-shadow: var(--shadow); padding: 13px 16px; position: relative; overflow: hidden; cursor: pointer; }
.transit-card .t-head { font-weight: 600; font-size: 14.5px; }
.transit-card .t-meta { font-family: 'IBM Plex Mono', monospace; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin-top: 3px; }
.transit-card .t-voice { font-style: italic; font-size: 13px; margin-top: 7px; line-height: 1.5; }

/* stat blocks (SELF) */
.stat-block { flex: 1; cursor: pointer; padding: 10px 4px; }
.stat-block .s-label { font-family: 'IBM Plex Mono', monospace; font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
.stat-block .s-value { font-family: 'Marcellus', serif; font-size: 27px; margin-top: 2px; }
.stat-block .s-name { font-family: 'IBM Plex Mono', monospace; font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin-top: 2px; }

/* friend cards */
.star-card { display: flex; align-items: center; gap: 13px; }
.star-card .avatar {
  width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: 'Marcellus', serif; font-size: 18px; flex: none;
}
.star-card .bigthree { font-family: 'IBM Plex Mono', monospace; font-size: 9px; letter-spacing: .1em; color: var(--dim); text-align: right; line-height: 1.7; white-space: nowrap; }

.hr-line { border: none; border-top: 1px solid var(--line-soft); margin: 2px 0; }

/* glyph-circle toggles · the quiet alternative to chip rows */
.gtog { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; min-width: 44px; }
.gtog .gt-circle {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  color: var(--dim); background: var(--panel); transition: all .15s ease;
}
.gtog.on .gt-circle {
  border-color: var(--gold-line); color: var(--gold);
  background: linear-gradient(165deg, #F5EDDA, var(--panel)); box-shadow: var(--shadow);
}
.gtog .gt-label { font-family: 'IBM Plex Mono', monospace; font-size: 7.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.gtog.on .gt-label { color: var(--gold); }
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; }
.suggest { position: relative; }
.suggest-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 25;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(43,37,52,.14); overflow: hidden;
}
.suggest-list .sg {
  padding: 11px 16px; cursor: pointer; font-size: 13.5px; border-bottom: 1px solid var(--line-soft);
}
.suggest-list .sg:last-child { border-bottom: none; }
.suggest-list .sg .sg-sub { font-family: 'IBM Plex Mono', monospace; font-size: 9px; color: var(--dim); letter-spacing: .1em; }
