@font-face { font-family: "LCTitle"; src: url("fonts/GmarketSansBold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #E9E0D4;          /* 로어코어 베이지(로고 아이콘 바탕) */
  --cell: #F4EEE6;        /* 그룹 셀, 시트 */
  --cell-2: #DDD2C4;      /* 눌림, 보조 면 */
  --ink: #1A1714;         /* 로고 잉크 = 유일한 강조색 */
  --on-ink: #F4EEE6;
  --label: #1A1714;
  --label-2: rgba(26, 23, 20, .62);
  --label-3: rgba(26, 23, 20, .36);
  --sep: rgba(26, 23, 20, .13);
  --bubble: #F4EEE6;
  --r: 14px;
  --title: "LCTitle", -apple-system, "Apple SD Gothic Neo", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  --tabh: 50px;
  --sb: env(safe-area-inset-bottom, 0px);
  --st: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12100E; --cell: #1F1C19; --cell-2: #2B2723; --ink: #E9E0D4; --on-ink: #1A1714;
    --label: #EFE7DC; --label-2: rgba(239, 231, 220, .62); --label-3: rgba(239, 231, 220, .34); --sep: rgba(239, 231, 220, .12); --bubble: #24211D;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--label); font-family: var(--body); font-size: 17px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }

/* 셸: 모바일은 앱 하나, 넓은 화면은 왼쪽 브랜드 + 오른쪽 앱 */
.shell { min-height: 100%; }
.brand { display: none; }
.app { position: relative; min-height: 100dvh; max-width: 480px; margin: 0 auto; background: var(--bg); }
@media (min-width: 980px) {
  .shell { display: grid; grid-template-columns: 1fr 430px; height: 100dvh; overflow: hidden; }
  .brand { display: block; position: relative; overflow: hidden; }
  .brand-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
  .brand::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(233,224,212,.0) 40%, rgba(233,224,212,.92) 100%); }
  .brand-copy { position: absolute; z-index: 1; left: 56px; bottom: 56px; max-width: 460px; color: #1A1714; background: rgba(233,224,212,.86); padding: 28px 30px; border-radius: var(--r); backdrop-filter: blur(12px); }
  .brand-logo { width: 150px; margin-bottom: 22px; }
  .brand-title { font-family: var(--title); font-size: 40px; line-height: 1.12; letter-spacing: -.5px; margin: 0 0 14px; }
  .brand-sub { margin: 0; color: rgba(26,23,20,.7); font-size: 17px; }
  .brand-model { margin: 18px 0 0; font-size: 13px; color: rgba(26,23,20,.55); }
  .shell > * { min-width: 0; }
  .app { margin: 0; width: 100%; max-width: none; height: 100dvh; overflow-y: auto; min-height: 0; border-left: 1px solid var(--sep); }
}

/* 공통 타이포 */
.t-large { font-family: var(--title); font-size: 32px; line-height: 1.15; letter-spacing: -.6px; margin: 0; }
.t-title2 { font-family: var(--title); font-size: 22px; line-height: 1.25; letter-spacing: -.3px; margin: 0; }
.t-head { font-weight: 600; font-size: 17px; }
.t-sub { font-size: 15px; color: var(--label-2); }
.t-foot { font-size: 13px; color: var(--label-2); }
.t-cap { font-size: 12px; color: var(--label-2); }

/* 내비 바 */
.nav { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: calc(var(--st) + 6px) 12px 6px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px); }
.nav .logo { height: 24px; width: auto; margin-left: 4px; }
.nav .spacer { flex: 1; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--label); }
.icon-btn:active { background: var(--cell-2); }
.icon-btn svg { width: 22px; height: 22px; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.back { color: var(--ink); display: flex; align-items: center; gap: 2px; height: 44px; padding: 0 8px 0 2px; font-size: 17px; }
.back svg { width: 22px; height: 22px; }

.page { padding: 4px 16px calc(var(--tabh) + var(--sb) + 24px); }
.large-head { padding: 6px 4px 14px; }

/* 탭 바 */
.tabbar { position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(3, 1fr); height: calc(var(--tabh) + var(--sb)); padding-bottom: var(--sb); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px); border-top: .5px solid var(--sep); max-width: 480px; margin: 0 auto; }
@media (min-width: 980px) { .tabbar { left: auto; right: 0; width: 430px; max-width: none; margin: 0; border-left: 1px solid var(--sep); } }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; font-weight: 500; color: var(--label-3); min-height: 44px; }
.tab svg { width: 25px; height: 25px; }
.tab[aria-current="page"] { color: var(--label); }

