/* ============================================================================
   styles.css — "Ask Rohan" ChatGPT/Claude-style theme.
   Light + dark (auto via prefers-color-scheme, override via [data-theme]).
   No external fonts or libraries — instant load on any device.
   ============================================================================ */

:root {
  --bg: #ffffff;
  --bg-side: #f9f9f9;
  --bg-elev: #ffffff;
  --bubble-user: #f0f0f2;
  --bubble-hover: #f3f3f5;
  --text: #1d1d1f;
  --text-muted: #6b6b70;
  --text-faint: #9a9aa0;
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.18);
  --accent: #5b5bd6;
  --accent-ink: #ffffff;
  --avatar: #0a0e12;
  --pill-bg: #f0f0f4;
  --pill-text: #44444a;
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 720px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #212121;
    --bg-side: #171717;
    --bg-elev: #2a2a2a;
    --bubble-user: #2f2f2f;
    --bubble-hover: #343434;
    --text: #ececec;
    --text-muted: #a6a6a6;
    --text-faint: #777;
    --border: rgba(255, 255, 255, 0.12);
    --border-strong: rgba(255, 255, 255, 0.22);
    --accent: #7c7cf0;
    --avatar: #ececec;
    --pill-bg: #333;
    --pill-text: #cfcfd4;
  }
}
:root[data-theme="dark"] {
  --bg: #212121;
  --bg-side: #171717;
  --bg-elev: #2a2a2a;
  --bubble-user: #2f2f2f;
  --bubble-hover: #343434;
  --text: #ececec;
  --text-muted: #a6a6a6;
  --text-faint: #777;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --accent: #7c7cf0;
  --avatar: #ececec;
  --pill-bg: #333;
  --pill-text: #cfcfd4;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* ------------------------------- Sidebar --------------------------------- */
.sidebar {
  width: 264px;
  flex: none;
  background: var(--bg-side);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 8px;
  transition: transform 0.25s ease;
}
.brand {
  font-weight: 600;
  font-size: 16px;
  padding: 6px 8px 4px;
  letter-spacing: 0.2px;
}
.new-chat {
  text-align: left;
  background: transparent;
  border: 0.5px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.new-chat:hover { background: var(--bubble-hover); }

.recent { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.recent-label {
  font-size: 10.5px;
  letter-spacing: 1px;
  color: var(--text-faint);
  padding: 6px 8px;
}
.recent-item {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
}
.recent-item:hover { background: var(--bubble-hover); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.ghost-row {
  display: flex; align-items: center; gap: 8px;
  background: transparent; border: none; color: var(--text-muted);
  font-family: inherit; font-size: 13px; cursor: pointer;
  padding: 8px 10px; border-radius: var(--radius-sm); text-align: left;
}
.ghost-row:hover { background: var(--bubble-hover); color: var(--text); }
.account {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; padding: 8px 10px;
  border-top: 0.5px solid var(--border);
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--avatar);
  color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex: none;
}
.avatar.sm { width: 22px; height: 22px; font-size: 11px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

.scrim {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4);
  z-index: 5;
}

/* -------------------------------- Main ----------------------------------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
}
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  background: transparent; border: none; color: var(--text);
  font-size: 17px; cursor: pointer; padding: 6px 8px; border-radius: 8px;
  line-height: 1;
}
.icon-btn:hover { background: var(--bubble-hover); }
.pill-btn {
  background: transparent; border: 0.5px solid var(--border-strong);
  color: var(--text); font-family: inherit; font-size: 12.5px;
  padding: 6px 12px; border-radius: 20px; cursor: pointer;
}
.pill-btn:hover { background: var(--bubble-hover); }
.only-mobile { display: none; }

/* Messages */
.messages { flex: 1; overflow-y: auto; padding: 22px 16px 8px; }
.msg { max-width: var(--maxw); margin: 0 auto 22px; display: flex; gap: 12px; }
.msg.user { justify-content: flex-end; }
.msg.user .text {
  background: var(--bubble-user);
  border-radius: 16px;
  padding: 10px 14px;
  max-width: 80%;
}
.msg.bot .avatar { margin-top: 2px; }
.msg .text { font-size: 15px; }
.msg.bot .text { animation: rise 0.32s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.text p { margin: 0 0 10px; }
.text p:last-child { margin-bottom: 0; }
.text ul { margin: 6px 0 10px; padding-left: 20px; }
.text li { margin: 3px 0; }

/* Typing dots */
.typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint);
  animation: td 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes td { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }

/* Cards */
.cards { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 6px; }
.card {
  display: block;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg-elev);
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.card-title { font-weight: 600; font-size: 14.5px; }
.card-link { color: var(--text-faint); font-weight: 400; }
.card-blurb { font-size: 13px; color: var(--text-muted); margin: 4px 0 8px; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  font-size: 11.5px; background: var(--pill-bg); color: var(--pill-text);
  padding: 3px 9px; border-radius: 20px;
}

.xp { margin-bottom: 12px; }
.xp-head { font-size: 14.5px; }
.xp-when { color: var(--text-faint); font-size: 12.5px; margin-left: 6px; }
.skill-group { margin-bottom: 12px; }
.skill-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.3px; }
.contact-list { list-style: none; padding: 0; margin: 4px 0; }
.contact-list li { margin: 7px 0; }

.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  padding: 8px 16px; border-radius: 20px; font-size: 13.5px; border: none;
  cursor: pointer; font-family: inherit; margin: 2px 6px 2px 0;
}
.btn:hover { text-decoration: none; opacity: 0.92; }
.btn-ghost { background: transparent; color: var(--text); border: 0.5px solid var(--border-strong); }

/* Composer */
.composer { padding: 6px 16px 14px; }
.chips {
  max-width: var(--maxw); margin: 0 auto 10px;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.chip {
  background: var(--bg-elev); border: 0.5px solid var(--border-strong);
  color: var(--text); font-size: 13px; padding: 7px 13px;
  border-radius: 18px; cursor: pointer; font-family: inherit;
}
.chip:hover { background: var(--bubble-hover); }
.input-row {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  border: 0.5px solid var(--border-strong); border-radius: 26px;
  padding: 6px 6px 6px 18px; background: var(--bg-elev);
}
.input-row:focus-within { border-color: var(--accent); }
#input {
  flex: 1; border: none; background: transparent; color: var(--text);
  font-size: 15px; font-family: inherit; padding: 8px 0; outline: none;
}
.send {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: var(--accent); color: var(--accent-ink);
  font-size: 16px; cursor: pointer; flex: none;
}
.send:hover { opacity: 0.92; }
.composer-note {
  max-width: var(--maxw); margin: 8px auto 0;
  text-align: center; font-size: 11.5px; color: var(--text-faint);
}

/* ----------------------------- Plain view -------------------------------- */
.plain-view {
  position: absolute; inset: 0; background: var(--bg);
  overflow-y: auto; padding: 28px 20px 60px; z-index: 10;
}
.plain-wrap { max-width: 760px; margin: 0 auto; }
.back-btn {
  position: sticky; top: 0; margin-bottom: 14px;
  background: var(--bg-elev); border: 0.5px solid var(--border-strong);
  color: var(--text); border-radius: 20px; padding: 7px 14px;
  font-size: 13px; cursor: pointer; font-family: inherit;
}
.r-head { display: flex; gap: 18px; align-items: center; }
.r-photo { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; flex: none; border: 0.5px solid var(--border); }
.about-photo { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; float: right; margin: 2px 0 10px 16px; border: 0.5px solid var(--border); }
.r-head h1 { margin: 0; font-size: 28px; }
.r-head .r-sub { color: var(--text-muted); margin: 4px 0 10px; }
.r-links { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13.5px; margin-bottom: 8px; }
.r-section { margin-top: 26px; }
.r-section h2 {
  font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--text-muted); border-bottom: 0.5px solid var(--border);
  padding-bottom: 6px; margin: 0 0 12px;
}
.r-item { margin-bottom: 14px; }
.r-item-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.r-item-head strong { font-size: 15px; }
.r-item-when { color: var(--text-faint); font-size: 13px; }
.r-item ul { margin: 6px 0 0; padding-left: 20px; }
.r-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ------------------------------ Responsive ------------------------------- */
body.plain-mode .main { display: none; }
body:not(.plain-mode) .plain-view { display: none; }

