/* =========================================================================
   SALON · playful skin
   Type:  Bricolage Grotesque (display) · Hanken Grotesk (body)
   Mood:  bright white canvas, vibrant gradient objects, floating orbs,
          isometric emblems. Modern, toy-like, alive.
   ========================================================================= */

:root {
  --bg:        #f5f6f9;
  --bg-2:      #ffffff;
  --ink:       #14151b;
  --ink-soft:  #5d6070;
  --ink-faint: #9a9eb0;
  --line:      #e7e8ef;
  --card:      #ffffff;

  /* gradient identity (overridden per personality) */
  --g1: #6a5cff;
  --g2: #2ad0d8;
  --tint:  rgba(106,92,255,0.10);
  --tint2: rgba(42,208,216,0.10);

  --ff-display: "Bricolage Grotesque", system-ui, sans-serif;
  --ff-body: "Hanken Grotesk", system-ui, sans-serif;

  --r-xl: 30px;
  --r-lg: 24px;
  --r-md: 16px;
  --ease: cubic-bezier(.22,.7,.3,1);
  --spring: cubic-bezier(.34,1.56,.64,1);
  --maxw: 540px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--ff-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

/* ---------------------------- ambient orbs ------------------------------- */
.orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb {
  position: absolute; border-radius: 50%; filter: blur(8px);
  opacity: .55; will-change: transform;
}
.orb--1 { width: 200px; height: 200px; top: -40px; right: -50px;
  background: radial-gradient(circle at 35% 30%, #ffd27a, #ff7a45 70%);
  animation: float1 16s var(--ease) infinite; }
.orb--2 { width: 150px; height: 150px; bottom: 8%; left: -56px;
  background: radial-gradient(circle at 35% 30%, #9b8cff, #5b6cff 72%);
  animation: float2 19s var(--ease) infinite; }
.orb--3 { width: 110px; height: 110px; top: 42%; right: -34px;
  background: radial-gradient(circle at 35% 30%, #6ff0e6, #2ad0d8 72%);
  animation: float3 22s var(--ease) infinite; }
body.in-chat .orbs { opacity: .5; }
@keyframes float1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-26px,30px)} }
@keyframes float2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(30px,-24px)} }
@keyframes float3 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-18px,-30px)} }

/* ------------------------------- shell ----------------------------------- */
.app {
  position: relative; z-index: 2;
  width: 100%; max-width: var(--maxw); height: 100%;
  margin: 0 auto; overflow: hidden;
}
.view {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transform: translateY(10px) scale(.99);
  transition: opacity .45s var(--ease), transform .45s var(--ease), visibility 0s linear .45s;
}
.view.is-active {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}

.icon-btn {
  display: grid; place-items: center; width: 42px; height: 42px; padding: 0;
  border: none; border-radius: 50%; background: transparent; color: var(--ink);
  cursor: pointer; transition: background .2s var(--ease), transform .15s var(--ease);
}
.icon-btn:hover { background: rgba(0,0,0,.05); }
.icon-btn:active { transform: scale(.9); }

