/* ==========================================================================
   첫눈 · app.css (participant screens)
   Builds on base.css. Never puts a background on html, body or #app: the living sky
   (shared/sky.js) is the signature and sits behind everything. Panes stay quiet; the
   received pane on home is the emotional centre.
   ========================================================================== */

/* ---------- 1. Shell ----------------------------------------------------- */
.app { position: relative; min-height: 100%; }
.sec { display: contents; }
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { outline: none; }

.noscript {
  max-width: 420px;
  margin: 40vh auto 0;
  padding: 0 24px;
  text-align: center;
  font-size: var(--fs-15);
  color: var(--text-2);
}

/* page entrance: children rise one after another. The animation sits on the children,
   not on the page, so frosted panes keep their blur while they fade in. */
@keyframes app-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.page.is-entering > *,
.page.is-entering > .sec > * { animation: app-in 0.42s var(--ease) var(--in-delay, 0s) both; }
.page.is-entering > :nth-child(2) { --in-delay: 0.04s; }
.page.is-entering > :nth-child(3) { --in-delay: 0.08s; }
.page.is-entering > :nth-child(4) { --in-delay: 0.12s; }
.page.is-entering > :nth-child(5) { --in-delay: 0.16s; }
.page.is-entering > :nth-child(n+6) { --in-delay: 0.2s; }

.page-center { justify-content: center; }

/* boot: one crystal breathing in the dark before the first answer */
.page-boot { justify-content: center; align-items: center; }
.boot-mark {
  width: 46px;
  height: 46px;
  background: var(--lamp-200);
  -webkit-mask: var(--crystal-mask) center / contain no-repeat;
  mask: var(--crystal-mask) center / contain no-repeat;
  opacity: 0.55;
  animation: fs-breathe 2.8s ease-in-out infinite;
}

/* small shared bits */
.privacy {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: var(--fs-12);
  line-height: 1.55;
  color: var(--text-3);
}
.privacy > .icon { flex: none; margin-top: 2px; color: var(--text-3); }

.form-error { font-size: var(--fs-13); line-height: 1.5; font-weight: 500; color: var(--danger); }
.form-error:empty { display: none; }

.load-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 16px;
  text-align: center;
  font-size: var(--fs-15);
  color: var(--text-2);
}

.skeleton-list { display: flex; flex-direction: column; gap: 18px; padding: 10px 0; }
.skeleton-row { display: flex; align-items: center; gap: 14px; }

/* ---------- 2. Tab bar extras -------------------------------------------- */
/* a small lamp dot on 첫인상 while the vote is open and I have not voted */
.tab-dot {
  position: absolute;
  top: 9px;
  left: calc(50% + 9px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lamp-300);
  box-shadow: 0 0 0 2px var(--night-900), 0 0 9px rgba(255, 190, 145, 0.85);
}

/* ---------- 3. Login and join -------------------------------------------- */
.page-auth { gap: 18px; }
.page-login { justify-content: center; }

.auth-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 7vh 0 4vh;
  text-align: center;
}
.auth-hero .wordmark { margin-right: 0.2em; text-wrap: balance; } /* room for the crystal that lands on it */
.wordmark-md { font-size: 48px; }
.wordmark-long { font-size: 34px; }
/* a title on two lines (login.js measures it): the landing crystal would hang at the box corner */
.wordmark.is-wrapped { margin-right: 0; }
.wordmark.is-wrapped::before, .wordmark.is-wrapped::after { display: none; }
.auth-sub {
  max-width: 22em;
  font-size: var(--fs-15);
  line-height: 1.55;
  letter-spacing: 0.04em;
  color: var(--text-2);
  text-wrap: balance;
}

/* a notice of two sentences over the form (an entry link opened too often): the second one,
   the way in with a PIN, starts on its own line */
.auth-banner-text { flex: 1 1 auto; min-width: 0; }
.auth-banner-text > span { display: block; text-wrap: pretty; }
.auth-banner-text > span + span { margin-top: 4px; }

.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-form > .btn { margin-top: 2px; }
.auth-help {
  font-size: var(--fs-13);
  line-height: 1.55;
  color: var(--text-3);
  text-align: center;
  text-wrap: balance;
}

