/* 루미나 대화방. 값은 승인된 시안(design/mockups/lumina-chat)에서 옮김. */
:root{
  /* 글꼴: 기본 둥근 고딕, 설정에서 바꿀 수 있음 */
  --ui-font:"Gowun Dodum","Malgun Gothic","Apple SD Gothic Neo",sans-serif;
  --bub-fs:14.5px; --read-fs:15.5px;
  /* 낮의 달 정원 (기본) */
  --room:#fee6bf;      /* 대화방 바닥 (그림 바탕과 같은 색) */
  --room-art:url(/img/bg-day-fit.jpg);
  --room-ink:#33261a;  /* 바닥 위 글자 */
  --room-sub:#6b5540;
  --room-line:#c9a56c;
  --paper:#fffaf0;     /* 루미나 말풍선·시트 */
  --bub-edge:#9a5a1e;  /* 말풍선 꼬리 테두리 (붓선 그림과 같은 색) */
  --me-tail:#f6cb72;
  --her-tail:#fbe6c2;
  --skin-her:url(/img/bub-paper-600.png);
  --skin-me:url(/img/bub-honey-600.png);
  --grain:url(/img/paper-tile.jpg); /* 올라오는 창·읽기·충전 화면의 종이 결 */
  --edge:#8a6a3c;      /* 버튼·입력창 테두리 */
  --ink:#33261a;
  --sub:#6b5540;
  --line:#e2d3b4;
  --accent:#f5cf6b;    /* 내 말풍선·주 버튼 */
  --accent-ink:#3a2a00;
  --night:#2a2f55;
  --warn:#9c2f1f;
  --r-ctl:999px;
}
:root[data-font=batang]{--ui-font:"Gowun Batang","Malgun Gothic",serif}
:root[data-font=story]{--ui-font:"Poor Story","Malgun Gothic",sans-serif;--bub-fs:16px;--read-fs:17px}
:root[data-theme=night]{
  /* 밤의 등불 */
  --room:#212540;
  --room-art:url(/img/bg-night-fit.jpg);
  --room-ink:#f4ead2;
  --room-sub:#c2bdd3;
  --room-line:#a88a45;
  --paper:#f8ecd0;
  /* 밤에는 테두리 없는 말풍선 */
  --bub-edge:transparent;
  --me-tail:#f6b941;
  --her-tail:#fbdba4;
  --skin-her:url(/img/bub-night-paper-600.png);
  --skin-me:url(/img/bub-night-gold-600.png);
  --edge:#c9a455;
  --line:#dccba4;
  --accent:#e3ac3c;
  --accent-ink:#2a1f00;
}
*{box-sizing:border-box;margin:0}
html,body{height:100%}
body{font-family:var(--ui-font);color:var(--ink);background:var(--room);line-height:1.55;font-size:15px;overflow:hidden;-webkit-text-size-adjust:100%}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid var(--night);outline-offset:2px}
:root[data-theme=night] .top button:focus-visible,:root[data-theme=night] .dock button:focus-visible{outline-color:var(--room-ink)}
[hidden]{display:none!important}

