/* Grok Bot faces, the sign-in horizon and the overview stage. */
@property --lid { syntax: "<number>"; inherits: true; initial-value: 1; }
.face {
  --size: 64px;
  --eye: var(--face-eye);
  --skin: var(--face-skin);
  position: relative;
  display: block;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: var(--shape, 50%);
  background: var(--skin);
  box-shadow: inset calc(var(--size) * -.05) calc(var(--size) * -.07) calc(var(--size) * .14) #0000002e;
}
.face[data-hue] {
  --eye: #101010db;
  --skin: radial-gradient(circle at 34% 26%, color-mix(in srgb, var(--c) 42%, white) 0, var(--c) 50%, color-mix(in srgb, var(--c) 70%, black) 100%);
}
.face[data-hue="red"] { --c: #fb2b3e; }
.face[data-hue="orange"] { --c: #fd690f; }
.face[data-hue="yellow"] { --c: #f59312; }
.face[data-hue="green"] { --c: #14c16f; }
.face[data-hue="cyan"] { --c: #13b7a2; }
.face[data-hue="blue"] { --c: #1e86fc; }
.face[data-hue="purple"] { --c: #8f59f9; }
.face[data-hue="magenta"] { --c: #f93498; }
.face[data-hue="brown"] { --c: #a06b39; }
.face-eyes {
  position: absolute;
  top: 27%;
  left: 31%;
  display: flex;
  justify-content: space-between;
  width: 38%;
  height: 30%;
  transform: translate(var(--look-x, 0px), var(--look-y, 0px));
  transition: transform var(--gaze-speed, 180ms) var(--ease-out);
}
.face-eye {
  width: 27%;
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--eye);
  transform: rotate(-22deg) scaleY(var(--lid));
  transition: transform 140ms var(--ease-out);
}
.face.blink .face-eye { --lid: .08; transition-duration: 60ms; }
.face[data-state="closed"] .face-eye, .face[data-state="sleep"] .face-eye { --lid: .1; }
.face[data-state="happy"] .face-eye { --lid: .32; }
.face[data-state="up"] .face-eyes { transform: translateY(-14%); }
.face[data-state="down"] .face-eyes { transform: translateY(16%); }
.face[data-state="busy"]:not([data-mood]) .face-eyes { animation: glance 2.8s ease-in-out infinite; }

/* Working moods: each face gets one, scaled by its own --mood-speed and shifted by --mood-delay. */
.face[data-mood] { --tempo: calc(var(--mood-speed, 1) * 1s); }
.face[data-mood="reading"] .face-eyes { animation: read calc(var(--tempo) * 2.6) ease-in-out infinite; animation-delay: var(--mood-delay); }
.face[data-mood="typing"] { animation: bob calc(var(--tempo) * .5) ease-in-out infinite alternate; animation-delay: var(--mood-delay); }
.face[data-mood="typing"] .face-eyes { animation: type calc(var(--tempo) * 1.2) steps(1) infinite; animation-delay: var(--mood-delay); }
.face[data-mood="thinking"] { animation: tilt calc(var(--tempo) * 3.4) ease-in-out infinite alternate, ponder calc(var(--tempo) * 4.6) linear infinite; animation-delay: var(--mood-delay); }
.face[data-mood="thinking"] .face-eyes { transform: translate(14%, -18%); }
.face[data-mood="scanning"] .face-eyes { animation: scan calc(var(--tempo) * 3.2) ease-in-out infinite; animation-delay: var(--mood-delay); }
.face[data-mood="focused"] { animation: breathe calc(var(--tempo) * 2.2) ease-in-out infinite alternate, stare calc(var(--tempo) * 3.8) linear infinite; animation-delay: var(--mood-delay); }
.face[data-mood="focused"] .face-eyes { transform: translateY(6%); }
.face[data-mood="nodding"] { animation: nod calc(var(--tempo) * 1.4) ease-in-out infinite; animation-delay: var(--mood-delay); }
.face[data-mood="nodding"] .face-eyes { transform: translate(-10%, 14%); }
@keyframes read { 0%, 100% { transform: translate(-14%, 6%); } 42%, 52% { transform: translate(14%, 6%); } 60% { transform: translate(14%, 12%); } }
@keyframes type { 0% { transform: translate(-8%, 20%); } 25% { transform: translate(-1%, 20%); } 50% { transform: translate(6%, 22%); } 75% { transform: translate(-3%, 20%); } }
@keyframes bob { to { translate: 0 3%; } }
@keyframes tilt { from { rotate: -5deg; } to { rotate: 6deg; } }
@keyframes ponder { 0%, 78% { --lid: .72; } 84% { --lid: .08; } 90%, 100% { --lid: .72; } }
@keyframes scan { 0%, 100% { transform: translate(-13%, -9%); } 25% { transform: translate(13%, -9%); } 50% { transform: translate(13%, 11%); } 75% { transform: translate(-13%, 11%); } }
@keyframes breathe { to { scale: 1.035; } }
@keyframes stare { 0%, 86% { --lid: .66; } 91% { --lid: .08; } 96%, 100% { --lid: .66; } }
@keyframes nod { 0%, 100% { translate: 0 0; rotate: 0deg; } 40% { translate: 0 4%; rotate: 3deg; } 60% { translate: 0 1%; rotate: -1deg; } }
.face.shake { animation: shake 520ms var(--ease-out); }
@keyframes glance { 0%, 100% { transform: translateX(-14%); } 45%, 55% { transform: translateX(14%); } }
@keyframes shake { 20% { translate: -2.5% 0; } 40% { translate: 2.5% 0; } 60% { translate: -1.5% 0; } 80% { translate: 1% 0; } }

/* Sign-in: the Host face rises over the bottom edge and watches the form. */
.auth { display: grid; grid-template-rows: auto 1fr auto; min-height: 100dvh; overflow: hidden; background: var(--sand-bg-sidebar); color: var(--sand-text-primary); }
html:has(.auth:not([hidden])) { background: #0e0e0e; }
.auth-top { display: flex; align-items: center; padding: 16px 20px; }
/* The password goes in a composer-style pill; errors pop up above it without moving it. */
.auth-talk {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  align-self: center;
  justify-self: center;
  width: min(460px, calc(100% - 32px));
  margin: 24px 0 48px;
}
.auth-bubble {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  left: 0;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 18px;
  border-radius: 22px;
  background: var(--sand-bg-elevated);
  color: var(--sand-text-danger-primary);
  font: 15px/22px var(--font-sans);
  text-align: center;
  animation: bubble-in 260ms var(--ease-out);
}
.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 6px 6px 6px 22px;
  border: var(--hairline) solid var(--sand-border-secondary-translucent);
  border-radius: var(--radius-full);
  background: var(--sand-bg-elevated);
  box-shadow: 0 12px 36px var(--sand-shadow-popover);
  transition: border-color var(--duration-fast) ease-out;
}
.composer:focus-within { border-color: var(--sand-border-primary-translucent); }
.composer input:not([type=checkbox]):not([type=radio]):not([type=file]) { flex: 1; min-height: 40px; padding: 0; border: 0; background: transparent; font: 15px/22px var(--font-sans); box-shadow: none; }
label.composer { padding-right: 22px; }
.send-btn { position: relative; width: 40px; height: 40px; background: var(--sand-bg-primary); color: var(--sand-text-inverted); }
.auth-talk.pending .send-btn svg { opacity: 0; }
.auth-talk.pending .send-btn::after { content: ""; position: absolute; inset: 0; width: 16px; height: 16px; margin: auto; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 700ms linear infinite; }
.send-btn:hover:not(:disabled) { background: var(--sand-bg-primary-hover); color: var(--sand-text-inverted); }
.send-btn:disabled { background: var(--sand-bg-primary-disabled); color: var(--sand-text-inverted); opacity: 1; }
.send-btn svg { width: 18px; height: 18px; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes spin { to { transform: rotate(1turn); } }
.auth-horizon { --face: min(92vmin, 820px); position: relative; height: calc(var(--face) * .34); }
.login-face { --size: var(--face); position: absolute; top: 0; left: 50%; transform: translateX(-50%); }
.login-face .face-eyes { top: 12%; left: 33%; width: 34%; height: 15%; }
@media (max-height: 640px) { .auth-horizon { --face: min(80vmin, 640px); } }

/* Overview header: a two-line display headline and today's usage on the left, the Host
   anchoring the right, and up to six working Bots in a row below. */
.page.overview { gap: 44px; max-width: 1040px; padding-top: 48px; padding-bottom: 48px; }
@media (min-width: 821px) { .page.overview { justify-content: center; min-height: 100dvh; } }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "copy host" "crew host";
  gap: 40px 56px;
  align-items: end;
}
.hero-copy { display: flex; flex-direction: column; gap: 16px; grid-area: copy; align-self: start; }
.hero-title { display: flex; flex-direction: column; font: 600 68px/1.02 var(--font-sans); letter-spacing: -0.04em; }
.hero-title span { white-space: nowrap; }
.hero-usage { color: var(--sand-text-secondary); font: 17px/24px var(--font-sans); font-variant-numeric: tabular-nums; }
.hero-host { grid-area: host; align-self: center; }
.hero-host .face { --size: 196px; box-shadow: inset calc(var(--size) * -.05) calc(var(--size) * -.07) calc(var(--size) * .14) #0000002e, 0 calc(var(--size) * .14) calc(var(--size) * .22) calc(var(--size) * -.1) #00000059; }
.crew { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 20px 22px; grid-area: crew; min-width: 0; }
.crew:empty { display: none; }
.crew-bot { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0; }
.crew-bot .face { --size: 76px; }
.crew-name { max-width: 92px; overflow: hidden; color: var(--sand-text-secondary); font: var(--text-label); text-overflow: ellipsis; white-space: nowrap; }
.crew-more { display: grid; place-items: center; min-width: 52px; height: 52px; margin-bottom: 36px; padding: 0 12px; border-radius: var(--radius-full); background: var(--sand-bg-elevated-hover); color: var(--sand-text-secondary); font: var(--text-body1); font-weight: var(--weight-medium); }
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 44px 24px; align-items: start; }
.row-icon-title { display: flex; align-items: center; gap: 10px; }
.row-icon-title svg { flex: none; color: var(--sand-icon-tertiary); }
.overview .row.link { min-height: 48px; }
.overview .row.link .status { color: var(--sand-text-secondary); }

@media (max-width: 900px) { .overview-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .page.overview { gap: 36px; padding-top: 28px; }
  .hero { grid-template-areas: "copy host" "crew crew"; gap: 28px 12px; align-items: start; }
  .hero-title { font-size: 40px; }
  .hero-usage { font-size: 15px; line-height: 22px; }
  .hero-host { align-self: start; }
  .hero-host .face { --size: 84px; }
  .crew { gap: 16px 12px; }
  .crew-bot .face { --size: 48px; }
  .crew-name { max-width: 52px; }
  .crew-more { min-width: 44px; height: 44px; margin-bottom: 30px; }
}
@media (prefers-reduced-motion: reduce) { .face-eyes { transition: none; } }
