:root {
  --yellow: #ffe33f;
  --green: #55d980;
  --blue: #c5dcf7;
  --pink: #ffbdd1;
  --paper: #fffdf4;
  --ink: #202038;
  --muted: #696673;
  --line: rgba(32,32,56,.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  color: var(--ink); background: var(--yellow);
  font-family: "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.page-noise { position: fixed; inset: 0; pointer-events: none; opacity: .14; background-image: radial-gradient(rgba(32,32,56,.34) 1px,transparent 1px); background-size: 22px 22px; }

.mini-brand { display: inline-flex; align-items: center; gap: 10px; font-family: "Arial Rounded MT Bold","Trebuchet MS",sans-serif; letter-spacing: -.04em; }
.brand-bubble { width: 35px; height: 33px; display: grid; place-items: center; background: var(--yellow); border: 2px solid var(--ink); border-radius: 52% 52% 52% 14%; box-shadow: 3px 3px 0 var(--green); transform: rotate(-6deg); }
.kicker { font-family: "Courier New",monospace; font-size: .67rem; font-weight: 800; letter-spacing: .12em; }

.password-gate { position: relative; z-index: 2; min-height: 100vh; padding: 24px; display: grid; place-items: center; background: radial-gradient(circle at 78% 18%, var(--green),transparent 25rem), radial-gradient(circle at 13% 82%,var(--pink),transparent 28rem),var(--yellow); }
.gate-card { width: min(100%, 540px); padding: clamp(28px,6vw,52px); background: var(--paper); border: 2px solid var(--ink); border-radius: 36px; box-shadow: 13px 14px 0 var(--blue); }
.lock-icon { width: 72px; height: 72px; margin: 48px 0 18px; display: grid; place-items: center; background: var(--pink); border: 2px solid var(--ink); border-radius: 50%; box-shadow: 5px 5px 0 var(--ink); font-size: 2rem; transform: rotate(-5deg); }
.gate-card h1 { margin: 8px 0 12px; font: 900 clamp(2.5rem,8vw,4.4rem)/.9 "Arial Rounded MT Bold","Trebuchet MS",sans-serif; letter-spacing: -.065em; }
.gate-copy { color: var(--muted); }
#passwordForm { margin-top: 30px; }
#passwordForm label { display: block; margin-bottom: 8px; font-size: .72rem; font-weight: 800; }
.password-row { display: flex; gap: 8px; }
.password-row input { min-width: 0; flex: 1; height: 52px; padding: 0 16px; color: var(--ink); background: white; border: 2px solid var(--ink); border-radius: 15px; outline: none; }
.password-row input:focus { box-shadow: 4px 4px 0 var(--blue); }
.password-row button { padding: 0 18px; border: 2px solid var(--ink); border-radius: 15px; background: var(--green); box-shadow: 4px 4px 0 var(--ink); cursor: pointer; font-weight: 800; }
.password-row button:hover { transform: translate(-1px,-1px); box-shadow: 6px 6px 0 var(--ink); }
.form-error { min-height: 23px; margin-top: 10px; color: #b12857; font-size: .78rem; }
.back-link { display: inline-block; margin-top: 24px; color: var(--muted); font-size: .74rem; font-weight: 700; }

.agent-shell { position: relative; z-index: 2; width: min(100%, 1240px); min-height: 100vh; margin: auto; padding: 16px; display: grid; grid-template-rows: auto 1fr auto; gap: 12px; }
.agent-header { min-height: 72px; padding: 10px 12px 10px 18px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; background: rgba(255,253,244,.94); border: 2px solid var(--ink); border-radius: 24px; box-shadow: 6px 6px 0 var(--ink); }
.agent-identity { display: flex; align-items: center; gap: 10px; }
.agent-avatar { position: relative; width: 43px; height: 43px; display: grid; place-items: center; background: var(--pink); border: 2px solid var(--ink); border-radius: 50%; font-size: 1.25rem; }
.agent-avatar i { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; background: var(--green); border: 2px solid var(--paper); border-radius: 50%; }
.agent-identity strong, .agent-identity small { display: block; }
.agent-identity small { margin-top: 2px; color: var(--muted); font-size: .64rem; }
.agent-identity small span { display: inline-block; width: 6px; height: 6px; background: var(--green); border-radius: 50%; }
.sound-toggle { justify-self: end; padding: 9px 12px; background: var(--blue); border: 1.5px solid var(--ink); border-radius: 12px; cursor: pointer; font-size: .68rem; font-weight: 800; }
.sound-toggle[aria-pressed="true"] { background: var(--green); }

.chat-stage { position: relative; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--paper); border: 2px solid var(--ink); border-radius: 34px; box-shadow: 8px 8px 0 var(--blue); }
.chat-intro { margin: auto; padding: 48px 24px 130px; text-align: center; max-width: 800px; }
.intro-icon { width: 64px; height: 64px; margin: auto auto 18px; display: grid; place-items: center; background: var(--green); border: 2px solid var(--ink); border-radius: 17px; box-shadow: 5px 5px 0 var(--ink); font-size: 1.7rem; transform: rotate(-5deg); }
.chat-intro h1 { margin: 11px 0 18px; font: 900 clamp(3rem,7vw,6.4rem)/.85 "Arial Rounded MT Bold","Trebuchet MS",sans-serif; letter-spacing: -.075em; }
.chat-intro h1 em { display: inline-block; padding: .04em .15em .1em; background: var(--pink); border-radius: .17em; font-style: normal; transform: rotate(-1deg); box-shadow: 6px 6px 0 var(--blue); }
.chat-intro > p:not(.kicker) { max-width: 600px; margin: auto; color: var(--muted); line-height: 1.55; }
.suggestions { margin-top: 30px; display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.suggestions button { padding: 16px; color: var(--ink); background: white; border: 1.5px solid var(--ink); border-radius: 17px; cursor: pointer; font-size: .76rem; font-weight: 700; line-height: 1.35; text-align: left; transition: .2s; }
.suggestions button:nth-child(2) { background: var(--blue); }
.suggestions button:nth-child(3) { background: var(--green); }
.suggestions button:hover { transform: translateY(-4px) rotate(-1deg); box-shadow: 4px 4px 0 var(--ink); }

.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 30px clamp(18px,6vw,76px) 125px; display: none; flex-direction: column; gap: 18px; scroll-behavior: smooth; }
.messages.active { display: flex; }
.message { max-width: min(78%,720px); animation: messageIn .3s ease; }
.message.user { align-self: flex-end; }
.message.assistant { align-self: flex-start; }
.message-label { margin: 0 8px 5px; color: var(--muted); font-size: .61rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.message.user .message-label { text-align: right; }
.message-bubble { padding: 15px 18px; border: 1.5px solid var(--ink); border-radius: 20px 20px 20px 5px; background: var(--blue); line-height: 1.55; white-space: pre-wrap; }
.message.user .message-bubble { background: var(--yellow); border-radius: 20px 20px 5px 20px; }
.message.pending .message-bubble { display: flex; gap: 5px; }
.message.pending i { width: 7px; height: 7px; background: var(--ink); border-radius: 50%; animation: typing .9s infinite alternate; }
.message.pending i:nth-child(2) { animation-delay: .2s; }.message.pending i:nth-child(3) { animation-delay: .4s; }
@keyframes messageIn { from { opacity: 0; transform: translateY(7px); } }
@keyframes typing { to { opacity: .2; transform: translateY(-4px); } }

.composer { position: absolute; z-index: 4; left: 50%; bottom: 18px; width: min(calc(100% - 30px),880px); min-height: 66px; padding: 7px; display: grid; grid-template-columns: 50px 1fr auto; align-items: end; gap: 7px; transform: translateX(-50%); background: white; border: 2px solid var(--ink); border-radius: 22px; box-shadow: 6px 7px 0 var(--pink); }
.composer textarea { max-height: 140px; min-height: 49px; resize: none; padding: 13px 5px; color: var(--ink); background: transparent; border: 0; outline: 0; line-height: 1.4; }
.voice-button, .send-button { height: 49px; border: 1.5px solid var(--ink); cursor: pointer; font-weight: 900; }
.voice-button { width: 49px; background: var(--pink); border-radius: 50%; }
.voice-button.listening { color: white; background: #dd386e; animation: pulse 1s infinite; }
.send-button { padding: 0 17px; background: var(--green); border-radius: 15px; }
.send-button:disabled { opacity: .45; cursor: wait; }
.voice-status { position: absolute; left: 18px; top: -24px; color: var(--muted); font-size: .65rem; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(221,56,110,.15); } }
.agent-footer { padding: 3px 8px; display: flex; justify-content: space-between; color: rgba(32,32,56,.7); font-size: .62rem; font-weight: 700; }

@media (max-width: 720px) {
  .agent-shell { padding: 8px; }
  .agent-header { grid-template-columns: 1fr auto; }
  .agent-header > .mini-brand { display: none; }
  .agent-identity { justify-self: start; }
  .chat-stage { border-radius: 25px; }
  .chat-intro { padding: 35px 16px 125px; }
  .suggestions { grid-template-columns: 1fr; }
  .suggestions button { text-align: center; }
  .message { max-width: 90%; }
  .messages { padding: 24px 14px 115px; }
  .agent-footer { flex-direction: column; align-items: center; gap: 2px; text-align: center; }
}

@media (max-width: 480px) {
  .password-gate { padding: 12px; }
  .gate-card { padding: 28px 22px; border-radius: 27px; box-shadow: 8px 9px 0 var(--blue); }
  .password-row { flex-direction: column; }
  .password-row button { height: 50px; }
  .agent-header { min-height: 63px; border-radius: 18px; }
  .agent-avatar { width: 38px; height: 38px; }
  .sound-toggle { padding: 8px; }
  .composer { bottom: 10px; grid-template-columns: 43px 1fr auto; }
  .voice-button { width: 43px; height: 43px; }
  .send-button { height: 43px; padding: 0 12px; }
  .composer textarea { min-height: 43px; padding-top: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
