/* 전우담 디자인: 은은한 색 배경 + 반투명 유리 질감 + 누를 때 튀는 움직임 */
:root {
  color-scheme: light dark;
  --bg: #f4f6fc;
  --text: #131a2a;
  --muted: #626d84;
  --card: rgba(255, 255, 255, .72);
  --card-solid: #ffffff;
  --edge: rgba(255, 255, 255, .95);
  --line: rgba(19, 26, 42, .09);
  --glass: rgba(255, 255, 255, .6);
  --sheet: rgba(250, 251, 255, .95);
  --field: rgba(255, 255, 255, .78);
  --brand: #0d9aa0;
  --brand-ink: #07766f;
  --soft: rgba(13, 154, 160, .11);
  --grad: linear-gradient(135deg, #0ea37c 0%, #0b8fbc 48%, #6d55ee 100%);
  --grad-warm: linear-gradient(135deg, #ff9f43 0%, #ff4d7d 58%, #b14ce6 100%);
  --like: #ff3d6e;
  --danger: #d02a1e;
  --shadow: 0 10px 30px -14px rgba(33, 42, 84, .26);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.22, .9, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0e17;
    --text: #eef1f9;
    --muted: #9aa5bc;
    --card: rgba(31, 38, 55, .62);
    --card-solid: #181e2c;
    --edge: rgba(255, 255, 255, .09);
    --line: rgba(255, 255, 255, .1);
    --glass: rgba(18, 23, 36, .62);
    --sheet: rgba(22, 28, 42, .96);
    --field: rgba(255, 255, 255, .06);
    --brand-ink: #55dcc8;
    --soft: rgba(85, 220, 200, .14);
    --danger: #ff7d72;
    --shadow: 0 12px 32px -16px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  letter-spacing: -.012em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
/* 유리 질감이 살아나도록 뒤에 깔리는 색 번짐 */
body::before {
  content: "";
  position: fixed;
  inset: -12vmax;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38vmax 32vmax at 16% 16%, rgba(62, 224, 161, .34), transparent 70%),
    radial-gradient(36vmax 34vmax at 86% 30%, rgba(110, 98, 255, .27), transparent 70%),
    radial-gradient(40vmax 30vmax at 22% 84%, rgba(255, 159, 67, .22), transparent 70%),
    radial-gradient(32vmax 32vmax at 82% 82%, rgba(255, 77, 125, .18), transparent 70%);
  animation: drift 22s ease-in-out infinite alternate;
}
body.locked { overflow: hidden; }
#app { max-width: 600px; margin: 0 auto; min-height: 100dvh; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 16px; letter-spacing: -.02em; }
a { color: inherit; text-decoration: none; }
small { color: var(--muted); display: block; font-size: 12.5px; word-spacing: 1px; }
button { font: inherit; color: inherit; letter-spacing: inherit; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- 뼈대 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 6px; min-height: 60px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { flex: 1; min-width: 0; font-size: 19px; font-weight: 850; letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1.wordmark { display: flex; align-items: center; gap: 9px; font-size: 24px; font-weight: 900; letter-spacing: -.07em; }
.wordmark img { width: 40px; height: 40px; }
.wordmark span, .auth h1 { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (prefers-color-scheme: dark) {
  .wordmark span, .auth h1 { background-image: linear-gradient(135deg, #5ff0b8, #4fd0ea 50%, #a79cff); }
}

main { padding: 14px 12px calc(124px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
/* .fab 에는 움직임을 주지 않는다. (변형이 걸린 요소 안에서는 고정 위치가 어긋난다) */
main.enter > :not(.fab):not(.composer) { animation: rise .42s var(--ease) backwards; }
main.enter > :nth-child(2) { animation-delay: .04s; }
main.enter > :nth-child(3) { animation-delay: .08s; }
main.enter > :nth-child(4) { animation-delay: .12s; }
.stack, .feed, .match { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.feed > * { animation: rise .48s var(--ease) backwards; }
.feed > :nth-child(2) { animation-delay: .06s; }
.feed > :nth-child(3) { animation-delay: .12s; }
.feed > :nth-child(4) { animation-delay: .18s; }

.tabbar {
  position: fixed; z-index: 6; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(576px, calc(100% - 24px));
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px;
  border: 1px solid var(--edge); border-radius: 30px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  backdrop-filter: blur(24px) saturate(190%);
  box-shadow: 0 18px 44px -16px rgba(12, 18, 48, .42);
}
.tab-indicator {
  position: absolute; top: 6px; bottom: 6px; left: 6px;
  width: calc((100% - 12px) / 5);
  border-radius: 24px; background: var(--soft);
  transform: translateX(calc(var(--i, 0) * 100%));
  transition: transform .48s var(--spring), opacity .2s;
}
.tabbar.none .tab-indicator { opacity: 0; }
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 5px; font-size: 11px; font-weight: 600; color: var(--muted); transition: color .2s; }
.tabbar a:active .icon { transform: scale(.78); }
.tabbar a.active { color: var(--brand-ink); font-weight: 850; }
.tabbar a.active .icon { stroke: url(#brandGrad); stroke-width: 2.3; animation: hop .5s var(--spring); }
.tabbar .badge { position: absolute; top: 2px; left: calc(50% + 6px); }
body.in-room .tabbar { display: none; }
body.in-room main { padding-bottom: 0; min-height: calc(100dvh - 60px); }

.icon { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; transition: transform .22s var(--spring), fill .2s; }
.icon-more { stroke-width: 3.2; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; border: 0; background: none; color: inherit; border-radius: 50%; cursor: pointer; transition: transform .22s var(--spring), background .2s; }
.icon-btn:hover { background: var(--soft); }
.icon-btn:active { transform: scale(.84); }
.icon-btn .badge { position: absolute; top: 0; right: -2px; }

.badge { display: inline-block; min-width: 19px; padding: 0 5px; border-radius: 10px; background: var(--grad-warm); color: #fff; font-size: 11px; font-weight: 800; line-height: 19px; text-align: center; margin-left: 4px; animation: popin .4s var(--spring); }

/* ---------- 공통 부품 ---------- */
.card { background: var(--card); border: 1px solid var(--edge); border-radius: 24px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.row { flex-direction: row; gap: 12px; }
.card.tap { position: relative; overflow: hidden; transition: transform .24s var(--spring); }
.card.tap:active { transform: scale(.97); }
.row { display: flex; align-items: center; gap: 10px; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
.meta { text-align: right; flex: none; }
.name { font-weight: 800; }
.name small { display: inline; font-weight: 400; }
.rank { margin-left: 6px; font-size: 11px; font-weight: 700; color: var(--brand-ink); background: var(--soft); border-radius: 99px; padding: 2px 7px; vertical-align: 1px; }
.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar {
  --av: linear-gradient(135deg, #34d399, #0d9488);
  --ring: conic-gradient(from 200deg, #3ee0a1, #0d9aa8, #6e62ff, #ff7a59, #3ee0a1);
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2.5px solid transparent;
  background: var(--av) padding-box, var(--ring) border-box;
  box-shadow: inset 0 0 0 2px var(--card-solid);
  color: #fff; font-weight: 800; font-size: 15px;
}
.av1 { --av: linear-gradient(135deg, #60a5fa, #4f46e5); }
.av2 { --av: linear-gradient(135deg, #fb923c, #e11d48); }
.av3 { --av: linear-gradient(135deg, #a78bfa, #7c3aed); }
.av4 { --av: linear-gradient(135deg, #22d3ee, #0284c7); }
.av5 { --av: linear-gradient(135deg, #f472b6, #be185d); }
.av-anon { --av: linear-gradient(135deg, #94a3b8, #475569); --ring: linear-gradient(135deg, #cbd5e1, #64748b); font-size: 20px; }

ul.list, ol.list { list-style: none; margin: 0; gap: 0; }
ul.list { padding: 0; }
.list > li { padding: 11px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.card.list { padding: 4px 16px; }

.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 48px; padding: 10px 18px; flex: none;
  border: 0; border-radius: 17px;
  background: var(--grad); color: #fff;
  font-weight: 800; cursor: pointer; user-select: none;
  box-shadow: 0 12px 24px -12px rgba(11, 129, 154, .85);
  transition: transform .24s var(--spring), filter .2s, box-shadow .2s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.95); }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--edge); box-shadow: var(--shadow); }
.btn.danger { background: rgba(240, 68, 56, .12); color: var(--danger); box-shadow: none; }
.btn.block { width: 100%; }
.btn.small { min-height: 34px; padding: 4px 14px; border-radius: 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.busy::after { content: ""; width: 15px; height: 15px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .24; transform: scale(0); pointer-events: none; animation: ripple .6s ease-out forwards; }
.link { border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px; align-self: center; flex: none; }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 800; font-size: 13px; padding-left: 4px; }
.field small { padding-left: 4px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select {
  width: 100%; min-width: 0; min-height: 48px; padding: 11px 15px;
  border: 1.5px solid var(--line); border-radius: 16px;
  background: var(--field); color: var(--text);
  font: inherit; font-size: 16px; /* 아이폰에서 입력할 때 화면이 확대되지 않게 */
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
input:not([type=checkbox]):not([type=radio]):focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--soft); }
textarea { resize: vertical; }
.row input.grow { width: auto; }
input.search:not([type=checkbox]):not([type=radio]):not([type=file]) { border-radius: 99px; padding-left: 20px; box-shadow: var(--shadow); }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 14px; }
.check input { width: 21px; height: 21px; margin: 0; accent-color: var(--brand); flex: none; }
.picker { display: flex; flex-direction: column; gap: 12px; max-height: 240px; overflow-y: auto; padding: 4px; }

/* 알약 모양 탭: 선택 표시가 미끄러지듯 움직인다 */
.tabs { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); flex: none; padding: 4px; border: 1px solid var(--edge); border-radius: 19px; background: var(--card); box-shadow: var(--shadow); }
.tabs .indicator { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--n, 1)); border-radius: 15px; background: var(--grad); transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .45s var(--spring); }
.tabs button { position: relative; z-index: 1; overflow: hidden; border-radius: 15px; min-width: 0; padding: 9px 2px; border: 0; background: none; color: var(--muted); font-size: 13.5px; font-weight: 800; white-space: nowrap; cursor: pointer; transition: color .25s; }
.tabs button.active { color: #fff; }
.tabs button .badge { min-width: 16px; line-height: 16px; margin-left: 3px; }
.tabs.small button { padding: 5px 2px; font-size: 12.5px; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: none; padding: 2px 2px 6px; }
.chip { display: inline-block; flex: none; padding: 3px 11px; border: 1px solid var(--edge); border-radius: 99px; background: var(--card); color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; margin-right: 6px; }
button.chip { position: relative; overflow: hidden; cursor: pointer; padding: 8px 15px; margin: 0; box-shadow: var(--shadow); transition: transform .22s var(--spring); }
button.chip:active { transform: scale(.9); }
.chip.active { background: var(--grad); border-color: transparent; color: #fff; }

.notice { background: var(--soft); border: 1px solid var(--edge); border-radius: 20px; padding: 14px 16px; }
.notice strong { display: flex; align-items: center; gap: 6px; }
.notice ol { margin: 8px 0 0; padding-left: 20px; font-size: 13.5px; }
.notice a { text-decoration: underline; font-weight: 700; }
.warn { background: rgba(255, 159, 67, .16); border-radius: 16px; padding: 11px 14px; font-size: 13px; font-weight: 600; }
.hint { color: var(--muted); font-size: 12.5px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; color: var(--muted); padding: 40px 16px; }
.empty::before { content: "✨"; display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 26px; background: var(--card); border: 1px solid var(--edge); box-shadow: var(--shadow); font-size: 30px; animation: float 3.2s ease-in-out infinite; }
.section { margin-top: 6px; padding-left: 4px; }
.prose { white-space: pre-wrap; }
.prose.big { font-size: 17px; }
.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-clamp: 6; overflow: hidden; }

.skeleton { display: flex; flex-direction: column; gap: 14px; list-style: none; }
.sk { display: block; height: 12px; border-radius: 99px; background: linear-gradient(100deg, var(--soft) 35%, var(--card-solid) 50%, var(--soft) 65%); background-size: 220% 100%; animation: shimmer 1.1s linear infinite; }
.sk.circle { width: 42px; height: 42px; flex: none; }
.sk.short { width: 40%; }
.sk.mid { width: 70%; }

/* ---------- 게시물 ---------- */
.post { padding: 14px; gap: 12px; }
.post-head { display: flex; align-items: center; gap: 11px; }
.post-title { font-size: 16.5px; letter-spacing: -.02em; }
.post > .prose { padding: 0 3px; }
.media { position: relative; margin: 0 -5px; border-radius: 20px; overflow: hidden; user-select: none; }
.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; touch-action: manipulation; background: var(--soft); }
.carousel img { width: 100%; flex: none; aspect-ratio: 4 / 5; object-fit: cover; scroll-snap-align: start; animation: fade .5s ease; }
.carousel.single img { aspect-ratio: auto; height: auto; min-height: 180px; max-height: 520px; }
.counter { position: absolute; top: 10px; right: 10px; padding: 3px 10px; border-radius: 99px; background: rgba(10, 14, 26, .5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; font-size: 12px; font-weight: 700; }
.post > .link { align-self: flex-start; padding: 0 3px; }
.post-actions { display: flex; gap: 20px; padding: 0 3px; }
.action { position: relative; display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: inherit; font-weight: 800; padding: 4px 0; cursor: pointer; }
.action .icon { width: 26px; height: 26px; }
.action:active .icon { transform: scale(.72); }
.action.like.on { color: var(--like); }
.action.like.on .icon { fill: currentColor; }
.action.like.pop .icon { animation: pop .5s var(--spring); }
.burst { position: absolute; left: 13px; top: 50%; pointer-events: none; }
.burst i { --a: 0deg; position: absolute; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: var(--like); animation: spark .6s ease-out forwards; }
.burst i:nth-child(2) { --a: 60deg; background: #ff9f43; }
.burst i:nth-child(3) { --a: 120deg; background: #6e62ff; }
.burst i:nth-child(4) { --a: 180deg; }
.burst i:nth-child(5) { --a: 240deg; background: #3ee0a1; }
.burst i:nth-child(6) { --a: 300deg; background: #ff9f43; }
.big-heart { position: absolute; left: 50%; top: 50%; width: 112px; height: 112px; margin: -56px 0 0 -56px; pointer-events: none; filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .35)); animation: big-heart .95s var(--ease) forwards; }
.big-heart .icon { width: 100%; height: 100%; fill: #fff; stroke: #fff; }

/* 글만 있는 썰의 색 배경 */
.theme-dawn { --paint: linear-gradient(140deg, #4a56d2, #8248cc 55%, #bd468a); }
.theme-sunset { --paint: linear-gradient(140deg, #e2761a, #e2474e 52%, #b52d84); }
.theme-forest { --paint: linear-gradient(140deg, #084c3d, #0c7a57 55%, #2f9a5e); }
.theme-ocean { --paint: linear-gradient(140deg, #0a347e, #0968a8 55%, #0e8f9f); }
.theme-night { --paint: linear-gradient(140deg, #0d1426, #1d2857 55%, #3a2968); }
.theme-peach { --paint: linear-gradient(140deg, #ffd6c6, #ffc4d8 52%, #e4ceff); }
.themed { position: relative; display: flex; align-items: center; justify-content: center; min-height: 260px; margin: 0 -5px; padding: 32px 24px; border-radius: 20px; background: var(--paint); color: #fff; text-align: center; overflow: hidden; user-select: none; touch-action: manipulation; }
.themed::before, .themed::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .13); }
.themed::before { width: 180px; height: 180px; top: -70px; right: -50px; }
.themed::after { width: 130px; height: 130px; bottom: -60px; left: -30px; }
.themed p { position: relative; z-index: 1; font-size: 21px; font-weight: 800; line-height: 1.5; white-space: pre-wrap; text-shadow: 0 2px 14px rgba(0, 0, 0, .25); }
.themed .big-heart { z-index: 2; }
.theme-peach.themed, .theme-peach textarea { color: #3d1f36; text-shadow: none; }
.theme-peach.themed p { text-shadow: none; }

.fab { position: fixed; z-index: 5; right: max(18px, calc(50% - 282px)); bottom: calc(94px + env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 7px; min-height: 52px; padding: 12px 20px; border: 0; border-radius: 99px; overflow: hidden; background: var(--grad-warm); color: #fff; font-weight: 850; box-shadow: 0 16px 30px -10px rgba(255, 77, 125, .75); cursor: pointer; animation: popin .5s var(--spring) .12s backwards; transition: transform .24s var(--spring); }
.fab:hover { transform: translateY(-2px); }
.fab:active { transform: scale(.9); }
.fab .icon { stroke-width: 2.6; transition: transform .35s var(--spring); }
.fab:active .icon { transform: rotate(90deg); }

/* ---------- 아래에서 올라오는 창 ---------- */
.backdrop { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(9, 13, 28, .36); -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px); animation: fade .24s ease; }
.sheet { width: 100%; max-width: 600px; max-height: 93dvh; display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--edge); border-bottom: 0; border-radius: 32px 32px 0 0; box-shadow: 0 -22px 60px -20px rgba(9, 13, 28, .5); animation: sheet-up .44s var(--ease); }
.sheet::before { content: ""; width: 42px; height: 5px; margin: 9px auto 0; border-radius: 99px; background: var(--line); flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 10px 6px 20px; }
.sheet-head h2 { font-size: 18px; font-weight: 850; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.sheet-body > * { flex-shrink: 0; }
.backdrop.closing { pointer-events: none; animation: fade-out .22s ease forwards; }
.backdrop.closing .sheet { animation: sheet-down .22s ease-in forwards; }

/* ---------- 글쓰기 ---------- */
.who { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 99px; background: var(--field); }
.segmented.wrap { display: flex; flex-wrap: wrap; border-radius: 20px; }
.segmented label { position: relative; cursor: pointer; }
.segmented span { display: block; word-spacing: 3px; padding: 6px 13px; border-radius: 99px; color: var(--muted); font-size: 12.5px; font-weight: 800; transition: color .2s, transform .22s var(--spring); }
.segmented input:checked + span { background: var(--grad); color: #fff; }
.segmented label:active span { transform: scale(.9); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); }

.canvas { position: relative; padding: 4px 4px 26px; border: 1.5px solid var(--line); border-radius: 26px; background: var(--paint, var(--field)); transition: border-color .2s, box-shadow .2s; }
.canvas:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--soft); }
.canvas textarea:not([type=file]) { display: block; min-height: 150px; border: 0; background: transparent; box-shadow: none; resize: none; font-size: 18px; line-height: 1.55; }
.canvas textarea:focus { border: 0; box-shadow: none; }
.canvas[class*="theme-"] { border-color: transparent; }
.canvas[class*="theme-"] textarea:not([type=file]) { min-height: 220px; padding-top: 56px; color: #fff; text-align: center; font-size: 21px; font-weight: 800; }
.canvas[class*="theme-"] textarea::placeholder { color: currentColor; opacity: .72; }
.canvas.theme-peach textarea:not([type=file]) { color: #3d1f36; }
.canvas .count { position: absolute; right: 16px; bottom: 7px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.canvas[class*="theme-"] .count { color: rgba(255, 255, 255, .85); }
.canvas.theme-peach .count { color: #3d1f36; }

.swatches { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; padding: 8px 8px; }
.swatches label { position: relative; flex: none; cursor: pointer; }
.swatches span { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--paint, var(--card-solid)); border: 1px solid var(--line); font-size: 13px; font-weight: 800; transition: transform .26s var(--spring), box-shadow .2s; }
.swatches input:checked + span { transform: scale(1.12); box-shadow: 0 0 0 2.5px var(--card-solid), 0 0 0 5px var(--brand); }
.swatches input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 5px; }

.emoji-row { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding: 3px 1px; }
.emoji { flex: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 15px; background: var(--field); font-size: 21px; cursor: pointer; transition: transform .26s var(--spring); }
.emoji:active { transform: scale(1.3) rotate(-10deg); }

.switch-row { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1.5px solid var(--line); border-radius: 20px; background: var(--field); cursor: pointer; transition: border-color .2s, background .2s; }
.switch-row .mask { font-size: 24px; transition: transform .35s var(--spring); }
.switch-row:has(input:checked) { border-color: var(--brand); background: var(--soft); }
.switch-row:has(input:checked) .mask { transform: scale(1.25) rotate(-10deg); }
.switch-row strong { display: block; }
.switch { position: relative; flex: none; width: 52px; height: 31px; border-radius: 99px; background: rgba(120, 130, 155, .42); transition: background .25s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 25px; height: 25px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .32s var(--spring); }
input:checked + .switch { background: var(--grad); }
input:checked + .switch::after { transform: translateX(21px); }
input:focus-visible + .switch { outline: 2px solid var(--brand); outline-offset: 2px; }

.photo-row { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-add { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 86px; height: 86px; flex: none; border: 2px dashed var(--brand); border-radius: 20px; background: var(--soft); color: var(--brand-ink); font-size: 12px; font-weight: 800; text-align: center; cursor: pointer; transition: transform .24s var(--spring); }
.photo-add:active { transform: scale(.93); }
.photo-add:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.photo-add .icon { width: 28px; height: 28px; }
.photo-add.wide { width: 100%; height: 132px; font-size: 14px; }
.preview { position: relative; width: 86px; height: 86px; padding: 0; border: 0; border-radius: 20px; overflow: hidden; cursor: pointer; background: var(--soft); animation: popin .4s var(--spring); }
.preview.wide { width: 100%; height: 220px; }
.preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview.wide img { object-fit: contain; }
.preview span { position: absolute; top: 5px; right: 5px; width: 23px; height: 23px; border-radius: 50%; background: rgba(10, 14, 26, .66); color: #fff; font-weight: 800; line-height: 22px; }

.comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.comments li:not(.skeleton) { display: flex; gap: 10px; align-items: flex-start; animation: rise .3s var(--ease) backwards; }
.comments .grow { background: var(--field); border: 1px solid var(--line); border-radius: 4px 18px 18px 18px; padding: 9px 13px; }

/* ---------- 계급(로고) 고르기 ---------- */
.rank-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin: 0; padding: 0; border: 0; min-width: 0; }
.rank-picker legend { margin-bottom: 8px; padding: 0 0 0 4px; }
.rank-picker label { position: relative; cursor: pointer; }
.rank-picker span { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 2px 7px; border: 2px solid var(--line); border-radius: 18px; background: var(--field); font-size: 12.5px; font-weight: 800; color: var(--muted); white-space: nowrap; transition: transform .26s var(--spring), border-color .2s, background-color .2s; }
.rank-picker img { width: 64px; height: 64px; max-width: 100%; }
.rank-picker label:active span { transform: scale(.92); }
.rank-picker input:checked + span { border-color: var(--brand); background: var(--soft); color: var(--brand-ink); transform: scale(1.04); }
.rank-picker input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.wordmark img { animation: popin .45s var(--spring); }

/* ---------- 러닝 ---------- */
.card.stats { position: relative; overflow: hidden; display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; padding: 20px 10px; border: 0; background: var(--grad); color: #fff; box-shadow: 0 20px 38px -20px rgba(87, 80, 216, .85); }
.card.stats::after { content: "🏃"; position: absolute; right: -8px; bottom: -18px; font-size: 76px; opacity: .16; transform: scaleX(-1); }
.card.stats small { color: rgba(255, 255, 255, .85); font-weight: 700; }
.card.stats strong { font-size: 22px; letter-spacing: -.03em; }
.ranking { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.ranking > li { animation: rise .44s var(--ease) backwards; }
.ranking > li:nth-child(2) { animation-delay: .07s; }
.ranking > li:nth-child(3) { animation-delay: .14s; }
.ranking.card.list { padding: 4px 16px; gap: 0; }
.ranking > li.card.mine { border: 2px solid transparent; background: linear-gradient(var(--card-solid), var(--card-solid)) padding-box, var(--grad) border-box; }
.ranking.list > li.mine { color: var(--brand-ink); }
.place { width: 30px; flex: none; text-align: center; font-weight: 900; font-size: 19px; }
.score { font-weight: 900; font-size: 16px; white-space: nowrap; }
.bar { height: 10px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--grad); transform-origin: left; animation: grow 1s var(--ease) .1s backwards; }
.proof-link { display: inline-flex; align-items: center; gap: 4px; }
.proof-img { width: 100%; max-height: 60dvh; object-fit: contain; border-radius: 18px; }

/* ---------- 대화 ---------- */
.messages { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.day { align-self: center; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--card); border: 1px solid var(--edge); border-radius: 99px; padding: 3px 13px; }
.msg { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.msg.mine { align-items: flex-end; }
.msg.new { animation: msg-in .38s var(--spring) backwards; transform-origin: bottom left; }
.msg.mine.new { transform-origin: bottom right; }
.bubble-row { display: flex; align-items: flex-end; gap: 6px; max-width: 85%; }
.msg.mine .bubble-row { flex-direction: row-reverse; }
.bubble { white-space: pre-wrap; padding: 10px 15px; border-radius: 22px 22px 22px 6px; background: var(--card-solid); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.msg.mine .bubble { border: 0; border-radius: 22px 22px 6px 22px; background: var(--grad); color: #fff; }
.bubble-row time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.composer { position: sticky; bottom: 0; margin: 0 -12px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%); border-top: 1px solid var(--line); }
.composer input:not([type=checkbox]):not([type=radio]):not([type=file]) { border-radius: 99px; }
.composer .btn { width: 48px; padding: 0; border-radius: 50%; }

/* ---------- 관리 ---------- */
dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0; }
dt { color: var(--muted); font-size: 13px; }
dd { margin: 0; }
.temp { font: 700 24px ui-monospace, Menlo, monospace; text-align: center; user-select: all; }
.report-img { max-width: 100%; max-height: 260px; object-fit: contain; border-radius: 16px; }

/* ---------- 로그인·가입 ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 12px; max-width: 430px; margin: 0 auto; padding: 36px 18px calc(36px + env(safe-area-inset-bottom)); }
.auth .logo-wrap { align-self: center; animation: popin .7s var(--spring); }
.auth .logo { display: block; width: 104px; height: 104px; filter: drop-shadow(0 18px 26px rgba(11, 129, 154, .42)); animation: float 4s ease-in-out infinite; }
.auth h1 { text-align: center; font-size: 38px; font-weight: 900; letter-spacing: -.07em; line-height: 1.25; }
.auth .sub { text-align: center; color: var(--muted); font-weight: 600; }
.auth-card { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; padding: 22px 18px; border: 1px solid var(--edge); border-radius: 30px; background: var(--glass); -webkit-backdrop-filter: blur(26px) saturate(180%); backdrop-filter: blur(26px) saturate(180%); box-shadow: 0 24px 60px -28px rgba(33, 42, 84, .45); animation: rise .55s var(--ease) .08s backwards; }

.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(104px + env(safe-area-inset-bottom)); transform: translate(-50%, 18px) scale(.9); width: max-content; max-width: min(90vw, 480px); padding: 12px 20px; border-radius: 24px; background: rgba(17, 23, 40, .84); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: #fff; font-weight: 700; text-align: center; opacity: 0; pointer-events: none; transition: opacity .22s, transform .38s var(--spring); }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- 움직임 ---------- */
@keyframes drift { to { transform: translate3d(3vmax, -2.5vmax, 0) scale(1.07); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes popin { from { opacity: 0; transform: scale(.5); } }
@keyframes hop { 0% { transform: scale(.72) translateY(2px); } 55% { transform: scale(1.2) translateY(-3px); } 100% { transform: none; } }
@keyframes pop { 0% { transform: scale(.6); } 50% { transform: scale(1.4) rotate(-8deg); } 100% { transform: none; } }
@keyframes spark { from { transform: rotate(var(--a)) translateY(-8px); } to { transform: rotate(var(--a)) translateY(-27px) scale(0); opacity: 0; } }
@keyframes big-heart { 0% { opacity: 0; transform: scale(.2) rotate(-18deg); } 25% { opacity: 1; transform: scale(1.16) rotate(7deg); } 45% { transform: scale(.94); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.2) translateY(-44px); } }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 50% { transform: translateY(-7px); } }
@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes msg-in { from { opacity: 0; transform: translateY(12px) scale(.86); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