/* 화면 틀: 폰에서는 화면 전체, 넓은 화면에서는 가운데 한 줄 */
.app{height:100dvh;max-width:480px;margin:0 auto;background:var(--room);display:flex;flex-direction:column;position:relative;overflow:hidden}
@media (min-width:481px){
  body{background:color-mix(in srgb,var(--room) 82%,#000)}
  .app{border-inline:1px solid var(--room-line)}
}

/* 머리줄 */
.top{display:flex;align-items:center;gap:8px;padding:10px 14px;padding-top:max(10px,env(safe-area-inset-top));background:var(--room);color:var(--room-ink);border-bottom:1.5px solid var(--room-line);flex:none}
.top .face{width:44px;height:44px;border-radius:16px}
.top .name{font-weight:700;font-size:16px;flex:1;min-width:0}
.top .name small{display:block;font-weight:400;font-size:12px;color:var(--room-sub);line-height:1.2;white-space:nowrap;letter-spacing:-.02em}
.mode{width:44px;height:44px;display:grid;place-items:center;border:1.5px solid var(--edge);border-radius:50%;background:none;color:var(--room-ink);flex:none}
.mode:hover{border-color:var(--room-ink)}
.coin{display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 14px 0 10px;border:1.5px solid var(--edge);border-radius:var(--r-ctl);background:var(--paper);font-size:14px;font-weight:700;color:var(--ink);flex:none;white-space:nowrap}
.coin i{width:24px;height:24px;background:url(/img/coin-96.png) center/contain no-repeat;display:inline-block}
.coin.plain{padding:0 16px}
.coin:hover{border-color:var(--ink)}
.back{width:44px;height:44px;border:0;background:none;font-size:22px;color:var(--room-ink);border-radius:var(--r-ctl);flex:none}

/* 대화 */
.room{flex:1;min-height:0;position:relative;isolation:isolate}
/* 같은 그림을 위·아래에 한 번씩 붙여, 화면 높이가 달라져도 위의 달과 아래 풍경이 모두 보이게 함 */
.room::before,.room::after{content:"";position:absolute;inset:0;z-index:-1;background:var(--room-art) top center/100% auto no-repeat}
.room::after{background-position:bottom center;-webkit-mask-image:linear-gradient(transparent 30%,#000 55%);mask-image:linear-gradient(transparent 30%,#000 55%)}
.talk{height:100%;overflow-y:auto;overscroll-behavior:contain;padding:16px 14px;display:flex;flex-direction:column;gap:16px}
.day{align-self:center;font-size:12px;color:var(--room-sub)}
.row{display:flex;gap:8px;align-items:flex-start}
.row.me{flex-direction:row-reverse}
.face{width:52px;height:52px;border-radius:18px;border:1.5px solid var(--edge);background:var(--night) url(/img/lumina.jpg) center/cover;flex:none}
.who{font-size:12px;color:var(--room-sub);margin-bottom:3px}
.col{max-width:min(74%,330px);min-width:0}
.col.wide{max-width:min(82%,360px)}
.bub{--skin:var(--skin-her);--bg:var(--her-tail);position:relative;isolation:isolate;padding:13px 17px;font-size:var(--bub-fs);color:var(--ink);word-break:keep-all;overflow-wrap:anywhere}
/* 붓으로 그린 종이 그림 한 장을 모서리·변·가운데로 나눠 늘려 붙임: 글 길이가 달라져도 붓선과 종이 결이 유지됨 */
.bub::before{content:"";position:absolute;inset:0;z-index:-1;border:1px solid transparent;border-image:var(--skin) 130 fill / 42px stretch}
.bub::after{content:"";position:absolute;z-index:-1;top:18px;left:-5px;width:12px;height:12px;background:var(--bg);border-left:1.5px solid var(--bub-edge);border-bottom:1.5px solid var(--bub-edge);transform:rotate(45deg);border-radius:0 0 0 3px}
.me .bub{--skin:var(--skin-me);--bg:var(--me-tail);color:var(--accent-ink);white-space:pre-wrap}
.me .bub::after{left:auto;right:-5px;border-left:0;border-bottom:0;border-right:1.5px solid var(--bub-edge);border-top:1.5px solid var(--bub-edge);border-radius:0 3px 0 0}
.bub p{white-space:pre-wrap}
.bub p+p,.bub .bars+p{margin-top:8px}
.meta{font-size:12px;color:var(--room-sub);margin-top:3px}
.me .meta{text-align:right}
/* 배경 그림 위에서도 작은 글자가 읽히게 바탕색 번짐을 깔아 줌 */
.meta,.who,.day{text-shadow:0 0 3px var(--room),0 0 6px var(--room),0 0 9px var(--room)}
.more{display:flex;justify-content:space-between;align-items:center;width:100%;min-height:44px;margin-top:8px;padding:0;border:0;border-top:1px solid var(--line);background:none;font-size:14px;color:var(--sub)}
.more:hover{color:var(--ink)}
/* 답을 쓰는 중 */
.dots{display:inline-flex;gap:5px;padding:5px 2px}
.dots i{width:7px;height:7px;border-radius:50%;background:var(--sub);animation:dot 1.2s infinite ease-in-out}
.dots i:nth-child(2){animation-delay:.15s}
.dots i:nth-child(3){animation-delay:.3s}
@keyframes dot{0%,60%,100%{opacity:.25}30%{opacity:1}}
@media (prefers-reduced-motion:reduce){.dots i{animation:none;opacity:.6}}

/* 비율 막대: 답변 속 숫자를 그대로 그림으로 */
.bars{margin:10px 0 2px;display:grid;gap:6px}
.bar{display:grid;grid-template-columns:76px 1fr 38px;align-items:center;gap:8px;font-size:13px}
.bar span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bar span:last-child{text-align:right;font-variant-numeric:tabular-nums;font-weight:700}
.bar u{display:block;height:13px;border-radius:7px;border:1.5px solid #8a6a3c;background:#fffaf0;position:relative;overflow:hidden;text-decoration:none}
.bar u::after{content:"";position:absolute;inset:0 auto 0 0;width:var(--v);border-radius:0 6px 6px 0;background:#f2c14e}
.bar.top1 u::after{background:#e39a1c}

/* 입력 */
.dock{background:var(--room);padding:10px 14px 14px;padding-bottom:max(14px,env(safe-area-inset-bottom));flex:none}
.sum{display:flex;align-items:center;gap:5px;margin:0 0 8px 8px;font-size:13px;color:var(--room-sub)}
.sum i{width:18px;height:18px;background:url(/img/coin-96.png) center/contain no-repeat}
/* 기존 루미나 웹과 같은 한 줄 입력창: + (질문 도구) · 글 · 보내기 */
.write{display:flex;gap:4px;align-items:flex-end;min-height:58px;padding:6px 7px;border:1.5px solid var(--edge);border-radius:29px;background:var(--paper)}
.write:focus-within{border-color:var(--ink)}
.plus{width:44px;height:44px;border:0;border-radius:50%;background:none;color:var(--ink);font-size:26px;line-height:1;flex:none}
.plus:hover{background:#f3e7cc}
/* 16px 미만이면 아이폰이 입력할 때 화면을 확대함 */
.field{flex:1;min-width:0;align-self:center;padding:4px;border:0;background:none;resize:none;font-size:16px;line-height:1.4;max-height:112px;color:var(--ink);outline:none}
.field::placeholder{color:var(--sub);opacity:1}
.send{width:44px;height:44px;display:grid;place-items:center;border:1.5px solid #8a6a3c;border-radius:50%;background:var(--accent);color:var(--accent-ink);flex:none}
.send:hover{filter:brightness(.95)}
.send:disabled{opacity:.5;cursor:default;filter:none}
.send svg{width:20px;height:20px}

/* 올라오는 창 */
.dim{position:absolute;inset:0;background:rgba(31,27,22,.45);z-index:5}
.sheet{position:absolute;left:0;right:0;bottom:0;z-index:6;max-height:88%;overflow-y:auto;border-radius:20px 20px 0 0;padding:20px 16px 16px;padding-bottom:max(16px,env(safe-area-inset-bottom));background:var(--paper) var(--grain) top center/100% auto repeat-y;color:var(--ink)}
.sheet h3{font-size:17px}
.sheet>p{font-size:14px;color:var(--sub);margin:4px 0 14px}
.tools h3{margin-bottom:14px}
.tools h4{font-size:13px;font-weight:400;color:var(--sub);margin:14px 0 8px}
.tools h4:first-of-type{margin-top:0}
.opts{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.opts.three{grid-template-columns:1fr 1fr 1fr}
.opts.three .opt{padding:8px 10px}
.opt{min-height:56px;padding:8px 14px;border:1.5px solid #c9b48a;border-radius:16px;background:none;text-align:left;color:var(--ink)}
.opt b{display:block;font-size:15px}
.opt small{display:block;font-size:12px;color:var(--sub)}
.opt:hover{border-color:#8a6a3c}
.opt[aria-pressed=true]{background:var(--accent);border-color:#8a6a3c;color:var(--accent-ink)}
.opt[aria-pressed=true] small{color:var(--accent-ink)}
.linkrow{display:flex;justify-content:space-between;align-items:center;width:100%;min-height:52px;padding:0 4px;border:0;border-top:1px solid var(--line);background:none;font-size:15px;color:var(--ink);text-align:left}
.linkrow:first-of-type{margin-top:14px}
.linkrow.quiet{font-size:13px;color:var(--sub);min-height:44px}
.keep{background:#f3dcae;border-radius:16px;padding:10px 12px;font-size:14px;margin-bottom:14px;white-space:pre-wrap;overflow-wrap:anywhere}
.keep small{display:block;font-size:12px;color:var(--sub)}
.acts{display:flex;gap:8px;padding:10px;border-top:1px solid var(--line);background:var(--paper) var(--grain) top center/100% auto repeat-y;flex:none}
.sheet .acts{background:none;padding:0;border:0}
.btn{flex:1;min-height:46px;padding:0 14px;border-radius:var(--r-ctl);border:1.5px solid #8a6a3c;background:none;font-size:14.5px;color:var(--ink)}
.btn:hover{border-color:var(--ink)}
.btn.main{background:var(--accent);color:var(--accent-ink);font-weight:700}
.btn:disabled{opacity:.55;cursor:default}
.stack{display:grid;gap:8px}
.stack .btn{width:100%}
a.btn{display:flex;align-items:center;justify-content:center;text-decoration:none}
.btn.kakao{background:#fee500;border-color:#d9c400;color:#191600;font-weight:700}
.err{font-size:13px;color:var(--warn);margin-top:8px}

/* 전체보기 · 충전 · 인물 정보: 종이 위의 읽는 화면 */
.read,.shop,.people{flex:1;min-height:0;overflow-y:auto;background:var(--paper) var(--grain) top center/100% auto repeat-y;color:var(--ink)}
.read{padding:18px 20px 28px}
.read h2{font-size:19px;line-height:1.35;letter-spacing:-.01em;margin-bottom:4px;word-break:keep-all;overflow-wrap:anywhere}
.read .q{font-size:13px;color:var(--sub);margin-bottom:14px}
.read p{font-size:var(--read-fs);line-height:1.75;margin-top:12px;word-break:keep-all;overflow-wrap:anywhere;white-space:pre-wrap}
.read .bars{margin:14px 0}
.empty{padding:40px 20px;text-align:center;color:var(--sub);font-size:14px}

.shop{padding:16px}
.have{display:flex;justify-content:space-between;align-items:baseline;padding-bottom:14px;border-bottom:1px solid var(--line)}
.have b{font-size:26px;font-variant-numeric:tabular-nums}
.have span{font-size:14px;color:var(--sub)}
.pack{display:grid;grid-template-columns:1fr auto;align-items:center;width:100%;min-height:64px;padding:10px 0;border:0;border-bottom:1px solid var(--line);background:none;text-align:left;color:var(--ink)}
.pack:hover{background:rgba(138,106,60,.08)}
.pack strong{font-size:16px}
.pack small{display:block;font-size:13px;color:var(--sub)}
.pack em{font-style:normal;font-weight:700;font-variant-numeric:tabular-nums;padding:8px 14px;border:1.5px solid #8a6a3c;border-radius:var(--r-ctl)}
.pack.pick em{background:var(--accent);color:var(--accent-ink)}
.pack:disabled{opacity:.55;cursor:default}
.shop h4{font-size:13px;font-weight:400;color:var(--sub);margin:18px 0 8px}
.rule{font-size:13px;color:var(--sub);margin-top:14px}
.rule li{margin-left:16px}
.paid{display:grid;grid-template-columns:1fr auto;align-items:center;gap:8px;padding:10px 0;border-bottom:1px solid var(--line);font-size:14px}
.paid small{display:block;font-size:12px;color:var(--sub)}
.small{min-height:44px;padding:0 14px;border:1.5px solid #b8975e;border-radius:var(--r-ctl);background:none;font-size:13px;color:var(--ink)}
.small:hover{border-color:#8a6a3c}

/* 생일 입력: 대화 속(시안 E)과 인물 정보 창이 같은 칸을 씀 */
.form{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px}
.form label{display:block;font-size:12px;color:var(--sub);min-width:0}
.form .wide{grid-column:1/-1}
.form input:not([type=checkbox]),.form select{display:block;width:100%;min-width:0;min-height:44px;margin-top:3px;padding:0 10px;border:1.5px solid #b8975e;border-radius:12px;background:#fffaf0;font-size:16px;color:#33261a}
.form .chk{display:flex;align-items:center;gap:8px;min-height:44px;margin-top:19px;font-size:14px;color:var(--ink)}
.form .chk input{width:26px;height:26px;flex:none;accent-color:#8a6a3c}
.form .btn,.form .acts,.form .err{grid-column:1/-1}
.form .btn{margin-top:4px;flex:none}
.note{font-size:12px;color:var(--sub);margin-top:8px}

.people{padding:16px}
.people>p{font-size:13px;color:var(--sub);margin-bottom:12px}
.person{display:grid;grid-template-columns:44px 1fr auto;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid var(--line)}
.person .pic{width:44px;height:44px;border-radius:50%;border:1.5px solid #b8975e;background:#fffaf0;display:grid;place-items:center;font-weight:700;color:#8a6a3c}
.person b{font-size:15.5px}
.person em{font-style:normal;font-size:12px;padding:1px 8px;margin-left:6px;border-radius:999px;background:#f3dcae;color:#5a3d00}
.person small{display:block;font-size:13px;color:var(--sub)}
.edit{min-width:56px;min-height:44px;border:1.5px solid #b8975e;border-radius:999px;background:none;font-size:13px;color:var(--ink)}
.edit:hover{border-color:#8a6a3c}
.add{width:100%;min-height:48px;margin-top:14px;border:1.5px dashed #8a6a3c;border-radius:999px;background:none;font-size:14.5px;color:var(--ink)}
.add:hover{background:#f3dcae}
