:root {
  color-scheme: dark;
  --bg: #0b0810;
  --bg-soft: #15101a;
  --surface: #1a121f;
  --surface-2: #231627;
  --surface-3: #2d1830;
  --text: #fff8fb;
  --muted: #b4a8b6;
  --muted-2: #7f7482;
  --border: rgba(255,255,255,.085);
  --rose: #f45b91;
  --rose-bright: #ff79aa;
  --rose-soft: #ffb0c9;
  --rose-deep: #7d2348;
  --teal: #35d0c4;
  --teal-soft: #7de2da;
  --teal-deep: #0b6969;
  --amber: #ffb85c;
  --danger: #ff657d;
  --success: #55ddb9;
  --card-gap: 18px;
  --radius: 22px;
  --shadow: 0 20px 58px rgba(0,0,0,.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(244,91,145,.13), transparent 30%),
    radial-gradient(circle at 92% 10%, rgba(53,208,196,.07), transparent 28%),
    var(--bg);
  color: var(--text);
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(24,15,28,.98), rgba(11,7,14,.99));
  position: relative;
  padding: max(18px, env(safe-area-inset-top)) 20px calc(102px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

@media (min-width: 700px) {
  body { padding: 28px; }
  .app-shell {
    min-height: calc(100vh - 56px);
    border-radius: 30px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 30px;
}
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255,176,201,.28), 0 0 24px rgba(244,91,145,.23);
}
.brand-script {
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: 31px;
  line-height: .9;
  color: var(--rose-soft);
  letter-spacing: .3px;
}
.brand-script span { color: var(--rose-bright); font-size: 18px; vertical-align: top; }
.brand-lockup p, .login-brand p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.icon-button {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.035);
  position: relative;
  cursor: pointer;
}
.notification-dot {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rose-bright);
  box-shadow: 0 0 10px var(--rose);
}