/* ============================== GALLERY ================================== */
.view--gallery { overflow-y: auto; }
.view--gallery::-webkit-scrollbar { width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top)) 22px 6px;
}
.wordmark {
  font-family: var(--ff-display); font-weight: 800; font-size: 22px;
  letter-spacing: -.02em; color: var(--ink);
}
.wordmark sup { font-size: 11px; font-weight: 600; color: var(--ink-faint); margin-left: 1px; }
.dot-btn {
  display: grid; grid-auto-flow: column; gap: 3px; align-items: center;
  width: 42px; height: 42px; border: none; background: transparent; cursor: pointer;
  border-radius: 50%; transition: background .2s var(--ease);
}
.dot-btn:hover { background: rgba(0,0,0,.05); }
.dot-btn span { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); display: block; }
.dot-btn span:nth-child(1){ background: #ff7a45; }
.dot-btn span:nth-child(2){ background: #6a5cff; }
.dot-btn span:nth-child(3){ background: #2ad0d8; }

.hero { padding: 18px 24px 22px; }
.hero__title {
  margin: 0; font-family: var(--ff-display); font-weight: 800;
  font-size: clamp(58px, 19vw, 92px); line-height: .92; letter-spacing: -.035em;
  color: var(--ink);
}
.hero__title em {
  font-style: normal; position: relative;
  background: linear-gradient(100deg, #ff7a45, #6a5cff 45%, #2ad0d8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__sub {
  margin: 16px 0 0; font-size: 16px; color: var(--ink-soft); max-width: 26ch; line-height: 1.45;
}

/* deck of personality tiles */
.deck { display: flex; flex-direction: column; gap: 16px; padding: 8px 18px 6px; }
.tile {
  --c1: var(--g1); --c2: var(--g2);
  position: relative; display: flex; align-items: center;
  gap: 14px; padding: 18px 18px 30px; border: none; cursor: pointer; text-align: left;
  border-radius: var(--r-xl); overflow: hidden; color: #fff;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  box-shadow: 0 20px 40px -22px var(--g1), inset 0 1px 0 rgba(255,255,255,.25);
  opacity: 0; transform: translateY(18px) scale(.98);
  animation: tileIn .7s var(--spring) forwards;
  transition: transform .35s var(--spring), box-shadow .35s var(--ease);
}
.tile::after {  /* glossy sheen */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 80% -10%, rgba(255,255,255,.35), transparent 50%);
}
.tile:hover { transform: translateY(-3px) scale(1.01); box-shadow: 0 28px 50px -20px var(--g1), inset 0 1px 0 rgba(255,255,255,.3); }
.tile:active { transform: scale(.99); }
@keyframes tileIn { to { opacity: 1; transform: none; } }

.tile__emblem { flex: 0 0 92px; display: grid; place-items: center; filter: drop-shadow(0 10px 16px rgba(0,0,0,.18)); animation: bob 6s var(--ease) infinite; }
.tile:nth-child(2n) .tile__emblem { animation-duration: 7.2s; }
.tile:nth-child(3n) .tile__emblem { animation-duration: 8s; }
@keyframes bob { 0%,100%{ transform: translateY(0) } 50%{ transform: translateY(-7px) } }

.tile__meta { flex: 1 1 auto; min-width: 0; overflow: hidden; padding-right: 6px; }
.tile__domain {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.82);
}
.tile__name {
  display: block; font-family: var(--ff-display); font-weight: 800;
  font-size: 27px; line-height: 1.04; letter-spacing: -.02em; margin: 4px 0 6px;
  text-shadow: 0 2px 12px rgba(0,0,0,.14);
}
.tile__tag {
  display: block; overflow: hidden; max-height: 2.85em;
  font-size: 14px; line-height: 1.4; color: rgba(255,255,255,.92);
}
.tile__go {
  position: absolute; right: 16px; bottom: 14px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; color: #fff;
  display: inline-flex; align-items: center; gap: 4px; opacity: .9;
  background: rgba(255,255,255,.18); padding: 5px 11px; border-radius: 999px;
  backdrop-filter: blur(6px);
}
.tile__go b { transition: transform .25s var(--spring); }
.tile:hover .tile__go b { transform: translateX(4px); }

.foot {
  margin-top: auto; padding: 22px 24px calc(26px + env(safe-area-inset-bottom));
  text-align: center; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint);
}

/* =============================== CHAT =================================== */
.view--chat {
  background:
    radial-gradient(120% 60% at 50% 0%, var(--tint), transparent 60%),
    radial-gradient(100% 50% at 100% 0%, var(--tint2), transparent 55%),
    var(--bg);
}

.chat-top {
  display: flex; align-items: center; gap: 11px;
  padding: calc(12px + env(safe-area-inset-top)) 14px 11px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line); z-index: 6;
}
.chat-top__back { margin-left: -4px; }
.chat-top__emblem { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; }
.chat-top__emblem svg { filter: drop-shadow(0 4px 8px rgba(0,0,0,.14)); }
.chat-top__id { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.15; }
.chat-top__name { font-family: var(--ff-display); font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.chat-top__status { font-size: 11.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.chat-top__status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  box-shadow: 0 0 0 0 var(--g1); animation: pulse 2.4s var(--ease) infinite;
}
.chat-top__status.is-typing { color: var(--g1); font-weight: 600; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 var(--tint)} 70%{box-shadow:0 0 0 8px transparent} 100%{box-shadow:0 0 0 0 transparent} }

