/* 테마: <html data-theme="..."> 로 바뀜. 기본은 핑크 */
:root {
  --bg: #fff5f8;
  --panel: #ffffff;
  --field: #ffffff;
  --text: #3a2b33;
  --muted: #9a8790;
  --pink: #ff6fa5;
  --on-pink: #ffffff;
  --pink-soft: #ffe1ec;
  --line: #f1dbe4;
  --danger: #e2556a;
  --danger-soft: #fde4e8;
  --bubble-me: #ff8db8;
  --bubble-her: #ffffff;
  --checker: #f6eef2;
  --chip-glass: rgba(255,255,255,.9);
  --info: #3a6fd8;
  --info-soft: #e7f0ff;
  --info-panel: #f7f9ff;
  --warn: #8a6d1f;
  --warn-soft: #fff8e6;
  --backdrop: rgba(40, 20, 30, .35);
  --bg-deco: none;
  color-scheme: light;
}
/* 화이트: 깔끔한 흰 바탕 + 차분한 파랑 */
:root[data-theme="light"] {
  --bg: #f6f7f9; --panel: #ffffff; --field: #ffffff; --text: #22262e; --muted: #858b96;
  --pink: #4a7cf0; --pink-soft: #e6edfd; --line: #e3e6ec; --bubble-me: #4a7cf0; --bubble-her: #ffffff;
  --checker: #eef0f4; --backdrop: rgba(20, 24, 32, .35);
}
/* 다크 */
:root[data-theme="dark"] {
  --bg: #15141a; --panel: #211f28; --field: #2a2832; --text: #ece8f0; --muted: #9d97a8;
  --pink: #ff7fb0; --on-pink: #1a0f15; --pink-soft: #3a2632; --line: #36323f;
  --danger: #ff7a8a; --danger-soft: #3d2228; --bubble-me: #ff7fb0; --bubble-her: #2a2832;
  --checker: #33303b; --chip-glass: rgba(33,31,40,.88);
  --info: #8fb0ff; --info-soft: #24304a; --info-panel: #1e2230; --warn: #f0cf7a; --warn-soft: #3a3220;
  --backdrop: rgba(0, 0, 0, .55);
  color-scheme: dark;
}
/* 할로윈: 어두운 보라 + 호박 주황 */
:root[data-theme="halloween"] {
  --bg: #1a1225; --panel: #261a33; --field: #2f2140; --text: #f6ecdf; --muted: #b3a0c4;
  --pink: #ff8a1f; --on-pink: #1a1225; --pink-soft: #3d2a2a; --line: #3d2c52;
  --danger: #ff6b6b; --danger-soft: #42232a; --bubble-me: #ff8a1f; --bubble-her: #2f2140;
  --checker: #3a2a4d; --chip-glass: rgba(38,26,51,.88);
  --info: #b48cff; --info-soft: #33254d; --info-panel: #221833; --warn: #ffc56b; --warn-soft: #3d2f1f;
  --backdrop: rgba(10, 4, 18, .6);
  --bg-deco: radial-gradient(circle at 85% 6%, rgba(255,214,120,.22) 0 34px, transparent 36px),
             radial-gradient(ellipse at 50% 120%, rgba(255,138,31,.18), transparent 60%);
  color-scheme: dark;
}
/* 크리스마스: 진녹색 + 빨강, 눈 내리는 배경 */
:root[data-theme="christmas"] {
  --bg: #13281f; --panel: #1a3529; --field: #20402f; --text: #eeeae0; --muted: #a3b8ac;
  --pink: #cf4a5a; --on-pink: #ffffff; --pink-soft: #3f2e2f; --line: #2a4a3b;
  --danger: #ef7482; --danger-soft: #45282c; --bubble-me: #c4505e; --bubble-her: #20402f;
  --checker: #264a39; --chip-glass: rgba(26,53,41,.88);
  --info: #e9cf82; --info-soft: #34432a; --info-panel: #1a3a2c; --warn: #e9cf82; --warn-soft: #3a3824;
  --backdrop: rgba(4, 16, 10, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .3s, color .3s;
}
/* 테마 장식(할로윈 달·크리스마스 눈). 글자 뒤에 깔림 */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; background: var(--bg-deco);
}
/* 크리스마스 눈: 크기·속도가 다른 세 겹(가까운 눈은 크고 빠르게, 먼 눈은 작고 느리게) */
:root[data-theme="christmas"] body::before {
  background-image:
    radial-gradient(circle at 22% 40%, rgba(255,255,255,0.6) 0 2.6px, transparent 5px),
    radial-gradient(circle at 68% 8%, rgba(255,255,255,0.55) 0 3px, transparent 5.6px),
    radial-gradient(circle at 91% 77%, rgba(255,255,255,0.6) 0 2.4px, transparent 4.8px),
    radial-gradient(circle at 31% 12%, rgba(255,255,255,0.5) 0 1.8px, transparent 3.2px),
    radial-gradient(circle at 76% 58%, rgba(255,255,255,0.45) 0 1.6px, transparent 3.0px),
    radial-gradient(circle at 9% 83%, rgba(255,255,255,0.5) 0 1.7px, transparent 3.1px),
    radial-gradient(circle at 14% 22%, rgba(255,255,255,0.35) 0 1px, transparent 2px),
    radial-gradient(circle at 57% 71%, rgba(255,255,255,0.3) 0 1.1px, transparent 2.1px),
    radial-gradient(circle at 83% 36%, rgba(255,255,255,0.35) 0 0.9px, transparent 1.9px);
  background-size: 360px 360px, 360px 360px, 360px 360px, 250px 250px, 250px 250px, 250px 250px, 180px 180px, 180px 180px, 180px 180px;
  animation: snow 40s linear infinite;
}
@keyframes snow { from { background-position: 0 0; } to { background-position: 360px 1440px, 360px 1440px, 360px 1440px, -250px 750px, -250px 750px, -250px 750px, 0px 360px, 0px 360px, 0px 360px; } }
#app { position: relative; z-index: 0; }
#app { max-width: 480px; margin: 0 auto; min-height: 100%; }
.screen { min-height: 100dvh; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
[hidden] { display: none !important; }

h1 { margin: 12px 0 4px; font-size: 24px; }
h2 { margin: 0; font-size: 18px; flex: 1; text-align: center; }
.sub, .hint { color: var(--muted); font-size: 13px; margin: 0; }
.hint { text-align: center; }
.top { text-align: center; }

/* 버튼 */
.btn {
  border: 0; border-radius: 999px; padding: 10px 16px; font: inherit; font-weight: 600;
  background: var(--pink-soft); color: var(--text); cursor: pointer;
}
.btn.primary { background: var(--pink); color: var(--on-pink); }
.btn.kakao { background: #fee500; color: #191919; }
.btn.insta { background: linear-gradient(45deg, #f9a03f, #e1306c 45%, #833ab4); color: #fff; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; padding: 8px 10px; }
.btn.big { padding: 14px; font-size: 16px; }
.btn:active { transform: scale(0.97); }
.row { display: flex; gap: 8px; }
.grow { flex: 1; }
.bar { display: flex; align-items: center; gap: 2px; }
.bar h2 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .btn.ghost { padding: 8px 7px; flex: none; }

/* 캐릭터 목록 */
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.card {
  background: var(--panel); border-radius: 16px; overflow: hidden; border: 1px solid var(--line);
  cursor: pointer; text-align: left; padding: 0; font: inherit; color: inherit;
}
.card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: var(--pink-soft); }
.card b { display: block; padding: 8px 10px 2px; }
.card small { display: block; padding: 0 10px 10px; color: var(--muted); }

/* 만들기 폼 */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
.form input:not([type=checkbox]):not([type=file]), .form select {
  font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); color: var(--text);
}
.form .consent { flex-direction: row; align-items: flex-start; font-weight: 400; font-size: 13px; color: var(--muted); }
.photo-pick {
  align-self: center; width: 180px; aspect-ratio: 3/4; border-radius: 20px; border: 2px dashed var(--pink);
  background: var(--field); position: relative; overflow: hidden; cursor: pointer;
  display: grid !important; place-items: center; text-align: center; color: var(--pink);
}
.photo-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-pick img:not([src]), .photo-pick img[src=""] { display: none; }
.photo-pick input, .slot input[type=file] { display: none; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.label { font-size: 14px; font-weight: 600; }
.small { font-size: 12px; }
.hint.left { text-align: left; margin: 4px 0 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field textarea { font: inherit; background: var(--field); color: var(--text); padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; resize: vertical; }

/* 표정 이미지 칸 */
.slot-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.slot { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.slot .pick {
  aspect-ratio: 3/4; border: 1px dashed var(--pink); border-radius: 12px; position: relative; overflow: hidden; cursor: pointer;
  background: repeating-conic-gradient(var(--checker) 0 25%, var(--field) 0 50%) 0 0 / 14px 14px;
  display: grid; place-items: center; color: var(--pink); font-size: 22px;
}
.slot .pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.slot .pick img[src=""] { display: none; }
.slot .remove {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(0,0,0,.55); color: #fff; font-size: 13px; line-height: 24px; cursor: pointer; z-index: 1;
}
.slot .name { font-size: 12px; text-align: center; font-weight: 600; }
.slot input.name { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; font: inherit; font-size: 12px; text-align: center; min-width: 0; }
.slot.add .pick { border-style: dashed; background: var(--field); font-size: 14px; font-weight: 700; }

/* 말투 프리셋 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--field); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--pink); color: var(--on-pink); border-color: var(--pink); }

/* 대화 화면 */
#screen-chat, #screen-group { padding-bottom: 0; gap: 8px; height: 100dvh; }
.affection { display: flex; align-items: center; gap: 4px; }
.meter { width: 56px; height: 8px; border-radius: 99px; background: var(--pink-soft); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--pink); transition: width .5s; }

.stage {
  display: flex; justify-content: center; align-items: flex-end; flex: 0 0 auto; height: 38dvh; border-radius: 20px;
  background: url("assets/room.webp") center / cover; overflow: hidden; padding-top: 14px;
}
.avatar { position: relative; height: calc(38dvh - 24px); aspect-ratio: 3/4; margin-bottom: 10px; transform-origin: 50% 100%; animation: breathe 3.2s ease-in-out infinite; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 18px; transition: filter .4s; box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.avatar.png-sprite { height: calc(38dvh - 14px); margin-bottom: 0; }
.avatar.png-sprite img { object-fit: contain; object-position: bottom; box-shadow: none; }
.avatar .fx { position: absolute; inset: 0; border-radius: 18px; pointer-events: none; opacity: 0; transition: opacity .4s; }
.avatar .badge {
  position: absolute; top: -6px; right: -14px; font-size: 32px; opacity: 0; transform: scale(.4);
  transition: opacity .3s, transform .3s cubic-bezier(.3,1.6,.6,1);
}
.avatar.show-badge .badge { opacity: 1; transform: scale(1); }

/* 표정 효과: 사진이 한 장뿐이어도 감정이 보이도록 */
.avatar .blush { background: radial-gradient(circle at 32% 55%, rgba(255,90,140,.45) 0 9%, transparent 16%),
                               radial-gradient(circle at 68% 55%, rgba(255,90,140,.45) 0 9%, transparent 16%); }
.emo-happy { animation: hop .5s ease-out, breathe 3.2s ease-in-out .5s infinite; }
.emo-happy img { filter: saturate(1.25) brightness(1.06); }
.emo-happy .tint { opacity: .25; background: radial-gradient(circle, rgba(255,230,140,.8), transparent 70%); }

.emo-sad { animation: droop .6s ease-out forwards; }
.emo-sad img { filter: grayscale(.55) brightness(.9); }
.emo-sad .tint { opacity: .35; background: linear-gradient(rgba(80,120,220,.5), rgba(80,120,220,.1)); }

.emo-angry { animation: shake .45s ease-in-out, breathe 3.2s ease-in-out .45s infinite; }
.emo-angry img { filter: saturate(1.4) contrast(1.05); }
.emo-angry .tint { opacity: .3; background: radial-gradient(circle at 50% 30%, rgba(255,40,40,.6), transparent 70%); }

.emo-embarrassed { animation: wobble .7s ease-in-out, breathe 3.2s ease-in-out .7s infinite; }
.emo-embarrassed .blush { opacity: 1; }
.emo-embarrassed .tint { opacity: .15; background: rgba(255,120,170,.6); }

/* 투명 배경 캐릭터: 사각형 색 덮개·볼터치 대신 그림자와 색감만 */
.avatar.png-sprite .tint, .avatar.png-sprite .blush { display: none; }
.avatar.png-sprite img { filter: drop-shadow(0 6px 10px rgba(0,0,0,.18)); }
.avatar.png-sprite.emo-embarrassed img { filter: drop-shadow(0 0 14px rgba(255,90,140,.7)); }
.avatar.png-sprite.emo-angry img { filter: drop-shadow(0 0 14px rgba(255,40,40,.6)) saturate(1.3); }
.avatar.png-sprite.emo-sad img { filter: drop-shadow(0 6px 10px rgba(60,90,200,.35)) grayscale(.5); }
.avatar.png-sprite.emo-happy img { filter: drop-shadow(0 0 14px rgba(255,220,120,.8)) brightness(1.06); }

/* 표정별 사진을 넣은 경우에는 색 효과를 약하게 */
.avatar.has-slot img { filter: none; }
.avatar.has-slot .tint, .avatar.has-slot .blush { opacity: 0; }

.emo-custom { animation: hop .5s ease-out, breathe 3.2s ease-in-out .5s infinite; }

@keyframes breathe { 0%,100% { transform: scale(1, 1); } 50% { transform: scale(.996, 1.012); } }
@keyframes hop { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-18px); } }
@keyframes droop { to { transform: translateY(6px) scale(.97); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-7px) rotate(-1.5deg); } 40%,80% { transform: translateX(7px) rotate(1.5deg); } }
@keyframes wobble { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }

.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; }
.msg { max-width: 80%; padding: 9px 13px; border-radius: 18px; line-height: 1.45; font-size: 15px; word-break: break-word; animation: pop .2s ease-out; }
.msg.her { align-self: flex-start; background: var(--bubble-her); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: var(--bubble-me); color: var(--on-pink); border-bottom-right-radius: 6px; }
.msg.system { align-self: center; background: transparent; color: var(--muted); font-size: 12px; }
.msg.typing { color: var(--muted); }
/* 대답 기다리는 중: 점 3개가 차례로 통통 튀어서 멈춘 게 아님을 보여 줌 */
.dots { display: inline-flex; gap: 4px; align-items: center; height: 1.45em; padding: 0 2px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: dot-hop 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot-hop { 0%,60%,100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes dot-fade { 0%,60%,100% { opacity: .35; } 30% { opacity: 1; } }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }

.chat-input {
  display: flex; gap: 8px; padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  position: sticky; bottom: 0; background: var(--bg);
}
.chat-input input { flex: 1; font: inherit; background: var(--field); color: var(--text); padding: 11px 14px; border: 1px solid var(--line); border-radius: 999px; min-width: 0; }
.teach-tag { display: inline-block; font-size: 11px; color: var(--pink); margin-left: 4px; }

/* 사진 편집기 */
.ie-canvas {
  width: 100%; max-height: 56dvh; object-fit: contain; border-radius: 14px; background: var(--pink-soft);
  touch-action: none; cursor: grab; align-self: center; max-width: 100%;
}
.ie-canvas.checker {
  background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 20px 20px;
}
.ie-zoom-row { align-items: center; color: var(--muted); }
.small-btn { padding: 7px 12px; font-size: 13px; align-self: center; }

/* 배경 선택 */
.bg-pick { display: flex; align-items: center; gap: 10px; }
.bg-pick .label { font-size: 14px; font-weight: 600; }
.bg-thumb {
  width: 120px; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; position: relative; cursor: pointer;
  border: 1px dashed var(--pink); background: url("assets/room.webp") center / cover;
  display: grid !important; place-items: center; font-size: 12px !important; color: #fff;
}
.bg-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bg-thumb img[src=""], .bg-thumb img:not([src]) { display: none; }
.bg-thumb span { position: relative; background: rgba(0,0,0,.35); padding: 2px 6px; border-radius: 6px; }
.bg-thumb input { display: none; }
.form textarea { background: var(--field); color: var(--text); font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; resize: vertical; }
.muted { color: var(--muted); font-weight: 400; }

/* AI */
.ai-entry { background: var(--panel); border: 1px solid var(--line); }
.ai-entry span { font-size: 12px; color: var(--pink); }
.stage { position: relative; }
.mode-chip {
  position: absolute; top: 8px; left: 8px; z-index: 1; box-shadow: 0 1px 4px rgba(0,0,0,.12);
  flex: none; border: 0; border-radius: 999px; padding: 3px 8px; font: inherit; font-size: 11px; font-weight: 700;
  background: var(--chip-glass); color: var(--muted); cursor: pointer;
}
.reset-chip { left: auto; right: 8px; }
.mode-chip.on { background: var(--info-soft); color: var(--info); }
.ai-share { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; background: var(--info-panel); }
.ai-share .consent { color: var(--text); font-size: 14px; }
.ai-share-limit { align-items: center; font-size: 13px; gap: 6px; }
.ai-share-limit input { width: 90px; background: var(--field); color: var(--text); font: inherit; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); }
.ai-share-limit select { background: var(--field); color: var(--text); font: inherit; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); }
.hint-link { font-size: 12px; color: var(--pink); align-self: flex-start; }
.hint.warn { text-align: left; background: var(--warn-soft); border-radius: 10px; padding: 8px 10px; color: var(--warn); }
/* API 키 칸: 비밀번호 칸(type=password)이면 브라우저가 저장된 비밀번호를 자동으로 채워 넣어서,
   일반 칸에 글자만 가림 */