.auth-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.auth-foot .privacy { justify-content: center; max-width: 330px; text-align: left; }
.auth-alt {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 10px;
  font-size: var(--fs-15);
  font-weight: 600;
  color: var(--lamp-200);
  text-decoration: none;
}
.auth-alt:hover { text-decoration: underline; text-underline-offset: 4px; }

.auth-top { display: flex; align-items: center; gap: 4px; min-height: 48px; margin-left: -10px; }
.join-intro { padding: 4px 2px 2px; }
.join-closed { display: flex; flex-direction: column; gap: 12px; }
.join-closed .btn { margin-top: 6px; }
.join-closed-text { font-size: var(--fs-15); line-height: 1.65; color: var(--text-2); }

/* ---------- 4. Home ------------------------------------------------------ */
.home-mast { padding-top: 2px; }
/* a long event name or subtitle: the subtitle moves under the name instead of squeezing beside it */
.home-mast.fs-masthead { flex-wrap: wrap; row-gap: 2px; }
.home-mast .fs-masthead-sub { line-height: 1.5; }
.home-hello { display: flex; flex-direction: column; gap: 4px; padding: 20px 2px 6px; }
.home-when { font-size: var(--fs-12); letter-spacing: 0.08em; color: var(--text-3); }
.home-name { overflow-wrap: anywhere; }
.home-context { font-size: var(--fs-15); }

.notice-text { white-space: pre-line; font-size: var(--fs-15); line-height: 1.7; color: var(--text); }

.round-pane { display: flex; flex-direction: column; gap: 8px; }
.round-pane .pane-title { margin-bottom: 4px; }
.round-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.round-lead {
  font-family: var(--font-display);
  font-size: var(--fs-20);
  line-height: 1.45;
  color: var(--text);
  text-wrap: balance;
}
.round-when { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); }
.round-when > .icon { color: var(--lamp-200); }
.round-when.tiny { font-size: var(--fs-12); color: var(--text-3); margin-top: 4px; }
.round-label { font-size: var(--fs-13); font-weight: 600; color: var(--text-2); }
.round-cta { margin-top: 10px; }

.fs-received { padding-top: 22px; padding-bottom: 18px; }
/* "쪽지로 먼저 말을 걸어 보세요.": a 44px target without moving the lines around it */
.fs-received-sub .fs-link { display: inline-block; padding: 14px 10px; margin: -14px -10px; }

.notes-row { flex-wrap: wrap; row-gap: 10px; }
.notes-pane .btn-sm { min-height: 44px; } /* a full finger target */
.notes-line { font-size: var(--fs-15); color: var(--text); }
.notes-line b { font-weight: 700; color: var(--lamp-200); }
.notes-line.is-quiet { color: var(--text-2); }
.notes-pane .pane-title > .dot { margin-left: 2px; }

/* ---------- 5. Vote ------------------------------------------------------ */
.vote-head { display: flex; flex-direction: column; gap: 6px; padding: 12px 2px 4px; }
.vote-lead { font-size: var(--fs-15); line-height: 1.6; color: var(--text-2); }
.vote-note, .vote-when { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); }
.vote-note > .icon, .vote-when > .icon { color: var(--lamp-200); }
.vote-grid { min-height: 160px; }
.namecard-skeleton { min-height: 150px; border-radius: 20px; }
.fs-namecard { touch-action: manipulation; }
.fs-rank > .icon { width: 16px; height: 16px; }

/* The pick screen ends in one dock: the count and 다음 ride on a frosted band that runs down behind
   the tab bar, so no card text shows between the two bars. The dock carries the room the page
   usually keeps for the tab bar, so it sits flush with the bottom when the list ends too. */