/* mode bar */
.modebar {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 12px 16px 12px; z-index: 5;
}
.modebar::-webkit-scrollbar { display: none; }
.mode {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--ff-body); font-weight: 600; font-size: 13.5px; color: var(--ink-soft);
  padding: 9px 15px; border-radius: 999px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line);
  transition: transform .18s var(--spring), color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.mode__g { font-size: 13px; opacity: .9; }
.mode:hover { border-color: var(--g1); color: var(--ink); }
.mode:active { transform: scale(.94); }
.mode.is-active {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  box-shadow: 0 10px 22px -12px var(--g1);
}

/* thread */
.thread { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 16px 8px; display: flex; flex-direction: column; }
.thread::-webkit-scrollbar { width: 0; }
.messages { display: flex; flex-direction: column; gap: 11px; padding-top: 8px; }

.divider {
  display: flex; align-items: center; justify-content: center; margin: 14px 0 6px;
}
.divider span {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--g1); background: var(--tint); padding: 5px 13px; border-radius: 999px;
}

.msg {
  max-width: 82%; padding: 11px 15px 13px; font-size: 16px; line-height: 1.46;
  border-radius: 22px; position: relative; word-wrap: break-word;
  animation: msgIn .42s var(--spring) both;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.msg--them {
  align-self: flex-start; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-bottom-left-radius: 8px;
  box-shadow: 0 14px 30px -24px rgba(20,20,40,.5);
}
.msg--me {
  align-self: flex-end; color: #fff; border-bottom-right-radius: 8px;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  box-shadow: 0 14px 28px -18px var(--g1);
}
.msg__time { display: block; margin-top: 5px; font-size: 10px; letter-spacing: .06em; opacity: .5; }
.msg--me .msg__time { text-align: right; opacity: .75; }

.typing {
  align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 22px; border-bottom-left-radius: 8px;
}
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--g1); opacity: .4; animation: blink 1.3s var(--ease) infinite; }
.typing span:nth-child(2){ animation-delay:.16s } .typing span:nth-child(3){ animation-delay:.32s }
@keyframes blink { 0%,60%,100%{opacity:.25;transform:translateY(0)} 30%{opacity:.95;transform:translateY(-3px)} }

