/*
  Ruth, as the phone she actually lives on.

  A tab on the right edge until she is called. Pressing it slides a phone out of
  the side of the screen — bezel, island, status bar, the app, and the home bar
  at the bottom — and the conversation runs inside it as messages. On a real
  phone the phone-inside-a-phone is dropped: she comes up from the bottom edge
  as a sheet, because the reader is already holding one.
*/

/* ── the tab ─────────────────────────────────────────────────────────────── */
#ruth-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 16px 14px 18px;
  border: 0;
  border-radius: 16px 0 0 16px;
  background: var(--accent, #1F7FDB);
  color: #fff;
  font: 700 14px/1 Manrope, system-ui, sans-serif;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 10px 30px -12px rgba(27, 42, 65, .55);
  transition: transform .34s cubic-bezier(.22,.8,.26,1), opacity .2s ease, background .2s ease;
}
#ruth-tab:hover { transform: translateY(-50%) translateX(-3px); }
#ruth-tab.hidden { opacity: 0; pointer-events: none; transform: translateY(-50%) translateX(40px); }
#ruth-tab .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #A6E3E9;
  animation: ruth-pulse 2.6s ease-out infinite;
}
@keyframes ruth-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(166,227,233,.7); }
  70%  { box-shadow: 0 0 0 9px rgba(166,227,233,0); }
  100% { box-shadow: 0 0 0 0 rgba(166,227,233,0); }
}

/* ── the phone ───────────────────────────────────────────────────────────── */
#ruth-panel {
  position: fixed;
  right: 26px;
  top: 50%;
  z-index: 9991;
  width: 352px;
  height: min(700px, calc(100vh - 48px));
  padding: 11px;                       /* the bezel */
  border-radius: 46px;
  background: linear-gradient(160deg, #2A3650 0%, #121A2B 42%, #0B1220 100%);
  box-shadow:
    0 0 0 1.5px rgba(255,255,255,.10) inset,
    0 0 0 1px rgba(11,18,32,.9),
    -30px 40px 90px -40px rgba(8, 14, 26, .85),
    -8px 12px 30px -14px rgba(8, 14, 26, .5);
  transform: translateY(-50%) translateX(calc(100% + 34px)) rotate(1.4deg);
  visibility: hidden;
  transition: transform .42s cubic-bezier(.22,.9,.24,1), visibility 0s linear .42s;
}
#ruth-panel.open {
  transform: translateY(-50%) translateX(0) rotate(0deg);
  visibility: visible;
  transition: transform .42s cubic-bezier(.22,.9,.24,1), visibility 0s;
}

/* the side buttons, because a phone has them */
#ruth-panel::before,
#ruth-panel::after {
  content: "";
  position: absolute;
  right: -2px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(180deg, #46536E, #28334A);
}
#ruth-panel::before { top: 150px; height: 56px; }
#ruth-panel::after  { top: 220px; height: 92px; }

/* ── the screen ──────────────────────────────────────────────────────────── */
#ruth-screen {
  position: relative;
  height: 100%;
  border-radius: 36px;
  overflow: hidden;
  background: #F8F9FA;
  display: flex;
  flex-direction: column;
}

/* the island */
#ruth-screen .island {
  position: absolute;
  top: 9px; left: 50%;
  transform: translateX(-50%);
  width: 92px; height: 26px;
  border-radius: 999px;
  background: #080D17;
  z-index: 4;
}
#ruth-screen .island::after {
  content: "";
  position: absolute; right: 11px; top: 8px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #15213A;
  box-shadow: 0 0 0 1px rgba(120,160,220,.22) inset;
}

