:root{--bg:#f2f4f6;--surface:#fff;--surface-soft:#f7f8fa;--text:#191f28;--muted:#6b7684;--line:#e5e8eb;--accent:#f04464;--accent-hover:#d93452;--accent-soft:#fff0f3;--blue:#3182f6;--radius:24px;--shadow:0 8px 30px rgba(0,0,0,.04)}
*{box-sizing:border-box}html{height:100%;background:var(--bg)}body{min-height:100%;margin:0;background:var(--bg);color:var(--text);font-family:Pretendard,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans KR",sans-serif;-webkit-font-smoothing:antialiased}button,input,textarea{font:inherit}fieldset{min-width:0;margin:0;padding:0;border:0}.app-shell{width:min(100%,720px);min-height:100dvh;margin:0 auto;padding:0 20px 32px;display:flex;flex-direction:column}.topbar{height:72px;display:flex;align-items:center;justify-content:space-between}.brand{display:flex;gap:10px;align-items:center;color:var(--text);font-weight:750;text-decoration:none;font-size:17px}.brand-mark{width:34px;height:34px;border-radius:11px;object-fit:cover}.status-pill{display:inline-flex;align-items:center;gap:7px;font-size:12px;font-weight:700;color:#4e5968;background:#e8ebed;padding:8px 10px;border-radius:999px}.status-pill i,.person [data-ai-status] i{width:7px;height:7px;border-radius:50%;background:#f59f00}.status-pill[data-state=ready] i,.person [data-ai-status][data-state=ready] i{background:#20c997}.status-pill[data-state=offline] i,.person [data-ai-status][data-state=offline] i{background:#fa5252}.start-hero{padding:44px 6px 28px}.eyebrow{margin:0 0 10px;font-size:12px;line-height:1;font-weight:800;letter-spacing:.08em;color:var(--accent)}.start-hero h1{font-size:clamp(34px,7vw,50px);line-height:1.17;letter-spacing:-.05em;margin:0;font-weight:800}.start-hero>p:last-child{max-width:520px;margin:18px 0 0;color:var(--muted);font-size:16px;line-height:1.7}.panel{background:var(--surface);border-radius:var(--radius);padding:28px;box-shadow:var(--shadow)}.profile-panel fieldset{display:grid;gap:20px}.profile-panel fieldset:disabled{opacity:.68}.field-group{display:grid;gap:9px}.field-group label{font-size:14px;font-weight:750}.field-group input[type=text],.field-group input[type=number]{width:100%;height:54px;border:0;outline:0;border-radius:16px;background:var(--surface-soft);padding:0 16px;color:var(--text);font-size:16px;transition:box-shadow .18s,background .18s}.field-group input:focus{background:#fff;box-shadow:0 0 0 2px var(--accent)}.field-group input::placeholder{color:#b0b8c1}.segment{display:grid;grid-template-columns:1fr 1fr;gap:8px}.segment input{position:absolute;opacity:0;pointer-events:none}.segment span{display:grid;place-items:center;height:52px;border-radius:16px;background:var(--surface-soft);color:#4e5968;font-size:15px;font-weight:700;cursor:pointer;transition:.18s}.segment input:checked+span{background:var(--accent-soft);color:var(--accent);box-shadow:inset 0 0 0 1.5px #ffc4cf}.form-note{margin:-3px 0 0;color:#8b95a1;font-size:12px;line-height:1.5}.primary-button{height:56px;border:0;border-radius:16px;background:var(--accent);color:#fff;font-size:16px;font-weight:750;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:10px;transition:.15s}.primary-button:hover{background:var(--accent-hover)}.primary-button:active{transform:scale(.985)}.primary-button[disabled]{opacity:.7;cursor:not-allowed}.spinner{display:none;width:18px;height:18px;border:2px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;animation:spin .8s linear infinite}.primary-button.loading .spinner{display:block}.chat-shell{min-height:100dvh;display:flex;flex-direction:column}.chat-topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;gap:16px;height:74px;padding:0 max(20px,calc((100vw - 720px)/2 + 20px));background:rgba(242,244,246,.9);backdrop-filter:blur(18px);border-bottom:1px solid rgba(229,232,235,.85)}.person{display:flex;align-items:center;gap:11px}.avatar{width:42px;height:42px;border-radius:15px;overflow:hidden}.avatar img,.intro-avatar img{width:100%;height:100%;object-fit:cover}.person>div:last-child{display:grid;gap:3px}.person strong{font-size:15px}.person [data-ai-status]{display:flex;align-items:center;gap:6px;color:#8b95a1;font-size:11px}.header-actions{display:flex;gap:6px}.header-actions button{border:0;background:transparent;color:#6b7684;font-size:12px;font-weight:700;padding:9px;cursor:pointer;border-radius:10px}.header-actions button:hover{background:#e8ebed;color:#333d4b}.header-actions button:disabled{opacity:.4;cursor:not-allowed}.conversation-wrap{width:min(100%,720px);flex:1;margin:0 auto;padding:44px 20px 170px;display:flex;flex-direction:column}.conversation-intro{text-align:center;padding:8px 0 38px}.intro-avatar{width:72px;height:72px;border-radius:24px;overflow:hidden;margin:0 auto 18px;box-shadow:0 8px 28px rgba(240,68,100,.12)}.conversation-intro h1{margin:0;font-size:24px;letter-spacing:-.04em}.conversation-intro p{margin:10px auto 0;max-width:420px;color:var(--muted);font-size:14px;line-height:1.6}.messages{display:grid;gap:14px}.message{display:flex}.message.user{justify-content:flex-end}.message.model,.message.typing{justify-content:flex-start;align-items:flex-start;gap:9px}.message-avatar{width:34px;height:34px;border-radius:12px;object-fit:cover;flex:0 0 34px;box-shadow:0 2px 10px rgba(0,0,0,.06)}.model-message{display:grid;gap:5px;max-width:min(80%,554px)}.message-name{padding-left:2px;color:#6b7684;font-size:11px;font-weight:750}.model-message .bubble{max-width:100%}.bubble{max-width:min(80%,520px);padding:12px 15px;border-radius:18px;font-size:15px;line-height:1.55;white-space:pre-wrap;word-break:break-word}.message.user .bubble{background:#333d4b;color:#fff;border-bottom-right-radius:6px}.message.model .bubble,.message.typing .bubble{background:#fff;color:var(--text);border-bottom-left-radius:6px;box-shadow:0 2px 14px rgba(0,0,0,.03)}.message.system{justify-content:center}.message.system .bubble{max-width:90%;background:transparent;color:#8b95a1;text-align:center;font-size:12px;padding:6px}.typing .bubble{display:flex;align-items:center;gap:5px;padding:16px 17px}.typing i{width:6px;height:6px;border-radius:50%;background:#b0b8c1;animation:typing 1.1s infinite}.typing i:nth-child(2){animation-delay:.16s}.typing i:nth-child(3){animation-delay:.32s}.composer{position:fixed;left:0;right:0;bottom:0;z-index:30;padding:12px max(20px,calc((100vw - 720px)/2 + 20px)) calc(12px + env(safe-area-inset-bottom));background:linear-gradient(to bottom,rgba(242,244,246,0),#f2f4f6 24%,#f2f4f6)}.composer-inner{display:flex;align-items:flex-end;gap:10px;background:#fff;border-radius:22px;padding:8px 8px 8px 16px;box-shadow:0 8px 32px rgba(0,0,0,.08)}.composer textarea{flex:1;min-height:42px;max-height:132px;padding:10px 0;border:0;outline:0;resize:none;color:var(--text);font-size:15px;line-height:1.45}.composer textarea::placeholder{color:#b0b8c1}.composer textarea:disabled{background:transparent;color:#8b95a1;cursor:not-allowed}.composer button{flex:0 0 42px;width:42px;height:42px;border-radius:14px;border:0;background:var(--accent);display:grid;place-items:center;cursor:pointer}.composer button:disabled{opacity:.45;cursor:not-allowed}.composer svg{width:22px;height:22px;fill:none;stroke:#fff;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}.composer>p{margin:8px 4px 0;text-align:center;color:#b0b8c1;font-size:10px}.footer{margin-top:auto;text-align:center;padding:32px 0 8px;color:#b0b8c1;font-size:12px}.footer a{color:inherit;text-decoration:none;font-weight:700}.footer a:hover{color:#6b7684}.chat-footer{padding-top:48px}.modal{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:20px}.modal[hidden]{display:none}.modal-backdrop{position:absolute;inset:0;width:100%;height:100%;border:0;background:rgba(25,31,40,.42);backdrop-filter:blur(4px);cursor:default}.modal-card{position:relative;width:min(100%,360px);padding:26px;background:#fff;border-radius:24px;box-shadow:0 20px 60px rgba(0,0,0,.18);text-align:center;animation:modal-in .18s ease-out}.modal-icon{display:grid;place-items:center;width:44px;height:44px;margin:0 auto 14px;border-radius:15px;background:var(--accent-soft);color:var(--accent);font-size:20px;font-weight:900}.modal-card h2{margin:0;font-size:20px;letter-spacing:-.035em}.modal-card p{margin:10px 0 22px;color:var(--muted);font-size:14px;line-height:1.6;white-space:pre-wrap;word-break:keep-all}.modal-actions{display:flex;gap:8px}.modal-button{flex:1;height:48px;border:0;border-radius:14px;font-size:14px;font-weight:750;cursor:pointer}.modal-button.primary{background:var(--accent);color:#fff}.modal-button.secondary{background:#f2f4f6;color:#4e5968}.modal-button:active{transform:scale(.985)}.modal-open{overflow:hidden}@keyframes modal-in{from{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:none}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes typing{0%,60%,100%{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}
@media(max-width:560px){.app-shell{padding:0 16px 24px}.topbar{height:64px}.start-hero{padding:36px 4px 24px}.start-hero>p:last-child{font-size:15px}.panel{padding:22px;border-radius:22px}.chat-topbar{height:68px;padding-left:16px;padding-right:10px}.header-actions button{font-size:11px;padding:8px 6px}.conversation-wrap{padding:34px 16px 158px}.bubble{max-width:86%;font-size:14px}.model-message{max-width:calc(86% - 43px)}.composer{padding-left:12px;padding-right:12px}.status-pill{font-size:11px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;animation-duration:.01ms!important;transition-duration:.01ms!important}}


.companion-picker{display:grid;gap:12px}.companion-option{display:block;cursor:pointer}.companion-option input{position:absolute;opacity:0;pointer-events:none}.companion-option-body{display:flex;align-items:center;gap:14px;padding:14px;border:1px solid #e5e8eb;border-radius:18px;background:#fff;transition:border-color .2s ease,box-shadow .2s ease,transform .2s ease}.companion-option:hover .companion-option-body{transform:translateY(-1px);box-shadow:0 8px 24px rgba(0,0,0,.05)}.companion-option input:checked+.companion-option-body{border-color:#ff75a6;box-shadow:0 0 0 4px rgba(255,117,166,.14)}.companion-option-avatar{width:72px;height:72px;border-radius:20px;object-fit:cover;flex:0 0 72px;background:#f2f4f6}.companion-option-meta{display:grid;gap:4px;min-width:0}.companion-option-meta strong{font-size:17px;line-height:1.2}.companion-option-meta em{font-style:normal;color:#8b95a1;font-size:13px}.companion-option-meta small{color:#4e5968;font-size:13px;line-height:1.45}
@media(max-width:560px){.companion-option-body{align-items:flex-start}.companion-option-avatar{width:64px;height:64px;border-radius:18px}.companion-option-meta strong{font-size:16px}}
.companion-traits{display:flex;flex-wrap:wrap;gap:5px;margin-top:3px}.companion-traits b{font-size:10px;font-weight:750;color:#e64980;background:#fff0f6;border-radius:999px;padding:4px 7px}


/* Character picker + profile detail */
.companion-option{display:grid;gap:8px}.companion-option>label{display:block;cursor:pointer}.companion-option>label input{position:absolute;opacity:0;pointer-events:none}.companion-option>label input:checked+.companion-option-body{border-color:#ff75a6;box-shadow:0 0 0 4px rgba(255,117,166,.14)}.companion-detail-button{justify-self:end;border:0;background:transparent;color:#8b95a1;font-size:12px;font-weight:750;padding:4px 6px;cursor:pointer;border-radius:8px}.companion-detail-button:hover{color:var(--accent);background:var(--accent-soft)}
.profile-modal{position:fixed;inset:0;z-index:120;display:grid;place-items:center;padding:20px}.profile-modal[hidden]{display:none}.profile-modal-backdrop{position:absolute;inset:0;width:100%;height:100%;border:0;background:rgba(25,31,40,.52);backdrop-filter:blur(6px)}.profile-detail-card{position:relative;width:min(100%,430px);max-height:min(760px,calc(100dvh - 40px));overflow:auto;background:#fff;border-radius:28px;box-shadow:0 28px 80px rgba(0,0,0,.2);animation:modal-in .2s ease-out}.profile-detail-close{position:absolute;right:14px;top:14px;z-index:2;width:36px;height:36px;border:0;border-radius:50%;background:rgba(255,255,255,.92);color:#4e5968;font-size:25px;line-height:1;cursor:pointer;box-shadow:0 4px 16px rgba(0,0,0,.08)}.profile-detail-cover{height:280px;background:#f2f4f6;overflow:hidden}.profile-detail-cover img{width:100%;height:100%;object-fit:cover;display:block}.profile-detail-content{padding:24px;display:grid;gap:17px}.profile-detail-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}.profile-detail-heading h2{margin:0;font-size:26px;letter-spacing:-.04em}.profile-detail-heading p{margin:6px 0 0;color:#6b7684;font-size:13px;line-height:1.5}.profile-status{flex:0 0 auto;display:inline-flex;align-items:center;gap:6px;padding:7px 9px;border-radius:999px;background:#f2f4f6;color:#6b7684;font-size:11px;font-weight:750}.profile-status i{width:7px;height:7px;border-radius:50%;background:#f59f00}.profile-status[data-state=ready] i{background:#20c997}.profile-status[data-state=offline] i{background:#fa5252}.profile-facts{display:grid;grid-template-columns:1fr 1fr;gap:8px}.profile-facts span{display:grid;gap:5px;padding:12px 14px;border-radius:14px;background:#f7f8fa}.profile-facts b{color:#8b95a1;font-size:11px}.profile-facts em{font-style:normal;color:#333d4b;font-size:14px;font-weight:750}.profile-detail-summary{margin:0;font-size:15px;font-weight:750;color:#333d4b}.profile-detail-about{margin:0;color:#6b7684;font-size:14px;line-height:1.7}.profile-detail-section{display:grid;gap:9px}.profile-detail-section[hidden]{display:none}.profile-detail-section h3{margin:0;font-size:12px;color:#8b95a1}.profile-chip-list{display:flex;flex-wrap:wrap;gap:7px}.profile-chip-list span{padding:7px 10px;border-radius:999px;background:#fff0f6;color:#e64980;font-size:12px;font-weight:700}.profile-select-button{height:50px;border:0;border-radius:15px;background:var(--accent);color:#fff;font-size:14px;font-weight:800;cursor:pointer}.profile-select-button:disabled{background:#e8ebed;color:#8b95a1;cursor:default}.profile-open{overflow:hidden}
@media(max-width:560px){.profile-modal{padding:12px}.profile-detail-card{max-height:calc(100dvh - 24px);border-radius:24px}.profile-detail-cover{height:240px}.profile-detail-content{padding:20px}.profile-detail-heading h2{font-size:23px}}

/* Character picker: 상세보기 버튼을 프로필 카드 내부에 배치 */
.companion-option{display:block;cursor:default}
.companion-option>input{position:absolute;opacity:0;pointer-events:none}
.companion-option-body{display:grid;gap:10px;padding:14px;border:1px solid #e5e8eb;border-radius:18px;background:#fff;transition:border-color .2s ease,box-shadow .2s ease,transform .2s ease}
.companion-option:hover .companion-option-body{transform:translateY(-1px);box-shadow:0 8px 24px rgba(0,0,0,.05)}
.companion-option>input:checked+.companion-option-body{border-color:#ff75a6;box-shadow:0 0 0 4px rgba(255,117,166,.14)}
.companion-option-main{display:flex;align-items:center;gap:14px;cursor:pointer}
.companion-detail-button{width:100%;display:flex;align-items:center;justify-content:space-between;border:0;border-top:1px solid #f0f1f3;background:transparent;color:#6b7684;font-size:12px;font-weight:750;padding:10px 2px 0;cursor:pointer;border-radius:0}
.companion-detail-button span{font-size:18px;line-height:1;color:#b0b8c1}
.companion-detail-button:hover{color:var(--accent);background:transparent}
.companion-detail-button:hover span{color:var(--accent)}
@media(max-width:560px){.companion-option-main{align-items:flex-start}}
