/* Readable type scale for the main app (senior-first).
   Tailwind's arbitrary small sizes are raised to a legible floor, and the
   accessibility "글씨 크기" setting (html[data-wb-font]) scales the whole app,
   not only chat bubbles. Loaded after every other stylesheet. */
.text-\[9px\],.text-\[10px\],.text-\[9\.5px\],.text-\[10\.5px\]{font-size:12.5px}
.text-\[11px\],.text-\[11\.5px\]{font-size:13.5px}
.text-\[12px\],.text-\[12\.5px\]{font-size:14.5px}
.text-\[13px\],.text-\[13\.5px\]{font-size:15px}
.text-\[14px\],.text-\[14\.5px\]{font-size:16px}
.text-\[15px\],.text-\[15\.5px\]{font-size:16.5px}
html[data-wb-font=large] .text-\[9px\],html[data-wb-font=large] .text-\[10px\],html[data-wb-font=large] .text-\[9\.5px\],html[data-wb-font=large] .text-\[10\.5px\]{font-size:14px}
html[data-wb-font=large] .text-\[11px\],html[data-wb-font=large] .text-\[11\.5px\]{font-size:15px}
html[data-wb-font=large] .text-\[12px\],html[data-wb-font=large] .text-\[12\.5px\]{font-size:16px}
html[data-wb-font=large] .text-\[13px\],html[data-wb-font=large] .text-\[13\.5px\]{font-size:16.5px}
html[data-wb-font=large] .text-\[14px\],html[data-wb-font=large] .text-\[16px\],html[data-wb-font=large] .text-\[14\.5px\]{font-size:17.5px}
html[data-wb-font=large] .text-\[15px\],html[data-wb-font=large] .text-\[15\.5px\],html[data-wb-font=large] .text-\[16\.5px\]{font-size:18px}
html[data-wb-font=large] .text-\[17px\]{font-size:18.5px}
html[data-wb-font=large] .text-\[18px\]{font-size:19.5px}
html[data-wb-font=large] .text-\[19px\]{font-size:20.5px}
html[data-wb-font=large] .text-\[20px\]{font-size:21.5px}
html[data-wb-font=xlarge] .text-\[9px\],html[data-wb-font=xlarge] .text-\[10px\],html[data-wb-font=xlarge] .text-\[9\.5px\],html[data-wb-font=xlarge] .text-\[10\.5px\]{font-size:15.5px}
html[data-wb-font=xlarge] .text-\[11px\],html[data-wb-font=xlarge] .text-\[11\.5px\]{font-size:16.5px}
html[data-wb-font=xlarge] .text-\[12px\],html[data-wb-font=xlarge] .text-\[12\.5px\]{font-size:17.5px}
html[data-wb-font=xlarge] .text-\[13px\],html[data-wb-font=xlarge] .text-\[13\.5px\]{font-size:18px}
html[data-wb-font=xlarge] .text-\[14px\],html[data-wb-font=xlarge] .text-\[16px\],html[data-wb-font=xlarge] .text-\[14\.5px\]{font-size:19px}
html[data-wb-font=xlarge] .text-\[15px\],html[data-wb-font=xlarge] .text-\[15\.5px\],html[data-wb-font=xlarge] .text-\[16\.5px\]{font-size:19.5px}
html[data-wb-font=xlarge] .text-\[17px\]{font-size:20px}
html[data-wb-font=xlarge] .text-\[18px\]{font-size:21px}
html[data-wb-font=xlarge] .text-\[19px\]{font-size:22px}
html[data-wb-font=xlarge] .text-\[20px\]{font-size:23px}

/* Tailwind rem helpers used for a few labels. */
.text-xs{font-size:14px}.text-sm{font-size:15px}
html[data-wb-font=large] .text-xs{font-size:15.5px}html[data-wb-font=large] .text-sm{font-size:16.5px}
html[data-wb-font=xlarge] .text-xs{font-size:17px}html[data-wb-font=xlarge] .text-sm{font-size:18px}

/* Touch targets: at least 44px for small icon buttons. */
.room-card-delete{min-width:44px;min-height:44px;display:inline-flex;align-items:center;justify-content:center}
#btnCloseAiPolicy{width:44px;height:44px;font-size:18px}

/* Settings: section titles readable, collapsible rows easy to tap. */
#aiPolicyModal summary{min-height:44px;display:flex;align-items:center;gap:6px;cursor:pointer;font-size:16px;font-weight:700;color:#f1e6d6}
#aiPolicyModal #settingsDialogTitle{font-size:20px}
/* Keep the exit available while reading or using keyboard navigation. */
#aiPolicyModal>div{scroll-padding-top:68px}
#aiPolicyModal>div>div:has(>#settingsDialogTitle){
  position:sticky;top:0;z-index:1;background:#2b2520
}
html[data-wb-font=large] #aiPolicyModal :is(p,label,strong,a,summary,button){font-size:17.5px!important}
html[data-wb-font=xlarge] #aiPolicyModal :is(p,label,strong,a,summary,button){font-size:19px!important}