@media (max-width: 720px) {
  .only-mobile { display: inline-block; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 6;
    transform: translateX(-100%);
    box-shadow: 2px 0 18px rgba(0, 0, 0, 0.18);
  }
  body.sidebar-open .sidebar { transform: none; }
  .topbar-title { display: none; }
  .r-grid { grid-template-columns: 1fr; }
  .msg.user .text { max-width: 88%; }
}

/* -------------------------------- Mascot --------------------------------- */
.mascot-host { position: fixed; right: 22px; bottom: 22px; width: 92px; height: 92px; z-index: 50; }
.mascot-fig { width: 100%; height: 100%; cursor: pointer; filter: drop-shadow(0 6px 10px rgba(0,0,0,.18)); animation: m-bob 2.6s ease-in-out infinite; }
.mascot-inner { width: 100%; height: 100%; }
.mascot-fig svg { display: block; width: 100%; height: 100%; overflow: visible; }
.eyes { transform-box: fill-box; transform-origin: center; animation: m-blink 4.5s infinite; }
.paw { transform-box: fill-box; transform-origin: center; }
.mascot-dismiss {
  position: absolute; top: -4px; left: -4px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.55); color: #fff; font-size: 13px; line-height: 1;
  cursor: pointer; opacity: 0; transition: opacity .2s; z-index: 1;
}
.mascot-host:hover .mascot-dismiss, .mascot-host:focus-within .mascot-dismiss { opacity: 1; }
.mascot-restore {
  position: fixed; right: 18px; bottom: 18px; width: 42px; height: 42px; border-radius: 50%;
  border: 0.5px solid var(--border-strong); background: var(--bg-elev); cursor: pointer;
  font-size: 18px; display: none; align-items: center; justify-content: center; z-index: 50;
}
.m-fx { position: fixed; pointer-events: none; font-size: 18px; z-index: 51; animation: m-fly 1s ease-out forwards; }