.view { display: none; animation: fade .2s ease; padding-bottom: 8px; }
.view.active { display: block; }
@keyframes fade { from { opacity: .35; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

.welcome-row, .section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}
h1 { font-size: clamp(27px, 7.3vw, 34px); line-height: 1.08; margin: 4px 0 9px; letter-spacing: -.035em; }
h1 span { color: var(--rose-bright); }
h2 { margin: 0; font-size: 24px; letter-spacing: -.025em; }
.eyebrow { margin: 0; color: var(--rose-soft); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.teal-text { color: var(--teal-soft) !important; }
.muted { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.preview-pill, .date-chip, .online-pill {
  flex: none;
  border: 1px solid rgba(244,91,145,.27);
  color: var(--rose-soft);
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(244,91,145,.075);
}
.online-pill { color: var(--teal-soft); border-color: rgba(53,208,196,.23); background: rgba(53,208,196,.075); }

.hero-card, .compact-card, .brief-card, .leaderboard, .session-card, .routine-card, .mika-note {
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(255,255,255,.043), rgba(255,255,255,.014));
  border-radius: var(--radius);
  box-shadow: 0 13px 32px rgba(0,0,0,.16);
}
.hero-card { padding: 21px; margin-bottom: var(--card-gap); }
.rose-card {
  background: linear-gradient(145deg, rgba(126,36,72,.52), rgba(46,20,49,.74));
  border-color: rgba(244,91,145,.29);
}
.teal-card {
  border-color: rgba(53,208,196,.23);
  background: linear-gradient(145deg, rgba(12,108,108,.22), rgba(27,19,32,.8));
}
.card-label { font-size: 10px; font-weight: 800; letter-spacing: .13em; color: var(--rose-soft); margin-bottom: 13px; }
.hero-value-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.hero-value-row p { color: #d7cbd6; font-size: 12px; margin: 7px 0 0; }
.score { font-size: 42px; line-height: 1; font-weight: 750; color: #fff; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 23px; }
.mini-grid div { padding: 12px; border-radius: 15px; background: rgba(10,7,13,.32); min-width: 0; }
.mini-grid span { display: block; font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px; }
.mini-grid strong { font-size: 11px; line-height: 1.35; }

.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: var(--card-gap); }
.compact-card { padding: 18px; min-width: 0; }
.compact-card strong { display: block; font-size: 14px; margin-bottom: 7px; }
.compact-card p { color: var(--muted); font-size: 11px; line-height: 1.55; margin: 0 0 11px; }
.text-action { border: 0; background: none; color: var(--rose-soft); padding: 0; font-size: 11px; cursor: pointer; }
.text-action.teal { color: var(--teal-soft); }

.mika-note { display: flex; gap: 14px; padding: 18px; align-items: flex-start; }
.note-icon { width: 36px; height: 36px; flex: none; border-radius: 12px; display: grid; place-items: center; background: rgba(244,91,145,.13); color: var(--rose-bright); }
.mika-note strong { font-size: 12px; }
.mika-note p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.58; }

.segmented { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-bottom: 18px; padding-bottom: 2px; }
.segmented::-webkit-scrollbar { display: none; }
.segment { flex: none; min-height: 41px; border-radius: 999px; padding: 0 15px; border: 1px solid var(--border); background: rgba(255,255,255,.025); color: var(--muted); font-size: 11px; cursor: pointer; }
.segment.active { background: rgba(244,91,145,.14); border-color: rgba(244,91,145,.34); color: var(--rose-soft); }

.brief-card { padding: 20px; margin-bottom: var(--card-gap); }
.brief-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; margin-bottom: 12px; }
.status-ready { color: var(--teal-soft); }
.brief-card p { color: #c9bdca; line-height: 1.68; font-size: 12px; margin: 11px 0 15px; }
.brief-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.brief-tags span { padding: 6px 9px; border-radius: 9px; background: rgba(255,255,255,.045); color: var(--muted); font-size: 9px; }
.view[data-view="briefs"] > .compact-card + .compact-card { margin-top: var(--card-gap); }

.leaderboard { overflow: hidden; margin-bottom: var(--card-gap); }
.leaderboard-head, .leader-row { display: flex; align-items: center; justify-content: space-between; padding: 15px 17px; }
.leaderboard-head { background: rgba(244,91,145,.085); color: var(--rose-soft); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.leader-row { border-top: 1px solid rgba(255,255,255,.047); font-size: 13px; }
.leader-row span { display: flex; gap: 12px; align-items: center; }
.leader-row b { color: var(--muted); width: 12px; font-size: 10px; }
.leader-row strong { color: var(--success); }
.weak-board .leaderboard-head { background: rgba(255,95,120,.08); color: #ff9aae; }
.weak-board .leader-row strong { color: var(--danger); }

.progress-ring { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; border: 3px solid rgba(53,208,196,.27); border-top-color: var(--teal); color: var(--teal-soft); font-weight: 800; font-size: 12px; }
.session-card {
  padding: 20px;
  border-color: rgba(53,208,196,.22);
  background: linear-gradient(145deg, rgba(12,108,108,.19), rgba(27,19,32,.84));
  margin-bottom: var(--card-gap);
  display: grid;
  gap: 18px;
}
.countdown { font-variant-numeric: tabular-nums; font-size: 35px; line-height: 1; margin: 9px 0; letter-spacing: .02em; color: var(--teal-soft); }
.session-card small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.primary-button { width: 100%; min-height: 48px; border: 0; border-radius: 15px; background: linear-gradient(135deg, var(--rose), #c13f76); color: white; font-weight: 800; cursor: pointer; box-shadow: 0 10px 26px rgba(244,91,145,.18); }
.teal-button { background: linear-gradient(135deg, var(--teal), var(--teal-deep)); box-shadow: 0 10px 26px rgba(53,208,196,.15); }
.routine-card { overflow: hidden; }
.routine-row { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.048); }
.routine-row:first-child { border-top: 0; }
.routine-row > span { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.1); color: var(--muted); }
.routine-row.done > span { border-color: rgba(53,208,196,.36); background: rgba(53,208,196,.1); color: var(--teal-soft); }
.routine-row strong { display: block; font-size: 12px; }
.routine-row small { color: var(--muted); display: block; margin-top: 3px; font-size: 10px; }

.chat-stack { display: grid; gap: 13px; margin-bottom: 18px; }
.message { max-width: 88%; padding: 13px 15px; border-radius: 18px; font-size: 12px; line-height: 1.58; }
.message p { margin: 0; }
.mika-message { justify-self: start; background: rgba(255,255,255,.045); border: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; }
.mika-message img { width: 30px; height: 30px; border-radius: 9px; flex: none; object-fit: cover; }
.user-message { justify-self: end; background: linear-gradient(135deg, rgba(126,36,72,.82), rgba(78,29,72,.82)); border: 1px solid rgba(244,91,145,.18); }
.chat-input { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--border); background: rgba(255,255,255,.035); border-radius: 17px; }
.chat-input input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); padding: 7px 8px; font-size: 16px; }
.chat-input input::placeholder { color: #776c79; }
.chat-input button { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--rose); color: white; cursor: pointer; }

.bottom-nav {
  position: fixed;
  z-index: 20;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 480px);
  padding: 11px 13px max(11px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  border-top: 1px solid var(--border);
  background: rgba(15,10,18,.95);
  backdrop-filter: blur(18px);
}
@media (min-width: 700px) { .bottom-nav { bottom: 28px; border-radius: 0 0 30px 30px; } }
.nav-item { min-height: 54px; border: 0; background: transparent; color: #776c79; display: grid; justify-items: center; align-content: center; gap: 5px; border-radius: 15px; cursor: pointer; }
.nav-item span { font-size: 18px; line-height: 1; }
.nav-item small { font-size: 9px; }
.nav-item.active { color: var(--rose-soft); background: rgba(244,91,145,.105); }
.nav-item[data-target="myday"].active { color: var(--teal-soft); background: rgba(53,208,196,.095); }

.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translate(-50%, 15px); width: min(calc(100% - 36px), 430px); padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: rgba(31,22,35,.97); color: var(--text); font-size: 12px; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* Private login preview */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 22% 8%, rgba(244,91,145,.17), transparent 32%),
    radial-gradient(circle at 88% 82%, rgba(53,208,196,.09), transparent 30%),
    var(--bg);
}
.login-shell { width: min(100%, 440px); }
.login-card {
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 26px;
  background: linear-gradient(160deg, rgba(35,22,39,.97), rgba(13,9,16,.98));
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 34px; }
.login-avatar { width: 62px; height: 62px; object-fit: cover; border-radius: 19px; box-shadow: 0 0 0 1px rgba(255,176,201,.3), 0 0 28px rgba(244,91,145,.24); }
.login-logo { font-size: 36px; }
.login-copy { margin-bottom: 28px; }
.login-copy h1 { margin-top: 7px; }
.login-form { display: grid; gap: 11px; }
.login-form label { color: var(--rose-soft); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.login-form input { width: 100%; min-height: 50px; border-radius: 15px; border: 1px solid var(--border); background: rgba(255,255,255,.04); color: var(--text); padding: 0 15px; font-size: 16px; }
.login-form .primary-button { margin-top: 5px; }
.login-status { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 3px 0 0; }
.login-preview-link { display: inline-block; margin-top: 24px; color: var(--teal-soft); font-size: 12px; text-decoration: none; }

@media (max-width: 360px) {
  .app-shell { padding-left: 15px; padding-right: 15px; }
  .two-up { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: 1fr; }
  .score { font-size: 36px; }
}