/* the status bar */
.ruth-status {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 22px 4px;
  font: 700 12.5px/1 Manrope, system-ui, sans-serif;
  color: #0E2A52;
  background: #E0F2FE;
}
.ruth-status .bars { display: flex; align-items: center; gap: 6px; }
.ruth-status svg { width: 16px; height: 11px; fill: #0E2A52; }
.ruth-status .batt {
  width: 22px; height: 11px; border: 1.4px solid #0E2A52; border-radius: 3px;
  position: relative; opacity: .9;
}
.ruth-status .batt::before {
  content: ""; position: absolute; inset: 1.5px; right: 6px; background: #0E2A52; border-radius: 1px;
}
.ruth-status .batt::after {
  content: ""; position: absolute; right: -4px; top: 3px; width: 2px; height: 5px;
  background: #0E2A52; border-radius: 0 1px 1px 0;
}

/* the app's own header */
#ruth-panel header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px 14px;
  background: #E0F2FE;
  border-bottom: 1px solid #CFE4F5;
}
#ruth-panel header .avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  background: linear-gradient(145deg, #3AA0FF, #0F8FA5);
  color: #fff; font: 800 13px/30px Manrope, sans-serif; text-align: center;
}
#ruth-panel header b { font: 800 15px/1.1 Manrope, sans-serif; color: #0E2A52; display: block; }
#ruth-panel header small { color: #4A5A72; font-size: 11.5px; }
#ruth-close {
  margin-left: auto; border: 0; background: transparent; cursor: pointer;
  font-size: 21px; line-height: 1; color: #4A5A72; padding: 2px 4px;
}