/* 그룹 목록(인셋) */
.group { background: var(--cell); border-radius: var(--r); overflow: hidden; }
.group + .group { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 14px; width: 100%; text-align: left; position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: .5px solid var(--sep); }
button.row:active { background: var(--cell-2); }
.row .lbl { width: 54px; flex: none; font-size: 15px; color: var(--label-2); }
.row .val { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.row .val .ph { color: var(--label-3); }
.row .val .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .chev { width: 14px; height: 14px; color: var(--label-3); flex: none; }
.row input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; padding: 0; font-size: 17px; }
.row input::placeholder { color: var(--label-3); }
.thumb { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; flex: none; }
.avatar { border-radius: 50%; object-fit: cover; flex: none; }
.sec-h { margin: 22px 4px 8px; font-size: 13px; color: var(--label-2); }

/* 홈: 빈 방 */
.home { display: flex; flex-direction: column; min-height: 100dvh; }
@media (min-width: 980px) { .home { min-height: 100%; } }
.home-top { padding: 2px 16px 0; }
.stage { position: relative; margin: 14px 16px 0; border-radius: var(--r); overflow: hidden; aspect-ratio: 4 / 4.4; background: var(--cell-2); }
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; transition: filter .6s ease, opacity .6s ease, transform .6s ease; }
.stage[data-level="0"] img { filter: blur(22px) grayscale(.4); opacity: .55; transform: scale(1.12); }
.stage[data-level="1"] img { filter: blur(7px); opacity: .85; transform: scale(1.04); }
.stage[data-level="2"] img { filter: none; opacity: 1; transform: none; }
.stage .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 38%, rgba(18,16,14,.72) 100%); }
.stage[data-level="0"] .shade { background: linear-gradient(180deg, rgba(233,224,212,0) 30%, rgba(233,224,212,.55) 100%); }
@media (prefers-color-scheme: dark) { .stage[data-level="0"] .shade { background: linear-gradient(180deg, rgba(18,16,14,0) 30%, rgba(18,16,14,.7) 100%); } }
.stage .cap { position: absolute; left: 18px; right: 18px; bottom: 16px; color: #F4EEE6; }
.stage[data-level="0"] .cap { color: var(--label); }
.stage .cap .t-title2 { font-size: 24px; }
.stage .cap p { margin: 6px 0 0; font-size: 15px; opacity: .86; }
.stage .cursor { display: inline-block; width: 2px; height: 1.05em; background: currentColor; vertical-align: -2px; margin-left: 3px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.home-pick { margin: 12px 16px 0; }
.seeds { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px 2px; scrollbar-width: none; }
.seeds::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 14px; border-radius: 17px; border: .5px solid var(--sep); background: var(--cell); font-size: 15px; white-space: nowrap; }
.chip:active { background: var(--cell-2); }
.chip.sm { height: 24px; padding: 0 9px; border-radius: 12px; font-size: 12px; color: var(--label-2); background: transparent; }

/* 입력창 */
.composer { position: sticky; bottom: calc(var(--tabh) + var(--sb)); z-index: 4; display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 10px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.room .composer { bottom: 0; padding-bottom: calc(10px + var(--sb)); }
.field { flex: 1; display: flex; align-items: flex-end; min-height: 40px; border-radius: 20px; background: var(--cell); border: .5px solid var(--sep); padding: 0 4px 0 14px; }
.field textarea { flex: 1; border: 0; outline: 0; background: none; resize: none; padding: 9px 0; max-height: 132px; font-size: 17px; line-height: 1.3; }
.field textarea::placeholder { color: var(--label-3); }
.send { width: 32px; height: 32px; margin: 4px 0; border-radius: 50%; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; flex: none; transition: opacity .2s; }
.send:disabled { opacity: .25; }
.send svg { width: 18px; height: 18px; }
.mode { height: 40px; padding: 0 12px; border-radius: 20px; background: var(--cell); border: .5px solid var(--sep); font-size: 15px; font-weight: 600; flex: none; }
.mode[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: transparent; }

/* 버튼 */
.btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 50px; border-radius: var(--r); background: var(--ink); color: var(--on-ink); font-size: 17px; font-weight: 600; }
.btn:active, .send:active, .chip:active, .mode:active { transform: scale(.97); }
.btn.plain { background: var(--cell); color: var(--label); }
.link { color: var(--label); font-size: 15px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* 시트 */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.32); animation: fade .25s ease; }
.sheet { position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; max-height: 92dvh; display: flex; flex-direction: column; background: var(--bg); border-radius: var(--r) var(--r) 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.14); animation: up .3s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 980px) { .sheet { left: auto; right: 0; width: 430px; } }
.sheet .grab { width: 36px; height: 5px; border-radius: 3px; background: var(--label-3); margin: 6px auto 0; }
.sheet-head { display: flex; align-items: center; padding: 6px 8px 6px 20px; min-height: 52px; }
.sheet-head .t-head { flex: 1; font-size: 17px; }
.sheet-body { overflow-y: auto; padding: 0 16px calc(24px + var(--sb)); }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* 세그먼트 */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--cell-2); border-radius: 9px; padding: 2px; margin: 0 0 14px; }
.seg button { height: 30px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--label-2); }
.seg button[aria-pressed="true"] { background: var(--cell); color: var(--label); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* 로어북 줄 */
.book-row { align-items: flex-start; padding: 12px 14px; }
.book-row .cover { width: 56px; height: 74px; border-radius: 10px; object-fit: cover; flex: none; }
.book-row .empty-cover { width: 56px; height: 74px; border-radius: 10px; border: 1.5px dashed var(--label-3); flex: none; display: grid; place-items: center; font-family: var(--title); font-size: 13px; color: var(--label-3); }
.book-row .meta { flex: 1; min-width: 0; }
.book-row .meta .t-head { display: block; }
.book-row .meta .t-sub { display: block; margin-top: 2px; }
.book-row .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.book-row .rank { width: 18px; font-family: var(--title); font-size: 15px; color: var(--label-2); padding-top: 2px; flex: none; }
.check { width: 22px; height: 22px; color: var(--label); flex: none; align-self: center; }

/* 코어 그리드 */
.cores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.core-card { text-align: left; border-radius: var(--r); overflow: hidden; background: var(--cell); }
.core-card .pic { aspect-ratio: 3 / 4; width: 100%; object-fit: cover; object-position: 50% 20%; }
.core-card .empty-pic { aspect-ratio: 3 / 4; display: grid; place-items: center; border: 1.5px dashed var(--label-3); border-radius: var(--r) var(--r) 0 0; border-bottom: 0; font-family: var(--title); font-size: 28px; color: var(--label-3); }
.core-card .txt { padding: 10px 12px 12px; }
.core-card .t-head { display: block; font-size: 16px; }
.core-card .t-foot { display: block; margin-top: 2px; }
.core-card[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: -2px; }
.core-card:active { transform: scale(.98); }

/* 로어북 탭 */
.feature { position: relative; display: block; width: 100%; border-radius: var(--r); overflow: hidden; aspect-ratio: 4 / 4.6; text-align: left; }
.feature img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
.feature .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(18,16,14,.78) 100%); }
.feature .cap { position: absolute; left: 18px; right: 18px; bottom: 18px; color: #F4EEE6; }
.feature .cap .t-cap { color: rgba(244,238,230,.8); display: block; margin-bottom: 6px; }
.feature .cap p { margin: 6px 0 0; font-size: 15px; opacity: .88; }
.search { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: 10px; background: var(--cell-2); color: var(--label-2); margin: 0 0 16px; }
.search svg { width: 16px; height: 16px; }
.search input { border: 0; outline: 0; background: none; flex: 1; font-size: 17px; }

/* 로어북 상세 */
.hero { position: relative; margin: 0 -16px; aspect-ratio: 4 / 4.4; overflow: hidden; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
.hero .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, var(--bg) 100%); }
.book-head { margin-top: -54px; position: relative; padding: 0 4px; }
.book-head .quote { margin: 10px 0 0; font-size: 15px; color: var(--label-2); }
.hscroll { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll .core-card { width: 128px; flex: none; }
.kv .row { min-height: 44px; }
.kv .k { width: 64px; flex: none; font-size: 15px; color: var(--label-2); }
.kv .v { flex: 1; font-size: 15px; }
.kv .s { font-size: 12px; color: var(--label-3); flex: none; }
.kv .v.unset { color: var(--label-3); filter: blur(.4px); }

/* 내 이야기 */
.story-row .avatar { width: 48px; height: 48px; }
.story-row .meta { flex: 1; min-width: 0; }
.story-row .top { display: flex; gap: 8px; align-items: baseline; }
.story-row .top .t-head { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-row .prev { display: block; font-size: 15px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 48px 12px; text-align: left; }
.empty p { color: var(--label-2); margin: 8px 0 20px; }

/* 대화방 */
.room { display: flex; flex-direction: column; min-height: 100dvh; }
@media (min-width: 980px) { .room { min-height: 100%; } }
.room-nav .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.room-nav .who .avatar { width: 32px; height: 32px; }
.room-nav .who .nm { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.room-nav .who .rel { font-size: 12px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.who .empty-av { width: 32px; height: 32px; border-radius: 50%; border: 1.5px dashed var(--label-3); flex: none; }
.msgs { flex: 1; padding: 8px 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.scene-head { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 4px 0 14px; }
.scene-head img { width: 100%; aspect-ratio: 4/3; border-radius: var(--r); object-fit: cover; object-position: 50% 40%; }
.scene-head > span { padding: 0 2px; }
.scene-head .t-head { display: block; font-size: 15px; }
.msg { max-width: 84%; padding: 9px 13px; border-radius: var(--r); font-size: 16px; line-height: 1.45; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.msg.ai { align-self: flex-start; background: var(--bubble); }
.msg.me { align-self: flex-end; background: var(--ink); color: var(--on-ink); }
.msg .act { display: block; font-style: italic; color: var(--label-2); }
.msg.me .act { color: color-mix(in srgb, var(--on-ink) 72%, transparent); }
.msg .say + .act, .msg .act + .say, .msg .say + .say, .msg .act + .act { margin-top: 6px; }
.msg .say { display: block; }
.ai-tools { align-self: flex-start; display: flex; gap: 4px; margin: -2px 0 4px 2px; }
.ai-tools button { height: 32px; padding: 0 10px; border-radius: 16px; font-size: 13px; color: var(--label-2); display: flex; align-items: center; gap: 4px; }
.ai-tools button:active { background: var(--cell-2); }
.ai-tools svg { width: 15px; height: 15px; }
.typing { align-self: flex-start; display: flex; gap: 6px; align-items: center; padding: 0 2px; height: 20px; }
.typing .line { height: 12px; border-radius: 6px; background: var(--bubble); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.retry { align-self: flex-end; font-size: 13px; color: var(--label-2); text-decoration: underline; text-underline-offset: 3px; height: 32px; }
.null-wait { margin: auto 0; padding: 40px 6px; color: var(--label-3); font-family: var(--title); font-size: 22px; line-height: 1.3; }

/* 스플래시 */
.splash { position: fixed; inset: 0; z-index: 30; background: #1A1714; color: #F4EEE6; display: flex; flex-direction: column; justify-content: flex-end; max-width: 480px; margin: 0 auto; }
@media (min-width: 980px) { .splash { display: none; } }
.splash img.ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
.splash .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(26,23,20,0) 35%, rgba(26,23,20,.9) 82%); }
.splash .top { position: absolute; top: calc(var(--st) + 18px); left: 22px; }
.splash .top img { width: 112px; }
.splash .body { position: relative; padding: 0 22px calc(28px + var(--sb)); }
.splash .t-large { font-size: 36px; color: #F4EEE6; }
.splash p { margin: 12px 0 24px; font-size: 17px; color: rgba(244,238,230,.82); }
.splash .btn { background: #E9E0D4; color: #1A1714; }
.splash .model { display: block; margin-top: 14px; font-size: 12px; color: rgba(244,238,230,.55); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
