/* Conscious Connecting — app stylesheet
   Design language inherited from Design/preview.html:
   EB Garamond body, Playfair Display titles, 10 category colors,
   dark aubergine + gold accents. Mobile-first. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg: #f2f0ed;
  --paper: #fffdf9;
  --ink: #2a2420;
  --muted: #7a726a;
  --line: #ddd6cc;
  --aubergine: #211d27;
  --aubergine-2: #2b2531;
  --gold: #c9a45c;
  --gold-soft: #e6cf92;
  --gold-deep: #a07f3a;
  --danger: #B22222;
  --ok: #2E8B57;
  --font-body: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-ui: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --nav-h: 60px;
  --appbar-h: 76px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; font-weight: 700; }
button { font-family: var(--font-ui); }
p { margin: 0 0 0.6em; }

#app { min-height: 100vh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }

/* ---------- app bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 40;
  background:
    radial-gradient(140% 120% at 50% -20%, rgba(201,164,92,.18), rgba(0,0,0,0) 60%),
    var(--aubergine);
  color: #efe6cf;
  border-bottom: 2px solid var(--gold-deep);
}
.appbar-inner { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 14px; }
.appbar h1 { font-size: 21px; letter-spacing: 1.6px; font-weight: 800; color: var(--gold-soft); text-transform: uppercase; }
.appbar-sub { margin: 2px 0 0; font-family: var(--font-ui); font-size: 11.5px; letter-spacing: .5px; color: rgba(239,230,207,.7); font-style: italic; }
.appbar .spark { color: var(--gold); opacity: .85; }

/* ---------- view & blocks ---------- */
.view { max-width: 560px; margin: 0 auto; padding: 16px 16px 24px; }
.section { margin-bottom: 22px; }
.section-title {
  font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: 1.4px;
  color: var(--muted); text-transform: uppercase; margin: 0 0 10px;
}
.section-title .count { font-weight: 400; opacity: .75; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 18px 8px 10px; }
.hero .mark { color: var(--gold-deep); font-size: 18px; }
.hero h2 { font-size: 26px; letter-spacing: 1px; color: var(--aubergine); margin: 6px 0 4px; }
.hero p { color: var(--muted); font-style: italic; font-size: 16.5px; max-width: 40ch; margin: 0 auto; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-ui); font-size: 14.5px; font-weight: 600; letter-spacing: .3px;
  padding: 12px 18px; border-radius: 10px; border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none; min-height: 44px; user-select: none;
  transition: filter .12s ease, transform .06s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--aubergine); color: var(--gold-soft); border-color: var(--gold-deep); }