.cursor { display: inline-block; width: 2px; height: 1.05em; background: var(--g1); margin-left: 1px; vertical-align: -2px; animation: caret .9s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* quick starters / again */
.prompts { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 2px 6px; }
.chip {
  font-family: var(--ff-body); font-weight: 600; font-size: 14px; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 9px 15px; border-radius: 999px; cursor: pointer;
  transition: transform .18s var(--spring), border-color .2s var(--ease), background .2s var(--ease);
  animation: msgIn .5s var(--spring) both;
}
.chip:hover { border-color: var(--g1); background: var(--tint); }
.chip:active { transform: scale(.95); }
.chip--again { color: var(--g1); border-color: var(--g1); font-weight: 700; }

/* composer */
.composer {
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.composer__field {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg-2); border: 1.5px solid var(--line); border-radius: 26px;
  padding: 5px 5px 5px 17px; transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.composer__field:focus-within { border-color: var(--g1); box-shadow: 0 0 0 4px var(--tint); }
.composer__input {
  flex: 1; border: none; outline: none; resize: none; background: transparent;
  font-family: var(--ff-body); font-size: 16px; line-height: 1.4; color: var(--ink);
  max-height: 130px; padding: 9px 0; max-width: 100%;
}
.composer__input::placeholder { color: var(--ink-faint); }
.composer__send {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  box-shadow: 0 10px 20px -10px var(--g1);
  transition: transform .18s var(--spring), opacity .2s var(--ease), filter .2s var(--ease);
}
.composer__send:disabled { opacity: .38; filter: grayscale(.4); cursor: default; box-shadow: none; }
.composer__send:not(:disabled):hover { filter: brightness(1.07); }
.composer__send:not(:disabled):active { transform: scale(.88); }
.composer__hint { margin: 8px 6px 0; min-height: 14px; font-size: 12.5px; color: var(--ink-faint); text-align: center; }
.composer__hint a { color: var(--g1); font-weight: 700; cursor: pointer; border-bottom: 1.5px solid var(--tint); }
.composer__hint.is-error { color: #d6453a; }

/* ============================ SETTINGS SHEET ============================ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(20,21,27,.4); backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden; transition: opacity .35s var(--ease), visibility 0s linear .35s;
}
.sheet-backdrop.is-open { opacity: 1; visibility: visible; transition: opacity .35s var(--ease); }
.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 41; width: 100%; max-width: var(--maxw);
  transform: translate(-50%, 102%); background: var(--bg-2);
  border-radius: 30px 30px 0 0; border: 1px solid var(--line); border-bottom: none;
  padding: 12px 26px calc(28px + env(safe-area-inset-bottom));
  box-shadow: 0 -30px 70px -30px rgba(20,20,40,.5);
  transition: transform .45s var(--spring);
}
.sheet.is-open { transform: translate(-50%, 0); }
.sheet__handle { width: 44px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 18px; }
.sheet__title { font-family: var(--ff-display); font-weight: 800; font-size: 26px; letter-spacing: -.02em; margin: 0 0 10px; }
.sheet__body { font-size: 15px; line-height: 1.55; color: var(--ink-soft); margin: 0 0 22px; }
.sheet__body strong { color: var(--ink); font-weight: 700; }

.field { display: block; margin-bottom: 16px; }
.field__label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 8px; }
.field__inputwrap { position: relative; display: flex; }
.field__input {
  width: 100%; font-family: var(--ff-body); font-size: 16px; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 14px; padding: 13px 14px; outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field__input:focus { border-color: var(--g1); box-shadow: 0 0 0 4px var(--tint); }
.field__input--select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%235d6070' stroke-width='1.8'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }
.field__reveal { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: none; background: transparent; color: var(--ink-soft); font-family: var(--ff-body); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; padding: 6px 8px; }
.sheet__fine { font-size: 13px; line-height: 1.5; min-height: 18px; margin: 2px 0 18px; }
.sheet__fine.ok { color: #1f9d57; } .sheet__fine.warn { color: #d6453a; }
.sheet__actions { display: flex; gap: 12px; }
.btn { flex: 1; text-align: center; font-family: var(--ff-body); font-weight: 700; font-size: 15px; padding: 14px 18px; border-radius: 16px; cursor: pointer; border: 1.5px solid transparent; text-decoration: none; transition: transform .18s var(--spring), filter .2s var(--ease), background .2s var(--ease); }
.btn:active { transform: scale(.97); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); display: grid; place-items: center; }
.btn--ghost:hover { background: var(--bg); }
.btn--solid { color: #fff; background: linear-gradient(135deg, var(--g1), var(--g2)); box-shadow: 0 12px 24px -12px var(--g1); }
.btn--solid:hover { filter: brightness(1.06); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .12s !important; }
  .tile { opacity: 1; transform: none; }
}
@media (min-height: 780px) { .hero { padding-top: 26px; } }