/* Text size picker shown at the top of settings. */
.ux-font-picker{padding:14px;border-radius:16px;background:#362f29;border:1px solid #4d4135}
.ux-font-picker h4{margin:0 0 4px;font-size:16px;font-weight:700;color:#fbf7f2}
.ux-font-picker p{margin:0 0 10px;font-size:14.5px;line-height:1.5;color:#d5c8b7}
.ux-font-options{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.ux-font-options button{min-height:56px;border-radius:12px;border:1.5px solid #5b4b3b;background:#2b2520;color:#f5e9d8;font-weight:700;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;line-height:1.1}
.ux-font-options button span{font-size:13px;font-weight:600;color:#cdbfae}
.ux-font-options button[aria-pressed=true]{border-color:#e5a93c;background:#4a3a25;color:#ffd58a;box-shadow:0 0 0 2px #e5a93c55}
.ux-font-options button[aria-pressed=true] span{color:#f3d9a8}
.ux-font-options button:focus-visible{outline:3px solid #e5a93c;outline-offset:2px}
.ux-font-options [data-font=normal] b{font-size:16px}.ux-font-options [data-font=large] b{font-size:20px}.ux-font-options [data-font=xlarge] b{font-size:24px}

/* Room list: name and time on the first line, the character's age·job on
   its own full line instead of being cut to "25세 · …". */
.room-card-meta{flex-wrap:wrap;row-gap:2px}
.room-card-name{margin-right:auto;min-width:0;overflow-wrap:anywhere}
.room-card-details{flex-basis:100%;min-width:0}
.room-card-avatar img{width:52px;height:52px}
@media(max-width:420px){
  html:is([data-wb-font=large],[data-wb-font=xlarge]) .room-list-card{padding:10px;gap:8px}
  html:is([data-wb-font=large],[data-wb-font=xlarge]) .room-card-open{gap:8px}
  html:is([data-wb-font=large],[data-wb-font=xlarge]) .room-card-avatar img{width:40px;height:40px}
  html:is([data-wb-font=large],[data-wb-font=xlarge]) .room-card-preview{
    display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;
    white-space:normal;overflow-wrap:anywhere
  }
}

/* Footer wallet stays on one line; the decorative tagline yields on small screens. */
#listFooterCreditText{white-space:nowrap}
#btnOpenPaymentListFooter{min-height:40px;white-space:nowrap}
@media (max-width:420px){
  #homeCreditFooter>div:last-child{display:none}
  /* The header room count repeats "내 대화 N" and collides with the header buttons. */
  #listTotalRoomsBadge{display:none}
}

/* Larger text: let the filter summary wrap instead of collapsing to an emoji. */
html:is([data-wb-font=large],[data-wb-font=xlarge]) div:has(>#listFilterSummaryText){white-space:normal;flex-wrap:wrap;overflow:visible}
html:is([data-wb-font=large],[data-wb-font=xlarge]) #listFilterSummaryText{white-space:normal;overflow:visible;text-overflow:clip;word-break:keep-all}

/* Chat header: age·job gets its own line rather than "25세…". */
#headerAgeJob{flex-basis:100%;white-space:normal;overflow:visible}

/* Larger text on phones: full-width message box, then gift and a wide send
   button underneath, so typed text stays readable. */
@media (max-width:420px){
  html:is([data-wb-font=large],[data-wb-font=xlarge]) #chatForm{flex-wrap:wrap}
  html:is([data-wb-font=large],[data-wb-font=xlarge]) #chatForm>.wb-input{order:-1;flex-basis:100%}
  html:is([data-wb-font=large],[data-wb-font=xlarge]) #btnSend{flex:1;flex-direction:row;gap:8px;height:48px}
  html:is([data-wb-font=large],[data-wb-font=xlarge]) #btnOpenGiftModal{height:48px;width:auto;padding:0 14px;flex-direction:row;gap:6px}
}

/* Larger text on phones: buttons on the first header row, the character's
   photo, name and age·job on a full-width second row. */
@media (max-width:420px){
  html:is([data-wb-font=large],[data-wb-font=xlarge]) header:has(#btnBackToChatList)>div:first-child{flex-wrap:wrap;row-gap:6px}
  html:is([data-wb-font=large],[data-wb-font=xlarge]) #headerInfoArea{order:3;flex-basis:100%}
}

/* Chat footer: two rows instead of three — wallet first, then help on the
   left and the phone-link action on the right. */
#viewChatRoom .chat-footer-meta{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"wallet wallet" "links account";gap:6px 10px;align-items:start}
#viewChatRoom .chat-footer-wallet{justify-content:space-between;flex-wrap:nowrap}
#viewChatRoom .chat-footer-account{justify-content:flex-end;align-self:center}
#viewChatRoom .chat-footer-links summary{min-height:40px;display:flex;align-items:center}
#viewChatRoom .chat-footer-links[open]{grid-column:1/-1}

/* The message box auto-sizes from a 43px base; give enlarged text room. */
html[data-wb-font=large] #chatInput{min-height:52px}
html[data-wb-font=xlarge] #chatInput{min-height:58px}

/* Larger text on phones: the time/report column moves under the bubble so the
   reply text gets the full width instead of a few characters per line. */
@media (max-width:420px){
  html:is([data-wb-font=large],[data-wb-font=xlarge]) .wb-message-line{flex-direction:column;align-items:flex-start;gap:4px}
  html:is([data-wb-font=large],[data-wb-font=xlarge]) .wb-message-side{flex-direction:row;align-items:center;gap:8px}
  html:is([data-wb-font=large],[data-wb-font=xlarge]) #viewChatRoom .max-w-\[82\%\]{max-width:92%}
}

/* Keep sending in the natural reading order. Native disclosure works with
   touch, a keyboard and screen readers without taking up message space. */
#viewChatRoom #btnHeaderNextMatch {
  color:#f4e8d9; background:#342d27; border-color:#776553; box-shadow:none;
}
#viewChatRoom #btnHeaderNextMatch span { display:inline; }
#viewChatRoom #btnSend { background:#e5a93c; color:#21170d; }
#viewChatRoom #sendHeartCost { font-size:14px; line-height:1.2; }
#chatContainer .chat-message-time { color:#bfb09f; font-size:14px; line-height:1.35; white-space:nowrap; }
html[data-wb-font=large] :is(#viewChatRoom #sendHeartCost,#chatContainer .chat-message-time) { font-size:16px; }
html[data-wb-font=xlarge] :is(#viewChatRoom #sendHeartCost,#chatContainer .chat-message-time) { font-size:17px; }
.room-actions { position:relative; flex:none; }
.room-actions summary {
  list-style:none; display:grid; place-items:center; width:46px; min-height:50px;
  border:1px solid #887463; border-radius:14px; background:#342d27; color:#fff5e9;
  cursor:pointer; font:500 25px/1 system-ui;
}
.room-actions summary::-webkit-details-marker { display:none; }
.room-actions :focus-visible { outline:3px solid #e5a93c; outline-offset:2px; }
.room-action-list {
  position:absolute; z-index:2; inset:auto auto calc(100% + 6px) 0; width:max-content;
  max-height:min(52dvh,16rem); overflow-y:auto; padding:4px; border-radius:14px;
  background:#302820; border:1px solid #8a7865; box-shadow:0 5px 18px #0005;
}
#viewChatRoom .room-action-list :is(a,button), #viewChatRoom .room-actions #btnOpenGiftModal {
  display:block; width:100%; min-height:48px; padding:10px 16px; text-align:left;
  font:inherit; font-size:1rem; background:transparent; color:#fff5e9; border:0; box-shadow:none;
}
#viewChatRoom .room-actions #btnOpenGiftModal:disabled { opacity:.5; }
#chatForm .wb-input { min-width:0; }
@media (max-width:420px) {
  #chatForm .room-actions { grid-row:2; grid-column:1; justify-self:start; }
}

#viewChatRoom { max-height:var(--room-visible-height,100%); }
html[data-wb-font=large] #viewChatRoom { --room-action-type:18px; }
html[data-wb-font=xlarge] #viewChatRoom { --room-action-type:20px; }
#viewChatRoom #btnSend, #viewChatRoom .room-action-list :is(a,button) {
  font-size:var(--room-action-type,16px);
}

/* Reserve space for the message history when the keyboard leaves a short
   viewport. The original wallet and account buttons move into the + menu. */
#viewChatRoom.compact-chat > header { padding:4px 8px; }
#viewChatRoom.compact-chat > header > div:first-child { display:flex; flex-wrap:nowrap; gap:6px; }
#viewChatRoom.compact-chat #headerInfoArea { order:0; flex:1 1 0; min-width:0; }
.compact-chat #headerInfoArea > div:first-child,
.compact-chat #headerAgeJob, .compact-chat #headerStatusText { display:none; }
#viewChatRoom.compact-chat #chatContainer { padding-block:6px; min-height:0; }
#viewChatRoom.compact-chat > footer { padding:5px 8px; flex-shrink:0; overflow:visible; }
#viewChatRoom.compact-chat .wb-input { padding:2px 6px; min-height:44px; }
#viewChatRoom.compact-chat #chatInput { max-height:2.8em; }
#viewChatRoom.compact-chat #chatForm { gap:4px 8px; }
#viewChatRoom.compact-chat #btnSend, .compact-chat .room-actions summary { min-height:44px; height:44px; }
#viewChatRoom.compact-chat .chat-footer-meta { display:block; padding:0; margin:0; color:#f5e9db; }
#viewChatRoom.compact-chat .chat-footer-wallet { flex-direction:column; align-items:stretch; gap:0; }
#viewChatRoom.compact-chat .chat-footer-wallet span { padding:8px 16px 0; font-size:var(--room-action-type,16px); }
#viewChatRoom.compact-chat .chat-footer-links { display:none; }
#viewChatRoom.compact-chat .room-action-list {
  max-width:100cqw;
  max-height:min(var(--room-menu-height,45dvh), 17rem);
  overflow-wrap:anywhere;
  overscroll-behavior:contain;
}
#viewChatRoom.compact-chat .composer-notices { max-height:88px; overflow-y:auto; overscroll-behavior:contain; }
/* Enlarging text can leave less room than the name and both navigation
   buttons need. Give the profile its own row instead of overlapping it. */
@container (max-width:240px) {
  #viewChatRoom.compact-chat > header > div:first-child {
    display:grid; grid-template-columns:minmax(0,1fr) auto; gap:2px 6px;
  }
  #viewChatRoom.compact-chat #headerInfoArea { grid-area:2 / 1 / auto / -1; }
  #viewChatRoom.compact-chat #headerInfoArea > div:nth-child(2) > div {
    display:flex; flex-wrap:nowrap;
  }
  #viewChatRoom.compact-chat #headerName { min-width:0; overflow:hidden; text-overflow:ellipsis; }
  #viewChatRoom.compact-chat #btnBackToChatList { grid-area:1 / 1; justify-self:start; }
  #viewChatRoom.compact-chat > header > div:first-child > div:last-child { grid-area:1 / 2; }
}
@container (max-width:275px) {
  #viewChatRoom.compact-chat:not(.dense-chat) #chatForm {
    display:grid; grid-template-columns:minmax(0,1fr) auto;
  }
  #viewChatRoom.compact-chat:not(.dense-chat) #chatForm>.wb-input { grid-area:1 / 1 / auto / -1; }
  #viewChatRoom.compact-chat:not(.dense-chat) #chatForm .room-actions { grid-area:2 / 1; justify-self:start; }
  #viewChatRoom.compact-chat:not(.dense-chat) #btnSend { grid-area:2 / 2; }
}
/* On the shortest visible viewports keep the main controls on one row.
   The footer remains fixed while notices can scroll within their own area. */
#viewChatRoom.dense-chat #chatForm {
  display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:end; gap:4px;
}
#viewChatRoom.dense-chat #chatForm .room-actions { grid-column:1; grid-row:1; }
#viewChatRoom.dense-chat #chatForm>.wb-input { grid-column:2; grid-row:1; order:0; }
#viewChatRoom.dense-chat #btnSend {
  grid-column:3; grid-row:1; min-width:58px; padding-inline:6px; flex-direction:column; gap:2px; line-height:1.05;
}
#viewChatRoom.dense-chat #sendHeartCost { line-height:1.05; }
/* Preserve one large line of text when the keyboard leaves little room.
   Longer drafts scroll within the input without covering the conversation. */
#viewChatRoom.short-chat #chatInput { min-height:44px; max-height:1.85em; }
#viewChatRoom.short-chat:not(.dense-chat) { overflow-y:auto; }
#viewChatRoom.short-chat:not(.dense-chat) > footer { padding-block:2px; }
#viewChatRoom.short-chat:not(.dense-chat) .wb-input { padding-block:0; }
#viewChatRoom.dense-chat .composer-notices { max-height:60px; overflow-y:auto; overscroll-behavior:contain; }
#viewChatRoom.dense-chat .composer-notices:has(#chatInputError[hidden]) { max-height:48px; }
#viewChatRoom.compact-chat #notificationPromptBannerRoom { display:none!important; }

#viewChatRoom > footer:has(#roomActions[open]) { z-index:45; }


.chat-latest-control { position:relative; flex:none; z-index:10; }
#btnChatLatest {
  position:absolute; right:12px; bottom:8px; min-height:44px; padding:0 14px;
  border:1px solid #bfa98c; border-radius:22px; background:#342d27; color:#fff5e9;
  font-size:16px; font-weight:700; box-shadow:0 2px 8px #211b1880;
}
html[data-wb-font=xlarge] #btnChatLatest { font-size:19px; }
#btnChatLatest:focus-visible { outline:3px solid #e5a93c; outline-offset:2px; }