.page-pick { padding-bottom: 0; }
.vote-dock {
  position: sticky;
  z-index: 30;
  bottom: 0;
  margin: auto calc(-20px - var(--safe-r)) 0 calc(-20px - var(--safe-l));
  padding: 22px calc(20px + var(--safe-r)) calc(var(--safe-b) + var(--tabbar-h)) calc(20px + var(--safe-l));
}
.vote-dock::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 13, 36, 0) 0, rgba(11, 13, 36, 0.5) 30px, rgba(11, 13, 36, 0.62) 100%);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 26px);
  mask-image: linear-gradient(180deg, transparent 0, #000 26px);
  pointer-events: none;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .vote-dock::before { background: linear-gradient(180deg, rgba(11, 13, 36, 0) 0, rgba(11, 13, 36, 0.94) 26px); }
}
/* wide screens: the band also fades at its sides, so it melts into the sky around the column
   (from 600px the column has at least 40px of sky on each side, so the wider band never overflows) */
@media (min-width: 600px) {
  .vote-dock::before {
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 26px), linear-gradient(90deg, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(180deg, transparent 0, #000 26px), linear-gradient(90deg, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
    mask-composite: intersect;
    left: -28px;
    right: -28px;
  }
}
.vote-dock > .fs-actionbar { position: relative; bottom: auto; }
.vote-bar-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.vote-bar-hint { font-size: var(--fs-12); line-height: 1.4; color: var(--text-2); }

.review-list { list-style: none; margin: 0; padding: 4px 0; }
.review-row { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; }
.review-row + .review-row { border-top: 1px solid var(--line); }
.review-row.is-moved { animation: review-glow 0.9s var(--ease); }
@keyframes review-glow {
  from { background-color: rgba(255, 217, 186, 0.13); }
  to { background-color: rgba(255, 217, 186, 0); }
}
.review-rank {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--lamp-200), var(--lamp-300));
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
.review-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.review-name {
  font-family: var(--font-display);
  font-size: var(--fs-17);
  line-height: 1.35;
  color: var(--text);
  /* the whole nickname (12자 at most): two names that differ only at the end must stay apart */
  overflow-wrap: anywhere;
}
.review-intro { font-size: var(--fs-13); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-move { flex: none; display: flex; gap: 4px; margin-right: -4px; }
.review-move .btn-icon.btn-sm { width: 44px; height: 44px; }
.review-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 0 4px;
  font-size: var(--fs-13);
  line-height: 1.6;
  color: var(--text-2);
}
.review-note > .icon { flex: none; margin-top: 3px; color: var(--lamp-200); }
.review-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 4px; }

/* sent: one crystal drifts down onto the screen */
.page-sent { justify-content: center; }
.sent { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6vh 0 10vh; text-align: center; }
.sent-art {
  margin-bottom: 8px;
  color: var(--lamp-200);
  filter: drop-shadow(0 0 3px rgba(255, 228, 206, 0.8)) drop-shadow(0 0 18px rgba(255, 190, 145, 0.55));
  animation: fs-settle-hero 1.4s var(--ease-settle) 0.1s both;
}
.sent .chips { justify-content: center; margin-top: 6px; }
.sent-home { margin-top: 18px; min-width: 168px; }

/* ---------- 6. Notes inbox ----------------------------------------------- */
.notes-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 8px; margin-right: -8px; }
.notes-intro { display: flex; flex-direction: column; gap: 6px; margin-top: -6px; }
.notes-sub { font-size: var(--fs-13); line-height: 1.55; color: var(--text-2); }
.notes-body { min-height: 30vh; }
.fs-dm-row { min-height: 72px; }
.dm-closed { display: inline-flex; flex: none; color: var(--text-3); }
.notes-empty { padding-top: 48px; }