/* ── the conversation ────────────────────────────────────────────────────── */
#ruth-body {
  flex: 1;
  padding: 16px 16px 8px;
  overflow-y: auto;
  font: 400 14.5px/1.5 Inter, system-ui, sans-serif;
  color: #0E2A52;
  background: #F8F9FA;
  scrollbar-width: thin;
}
.ruth-say {
  position: relative;
  max-width: 88%;
  margin: 0 0 10px;
  padding: 11px 14px;
  border-radius: 16px 16px 16px 5px;
  background: #fff;
  border: 1px solid #E4EBF3;
  box-shadow: 0 1px 2px rgba(27,42,65,.05);
}
.ruth-say.mine {
  margin-left: auto;
  background: #3AA0FF;
  border-color: #3AA0FF;
  color: #fff;
  border-radius: 16px 16px 5px 16px;
  font-weight: 600;
}
.ruth-say a { color: #1F7FDB; }
.ruth-say.mine a { color: #fff; }

.ruth-taps { display: flex; flex-wrap: wrap; gap: 7px; margin: 2px 0 14px; justify-content: flex-end; }
.ruth-tap {
  border: 1px solid #A6E3E9; background: #fff; color: #0E2A52;
  border-radius: 999px; padding: 9px 13px; cursor: pointer;
  font: 600 13px/1 Manrope, sans-serif;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.ruth-tap:hover { background: #E3FDFD; border-color: #3AA0FF; transform: translateY(-1px); }

.ruth-field { display: flex; gap: 7px; margin: 2px 0 14px; }
.ruth-field input {
  flex: 1; min-width: 0;
  border: 1px solid #D9E3EE; border-radius: 999px; padding: 10px 14px;
  font: 400 14px/1.2 Inter, sans-serif; color: #0E2A52; background: #fff;
}
.ruth-field button {
  border: 0; border-radius: 999px; padding: 10px 15px; cursor: pointer;
  background: #3AA0FF; color: #fff; font: 700 13px/1 Manrope, sans-serif;
}

/* a priced answer, as a card inside the conversation */
.ruth-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 10px 12px; border-top: 1px solid #EDF2F8;
  background: #fff;
}
.ruth-row:first-of-type { border-top: 0; border-radius: 14px 14px 0 0; }
.ruth-row:last-of-type { border-radius: 0 0 14px 14px; margin-bottom: 12px; }
.ruth-row .what { font: 600 13px/1.3 Manrope, sans-serif; }
.ruth-row .where { display: block; font-size: 12px; color: #4A5A72; font-weight: 400; }
.ruth-row .amt { margin-left: auto; font: 800 15.5px/1 Manrope, sans-serif; white-space: nowrap; }
.ruth-row.low .amt { color: #1F7FDB; }
.ruth-row.high .amt { color: #C9303C; }
.ruth-note { font-size: 12.5px; color: #4A5A72; }

/* the row under an answer */
.ruth-actions { display: flex; align-items: center; gap: 2px; margin: 2px 0 12px; }
.ruth-act {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  color: #8FA3BD;
  transition: background .18s ease, color .18s ease;
}
.ruth-act:hover { background: #EDF4FB; color: #0E2A52; }
.ruth-act svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9;
                stroke-linecap: round; stroke-linejoin: round; }
.ruth-act.done, .ruth-act.rated { color: #1F7FDB; background: #E0F2FE; }
.ruth-why { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.ruth-why span { font-size: 12.5px; color: #4A5A72; }
.ruth-why .ruth-tap { padding: 6px 10px; font-size: 12px; }

/* the twenty minutes, offered as a demo lands */
.ruth-cta {
  margin: 4px 0 12px; padding: 16px;
  border: 1px solid #A6E3E9; border-radius: 16px;
  background: linear-gradient(180deg, #fff 0%, #E3FDFD 100%);
}
.ruth-cta p { margin: 0 0 12px; font-size: 14px; line-height: 1.5; }
.ruth-cta b { font-family: Manrope, sans-serif; }
.ruth-cta .btn-book {
  display: block; text-align: center; text-decoration: none;
  background: #3AA0FF; color: #fff;
  font: 700 14px/1 Manrope, sans-serif;
  padding: 13px 16px; border-radius: 999px; margin-bottom: 9px;
  box-shadow: 0 6px 18px rgba(58,160,255,.32);
}
.ruth-cta .btn-book:hover { background: #1F7FDB; }
.ruth-cta .ruth-tap { width: 100%; }

/* the home bar */
.ruth-home {
  flex: 0 0 auto;
  padding: 7px 0 9px;
  background: #F8F9FA;
  display: flex; justify-content: center;
}
.ruth-home span {
  width: 124px; height: 5px; border-radius: 999px; background: #0E2A52; opacity: .22;
}

@media (prefers-reduced-motion: reduce) {
  #ruth-tab, #ruth-panel, #ruth-tab .dot { animation: none !important; transition: none !important; }
}

/* On a real phone, no phone inside the phone: a sheet from the bottom edge. */
@media (max-width: 560px) {
  #ruth-tab { top: auto; bottom: 16px; right: 16px; transform: none; border-radius: 16px; }
  #ruth-tab:hover { transform: none; }
  #ruth-tab.hidden { transform: translateX(40px); }
  #ruth-panel {
    right: 0; left: 0; top: auto; bottom: 0;
    width: 100%; height: 82vh; padding: 0;
    border-radius: 22px 22px 0 0;
    background: #F8F9FA;
    box-shadow: 0 -18px 50px -24px rgba(8,14,26,.6);
    transform: translateY(100%) translateX(0) rotate(0);
  }
  #ruth-panel.open { transform: translateY(0) translateX(0); }
  #ruth-panel::before, #ruth-panel::after { display: none; }
  #ruth-screen { border-radius: 22px 22px 0 0; }
  #ruth-screen .island, .ruth-status, .ruth-home { display: none; }
}

/* ── a priced answer, as bars ───────────────────────────────────────────── */
.tier-card {
  margin: 2px 0 14px; padding: 14px 14px 10px;
  border: 1px solid #CFE4F5; border-radius: 18px;
  background: linear-gradient(180deg, #fff 0%, #F3FAFF 100%);
  box-shadow: 0 1px 2px rgba(27,42,65,.05);
}
.tc-title {
  font: 800 11px/1 Manrope, sans-serif; letter-spacing: .14em; text-transform: uppercase;
  color: #4A5A72; margin-bottom: 12px;
}
.tier-bar { margin-bottom: 12px; }
.tb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tb-label { font: 600 12.5px/1.2 Manrope, sans-serif; color: #0E2A52; }
.tb-amt { font: 800 14px/1 Manrope, sans-serif; color: #1F7FDB; font-variant-numeric: tabular-nums; }
.tb-none { font-size: 11.5px; color: #8FA3BD; }
.tb-track { height: 8px; border-radius: 999px; background: #E6EEF7; overflow: hidden; margin-top: 6px; }
.tb-track span {
  display: block; height: 100%; border-radius: 999px; background: #3AA0FF;
  animation: tb-grow .75s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes tb-grow { from { width: 0 !important; } }
.tier-bar.bad .tb-amt { color: #C9303C; }
.tier-bar.bad .tb-track span { background: #FF5A5F; }
.tier-bar.good .tb-amt { color: #0F8FA5; font-size: 16px; }
.tier-bar.good .tb-track span { background: #0F8FA5; box-shadow: 0 0 12px rgba(15,143,165,.45); }
.tb-sub { font-size: 11.5px; color: #4A5A72; margin-top: 5px; line-height: 1.35; }
.tier-card .ruth-row { background: transparent; }
@media (prefers-reduced-motion: reduce) { .tb-track span { animation: none; } }

/* ── the played conversation: a screen name, a composer, a tap ──────────── */
#ruth-panel header .screen-name {
  font: 700 12.5px/1 Manrope, sans-serif; color: #1F7FDB;
  margin-left: auto; margin-right: 10px;
  display: inline-flex; align-items: center; gap: 5px;
}
#ruth-panel header .screen-name i { font-style: normal; font-size: 17px; line-height: 1; }
#ruth-body.screen-in { animation: screen-in .42s cubic-bezier(.22,.8,.26,1); }
@keyframes screen-in { from { opacity: 0; transform: translateX(16px); } }

.ruth-composer {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px 4px;
  background: #F8F9FA;
  opacity: 0; transform: translateY(6px);
  transition: opacity .25s ease, transform .25s ease;
}
.ruth-composer.live { opacity: 1; transform: none; }
.ruth-composer .field {
  flex: 1; min-height: 38px;
  border: 1px solid #D9E3EE; border-radius: 999px; background: #fff;
  padding: 10px 14px;
  font: 400 14px/1.2 Inter, sans-serif; color: #0E2A52;
  display: flex; align-items: center; gap: 1px;
}
.ruth-composer .caret {
  display: inline-block; width: 1.5px; height: 15px; background: #3AA0FF;
  animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.ruth-composer .send {
  width: 34px; height: 34px; border-radius: 50%;
  background: #D9E3EE; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .2s ease, transform .2s ease;
}
.ruth-composer .send svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ruth-composer .send.ready { background: #3AA0FF; transform: scale(1.08); }

.ruth-tap.tapping {
  background: #3AA0FF; border-color: #3AA0FF; color: #fff;
  transform: scale(.96);
  box-shadow: 0 0 0 6px rgba(58,160,255,.18);
}

@media (prefers-reduced-motion: reduce) {
  .ruth-composer, .ruth-composer .caret, #ruth-body.screen-in { animation: none; transition: none; }
}

/* ── Ruth types before she speaks ────────────────────────────────────────── */
.ruth-typing {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 0 0 10px; padding: 13px 15px;
  background: #fff; border: 1px solid #E4EBF3;
  border-radius: 16px 16px 16px 5px;
  box-shadow: 0 1px 2px rgba(27,42,65,.05);
}
.ruth-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #9FB6D0;
  animation: ruth-dot 1.3s ease-in-out infinite;
}
.ruth-typing span:nth-child(2) { animation-delay: .18s; }
.ruth-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes ruth-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* the header's own status line */
#ruth-panel header small.live-dot {
  display: inline-flex; align-items: center; gap: 5px;
  color: #0F8FA5; font-weight: 600;
}
#ruth-panel header small.live-dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #0F8FA5;
}

@media (prefers-reduced-motion: reduce) { .ruth-typing span { animation: none; } }


/* ── the screen, dark: the look from the mockup David pointed at ─────────── */
#ruth-screen { background: #0B1628; }
.ruth-status { background: #0B1628; color: #C9D8EC; }
.ruth-status svg { fill: #C9D8EC; }
.ruth-status .batt { border-color: #C9D8EC; }
.ruth-status .batt::before, .ruth-status .batt::after { background: #C9D8EC; }

#ruth-panel header { background: #112036; border-bottom: 1px solid rgba(166,227,233,.14); }
#ruth-panel header b { color: #EEF4FB; }
#ruth-panel header small { color: #8FA9C8; }
#ruth-panel header .screen-name { color: #6FC3F5; }
#ruth-close { color: #8FA9C8; }

#ruth-body { background: #0B1628; color: #E4EDF8; }

.ruth-say {
  background: #16263F;
  border-color: rgba(166,227,233,.12);
  color: #E4EDF8;
  box-shadow: none;
}
.ruth-say.mine { background: #2E86E0; border-color: #2E86E0; color: #fff; }
.ruth-say a { color: #6FC3F5; }

.ruth-typing { background: #16263F; border-color: rgba(166,227,233,.12); box-shadow: none; }
.ruth-typing span { background: #7E9BBD; }

.ruth-tap { background: #16263F; border-color: rgba(111,195,245,.4); color: #DCE8F6; }
.ruth-tap:hover { background: #1C3550; border-color: #6FC3F5; }
.ruth-tap.tapping { background: #2E86E0; border-color: #2E86E0; color: #fff;
                    box-shadow: 0 0 0 6px rgba(46,134,224,.22); }

.ruth-composer { background: #0B1628; }
.ruth-composer .field { background: #16263F; border-color: rgba(166,227,233,.16); color: #E4EDF8; }
.ruth-composer .send { background: #27405F; }
.ruth-composer .send.ready { background: #2E86E0; }

.tier-card { background: #112036; border-color: rgba(166,227,233,.16); box-shadow: none; }
.tc-title { color: #8FA9C8; }
.tb-label { color: #E4EDF8; }
.tb-amt { color: #6FC3F5; }
.tb-track { background: rgba(255,255,255,.10); }
.tb-track span { background: #2E86E0; }
.tier-bar.bad .tb-amt { color: #FF8A8E; }
.tier-bar.bad .tb-track span { background: #FF5A5F; }
.tier-bar.good .tb-amt { color: #6FE3D2; }
.tier-bar.good .tb-track span { background: #39C2AE; box-shadow: 0 0 12px rgba(57,194,174,.45); }
.tb-sub, .ruth-note { color: #8FA9C8; }

.ruth-row { background: transparent; border-top-color: rgba(255,255,255,.08); }
.ruth-row .what { color: #E4EDF8; }
.ruth-row .where { color: #8FA9C8; }
.ruth-row .amt { color: #6FC3F5; }
.ruth-row.high .amt { color: #FF8A8E; }

.ruth-cta { background: #112036; border-color: rgba(111,195,245,.35); }
.ruth-cta p { color: #E4EDF8; }

.ruth-home { background: #0B1628; }
.ruth-home span { background: #C9D8EC; opacity: .28; }

@media (max-width: 560px) {
  #ruth-panel { background: #0B1628; }
}

/* ── the note that arrives, and the delivery that follows ───────────────── */
.note-card { padding: 0; overflow: hidden; }
.nc-head {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 14px;
  background: rgba(111,195,245,.08);
  border-bottom: 1px solid rgba(166,227,233,.14);
}
.nc-dot { width: 8px; height: 8px; border-radius: 50%; background: #6FC3F5; flex: 0 0 8px; }
.nc-dot.ok { background: #39C2AE; }
.nc-title { font: 700 13px/1.3 Manrope, sans-serif; color: #E4EDF8; }
.nc-badge {
  margin-left: auto; font: 700 10px/1 Manrope, sans-serif;
  letter-spacing: .08em; text-transform: uppercase;
  color: #6FC3F5; border: 1px solid rgba(111,195,245,.45);
  border-radius: 999px; padding: 4px 8px;
}
.nc-badge.ok { color: #6FE3D2; border-color: rgba(57,194,174,.5); }
.nc-note {
  padding: 13px 14px 15px;
  font: 400 13.5px/1.55 Inter, sans-serif;
  color: #C9D8EC;
}

/* the line she is still writing carries a caret, like a person mid-sentence */
.ruth-say.writing::after {
  content: "";
  display: inline-block;
  width: 2px; height: 1em;
  margin-left: 2px;
  vertical-align: -2px;
  background: #6FC3F5;
  animation: caret 1s steps(1) infinite;
}
