:root {
  --ice: #A9DCF7;
  --ice-light: #DCF1FC;
  --text: #F3F7FA;
  --soft: #DDE5EB;
  --quiet: #C6D0D9;
  --ground: #22262C;
  --room: #2B3138;
  --line: rgba(255, 255, 255, .1);
  --tab-height: 84px;
  --safe-top: max(env(safe-area-inset-top), 20px);
  --safe-bottom: env(safe-area-inset-bottom);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; background: var(--ground); }

body { color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }

#app {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: linear-gradient(180deg, #39414A 0%, var(--ground) 72%);
}

.screen {
  position: absolute;
  inset: 0 0 calc(var(--tab-height) + var(--safe-bottom)) 0;
  padding: calc(var(--safe-top) + 32px) 24px 16px;
  overflow-y: auto;
}

h1 { margin: 0; font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: -.02em; text-wrap: balance; }
p { margin: 0; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ice-light); outline-offset: 3px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.primary, .secondary {
  min-height: 54px;
  border-radius: 27px;
  padding: 0 20px;
  font-size: 17px;
}
.primary { border: 0; background: var(--ice); color: #1E2429; font-weight: 600; }
.primary:active { background: var(--ice-light); }
.secondary { border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .07); font-weight: 500; }
.round {
  width: 58px; height: 58px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .07);
}
.text-button { min-height: 44px; padding: 0; border: 0; background: none; color: var(--ice); font-size: 16px; font-weight: 600; }
.error { min-height: 20px; color: #FFC9B8; font-size: 15px; line-height: 20px; }
.role { margin-top: 4px; color: var(--ice); font-size: 16px; line-height: 22px; font-weight: 500; }

/* The pearl */
.pearl {
  border-radius: 50%;
  background: radial-gradient(circle at 33% 28%, #FFFFFF 0%, var(--ice-light) 16%, var(--ice) 38%, #7096AE 66%, #3B4B58 92%);
  box-shadow: 0 0 110px 26px rgba(169, 220, 247, .24), inset -34px -44px 90px rgba(24, 30, 37, .55);
}
.pearl-home {
  position: absolute; top: calc(var(--safe-top) - 8px); right: -84px; width: 300px; height: 300px;
  animation: breathe 5s ease-in-out infinite;
}
.home[data-state="listening"] .pearl-home { animation-duration: 2.8s; }
.home[data-state="thinking"] .pearl-home { animation-duration: 1.4s; }
.home[data-state="speaking"] .pearl-home { animation-duration: 2.2s; }
.orbit {
  position: absolute; top: calc(var(--safe-top) - 50px); right: -126px; width: 384px; height: 384px;
  border: 1px solid rgba(169, 220, 247, .22); border-radius: 50%;
}
.pearl-corner {
  position: absolute; top: -56px; right: -56px; width: 170px; height: 170px;
  box-shadow: 0 0 70px 14px rgba(169, 220, 247, .22);
}
.pearl-small { width: 120px; height: 120px; box-shadow: 0 0 70px 14px rgba(169, 220, 247, .22); }
.pearl-login { position: absolute; top: 8%; left: 50%; width: 220px; height: 220px; margin-left: -110px; }
@keyframes breathe { 50% { transform: scale(1.035); } }
@media (prefers-reduced-motion: reduce) { .pearl-home { animation: none; } }

/* Login */
.login { inset: 0; display: flex; align-items: flex-end; padding-bottom: calc(var(--safe-bottom) + 32px); }
.login form { position: relative; width: 100%; display: flex; flex-direction: column; gap: 10px; }
.login label { color: var(--quiet); font-size: 15px; }
input {
  width: 100%; min-height: 50px; padding: 0 16px; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .07); font-size: 17px;
}
input::placeholder { color: var(--quiet); }

/* Home */
.home { overflow: hidden; }
.wordmark { position: relative; font-size: 28px; line-height: 32px; letter-spacing: -.01em; }
.conversation { position: absolute; left: 24px; right: 24px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.state { color: var(--ice); font-size: 15px; line-height: 20px; font-weight: 500; }
.you-said { color: var(--quiet); font-size: 16px; line-height: 24px; max-height: 72px; overflow: hidden; }
.reply {
  max-height: 228px; overflow-y: auto; font-size: 32px; line-height: 38px; font-weight: 700;
  letter-spacing: -.02em; text-wrap: pretty; text-shadow: 0 1px 14px rgba(20, 24, 29, .6);
}
.reply.long { font-size: 22px; line-height: 29px; font-weight: 600; letter-spacing: -.01em; }
.actions { display: flex; gap: 12px; margin-top: 6px; }
.actions .primary { flex: 1; min-height: 58px; border-radius: 29px; }
.type-form { display: flex; gap: 8px; }
.send { flex: none; min-height: 50px; padding: 0 16px; border: 0; border-radius: 14px; background: var(--ice); color: #1E2429; font-weight: 600; }

/* Today */
.today .lead { max-width: 320px; margin-top: 14px; color: var(--soft); font-size: 19px; line-height: 27px; text-wrap: pretty; }
.timeline { position: relative; margin-top: 30px; }
.timeline-row { display: grid; grid-template-columns: 54px 36px minmax(0, 1fr); min-height: 80px; }
.timeline-row .time { color: var(--quiet); font-size: 15px; line-height: 22px; font-variant-numeric: tabular-nums; }
.timeline-row .dot-wrap { position: relative; display: flex; justify-content: center; padding-top: 4px; }
.timeline-row .dot-wrap::after {
  content: ""; position: absolute; top: 22px; bottom: -4px; left: 50%; width: 1px; background: rgba(169, 220, 247, .32);
}
.timeline-row:last-child .dot-wrap::after { display: none; }
.dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFFFFF 0%, #8FD3CF 60%, #2F6F72 100%);
  box-shadow: 0 0 12px #8FD3CF;
}
.timeline-row .title { font-size: 18px; line-height: 24px; font-weight: 500; }
.timeline-row .detail { margin-top: 2px; color: var(--quiet); font-size: 14px; line-height: 20px; }
.note { margin: 8px 0; color: var(--quiet); font-size: 16px; line-height: 24px; }

/* Team */
.floors { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.floor { display: flex; gap: 6px; }
.room {
  position: relative; display: block; flex: 1 1 0; min-width: 0; height: 112px; padding: 0; overflow: hidden; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background-color: var(--room);
}
.room.lead { height: 124px; border-radius: 62px 62px 12px 12px; }
.room svg { position: absolute; left: 0; top: 0; }
.head, .body { position: absolute; display: block; }
.head { top: 30px; width: 18px; height: 18px; border-radius: 50%; }
.body { top: 52px; width: 36px; height: 40px; border-radius: 18px 18px 4px 4px; }
.room-name { position: absolute; left: 12px; bottom: 2px; font-size: 13px; line-height: 16px; font-weight: 600; }
.room .mini-pearl {
  position: absolute; left: 38px; top: 20px; width: 50px; height: 50px; border-radius: 50%;
  background: radial-gradient(circle at 33% 28%, #FFFFFF 0%, var(--ice-light) 16%, var(--ice) 38%, #7096AE 66%, #3B4B58 92%);
  box-shadow: 0 0 30px 6px rgba(169, 220, 247, .24);
}
.office { display: flex; flex-direction: column; min-height: 100%; }
#office-room { position: relative; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 18px; background-color: var(--room); }
#office-room.lead { aspect-ratio: 342 / 124; border-radius: 62px 62px 12px 12px; }
#office-room .scene { position: absolute; left: 0; top: 0; width: 168px; height: 112px; transform-origin: 0 0; }
#office-room.lead .scene { width: 342px; height: 124px; }
.about { margin-top: 14px; color: var(--soft); font-size: 17px; line-height: 26px; }
.now { margin-top: 12px; font-size: 20px; line-height: 27px; font-weight: 600; }
.office-actions, .approval-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 20px; }
.office-actions > *, .approval-actions > * { flex: 1 1 0; }

/* Approve */
#approval { display: flex; flex-direction: column; min-height: 100%; }
.count { margin-bottom: 64px; color: var(--quiet); font-size: 15px; line-height: 20px; }
.sheet { margin: 24px 0 8px; padding: 18px 20px; border-radius: 20px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--soft); font-size: 16px; line-height: 24px; }
.all-clear { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 32px; text-align: center; }
.all-clear h1 { font-size: 28px; line-height: 34px; }

/* Bottom bar */
.tabs {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex;
  height: calc(var(--tab-height) + var(--safe-bottom));
  padding: 8px 8px calc(var(--safe-bottom) + 8px);
  background: rgba(30, 34, 39, .72);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  border-top: 1px solid var(--line);
}
.tabs button {
  position: relative; flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--quiet); font-size: 12px; font-weight: 500;
}
.tabs button[aria-current="page"] { color: var(--ice); font-weight: 600; }
.badge {
  position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--ice); color: #1E2429; font-size: 12px; line-height: 18px; font-weight: 700; text-align: center;
}