@keyframes m-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes m-blink { 0%,92%,100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes m-fly { 0% { opacity: 1; transform: translate(0,0) scale(.6); } 100% { opacity: 0; transform: translate(var(--dx), -46px) scale(1.3); } }
.a-wave .paw { animation: m-wave .45s ease-in-out 3; }
@keyframes m-wave { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-40deg); } }
.a-hop { animation: m-hop .6s ease 2; }
@keyframes m-hop { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-26px); } }
.a-spin { animation: m-spin .7s ease; }
@keyframes m-spin { 0% { transform: rotate(0); } 100% { transform: rotate(360deg); } }
.a-peekdown { animation: m-peekdown 1.4s ease; }
@keyframes m-peekdown { 0% { transform: translateY(0); } 25%,30% { transform: translateY(120px); } 70% { transform: translateY(-6px); } 100% { transform: translateY(0); } }
.a-peekside { animation: m-peekside 1.6s ease; }
@keyframes m-peekside { 0% { transform: translateX(0); } 25%,55% { transform: translateX(120px); } 80% { transform: translateX(-8px); } 100% { transform: translateX(0); } }
.a-surprise { animation: m-surprise .6s cubic-bezier(.34,1.6,.5,1); }
@keyframes m-surprise { 0% { transform: scale(1); } 40% { transform: scale(1.22) rotate(-6deg); } 100% { transform: scale(1); } }

@media (max-width: 720px) {
  .mascot-host { right: 10px; bottom: 124px; width: 72px; height: 72px; }
  .mascot-restore { bottom: 124px; right: 12px; width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .mascot-fig, .eyes, .mascot-inner, .a-wave .paw { animation: none !important; }
}