.btn-gold { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: #241d10; border-color: var(--gold-deep); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-outline { background: var(--paper); color: var(--aubergine); border-color: var(--gold-deep); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.action-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 20px; }
.action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 13px 6px; cursor: pointer; font-family: var(--font-ui); font-size: 12.5px; font-weight: 600; color: var(--ink);
}
.action-btn .ic { font-size: 22px; line-height: 1; }
.action-btn:active { background: #f6f2ea; }
.action-btn.partner-cta { border-color: var(--gold); color: var(--aubergine); }

/* ---------- category grid ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cat-tile {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  background: var(--tint, #fff); border: 1.6px solid var(--cat, #999); border-radius: 12px;
  padding: 12px 13px; cursor: pointer; min-height: 72px; position: relative; overflow: hidden;
}
.cat-tile .cat-letter { position: absolute; right: 8px; top: 4px; font-family: var(--font-display); font-weight: 800; font-size: 40px; color: var(--cat); opacity: .16; line-height: 1; }
.cat-tile .cat-name { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; color: var(--cat); letter-spacing: .4px; }
.cat-tile .cat-meta { font-family: var(--font-ui); font-size: 12px; color: var(--muted); }
.cat-tile .cat-lock { font-family: var(--font-ui); font-size: 10.5px; letter-spacing: 1px; color: var(--gold-deep); }

/* ---------- list rows (category, favorites, search) ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 1.4px solid var(--line); border-left: 5px solid var(--cat, #999);
  border-radius: 10px; padding: 10px 12px; cursor: pointer;
}
.row .id { font-family: var(--font-ui); font-size: 11.5px; font-weight: 700; color: var(--cat, #999); letter-spacing: .5px; width: 34px; flex: 0 0 auto; }
.row .row-main { flex: 1 1 auto; min-width: 0; }
.row .row-title { font-family: var(--font-display); font-weight: 700; font-size: 15.5px; line-height: 1.25; }
.row .row-sub { font-family: var(--font-ui); font-size: 12px; color: var(--muted); font-style: italic; }
.row .snippet { font-family: var(--font-body); font-size: 13.5px; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.row .fav { font-size: 18px; color: var(--gold-deep); }
.empty {
  text-align: center; color: var(--muted); padding: 30px 12px; font-style: italic;
  background: var(--paper); border: 1.5px dashed var(--line); border-radius: 12px;
}

/* ---------- card sheet (detail view) ---------- */
.card-sheet {
  background: var(--paper); border: 1.6px solid var(--cat, #999); border-radius: 16px;
  overflow: hidden; box-shadow: 0 2px 14px rgba(40,30,20,.07);
}
.sheet-band { background: var(--cat, #888); color: #fff; text-align: center; padding: 14px 12px 11px; }
.sheet-band .bt { font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: .8px; line-height: 1.2; }
.sheet-band .spark { font-size: 13px; opacity: .85; }
.sheet-dur { text-align: center; font-style: italic; color: var(--cat, #888); font-size: 15.5px; padding: 8px 10px 5px; }
.sheet-rule { border-top: 2px dotted var(--cat, #999); margin: 0 16px 6px; }
.sheet-body { padding: 10px 18px 18px; font-size: 17.5px; line-height: 1.5; }
.sheet-body p { margin: 0 0 11px; }
.sheet-body .li { display: flex; align-items: baseline; gap: 9px; }
.sheet-body .mark { color: var(--cat, #888); font-weight: 700; flex: 0 0 auto; }
.sheet-body .num .mark { width: 24px; text-align: right; font-family: var(--font-ui); font-size: 14.5px; }
.sheet-body .txt { flex: 1 1 auto; }
.sheet-body b { font-weight: 600; }

.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.card-actions .wide { grid-column: 1 / -1; }
.badge {
  display: inline-block; font-family: var(--font-ui); font-size: 11px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--gold-soft);
  background: var(--aubergine); padding: 5px 10px; border-radius: 20px;
}
.badge-wrap { text-align: center; margin: 12px 0 0; }
.back-link { display: inline-block; margin: 16px 0 6px; font-family: var(--font-ui); font-size: 13.5px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--ink); }

/* ---------- journal ---------- */
.journal { margin-top: 16px; background: var(--paper); border: 1.4px solid var(--line); border-radius: 14px; padding: 14px; }
.journal h3 { font-size: 17px; margin-bottom: 8px; color: var(--aubergine); }
.journal textarea {
  width: 100%; min-height: 96px; resize: vertical;
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  border: 1.4px solid var(--line); border-radius: 10px; padding: 10px; background: #fffdf6; color: var(--ink);
}
.journal .save-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.journal .saved { font-family: var(--font-ui); font-size: 12.5px; color: var(--ok); font-style: italic; }

/* ---------- search ---------- */
.search-box { display: flex; gap: 8px; margin-bottom: 14px; }
.search-box input {
  flex: 1; min-width: 0; font-family: var(--font-body); font-size: 17px;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--paper); color: var(--ink);
}
.search-hint { font-family: var(--font-ui); font-size: 13px; color: var(--muted); font-style: italic; margin: 0 0 10px; }

/* ---------- timer ---------- */
.timer-screen {
  background: var(--aubergine);
  color: #efe6cf;
  position: relative;
}
.timer-wrap {
  display: flex; flex-direction: column; align-items: center;
  min-height: calc(100vh - var(--appbar-h) - var(--nav-h)); padding: 20px 18px 28px;
}
.timer-card-label { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--gold-soft); text-align: center; letter-spacing: .5px; }
.timer-card-dur { font-family: var(--font-ui); font-size: 12.5px; color: rgba(239,230,207,.6); font-style: italic; margin-top: 2px; }
.timer-ring { position: relative; width: 230px; height: 230px; margin: 22px 0 8px; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring .track { fill: none; stroke: rgba(239,230,207,.14); stroke-width: 9; }
.timer-ring .prog { fill: none; stroke: url(#ringgrad); stroke-width: 9; stroke-linecap: round; }
.timer-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.timer-num .time { font-family: var(--font-display); font-weight: 700; font-size: 52px; letter-spacing: 2px; color: var(--gold-soft); }
.timer-num .lbl { font-family: var(--font-ui); font-size: 11.5px; letter-spacing: 2px; text-transform: uppercase; color: rgba(239,230,207,.6); }
.timer-controls { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; justify-content: center; }
.timer-dur-row { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.timer-dur-row .dur-chip {
  font-family: var(--font-ui); font-size: 13px; font-weight: 600; padding: 8px 12px;
  border-radius: 20px; border: 1.4px solid rgba(239,230,207,.35); background: transparent; color: #efe6cf; cursor: pointer;
}
.timer-dur-row .dur-chip.on { background: var(--gold); border-color: var(--gold); color: #241d10; }
.timer-note { font-family: var(--font-ui); font-size: 12.5px; color: rgba(239,230,207,.65); text-align: center; margin-top: 14px; max-width: 34ch; }
.timer-sync-line { font-family: var(--font-ui); font-size: 12px; color: var(--gold); letter-spacing: .6px; margin-top: 6px; }

/* ---------- partner ---------- */
.partner-hero { text-align: center; padding: 10px 6px 4px; }
.partner-hero h2 { font-size: 23px; color: var(--aubergine); }
.partner-hero p { color: var(--muted); font-style: italic; }
.session-card { background: var(--paper); border: 1.5px solid var(--gold); border-radius: 14px; padding: 16px; margin-top: 14px; }
.session-code { font-family: var(--font-display); font-weight: 800; font-size: 34px; letter-spacing: 8px; text-align: center; color: var(--aubergine); margin: 8px 0; }
.session-note { font-family: var(--font-ui); font-size: 12.5px; color: var(--muted); text-align: center; font-style: italic; }
.transport-line { font-family: var(--font-ui); font-size: 11.5px; text-align: center; color: var(--muted); margin-top: 10px; }
.transport-line .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--gold); }
.partner-card-pick { margin-top: 14px; }
.partner-card-pick select {
  width: 100%; font-family: var(--font-body); font-size: 16px; padding: 12px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink);
}

/* ---------- gate overlay ---------- */
#gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(140% 120% at 50% -10%, rgba(201,164,92,.22), rgba(0,0,0,0) 55%),
    var(--aubergine);
  color: #efe6cf;
  overflow-y: auto;
}
.gate-card { max-width: 400px; width: 100%; text-align: center; }
.gate-card .mark { color: var(--gold); font-size: 26px; letter-spacing: 10px; }
.gate-card h2 { font-size: 28px; letter-spacing: 2px; color: var(--gold-soft); text-transform: uppercase; margin: 10px 0 4px; }
.gate-card .sub { font-family: var(--font-ui); font-size: 12px; letter-spacing: 2px; color: rgba(239,230,207,.7); text-transform: uppercase; margin-bottom: 18px; }
.gate-card p { font-size: 17px; line-height: 1.55; margin-bottom: 14px; }
.gate-card .fine { font-family: var(--font-ui); font-size: 12.5px; color: rgba(239,230,207,.55); font-style: italic; }
.gate-btns { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 10px; }

/* ---------- about / settings ---------- */
.about-head { text-align: center; padding: 10px 6px 4px; }
.about-head .mark { color: var(--gold-deep); font-size: 22px; }
.about-head h2 { font-size: 24px; color: var(--aubergine); }
.about-body { background: var(--paper); border: 1.4px solid var(--line); border-radius: 14px; padding: 16px; margin-top: 14px; }
.about-body h3 { font-size: 17px; color: var(--aubergine); margin: 14px 0 6px; }
.about-body h3:first-child { margin-top: 0; }
.about-body p, .about-body li { font-size: 16px; }
.about-body ul { padding-left: 20px; margin: 6px 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .s-label { font-family: var(--font-ui); font-size: 14px; font-weight: 600; }
.setting-row .s-sub { font-family: var(--font-ui); font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px); transform: translateX(-50%);
  background: var(--aubergine); color: var(--gold-soft); font-family: var(--font-ui); font-size: 13.5px;
  padding: 12px 18px; border-radius: 24px; border: 1px solid var(--gold-deep); z-index: 90;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: 86vw; text-align: center;
}

/* ---------- nav ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around; align-items: stretch;
  background: var(--aubergine); border-top: 2px solid var(--gold-deep);
  padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.nav-btn {
  flex: 1; background: none; border: none; cursor: pointer;
  font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: 1.2px;
  color: rgba(239,230,207,.55); text-transform: uppercase; padding: 8px 4px;
}
.nav-btn.active { color: var(--gold-soft); }

/* ---------- responsive ---------- */
@media (min-width: 620px) {
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .view { padding-top: 22px; }
}
@media (max-width: 360px) {
  .cat-grid { grid-template-columns: 1fr; }
  .action-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}