/* ---------- 7. New note -------------------------------------------------- */
.subhead { display: flex; align-items: center; gap: 4px; min-height: 52px; margin-left: -10px; }
.subhead-title {
  font-family: var(--font-display);
  font-size: var(--fs-24);
  font-weight: 400;
  line-height: 1.35;
  color: var(--text);
}
.search { position: relative; }
.search > .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-input { padding-left: 46px; border-radius: var(--radius-pill); }
.newnote-note { display: flex; align-items: flex-start; gap: 8px; padding: 0 4px; font-size: var(--fs-13); line-height: 1.6; color: var(--text-2); }
.newnote-note > .icon { flex: none; margin-top: 3px; color: var(--lamp-200); }
.people-list { list-style: none; margin: 0 -10px; padding: 0; }
.person-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 10px;
  border-radius: 20px;
  text-align: left;
  color: inherit;
  transition: background-color 0.18s;
}
.person-row:hover, .person-row:active { background: rgba(255, 255, 255, 0.06); }
.person-row:disabled { opacity: 0.5; }
.person-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.person-name { font-size: var(--fs-15); font-weight: 600; line-height: 1.35; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-intro { font-size: 14px; line-height: 1.4; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-row > .badge { height: 22px; }
.person-go { color: var(--text-3); }
.people-none { padding: 28px 4px; text-align: center; color: var(--text-2); }

/* ---------- 8. Chat ------------------------------------------------------ */
/* The chat is a fixed column sized to the visual viewport, so the composer rides on top of
   the keyboard (iOS and Android) while only the message list scrolls. */
html.is-chat, html.is-chat body { overflow: hidden; overscroll-behavior: none; }

.chat-screen {
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  height: var(--vvh, 100dvh);
  transform: translate3d(0, var(--vvt, 0px), 0);
  display: flex;
  flex-direction: column;
}
.chat-col { width: 100%; max-width: var(--page-max); margin-inline: auto; }

.chat-top {
  flex: none;
  position: relative;
  z-index: 2;
  padding: calc(var(--safe-t) + 4px) calc(var(--safe-r) + 10px) 2px calc(var(--safe-l) + 10px);
}
.chat-head-avatar { display: inline-flex; flex: none; }
.chat-top .fs-chathead-title { font-size: 16px; font-weight: 700; }

.chat-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overflow-anchor: none;
  padding: 0 calc(var(--safe-r) + 16px) 0 calc(var(--safe-l) + 16px);
  /* messages dissolve into the sky at the top edge instead of being cut */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 calc(100% - 8px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 calc(100% - 8px), transparent 100%);
}
.chat-body { display: flex; flex-direction: column; padding: 6px 0 10px; }
.chat-older { display: flex; justify-content: center; padding: 14px 0 2px; }
.chat-body .fs-chat-intro { padding-top: 22px; }

.chat-skeleton { display: flex; flex-direction: column; gap: 10px; padding: 32px 0; }
.chat-skeleton .skeleton { height: 40px; border-radius: 22px; }
.chat-skeleton .cs-a { width: 58%; }
.chat-skeleton .cs-b { width: 42%; align-self: flex-end; }
.chat-skeleton .cs-c { width: 66%; }
.chat-missing { padding-top: 12vh; }

/* new bubbles arrive softly; the animation sits on the children (keeps the frost blur) */
.fs-msg.is-new > * { animation: msg-in 0.34s var(--ease) both; }
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.fs-msg.theirs .fs-bubble { touch-action: manipulation; cursor: default; }
.fs-msg.theirs .fs-bubble:focus-visible { outline-offset: 2px; }
@media (hover: none) {
  .fs-bubble { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
}
button.fs-heart { cursor: pointer; }
.fs-heart > .icon { display: block; }

/* the heart that blooms on a double tap */
.heart-burst {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: var(--rose-300);
  filter: drop-shadow(0 4px 14px rgba(232, 166, 192, 0.8));
  animation: heart-burst 0.85s var(--ease) both;
}
.heart-burst > .icon { width: 44px; height: 44px; }
@keyframes heart-burst {
  0% { opacity: 0; transform: scale(0.3); }
  28% { opacity: 1; transform: scale(1.18); }
  58% { opacity: 1; transform: scale(0.96); }
  100% { opacity: 0; transform: translateY(-8px) scale(1.05); }
}

.fs-msg-fail { flex-wrap: wrap; justify-content: flex-end; text-align: right; }
.fs-msg-fail > .icon { flex: none; }
.chat-fail-btn {
  min-height: 44px;
  padding: 0 10px;
  font-size: var(--fs-12);
  font-weight: 700;
  color: var(--lamp-200);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.chat-bottom {
  flex: none;
  position: relative;
  z-index: 2;
  padding: 6px calc(var(--safe-r) + 12px) calc(var(--safe-b) + 10px) calc(var(--safe-l) + 12px);
}
.chat-screen.kb-open .chat-bottom { padding-bottom: 8px; }
.chat-bottom-col { position: relative; display: flex; flex-direction: column; gap: 8px; }
/* the 400~500자 counter sits above the composer: keep room for it so it never covers a bubble */
.fs-composer.has-count { margin-top: 22px; }
.fs-composer .fs-composer-count { white-space: nowrap; }
/* toasts below the chat header, not over the name and the ··· menu */
html.is-chat .toast-host { top: calc(var(--safe-t) + 64px); }
.chat-banner { min-height: 52px; }
.chat-banner .btn-sm { min-height: 44px; }
.chat-banner > span { flex: 1 1 auto; min-width: 0; }
.chat-newpill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  width: max-content;
  margin-inline: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 16px 0 12px;
  border-radius: var(--radius-pill);
  background: var(--glass-toast);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  color: var(--lamp-200);
  font-size: var(--fs-13);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 12px 30px -12px rgba(0, 0, 0, 0.7);
  animation: fs-pop 0.3s var(--ease) both;
}

/* ---------- 9. Me -------------------------------------------------------- */
.me-head { padding-top: 8px; }
.me-card { display: flex; align-items: center; gap: 18px; padding: 4px 2px 6px; }
.me-card-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.me-name {
  font-family: var(--font-display);
  font-size: var(--fs-24);
  line-height: 1.3;
  color: var(--text);
  overflow-wrap: anywhere;
}
.me-intro { font-size: 14px; line-height: 1.5; color: var(--text-2); }
.me-intro.is-empty { color: var(--text-3); }
.me-meta { font-size: var(--fs-12); letter-spacing: 0.02em; color: var(--text-3); }

.me-form, .me-pin { display: flex; flex-direction: column; gap: 18px; }
.me-form .pane-title, .me-pin .pane-title, .me-push .pane-title { margin-bottom: 0; }
.me-form > [data-locked]:empty { display: none; }
.me-push .pane-title { margin-bottom: 8px; }
.me-locked {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  font-size: 14px;
  color: var(--text);
}
.me-locked > .icon { flex: none; color: var(--lamp-200); }
.me-form.is-locked .fs-swatches label { cursor: not-allowed; }
/* base.css dims every disabled input inside .field (opacity .5), which also reveals the hidden
   native radios of .seg and .fs-swatches when the form is locked: keep them invisible */
.seg > label > input:disabled,
.fs-swatches input:disabled { opacity: 0; }
.push-note { font-size: 14px; line-height: 1.6; color: var(--text-2); }
.me-push .btn { margin-top: 12px; }
.push-switch .switch-text small, .me-sky .switch-text small { line-height: 1.5; }
.me-sky .pane-title { margin-bottom: 8px; }
.me-logout { margin-top: 2px; }

/* ---------- 10. Wider screens -------------------------------------------- */
@media (min-width: 720px) {
  .page { padding-top: calc(var(--safe-t) + 36px); }
  .page-login .auth-hero { padding-top: 4vh; }
  .chat-top { padding-top: calc(var(--safe-t) + 14px); }
  html.is-chat .toast-host { top: calc(var(--safe-t) + 74px); }
  .chat-bottom { padding-bottom: calc(var(--safe-b) + 18px); }
}

@media (max-width: 374px) {
  .vote-dock {
    margin-left: calc(-16px - var(--safe-l));
    margin-right: calc(-16px - var(--safe-r));
    padding-left: calc(16px + var(--safe-l));
    padding-right: calc(16px + var(--safe-r));
  }
  .auth-hero { padding: 5vh 0 3vh; }
  .review-row { gap: 10px; padding-left: 12px; }
  .review-actions { grid-template-columns: 1fr 1.2fr; }
}

@media (prefers-reduced-motion: reduce) {
  .boot-mark, .sent-art, .heart-burst, .fs-msg.is-new > *, .review-row.is-moved, .chat-newpill { animation: none !important; }
  .heart-burst { display: none; }
}
