/* Arirang Talk (아리랑톡, formerly AriChat) — real-time messenger. Design system derived from the brand icon:
   golden yellow (#F5B921) on top fading into near-black (#0D0D0D) at the bottom, a white fox-eared
   speech bubble as the mark, rounded shapes, dark surfaces with gold accents. */
:root {
  color-scheme: dark;
  --primary: #F5B921;                 /* Arirang Talk gold */
  --primary-2: #FFCF4A;               /* lighter gold (gradient tops, hovers) */
  --primary-deep: #B8850F;            /* darker gold */
  --primary-soft: rgba(245,185,33,.16);
  --primary-ink: #1A1400;             /* text on gold */
  --ok: #3DDC84;                      /* online / success */
  --ok-soft: rgba(61,220,132,.16);
  --warn: #FFA65C;
  --ink: #F4F3EE;                     /* main text */
  --muted: #A3A39B;
  --meta: #8B8B85;
  --line: #2A2A2E;
  --bg: #121214;                      /* app background */
  --surface: #1B1B1F;                 /* bars, cards, sheets */
  --surface-2: #26262B;               /* inputs, pills, chips */
  --surface-3: #303036;
  --chat-bg: #141416;
  --bubble-other: #26262B;
  --bubble-mine: linear-gradient(180deg, #FFCF4A 0%, #F5B921 100%);
  --bubble-mine-ink: #1A1400;
  --badge: #F5B921;
  --danger: #FF5C5C;
  --send-bg: #F5B921;
  --brand-grad: linear-gradient(180deg, #F7BE2B 0%, #D99E16 34%, #4A3508 72%, #0D0D0D 100%);
  /* App screens: the same gold-above-black gradient, with the gold band sized to the header so content panels sit on the dark part. */
  --brand-grad-app: linear-gradient(180deg, #F7BE2B 0px, #F2B726 calc(130px + var(--safe-top)), #C48D12 calc(260px + var(--safe-top)), #5E4409 calc(430px + var(--safe-top)), #221B0B calc(600px + var(--safe-top)), #0D0D0D calc(780px + var(--safe-top))); /* longer gold band (user request) */
  --header-ink: #1A1400;              /* text and icons on the gold header band */
  --header-muted: rgba(26,20,0,.62);
  --panel: rgba(13,13,13,.76);        /* translucent dark content panels over the gradient */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0D0D0D; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", Roboto, sans-serif;
  color: var(--ink); font-size: 15px; line-height: 1.4; overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
ul { list-style: none; margin: 0; padding: 0; }
img { display: block; }
[hidden] { display: none !important; }
input::placeholder, textarea::placeholder { color: var(--meta); }
::selection { background: rgba(245,185,33,.35); }

#app {
  position: relative; margin: 0 auto; max-width: 520px; height: 100vh; height: 100dvh;
  background: var(--brand-grad-app) no-repeat, #0D0D0D; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 0 0 1px rgba(255,255,255,.06);
}
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ---------- avatars & badges ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex: none; font-size: 15px; text-shadow: 0 1px 1px rgba(0,0,0,.2); }
.avatar.lg { width: 50px; height: 50px; font-size: 18px; }
.avatar.xl { width: 64px; height: 64px; font-size: 24px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; background: var(--badge); color: var(--primary-ink); font-size: 11px; font-weight: 800; line-height: 1; }
.chip { font-size: 11px; color: var(--primary); background: var(--primary-soft); border-radius: 10px; padding: 2px 8px; font-weight: 600; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; object-fit: cover; box-shadow: 0 0 0 2px rgba(255,255,255,.7), 0 2px 6px rgba(0,0,0,.25); }

/* ---------- connection banner & toast ---------- */
.conn-banner { position: absolute; top: var(--safe-top); left: 0; right: 0; z-index: 50; padding: 6px 12px; font-size: 13px; text-align: center; color: var(--primary-ink); background: var(--primary); }
.conn-banner.closed { background: var(--danger); color: #fff; }
.conn-banner.version { background: var(--primary); }
.conn-banner button { margin-left: 6px; padding: 2px 8px; border-radius: 10px; background: rgba(0,0,0,.22); color: inherit; font-size: 12px; }
.toast { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 60; background: rgba(28,28,32,.96); color: var(--ink); padding: 9px 14px; border-radius: 20px; font-size: 13px; max-width: 86%; text-align: center; border: 1px solid rgba(245,185,33,.35); box-shadow: 0 6px 20px rgba(0,0,0,.4); }

/* ---------- screen 1: login (the brand gradient: gold above, black below) ---------- */
.login { background: var(--brand-grad); color: #fff; align-items: center; justify-content: center; padding: 24px; }
.login-box { width: 100%; max-width: 340px; text-align: center; }
.logo { margin-bottom: 30px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.logo img { width: auto; height: 156px; filter: drop-shadow(0 10px 22px rgba(0,0,0,.4)); } /* transparent fox mark + wordmark straight on the gradient (the rounded tile was removed on 2026-09-05) */
.wordmark { font-size: 34px; font-weight: 800; letter-spacing: 8px; padding-left: 8px; }
.tagline { font-size: 14px; color: rgba(255,255,255,.82); margin-top: -6px; font-weight: 600; }
.login input { width: 100%; height: 50px; padding: 0 16px; border: 1px solid rgba(255,255,255,.16); border-radius: 14px; background: rgba(0,0,0,.38); color: #fff; font-size: 16px; outline: none; backdrop-filter: blur(6px); }
.login input::placeholder { color: rgba(255,255,255,.5); }
.at-field { position: relative; }
.at-field .at { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 17px; font-weight: 700; color: rgba(255,255,255,.55); pointer-events: none; }
.at-field input { padding-left: 36px; }
.at-field input:not(:placeholder-shown) ~ .at, .at-field input:focus ~ .at { color: var(--primary-2); }
.login input:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(245,185,33,.28); background: rgba(0,0,0,.5); }
.login button { width: 100%; height: 50px; margin-top: 12px; border-radius: 14px; background: linear-gradient(180deg, var(--primary-2), var(--primary)); color: var(--primary-ink); font-size: 16px; font-weight: 800; box-shadow: 0 8px 20px rgba(245,185,33,.28); }
.login button:disabled { opacity: .7; cursor: default; }
.form-error { color: #FFB4B4; font-size: 13px; margin-top: 8px; text-align: left; }
.login-hint { font-size: 12px; color: rgba(255,255,255,.6); margin-top: 18px; }

/* ---------- screen 2: main ---------- */
.main { background: transparent; }
.panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 54px; padding: 0 12px 0 16px; padding-top: var(--safe-top); flex: none; background: transparent; color: var(--header-ink); }
.topbar .icon-btn { color: var(--header-ink); }
.topbar .icon-btn:active { background: rgba(0,0,0,.14); color: var(--header-ink); }
.topbar h1 { font-size: 21px; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 9px; letter-spacing: -.2px; }
.topbar-actions { display: flex; gap: 2px; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--ink); }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:active { background: var(--primary-soft); color: var(--primary); }
.search-row { padding: 0 12px 8px; }
.search-row input { box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.search-row input { width: 100%; height: 38px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--ink); outline: none; font-size: 14px; }
.list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.list.compact { max-height: 50vh; }
.empty { padding: 60px 24px; text-align: center; color: var(--muted); font-size: 14px; }
.section-title { padding: 12px 16px 4px; font-size: 12px; color: var(--muted); font-weight: 600; }

.room-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; cursor: pointer; }
.room-row:active { background: rgba(255,255,255,.06); }
.room-main { flex: 1; min-width: 0; }
.room-title { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.room-name { font-weight: 700; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-count { font-size: 12px; color: var(--muted); flex: none; }
.room-preview { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; white-space: pre-line; }
.room-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; min-width: 44px; }
.room-time { font-size: 11px; color: var(--meta); }

.friend-row { display: flex; align-items: center; gap: 12px; padding: 9px 16px; }
.friend-main { flex: 1; min-width: 0; }
.friend-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-status { font-size: 12px; color: var(--meta); margin-top: 1px; }
.friend-status.online { color: var(--ok); }
.friend-status.online::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 5px; vertical-align: 1px; box-shadow: 0 0 0 2px rgba(61,220,132,.25); }

.profile-card { display: flex; align-items: center; gap: 16px; padding: 18px 16px; border-bottom: 8px solid var(--surface); }
.profile-name { font-size: 18px; font-weight: 800; }
.text-btn { color: var(--primary); font-size: 13px; font-weight: 600; }
.menu li { border-bottom: 1px solid var(--line); }
.menu-btn { display: block; width: 100%; text-align: left; padding: 15px 16px; font-size: 15px; color: var(--ink); }
.menu-btn:active { background: rgba(255,255,255,.06); }
.menu-btn.danger { color: var(--danger); }
.menu-btn.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.menu-value { color: var(--muted); font-size: 14px; }
.menu-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; }
.menu-text { flex: 1; min-width: 0; font-size: 15px; }
.menu-caption { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.switch { position: relative; width: 48px; height: 28px; flex: none; border-radius: 14px; background: var(--surface-3); transition: background .15s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--primary); }
.switch[aria-checked="true"] .knob { transform: translateX(20px); background: #1A1400; }
.switch:disabled { opacity: .45; cursor: default; }
.lang-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 15px; cursor: pointer; }
.lang-row:active { background: rgba(255,255,255,.06); }
.lang-row.active { color: var(--primary); font-weight: 700; }
.lang-row .check { display: none; }
.lang-row.active .check { display: inline; }
.bubble.translated .tr-orig { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.msg.mine .bubble.translated .tr-orig { border-top-color: rgba(0,0,0,.15); color: rgba(26,20,0,.7); }
.bubble.translated .tr-label { display: inline-block; font-size: 10.5px; color: var(--primary); background: var(--primary-soft); border-radius: 6px; padding: 0 5px; margin-right: 5px; vertical-align: 1px; }
.about { text-align: center; color: var(--meta); font-size: 12px; margin-top: auto; padding: 16px; }

/* Bottom tab menu: every item in gold (user request); the active one is bright with a marker, the others softer gold. */
.tabbar { display: flex; flex: none; border-top: 1px solid rgba(245,185,33,.32); background: var(--surface); padding-bottom: var(--safe-bottom); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 6px; color: rgba(245,185,33,.6); font-size: 11px; font-weight: 600; position: relative; transition: color .15s; }
.tabbar button:active { color: var(--primary-2); }
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button.active { color: var(--primary); font-weight: 800; text-shadow: 0 0 12px rgba(245,185,33,.35); }
.tabbar button.active::after { content: ""; position: absolute; top: 0; width: 22px; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
.tab-icon { position: relative; display: inline-flex; }
.tab-badge { position: absolute; top: -6px; left: 16px; }

/* ---------- screen 3: chat ---------- */
.chat { background: transparent; }
.chat-header { display: flex; align-items: center; gap: 4px; height: 54px; padding: 0 8px; padding-top: var(--safe-top); flex: none; background: transparent; color: var(--header-ink); }
.chat-header .icon-btn { color: var(--header-ink); }
.chat-header .icon-btn:active { background: rgba(0,0,0,.14); color: var(--header-ink); }
.chat-heading { flex: 1; min-width: 0; padding-left: 2px; }
.chat-title-row { display: flex; align-items: baseline; gap: 6px; font-weight: 800; font-size: 17px; }
.chat-title-row #chat-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-count { font-size: 13px; color: var(--header-muted); font-weight: 500; }
.chat-subtitle { font-size: 12px; color: #1F5A34; font-weight: 600; min-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-body { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; background: var(--panel); border-radius: 22px 22px 0 0; overflow: hidden; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; position: relative; }
.chat-list { position: relative; padding: 8px 12px 10px; display: flex; flex-direction: column; }
.chat-loader, .chat-loading { text-align: center; font-size: 12px; color: var(--meta); padding: 10px; }
.chat-loading { padding-top: 40px; }

.date-sep { display: flex; align-items: center; gap: 10px; margin: 14px 4px 10px; color: var(--meta); font-size: 12px; }
.date-sep::before, .date-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sys { display: flex; justify-content: center; margin: 6px 0; }
.sys span { color: var(--meta); font-size: 12px; padding: 2px 12px; text-align: center; }

.msg { display: flex; gap: 8px; margin-top: 3px; }
.msg.first { margin-top: 12px; }
.msg.other { align-items: flex-end; }
.msg.other .avatar { width: 34px; height: 34px; font-size: 13px; align-self: flex-start; }
.msg.other:not(.first) .avatar { visibility: hidden; height: 0; }
.msg.other .body { flex: 1; min-width: 0; }
.msg.other .name { font-size: 12px; color: var(--muted); margin: 0 0 4px 4px; font-weight: 600; }
.msg.other:not(.first) .name { display: none; }
.msg.mine { justify-content: flex-end; }
.row { display: flex; align-items: flex-end; gap: 6px; max-width: 100%; min-width: 0; }
.bubble {
  max-width: min(72vw, 330px); padding: 9px 13px; border-radius: 18px; font-size: 14.5px; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
}
.msg.other .bubble { background: var(--bubble-other); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.msg.other.last .bubble { border-bottom-left-radius: 6px; }
.msg.mine .bubble { background: var(--bubble-mine); color: var(--bubble-mine-ink); box-shadow: 0 2px 10px rgba(245,185,33,.22); }
.msg.mine.last .bubble { border-bottom-right-radius: 6px; }
.bubble.emoji-only { background: transparent !important; box-shadow: none !important; font-size: 40px; line-height: 1.15; padding: 2px 4px; }
.bubble a { color: var(--primary); text-decoration: underline; }
.msg.mine .bubble a { color: #1A1400; }
.meta { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: none; font-size: 10.5px; color: var(--meta); line-height: 1.2; padding-bottom: 3px; }
.msg.mine .meta { align-items: flex-end; }
.meta .unread { min-height: 12px; color: var(--primary); font-weight: 700; }
.meta .unread:not(:empty) { background: var(--primary-soft); border-radius: 8px; padding: 1px 6px; font-size: 10px; }
.meta .read-label { display: none; color: var(--ok); font-weight: 600; }
.msg.mine.last.all-read .meta .read-label { display: inline; }
.msg:not(.last) .meta .time { display: none; }
.msg.pending .meta { color: var(--meta); }
.msg.pending .bubble { opacity: .75; }
.fail-btn { width: 18px; height: 18px; border-radius: 50%; background: var(--danger); color: #fff; font-weight: 800; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.msg .actions { width: 100%; display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; }
.msg .actions .err { color: var(--danger); }
.msg .actions button { padding: 3px 10px; border-radius: 12px; background: var(--surface-2); color: var(--ink); font-size: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.msg .actions button.danger { color: var(--danger); }
.msg.mine { flex-wrap: wrap; }

.new-pill { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 5; max-width: 86%; display: flex; gap: 6px; align-items: center; background: var(--primary); color: var(--primary-ink); border-radius: 20px; padding: 8px 14px; box-shadow: 0 4px 14px rgba(245,185,33,.35); font-size: 13px; }
.new-pill b { flex: none; color: var(--primary-ink); }
.new-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scroll-fab { position: absolute; right: 12px; bottom: 12px; z-index: 5; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-2); box-shadow: 0 2px 10px rgba(0,0,0,.4); display: inline-flex; align-items: center; justify-content: center; color: var(--primary); }
.scroll-fab svg { width: 22px; height: 22px; }

/* ---------- chat input bar ---------- */
.chat-input {
  position: relative; display: flex; align-items: flex-end; gap: 8px; flex: none;
  padding: 8px 10px; padding-bottom: calc(8px + var(--safe-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
}
.input-pill {
  flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 4px;
  background: var(--surface-2); border: 1.5px solid transparent; border-radius: 22px; padding: 3px 5px 3px 14px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.input-pill:focus-within { background: var(--surface-3); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(245,185,33,.18); }
.input-pill textarea {
  flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: transparent; color: var(--ink);
  padding: 8px 0; min-height: 37px; max-height: 120px; line-height: 1.4; font-size: 15px;
}
.input-pill textarea::placeholder { color: var(--meta); }
.emoji-toggle { width: 34px; height: 34px; flex: none; border-radius: 50%; color: var(--meta); display: inline-flex; align-items: center; justify-content: center; transition: color .15s, background .15s, transform .15s; }
.emoji-toggle svg { width: 24px; height: 24px; }
.emoji-toggle:active { transform: scale(.9); }
.emoji-toggle.open { color: var(--primary); background: var(--primary-soft); }
#btn-send {
  width: 40px; height: 40px; flex: none; border-radius: 50%; position: relative;
  background: var(--surface-2); color: var(--meta); display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, transform .12s, box-shadow .15s;
}
#btn-send:active { transform: scale(.92); }
#btn-send .ico-like { font-size: 20px; line-height: 1; transform: translateY(-1px); }
#btn-send .ico-plane { display: none; width: 22px; height: 22px; }
#btn-send.active { background: linear-gradient(180deg, var(--primary-2), var(--primary)); color: var(--primary-ink); box-shadow: 0 4px 12px rgba(245,185,33,.35); }
#btn-send.active .ico-like { display: none; }
#btn-send.active .ico-plane { display: block; }
#btn-send.pop { animation: pop .22s ease-out; }
#btn-send.sent .ico-plane { animation: fly .38s ease-in-out; }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes fly {
  0% { transform: translate(0,0); opacity: 1; }
  45% { transform: translate(14px,-14px); opacity: 0; }
  50% { transform: translate(-10px,10px); opacity: 0; }
  100% { transform: translate(0,0); opacity: 1; }
}
.chat-counter { position: absolute; right: 60px; top: -20px; font-size: 11px; color: var(--muted); background: var(--surface-2); padding: 2px 8px; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.chat-counter.over { color: var(--danger); font-weight: 700; }
.chat-hint { position: absolute; left: 50%; top: -30px; transform: translateX(-50%); font-size: 12px; color: var(--primary-ink); background: var(--primary); padding: 4px 12px; border-radius: 12px; box-shadow: 0 2px 8px rgba(245,185,33,.35); white-space: nowrap; animation: hint-in .2s ease-out; }
@keyframes hint-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- emoji panel (takes the keyboard's place) ---------- */
.emoji-panel { flex: none; height: 236px; display: flex; flex-direction: column; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); animation: panel-up .18s ease-out; }
@keyframes panel-up { from { transform: translateY(12px); opacity: .5; } to { transform: none; opacity: 1; } }
.emoji-tabs { display: flex; gap: 4px; padding: 8px 10px 0; flex: none; overflow-x: auto; }
.emoji-tabs button { flex: none; padding: 5px 11px; border-radius: 14px; font-size: 12.5px; color: var(--muted); }
.emoji-tabs button.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.emoji-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px 10px; align-content: start; }
.emoji-grid button { font-size: 25px; height: 42px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.emoji-grid button:active { background: var(--primary-soft); transform: scale(1.15); }
.emoji-empty { grid-column: 1 / -1; text-align: center; color: var(--meta); font-size: 13px; padding: 40px 0; }

/* ---------- overlays / sheets ---------- */
.overlay { position: absolute; inset: 0; z-index: 40; background: rgba(0,0,0,.62); display: flex; align-items: flex-end; }
.sheet { width: 100%; background: var(--surface); color: var(--ink); border-radius: 20px 20px 0 0; padding: 14px 16px calc(16px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 12px; animation: sheet-up .18s ease-out; box-shadow: 0 -8px 30px rgba(0,0,0,.45); }
@keyframes sheet-up { from { transform: translateY(20px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: 16px; }
.sheet input { width: 100%; height: 46px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; outline: none; font-size: 16px; background: var(--surface-2); color: var(--ink); }
.sheet input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(245,185,33,.18); }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn { padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: 14px; }
.btn.primary { background: linear-gradient(180deg, var(--primary-2), var(--primary)); color: var(--primary-ink); box-shadow: 0 4px 12px rgba(245,185,33,.22); }
.btn.ghost { background: var(--surface-2); color: var(--ink); }

/* ---------- auth (login / sign-up) ---------- */
.login-box .logo img { height: 156px; }
.login-box .logo { margin-bottom: 22px; }
.auth-panel form { display: flex; flex-direction: column; gap: 10px; }
.login input + input { margin-top: 0; }
.login button[type="submit"] { margin-top: 4px; }
.auth-switch { font-size: 13px; color: rgba(255,255,255,.72); margin-top: 18px; }
.link-btn { color: var(--primary-2); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.login .form-error { text-align: center; }

/* ---------- onboarding ---------- */
.onboard { background: transparent; }
.ob-header { display: flex; align-items: center; height: 54px; padding: 0 8px; padding-top: var(--safe-top); flex: none; position: relative; color: var(--header-ink); }
.ob-header .icon-btn { color: var(--header-ink); }
.dots { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.dots .dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(26,20,0,.25); transition: background .15s, transform .15s; }
.dots .dot.active { background: var(--header-ink); transform: scale(1.25); }
.dots .dot.done { background: #1F5A34; }
.ob-panel { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 16px 20px calc(20px + var(--safe-bottom)); background: var(--panel); border-radius: 22px 22px 0 0; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.ob-title { font-size: 22px; font-weight: 800; margin: 12px 0 8px; letter-spacing: -.3px; }
.ob-text { color: var(--muted); font-size: 14px; margin: 0 0 16px; line-height: 1.5; }
.ob-actions { margin-top: auto; padding-top: 16px; display: flex; gap: 10px; }
.ob-actions.row { margin-top: 0; }
.ob-actions.row .btn { flex: 1; }
.big-input { width: 100%; height: 52px; padding: 0 16px; border: 1.5px solid var(--line); border-radius: 14px; font-size: 18px; outline: none; background: var(--surface-2); color: var(--ink); }
.big-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(245,185,33,.18); }
.list.boxed { flex: none; max-height: 46vh; border: 1px solid var(--line); border-radius: 14px; overflow-y: auto; background: var(--surface); }
.list.boxed .lang-row { padding: 12px 14px; }
.list.boxed .lang-row + .lang-row { border-top: 1px solid var(--line); }
.btn.block { width: 100%; text-align: center; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

/* contacts */
.manual-row { display: flex; gap: 6px; margin-bottom: 10px; }
.manual-row input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px; outline: none; background: var(--surface-2); color: var(--ink); }
.manual-row input:focus { border-color: var(--primary); }
.list.contacts { max-height: 34vh; }
.contact-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.contact-row + .contact-row { border-top: 1px solid var(--line); }
.checkbox { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.checkbox input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.contact-main { display: flex; flex-direction: column; min-width: 0; }
.contact-name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-phone { font-size: 12px; color: var(--muted); }
.empty.small { padding: 18px; font-size: 13px; }

/* ---------- profile editor ---------- */
.profile-editor { display: flex; flex-direction: column; gap: 14px; }
.profile-photo { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0 2px; }
.profile-photo-actions { display: flex; align-items: center; gap: 12px; }
.avatar.photo { background: var(--surface-2); overflow: hidden; }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar.plain { background: var(--surface-3); color: var(--muted); text-shadow: none; }
.profile-preview { width: 84px; height: 84px; font-size: 30px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.field input { height: 44px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 15px; outline: none; background: var(--surface-2); color: var(--ink); }
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(245,185,33,.18); }
.field-hint { font-size: 12px; color: var(--muted); min-height: 15px; }
.field-hint.ok { color: var(--ok); }
.field-hint.bad { color: var(--danger); }
.profile-sub { font-size: 12.5px; color: var(--muted); margin: 2px 0 6px; }
.panel-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
/* Content panels: translucent dark sheets with rounded tops, sitting on the gradient below the gold header band. */
.panel > .list, .panel > .panel-scroll { background: var(--panel); border-radius: 22px 22px 0 0; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.panel > .list { padding-top: 4px; }
.sheet.tall { max-height: 92%; overflow-y: auto; }
.sheet-text { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; }

/* ---------- names with pronunciation (reading first, original spelling underneath) ---------- */
.has-reading { display: flex; flex-direction: column; line-height: 1.2; }
.has-reading .primary { font-weight: 700; }
.reading { display: block; font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: .1px; margin-top: 1px; }
.msg.other .name.has-reading { margin-bottom: 5px; }
.msg.other .name .primary { color: #E4E3DD; font-weight: 600; }
.msg.other .name .reading { color: var(--meta); }
.friend-handle { font-size: 12px; color: var(--primary); margin-top: 1px; }
.members-foot { padding-top: 4px; }

/* ---------- first-launch language pick (brand gradient, mark without text) ---------- */
.langpick { background: var(--brand-grad); color: #fff; align-items: center; padding: 24px 20px; overflow-y: auto; }
.lp-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; margin: auto 0; }
.lp-logo { width: 84px; height: 84px; border-radius: 22px; align-self: center; box-shadow: 0 10px 28px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.14); }
.lp-box .ob-title { text-align: center; margin: 4px 0; color: #fff; }
.lp-box .ob-text { color: rgba(255,255,255,.8); text-align: center; }
.lp-box .list.boxed { max-height: 52vh; background: rgba(18,18,20,.88); border-color: rgba(255,255,255,.1); backdrop-filter: blur(8px); }
.lp-box .lang-row { color: var(--ink); }
.lp-box .lang-row.active { color: var(--primary); }
.auth-note { font-size: 12px; color: rgba(255,255,255,.65); margin: 8px 0 0; line-height: 1.5; }
.auth-note a { color: #fff; }
.terms-agree { margin: 14px 0 12px; font-size: 13px; line-height: 1.5; color: rgba(255,255,255,.85); text-align: left; align-items: flex-start; }
.terms-agree input { margin-top: 2px; }
.terms-agree a { color: #fff; text-decoration: underline; }
.ob-text.small { font-size: 12.5px; }
.ob-subtitle { font-size: 17px; font-weight: 800; margin: 16px 0 6px; }

/* ---------- engine notice (quota / offline engine) ---------- */
.engine-banner { flex: none; display: flex; align-items: flex-start; gap: 10px; padding: 9px 14px; background: #2A2208; color: #F5D77A; font-size: 12.5px; line-height: 1.45; border-top: 1px solid #3D3210; }
.engine-banner .text-btn { color: #F5D77A; flex: none; }
.engine-dot { width: 30px; height: 30px; border-radius: 50%; background: #2A2208; color: var(--primary); font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.engine-badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--surface-3); color: var(--muted); }
.engine-badge.ai { background: var(--primary-soft); color: var(--primary); }
.engine-badge.device { background: var(--ok-soft); color: var(--ok); }
.engine-badge.dict { background: rgba(255,166,92,.18); color: var(--warn); }
.msg.mine .engine-badge { background: rgba(0,0,0,.15); color: #1A1400; }
.tr-foot { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.avatar.tappable, .msg.other .name { cursor: pointer; }

/* ---------- menu / user / report sheets ---------- */
.sheet-menu { margin: 0 -16px -8px; }
.sheet-menu .menu-btn { text-align: center; font-weight: 600; }
.sheet-menu .menu-btn.muted { color: var(--muted); font-weight: 500; }
.menu-btn.link { display: block; text-decoration: none; color: inherit; }
.menu-caption.pad { padding: 0 16px 12px; }
.menu-value.ok { color: var(--ok); font-weight: 600; }
.menu-value.warn { color: var(--warn); font-weight: 600; }
.user-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 4px; text-align: center; }
.user-name { font-size: 18px; font-weight: 800; align-items: center; }
.sheet-actions.column { flex-direction: column; }
.btn.danger-text { color: var(--danger); }
.radio-list { display: flex; flex-direction: column; gap: 4px; }
.radio-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; font-size: 14.5px; cursor: pointer; }
.radio-row input { width: 18px; height: 18px; accent-color: var(--primary); }
.report-detail { width: 100%; margin-top: 8px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 14px; resize: none; outline: none; background: var(--surface-2); color: var(--ink); }
.report-detail:focus { border-color: var(--primary); }

/* ---------- friends tools ---------- */
.friend-tools { padding: 4px 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.invite-box { background: var(--surface); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); }
.invite-title { font-weight: 700; font-size: 14px; }
.row-gap { display: flex; gap: 8px; margin-top: 4px; }
.friend-search { height: 40px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 14px; outline: none; background: var(--surface-2); color: var(--ink); }
.friend-search:focus { border-color: var(--primary); }
.friend-row[role="button"] { cursor: pointer; }
.friend-row[role="button"]:active { background: rgba(255,255,255,.06); }
.chip.soft { background: var(--ok-soft); color: var(--ok); }
.list.boxed.compact { max-height: 40vh; }

[dir="rtl"] .msg.mine { justify-content: flex-start; }
[dir="rtl"] .msg.other { flex-direction: row-reverse; }

@media (min-width: 560px) {
  html, body { background: #0A0A0A; }
}
@media (prefers-reduced-motion: reduce) {
  #btn-send.pop, #btn-send.sent .ico-plane, .emoji-panel, .sheet, .chat-hint { animation: none; }
}

.field input:disabled { background: #202024; color: var(--muted); }
.search-caption { margin: 6px 4px 10px; }

/* ---- photos ---- */
.attach-btn { width: 40px; height: 40px; flex: none; border-radius: 50%; color: var(--meta); display: inline-flex; align-items: center; justify-content: center; transition: color .15s, background .15s, transform .12s; }
.attach-btn svg { width: 24px; height: 24px; }
.attach-btn:active { transform: scale(.9); background: var(--primary-soft); color: var(--primary); }
.msg.mine .bubble.photo, .msg.other .bubble.photo, .msg.pending .bubble.photo { padding: 3px; background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.4); max-width: min(72vw, 320px); }
.bubble.photo img { display: block; width: 100%; max-height: 380px; object-fit: cover; border-radius: 14px; background: var(--surface-3); cursor: zoom-in; }
.bubble.photo .caption { padding: 6px 8px 4px; font-size: 14.5px; line-height: 1.4; word-break: break-word; }
.bubble.photo .photo-placeholder { width: 160px; height: 120px; display: flex; align-items: center; justify-content: center; color: var(--muted); border-radius: 14px; background: var(--surface-3); }
.bubble.photo .photo-placeholder.expired { width: 200px; height: auto; min-height: 72px; padding: 12px; font-size: 12.5px; line-height: 1.4; text-align: center; }
.msg.pending.uploading .bubble.photo img, .msg.pending.sending .bubble.photo img { opacity: .65; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.94); display: flex; align-items: center; justify-content: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.lightbox-close { position: absolute; top: calc(12px + var(--safe-top, 0px)); right: 12px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; font-size: 18px; }

/* default avatar (no profile photo): the Arirang Talk mark on gold */
.avatar.photo.default { background: #E9AE1E; box-shadow: 0 0 0 1px rgba(255,255,255,.12) inset; }

/* ---- secondhand market ("장터") ---- */
.pill-btn { padding: 7px 14px; border-radius: 16px; background: rgba(0,0,0,.22); color: var(--header-ink); font-weight: 800; font-size: 13px; }
.pill-btn:active { background: rgba(0,0,0,.34); }
.market-tools { padding: 0 12px 8px; display: flex; flex-direction: column; gap: 8px; }
.market-tools .friend-search { width: 100%; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-btn { flex: none; padding: 6px 12px; border-radius: 14px; background: rgba(0,0,0,.3); color: #FFF1C9; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip-btn.active { background: var(--header-ink); color: var(--primary); }
.listing-row { display: flex; gap: 12px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--line); }
.listing-row:active { background: rgba(255,255,255,.06); }
.listing-thumb { width: 84px; height: 84px; border-radius: 12px; background: var(--surface-3); object-fit: cover; flex: none; display: flex; align-items: center; justify-content: center; font-size: 30px; }
.listing-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.listing-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.listing-meta { font-size: 12px; color: var(--muted); }
.listing-price { font-weight: 800; font-size: 15px; color: var(--primary); }
.listing-row.sold .listing-title, .listing-row.sold .listing-price { color: var(--muted); }
.status-chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 8px; margin-right: 6px; vertical-align: 2px; }
.status-chip.reserved { background: var(--ok-soft); color: var(--ok); }
.status-chip.sold { background: var(--surface-3); color: var(--muted); }
.load-more { display: flex; justify-content: center; padding: 12px; }
.listing-detail { display: flex; flex-direction: column; gap: 10px; }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 14px; }
.photo-strip img { width: 100%; max-height: 300px; object-fit: cover; border-radius: 14px; flex: none; scroll-snap-align: start; background: var(--surface-3); cursor: zoom-in; }
.photo-strip.multi img { width: 86%; }
.listing-head { font-size: 19px; font-weight: 800; line-height: 1.3; }
.listing-big-price { font-size: 20px; font-weight: 800; color: var(--primary); }
.seller-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; }
.listing-desc { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.listing-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.listing-actions .btn { flex: 1; min-width: 44%; text-align: center; }
.le-photos { display: flex; gap: 8px; flex-wrap: wrap; }
.le-photo { position: relative; width: 72px; height: 72px; border-radius: 12px; overflow: hidden; background: var(--surface-3); }
.le-photo img { width: 100%; height: 100%; object-fit: cover; }
.le-photo .remove { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; font-size: 13px; }
.le-add { width: 72px; height: 72px; border-radius: 12px; border: 1.5px dashed var(--muted); color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; gap: 2px; }
.le-add b { font-size: 22px; line-height: 1; }
.field textarea { min-height: 96px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 15px; outline: none; background: var(--surface-2); color: var(--ink); resize: vertical; }
.field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(245,185,33,.18); }
.field select { height: 44px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 15px; background: var(--surface-2); color: var(--ink); }

/* ---- chat list: pinned rows, long-press ---- */
.room-row { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.room-row.pinned { background: rgba(245,185,33,.06); }
.room-title .pin { font-size: 12px; margin-right: 2px; flex: none; }
.avatar.group.default { background: #C48D12; }

/* ---- marketplace: translated posts ---- */
.listing-orig { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: -4px; }
.listing-orig.block { display: block; margin-top: 0; padding-top: 6px; border-top: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.listing-orig .tr-label { display: inline-block; font-size: 10.5px; color: var(--primary); background: var(--primary-soft); border-radius: 6px; padding: 0 5px; margin-right: 5px; vertical-align: 1px; }

/* ---- directions ("길찾기") ---- */
.dir-panel { padding: 12px 14px calc(16px + var(--safe-bottom)); gap: 12px; }
.dir-form { display: flex; flex-direction: column; gap: 8px; }
.dir-form textarea { width: 100%; min-height: 64px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; font-size: 16px; line-height: 1.4; outline: none; background: var(--surface-2); color: var(--ink); resize: vertical; }
.dir-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(245,185,33,.18); }
.dir-row { display: flex; gap: 8px; }
.dir-row .btn { flex: 1; text-align: center; }
.dir-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.dir-line { display: flex; flex-direction: column; gap: 2px; }
.dir-line.muted { color: var(--muted); font-size: 13px; }
.dir-label { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.dir-value { font-size: 15px; line-height: 1.45; word-break: break-word; }
.dir-value.strong { font-size: 17px; font-weight: 800; }
.dir-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.map-btn { display: block; text-align: center; text-decoration: none; color: var(--primary-ink); background: linear-gradient(180deg, var(--primary-2), var(--primary)); font-weight: 800; }
.map-btn.kakao { background: linear-gradient(180deg, #FFE55C, #F7D31A); }
.map-btn.google { background: var(--surface-2); color: var(--ink); }
.dir-tip { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.dir-list { max-height: none; }
.dir-place { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; }
.dir-place + .dir-place { border-top: 1px solid var(--line); }
.dir-place-main { flex: 1; min-width: 0; }
.dir-place-name { font-weight: 700; font-size: 15px; }
.dir-place-addr { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip-btn.recent { background: var(--surface-2); color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.section-title.row-between { display: flex; align-items: center; justify-content: space-between; }

/* ---- AriShop stickers ---- */
.msg .bubble.sticker { background: transparent !important; box-shadow: none !important; padding: 0; }
.bubble.sticker img { width: 150px; height: 150px; object-fit: contain; display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
.emoji-grid.stickers { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.emoji-grid.stickers button { height: auto; padding: 4px; border-radius: 12px; }
.emoji-grid.stickers button img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.emoji-grid.stickers button:active { transform: scale(1.06); }
.shop-list { display: flex; flex-direction: column; gap: 12px; }
.shop-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.shop-cat { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 26px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 18px; cursor: pointer; color: var(--ink); text-align: center; }
.shop-cat:hover, .shop-cat:active { border-color: var(--primary); background: rgba(245,185,33,.08); }
.shop-cat-icon { width: 66px; height: 66px; object-fit: contain; }
.msg.archived { opacity: .72; }
.shop-cat-name { font-weight: 800; font-size: 15.5px; }
.shop-cat-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.sheet-head #shop-title { flex: 1; text-align: center; }
.shop-packgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.shop-pack-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; text-align: center; }
.shop-pack-card:hover, .shop-pack-card:active { border-color: var(--primary); }
.shop-pack-card img { width: 92px; height: 92px; object-fit: contain; }
.shop-pack-card .pk-name { font-weight: 800; font-size: 13.5px; line-height: 1.2; }
.shop-pack-card .pk-meta { font-size: 11.5px; color: var(--muted); }
.shop-pack-card .pk-meta .own { color: var(--primary); font-weight: 700; }
.shop-themegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.shop-theme-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.shop-theme-prev { width: 100%; height: 52px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.10); }
.shop-theme-card .nm { font-weight: 800; font-size: 13.5px; }
.theme-block { display: flex; flex-direction: column; gap: 10px; }
.theme-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-swatch { width: 42px; height: 42px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; box-shadow: 0 0 0 1px var(--line); padding: 0; }
.theme-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--primary); }
.shop-card { background: var(--surface-2); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.shop-head { display: flex; align-items: center; gap: 12px; }
.shop-cover { width: 64px; height: 64px; object-fit: contain; border-radius: 12px; background: rgba(255,255,255,.06); flex: none; }
.shop-main { flex: 1; min-width: 0; }
.shop-name { font-weight: 800; font-size: 15.5px; }
.shop-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.shop-meta { font-size: 12.5px; margin-top: 4px; }
.shop-price { color: var(--primary); font-weight: 800; }
.shop-meta .muted { color: var(--muted); }
.shop-preview { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.shop-preview img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,.05); }

/* ---- marketplace notice (pinned, not removable) ---- */
.market-notice { margin: 8px 12px 4px; padding: 12px 14px; border-radius: 14px; background: rgba(245,185,33,.12); border: 1px solid rgba(245,185,33,.35); cursor: pointer; }
.market-notice-title { font-weight: 800; font-size: 14px; color: var(--primary); }
.market-notice-body { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--ink); white-space: pre-line; }
.market-notice-more { margin-top: 6px; font-size: 12px; color: var(--primary); font-weight: 700; }

/* Dialog-style sheets always stack above content sheets (post detail, members, profile, shop). */
#sheet-confirm, #sheet-menu, #sheet-input, #sheet-password, #sheet-pick, #sheet-user, #sheet-report { z-index: 46; }

/* ---- job board (알바) ---- */
.pay-row { display: flex; gap: 8px; }
.pay-row select { flex: 0 0 38%; min-width: 0; }
.pay-row input { flex: 1; min-width: 0; }
.job-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 4px 0 6px; font-size: 13.5px; line-height: 1.4; }
.job-facts dt { color: var(--muted); white-space: nowrap; }
.job-facts dd { margin: 0; overflow-wrap: anywhere; }


/* ---- AriShop: "more packs later" note ---- */
.shop-soon { padding: 12px 14px; border-radius: 14px; border: 1px dashed rgba(245,185,33,.45); color: var(--muted); font-size: 13px; line-height: 1.5; text-align: center; }

/* ---- friends tab: my profile card (photo ~3x the list size) ---- */
.avatar.hero { width: 120px; height: 120px; font-size: 44px; box-shadow: 0 8px 24px rgba(0,0,0,.4), 0 0 0 3px rgba(245,185,33,.6); }
.friend-row.me-card { padding: 14px 16px 18px; gap: 18px; }
.friend-row.me-card .friend-name { font-size: 21px; font-weight: 800; white-space: normal; }
.friend-row.me-card .friend-handle { font-size: 14px; margin-top: 4px; }
.friend-row.me-card .chip { align-self: flex-start; margin-top: 6px; }

/* ---- replies (quote on top of a bubble) ---- */
.msg .bubble { -webkit-touch-callout: none; }
.quote { border-left: 3px solid rgba(245,185,33,.95); padding: 2px 8px; margin: 0 0 6px; font-size: 12.5px; line-height: 1.35; opacity: .92; cursor: pointer; }
.msg.mine .quote { border-left-color: rgba(26,20,0,.55); }
.quote-name { font-weight: 700; margin-bottom: 1px; }
.quote-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; }
.bubble.photo .quote { margin: 4px 6px 6px; }
.bubble.quote-holder { padding-bottom: 6px; }
.bubble.quote-holder .quote { margin-bottom: 0; }
.bubble-stack { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.msg.mine .bubble-stack { align-items: flex-end; }
.msg.flash .bubble { animation: quote-flash 1.3s ease; }
@keyframes quote-flash { 0%, 55% { box-shadow: 0 0 0 3px rgba(245,185,33,.85); } 100% { box-shadow: none; } }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; background: var(--surface-2); border-top: 1px solid rgba(245,185,33,.25); flex: none; }
.reply-main { flex: 1; min-width: 0; border-left: 3px solid var(--primary); padding-left: 8px; }
.reply-name { font-size: 12.5px; font-weight: 700; color: var(--primary); }
.reply-text { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* ---- in-chat banner slot ---- */
.ad-banner { display: block; position: relative; margin: 6px 10px 2px; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,.35); flex: none; }
.ad-banner img { display: block; width: 100%; aspect-ratio: 1200 / 392; object-fit: cover; }
.ad-tag { position: absolute; top: 6px; right: 8px; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: rgba(0,0,0,.5); color: #fff; letter-spacing: .4px; }

/* ---- room notice (group rooms) ---- */
.chat-notice { margin: 4px 10px 2px; border-radius: 12px; background: rgba(245,185,33,.14); border: 1px solid rgba(245,185,33,.35); flex: none; overflow: hidden; }
.notice-main { display: flex; align-items: flex-start; gap: 8px; width: 100%; padding: 8px 10px; text-align: left; color: var(--ink); }
.notice-ico { flex: none; font-size: 15px; line-height: 1.3; }
.notice-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notice-text { font-size: 13.5px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-notice.open .notice-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.notice-meta { font-size: 11.5px; color: var(--muted); }
.notice-chevron { flex: none; color: var(--primary); font-size: 14px; }
.notice-actions { display: flex; gap: 4px; justify-content: flex-end; padding: 0 6px 6px; border-top: 1px solid rgba(245,185,33,.2); }
.notice-actions .text-btn { font-size: 12.5px; padding: 6px 8px; }
.notice-pill { align-self: flex-end; flex: none; margin: 4px 12px 0; width: 34px; height: 34px; border-radius: 50%; background: rgba(245,185,33,.92); color: #1A1400; font-size: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
/* the notice sits on the gold band at the top of the room: a dark glass box reads on gold and on black alike */
.chat-notice { background: rgba(20,14,0,.62); border-color: rgba(255,215,94,.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.notice-main { color: #FFF8E6; }
.notice-meta { color: rgba(255,248,230,.7); }
.notice-chevron { color: #FFD75E; }
.notice-actions { border-top-color: rgba(255,215,94,.25); }
.notice-actions .text-btn { color: #FFD75E; font-weight: 700; }
.notice-actions .text-btn.danger-text { color: #FF8A80; }

/* ---- members sheet: role chips and two action buttons per row ---- */
.friend-row .btn.small { padding: 5px 9px; font-size: 12px; white-space: nowrap; }

/* ---- room drawer (slides in from the right) ---- */
.overlay.drawer-overlay { align-items: stretch; justify-content: flex-end; }
.drawer { width: min(84%, 360px); height: 100%; background: var(--surface); color: var(--ink); display: flex; flex-direction: column; padding: calc(8px + var(--safe-top)) 0 calc(10px + var(--safe-bottom)); box-shadow: -8px 0 28px rgba(0,0,0,.45); animation: drawer-in .22s ease; }
@keyframes drawer-in { from { transform: translateX(48px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 8px 16px; }
.drawer-title { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-size: 17px; font-weight: 800; }
.drawer-title span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-actions { display: flex; gap: 6px; padding: 2px 12px 10px; }
.drawer-action { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; background: var(--surface-2); color: var(--ink); font-size: 11.5px; font-weight: 600; }
.drawer-action:active { background: var(--surface-3); }
.drawer-ico { font-size: 18px; line-height: 1; }
.drawer-section { padding: 6px 16px 2px; font-size: 12px; font-weight: 700; color: var(--muted); }
.drawer-list { flex: 1; min-height: 0; overflow-y: auto; }
.drawer .friend-row { padding: 8px 12px; flex-wrap: wrap; }
.drawer .friend-row .btn.small { padding: 4px 8px; font-size: 11.5px; }
.members-foot { padding: 8px 12px 0; }
/* drawer rows: the two action buttons take their own line under the name */
.drawer .friend-row .btn.small { flex: 1 1 42%; text-align: center; }
.drawer .friend-row .friend-main { flex: 1 1 58%; }
.drawer .friend-row .btn.small { flex: 1 1 40%; }

/* ---- 더보기 → 알림 ---- */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); flex: none; }
.seg button { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg button.active { background: var(--primary); color: #1A1400; }
.select { background: var(--surface-3); color: var(--ink); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 7px 10px; font-size: 13.5px; }
.menu-row .row-gap { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---- 더보기 → 백업 and the read-only archive viewer ---- */
.backup-note { padding: 4px 16px 10px; }
.bk-messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 8px; }
.bk-date { text-align: center; font-size: 12px; color: var(--muted); margin: 8px 0 2px; }
.bk-sys { text-align: center; font-size: 12px; color: var(--muted); }
.bk-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.bk-msg.mine { align-self: flex-end; align-items: flex-end; }
.bk-name { font-size: 12px; color: var(--muted); margin: 0 0 2px 4px; }
.bk-quote { font-size: 12px; color: var(--muted); border-left: 2px solid var(--primary); padding-left: 6px; margin-bottom: 2px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-bubble { background: var(--bubble-other); color: var(--ink); padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.bk-msg.mine .bk-bubble { background: var(--bubble-mine); color: var(--bubble-mine-ink); }
.bk-bubble a { color: inherit; text-decoration: underline; }
.bk-time { font-size: 11px; color: var(--muted); margin: 2px 4px 0; }

/* translation rating (👍/👎 under a translated bubble) and the occasional system-style hint */
.tr-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tr-rate { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.tr-rate-label { opacity: .85; }
.tr-rate-btn { font: inherit; font-size: 11.5px; line-height: 1.2; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; }
.tr-rate-btn.good:hover, .tr-rate-btn.good:active { border-color: var(--ok); }
.tr-rate-btn.bad:hover, .tr-rate-btn.bad:active { border-color: var(--danger); }
.tr-rate.rated.good .tr-rated { color: var(--ok); font-weight: 700; }
.tr-rate.rated.bad .tr-rated { color: var(--danger); font-weight: 700; }
.tr-rate-btn.undo { opacity: .8; }
.sys.hint { background: var(--primary-soft); color: var(--ink); border: 1px dashed rgba(245,185,33,.45); border-radius: 12px; padding: 8px 12px; font-size: 12.5px; line-height: 1.45; margin: 6px 12px; }


/* voice input (speech → text) in the composer */
.mic-toggle.listening { color: #fff; background: var(--danger, #e5484d); animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229,72,77,.45); } 50% { box-shadow: 0 0 0 7px rgba(229,72,77,0); } }