.form input.masked { -webkit-text-security: disc; background: var(--field); color: var(--text); font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.form input[type=password] { background: var(--field); color: var(--text); font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }

.screen.center { justify-content: center; align-items: center; text-align: center; }
.guest-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--pink-soft); border-radius: 14px; padding: 6px 6px 6px 14px; font-size: 13px;
}
.guest-banner .btn { padding: 7px 12px; font-size: 13px; }
.btn.small { font-size: 12px; color: var(--muted); font-weight: 400; }
.card .tag { display: inline-block; font-size: 11px; color: var(--pink); margin-left: 4px; font-weight: 400; }

.sheet-backdrop { position: fixed; inset: 0; background: var(--backdrop); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet {
  width: 100%; max-width: 480px; background: var(--panel); border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px;
  max-height: 94dvh; overflow-y: auto;
  animation: slide-up .22s ease-out;
}
.sheet h3 { margin: 0; text-align: center; }
.card-preview { width: 100%; max-height: 52dvh; object-fit: contain; border-radius: 14px; border: 1px solid var(--line); }
.views { margin: 0; text-align: center; font-size: 14px; color: var(--pink); font-weight: 700; }
#share-body { display: flex; flex-direction: column; gap: 10px; }
#share-link { color: var(--text); font: inherit; font-size: 13px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
@keyframes slide-up { from { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none !important; }
  .avatar, .emo-happy, .emo-angry, .emo-embarrassed, .emo-sad { animation: none !important; }
  .dots i { animation-name: dot-fade; } /* 움직임은 줄여도 깜빡임으로 진행 중임은 보이게 */
}

/* 언어 선택 · 사용법 */
.home-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: -10px; }
.lang-pick { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.home-tools .picks { display: flex; gap: 6px; }
.lang-pick select { border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font: inherit; background: var(--field); color: var(--text); }

/* 나라별 공유 버튼 · QR */
.social-row { display: flex; flex-wrap: wrap; gap: 8px; }
.social-row .btn { flex: 1; min-width: 30%; color: #fff; }
.btn.line { background: #06c755; }
.btn.whatsapp { background: #25d366; }
.btn.x { background: #111; }
.btn.facebook { background: #1877f2; }
.btn.weibo { background: #e6162d; }
.btn.wechat { background: #07c160; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#qr-code { background: #fff; padding: 10px; border-radius: 12px; border: 1px solid var(--line); word-break: break-all; }
#qr-code img, #qr-code canvas { display: block; }

/* 튜토리얼 */
.tutorial { align-items: center; padding: 16px; }
.tutorial .sheet { border-radius: 22px; max-width: 420px; }
.tut-img { width: 120px; height: 160px; object-fit: contain; margin: 0 auto; display: block; }
.tut-body { margin: 0; line-height: 1.6; font-size: 15px; text-align: center; }
.tut-langs { justify-content: center; }
.tut-dots { display: flex; justify-content: center; gap: 6px; }
.tut-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tut-dots i.on { background: var(--pink); width: 20px; border-radius: 4px; }
.credit { margin-top: auto; padding-top: 8px; text-align: center; font-size: 12px; color: var(--muted); }

/* 둘러보기 · 관리 · 안내 */
a.card { text-decoration: none; display: block; }
.card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-tabs { justify-content: center; }
.credit a { color: var(--muted); }
.section-title { margin: 8px 0 0; font-size: 16px; }
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-row { display: flex; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.admin-row img { width: 64px; height: 84px; object-fit: cover; border-radius: 10px; background: var(--pink-soft); flex: none; }
.admin-row .reason { margin: 4px 0; font-size: 14px; }
.admin-row small { color: var(--muted); }
.admin-row .row { flex-wrap: wrap; margin-top: 6px; }
.small-btn { padding: 6px 10px; font-size: 13px; text-decoration: none; }
.privacy { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 4px 16px 12px; line-height: 1.6; font-size: 14px; }
.privacy h3 { font-size: 15px; margin: 14px 0 4px; }
.privacy ul { padding-left: 18px; margin: 0; }
.privacy p { margin: 0; }
.sources { margin-top: 6px; font-size: 12px; }
.sources p { margin: 0 0 4px; color: var(--muted); }
.sources a { color: var(--pink); }
.guest-banner .btn { padding: 8px 10px; font-size: 13px; }

/* 댓글 */
.comments-strip { display: flex; align-items: center; gap: 8px; flex: none; width: 100%; padding: 7px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.comments-strip[hidden] { display: none; }
.comments-strip b { flex: none; color: var(--pink); }
.comments-strip span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.comments-strip i { flex: none; font-style: normal; font-size: 16px; line-height: 1; color: var(--muted); }
.comments-list { display: flex; flex-direction: column; gap: 8px; max-height: 45dvh; overflow-y: auto; }
.comment { background: var(--bg); border-radius: 12px; padding: 8px 10px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 14px; }
.comment span { flex-basis: 100%; order: 3; line-height: 1.5; word-break: break-word; }
.comment small { color: var(--muted); }
.comment .btn { margin-left: auto; padding: 2px 6px; font-size: 12px; }
.comments-form { display: flex; flex-direction: column; gap: 6px; }
.comments-form input { background: var(--field); color: var(--text); font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }

/* 좋아요 · 랭킹 */
.card .thumb { position: relative; }
.card .rank { position: absolute; top: 6px; left: 6px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; background: var(--chip-glass); font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.card .like { position: absolute; right: 6px; bottom: 6px; border: 0; border-radius: 999px; padding: 4px 8px; font: inherit; font-size: 12px; font-weight: 700; background: var(--chip-glass); color: var(--text); cursor: pointer; }
.card .like.on, .like-chip.on { color: var(--pink); }
.card .cmt { position: absolute; left: 6px; bottom: 6px; border: 0; border-radius: 999px; padding: 4px 8px; font: inherit; font-size: 12px; font-weight: 700; background: var(--chip-glass); color: var(--text); cursor: pointer; }
.gallery-tabs { flex-wrap: wrap; }

/* 무대 아래쪽 칩: 미션 · 함께한 날 · 좋아요 */
.mission-chip { top: auto; bottom: 8px; left: 8px; }
.mission-chip.on { background: var(--pink); color: var(--on-pink); }
.dday-chip { top: auto; bottom: 34px; left: 8px; cursor: default; }
.like-chip { top: auto; left: auto; bottom: 8px; right: 8px; }

/* 미션 목록 */
.mission-list { display: flex; flex-direction: column; gap: 8px; }
.mission { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.mission b { flex: 1; font-weight: 600; }
.mission small { color: var(--muted); }
.mission.done b { color: var(--muted); text-decoration: line-through; }

/* 캐릭터 단톡방 */
.group-list { display: flex; flex-direction: column; gap: 8px; }
.group-row { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; color: inherit; text-decoration: none; }
.group-row .faces { display: flex; flex: none; }
.group-row .faces img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--panel); background: var(--pink-soft); margin-left: -10px; }
.group-row .faces img:first-child { margin-left: 0; }
.group-row b { display: block; }
.group-row small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-row .grow { min-width: 0; }
.group-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pick-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; }
.pick-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 12px; border: 2px solid var(--line); background: var(--pink-soft); }
.pick-card input { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; accent-color: var(--pink); }
.pick-card input:checked + img { border-color: var(--pink); }
.pick-card span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-members { display: flex; justify-content: center; gap: 10px; }
.group-members span { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--muted); }
.group-members img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--pink-soft); border: 2px solid var(--line); }
.gmsg { display: flex; gap: 8px; align-items: flex-start; max-width: 88%; animation: pop .2s ease-out; }
.gmsg img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; background: var(--pink-soft); }
.gmsg .gbody { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gmsg small { color: var(--muted); font-size: 11px; padding-left: 4px; }
.gmsg .msg { max-width: 100%; }
.gmsg.typing .msg { color: var(--muted); }
.group-auto { align-self: center; }
