/* ==========================================================================
   첫눈 · base.css  (design system: tokens, reset, typography, shared components)
   "첫눈 오는 밤" · a window onto a winter night in Seoul.

   Rules for consumers
   - Do not put a background on html, body or the app root: the sky (shared/sky.js) sits at z-index -1.
   - Component classes are single-class selectors, so app.css / admin.css can override them easily.
   - Classes from SPEC 7.5 keep their names. Extra patterns are prefixed with fs-.
   - Text colors were checked against every sky keyframe (see notes in the final report):
       --text, --text-2, --text-3, --lamp-200, --danger, --ok pass 4.5:1 on a standard .pane.
     Keep --text-3 and --danger text off brighter surfaces (hover states, badges, bubbles).
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
  color-scheme: dark;

  /* palette (SPEC 7.2; snow-400 and danger lifted for contrast on every sky) */
  --night-950: #0B0D24;
  --night-900: #12153A;
  --night-800: #1C1F4A;
  --dusk-600: #4A3F78;
  --rose-300: #E8A6C0;
  --lamp-200: #FFD9BA;
  --lamp-300: #FFBE91;
  --lamp-400: #F4A275;
  --snow-50: #F7F5FF;
  --snow-200: #D9D5F0;
  --snow-400: #C0BBE3;   /* was #A6A1CC: failed 4.5:1 on panes even at night */
  --snow-600: #77729E;   /* lines and disabled marks only, never text */
  --danger: #FFAAAA;     /* was #FF9C9C: lifted to pass 4.5:1 on panes at dawn */
  --ok: #A9E5CF;
  --violet-300: #C2B2FF; /* start of my own chat bubble gradient */
  --ink: #1B1A3A;        /* text on light fills: name tags, lamp buttons, my bubbles */

  /* participant name-tag colors (SPEC 7.3) */
  --pc-snow: #EDEBFA;
  --pc-frost: #BCD5F5;
  --pc-lilac: #CFC0F5;
  --pc-rose: #F5BED2;
  --pc-peach: #FFD2B0;
  --pc-mint: #B7E7D4;
  --pc-sage: #CBDDB2;
  --pc-honey: #F5DE9C;

  /* semantic */
  --text: var(--snow-50);
  --text-2: var(--snow-200);
  --text-3: var(--snow-400);
  --accent: var(--lamp-300);
  --focus: var(--lamp-200);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);

  /* glass */
  --pane-bg: rgba(255, 255, 255, 0.075);
  --pane-bg-hover: rgba(255, 255, 255, 0.11);
  --pane-hi: rgba(255, 255, 255, 0.17);
  --pane-edge: rgba(255, 255, 255, 0.055);
  --pane-shadow: 0 18px 44px -30px rgba(3, 4, 18, 0.9);
  --pane-fallback: rgba(38, 41, 86, 0.94);
  --glass-deep: rgba(19, 21, 56, 0.78);   /* tab bar, toasts */
  --glass-sheet: rgba(29, 31, 74, 0.94);  /* sheets */
  --glass-toast: rgba(42, 44, 100, 0.9);  /* toasts: a little brighter so they read over the sky */
  --well: rgba(6, 7, 28, 0.34);           /* inputs: a patch wiped clear of frost */

  /* shape */
  --radius: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  /* type */
  --font-display: "Gowun Batang", "Nanum Myeongjo", "AppleMyungjo", serif;
  --font-ui: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-15: 15px;
  --fs-17: 17px;
  --fs-20: 20px;
  --fs-24: 24px;
  --fs-32: 32px;
  --fs-44: 44px;
  --fs-64: 64px;

  /* space */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  /* motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-settle: cubic-bezier(0.22, 0.7, 0.2, 1);

  /* layout */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --page-max: 520px;
  --tabbar-h: 0px;

  /* sky (night defaults; shared/sky.js keeps these in step with Seoul time) */
  --sky-top: #080A1F;
  --sky-mid: #11153C;
  --sky-bottom: #1D1A4C;
  --sky-glow: rgba(142, 79, 142, 0.26);

  /* the crystal as a mask (used by .wordmark) */
  --crystal-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round'%3E%3Cpath d='M24 24L24 4M24 14.4L29.18 10.64M24 14.4L18.82 10.64M24 8.8L27.4 6.33M24 8.8L20.6 6.33M24 24L6.68 14M15.69 19.2L15.02 12.84M15.69 19.2L9.84 21.8M10.84 16.4L10.4 12.22M10.84 16.4L7 18.11M24 24L6.68 34M15.69 28.8L9.84 26.2M15.69 28.8L15.02 35.16M10.84 31.6L7 29.89M10.84 31.6L10.4 35.78M24 24L24 44M24 33.6L18.82 37.36M24 33.6L29.18 37.36M24 39.2L20.6 41.67M24 39.2L27.4 41.67M24 24L41.32 34M32.31 28.8L32.98 35.16M32.31 28.8L38.16 26.2M37.16 31.6L37.6 35.78M37.16 31.6L41 29.89M24 24L41.32 14M32.31 19.2L38.16 21.8M32.31 19.2L32.98 12.84M37.16 16.4L41 18.11M37.16 16.4L37.6 12.22'/%3E%3C/svg%3E");
}

/* the tab bar is fixed: give pages room for it */
body.has-tabbar { --tabbar-h: 84px; }
@supports selector(:has(a)) {
  body:has(.tabbar) { --tabbar-h: 84px; }
}

/* ---------- 2. Reset ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  background-color: var(--sky-mid);
  color: var(--text);
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: transparent;
  font-family: var(--font-ui);
  font-size: var(--fs-15);
  line-height: 1.6;
  letter-spacing: -0.005em;
  font-feature-settings: "ss06" 1; /* Pretendard: calmer zero, ignored elsewhere */
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ol, ul { margin: 0; }
h1, h2, h3, h4 { font-size: inherit; font-weight: 600; line-height: 1.35; letter-spacing: -0.02em; text-wrap: balance; }
ol, ul { padding: 0; }
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; margin: 0; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
button:disabled { cursor: not-allowed; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }
table { border-collapse: collapse; border-spacing: 0; }
hr { border: 0; height: 1px; background: var(--line); margin: 0; }
[hidden] { display: none !important; }
::selection { background: rgba(255, 190, 145, 0.36); color: #fff; }

a {
  color: var(--lamp-200);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(255, 217, 186, 0.45);
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: currentColor; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* An open sheet (ui.js puts .has-sheet on <html>) locks scrolling on the root element only.
   Do not lock body too: overflow on body would make it a scroll container, and every
   position: sticky element (vote action bar, admin tab strip) would come unstuck and jump away
   behind the dim layer. iOS 15 WebKit ignores root overflow while a finger drags; openSheet()
   in ui.js stops those drags at the sheet instead. */
html.has-sheet { overflow: hidden; }

/* ---------- 3. Typography ------------------------------------------------ */
.wordmark {
  position: relative;
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-64);
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--snow-50);
  text-shadow: 0 0 34px rgba(255, 217, 186, 0.22);
}
/* a single crystal has just landed on the wordmark */
.wordmark::after {
  content: "";
  position: absolute;
  width: 0.24em;
  height: 0.24em;
  right: -0.27em;
  top: 0.02em;
  background: var(--lamp-200);
  -webkit-mask: var(--crystal-mask) center / contain no-repeat;
  mask: var(--crystal-mask) center / contain no-repeat;
  opacity: 0.95;
}
.wordmark::before {
  content: "";
  position: absolute;
  width: 0.5em;
  height: 0.5em;
  right: -0.4em;
  top: -0.11em;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 210, 176, 0.38), rgba(255, 210, 176, 0) 70%);
  pointer-events: none;
}
.wordmark-sm { font-size: 22px; text-shadow: none; }
.wordmark-sm::before, .wordmark-sm::after { display: none; }

.display {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-24);
  line-height: 1.42;
  letter-spacing: -0.01em;
  color: var(--text);
  text-wrap: balance;
}
.display-sm { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-20); line-height: 1.45; letter-spacing: -0.01em; color: var(--text); }
.display-lg { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-32); line-height: 1.3; letter-spacing: -0.02em; color: var(--text); text-wrap: balance; }
.display-xl { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-44); line-height: 1.2; letter-spacing: -0.025em; color: var(--text); text-wrap: balance; }
.display b, .display strong, .display-sm b, .display-lg b, .display-xl b { font-weight: 700; color: var(--lamp-200); }

.muted { color: var(--text-2); }
.tiny { font-size: var(--fs-12); line-height: 1.55; color: var(--text-3); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* icons from shared/icons.js sit inline with text unless a flex parent places them */
.icon { display: inline-block; flex: none; vertical-align: -0.22em; }
.crystal-svg { display: inline-block; flex: none; vertical-align: middle; }

/* extras */
.fs-title { font-size: var(--fs-24); font-weight: 700; line-height: 1.3; letter-spacing: -0.025em; color: var(--text); }
.fs-num { font-variant-numeric: tabular-nums; }
.fs-link { color: var(--lamp-200); font-weight: 600; text-decoration: none; }
.fs-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.fs-divider { height: 1px; background: var(--line); border: 0; margin: 4px 0; }

/* ---------- 4. Layout ---------------------------------------------------- */
.page {
  position: relative;
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding:
    calc(var(--safe-t) + 18px)
    calc(var(--safe-r) + 20px)
    calc(var(--safe-b) + var(--tabbar-h) + 28px)
    calc(var(--safe-l) + 20px);
}
@supports (-webkit-touch-callout: none) {
  @supports not (height: 100dvh) {
    .page { min-height: -webkit-fill-available; }
  }
}
@media (max-width: 374px) {
  .page { padding-left: calc(var(--safe-l) + 16px); padding-right: calc(var(--safe-r) + 16px); }
}

.fs-stack { display: flex; flex-direction: column; gap: var(--gap, 12px); }
.fs-row { display: flex; align-items: center; gap: var(--gap, 10px); min-width: 0; }
.fs-spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.fs-grow { flex: 1 1 auto; min-width: 0; }
.fs-center { text-align: center; }

.fs-masthead { display: flex; align-items: baseline; gap: 10px; min-height: 40px; }
.fs-masthead-sub { font-size: var(--fs-12); color: var(--text-3); letter-spacing: 0.01em; }

/* ---------- 5. Buttons --------------------------------------------------- */
.btn {
  --btn-bg: rgba(255, 255, 255, 0.1);
  --btn-bd: rgba(255, 255, 255, 0.16);
  --btn-fg: var(--text);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.14s var(--ease), background-color 0.2s, border-color 0.2s, box-shadow 0.25s, opacity 0.2s, color 0.2s;
}
.btn:hover { --btn-bg: rgba(255, 255, 255, 0.14); }
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.42; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .icon { flex: none; }

.btn-primary {
  --btn-bd: transparent;
  --btn-fg: var(--ink);
  background: linear-gradient(180deg, var(--lamp-200) 0%, var(--lamp-300) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 10px 26px -14px rgba(255, 178, 130, 0.85);
}
.btn-primary:hover { background: linear-gradient(180deg, #FFE2CB 0%, #FFC8A1 100%); }
.btn-primary:disabled, .btn-primary[aria-disabled="true"] { background: rgba(255, 217, 186, 0.5); }

.btn-ghost { --btn-bg: transparent; --btn-bd: rgba(255, 255, 255, 0.28); }
.btn-ghost:hover { --btn-bg: rgba(255, 255, 255, 0.07); --btn-bd: rgba(255, 255, 255, 0.4); }

.btn-quiet { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-2); }
.btn-quiet:hover { --btn-bg: rgba(255, 255, 255, 0.07); --btn-fg: var(--text); }

.btn-danger { --btn-bg: var(--danger); --btn-bd: transparent; --btn-fg: var(--ink); }
.btn-danger:hover { --btn-bg: #FFBDBD; }
.btn-danger.btn-ghost, .btn-danger.btn-quiet { --btn-bg: transparent; --btn-fg: var(--danger); }
.btn-danger.btn-ghost { --btn-bd: rgba(255, 170, 170, 0.5); }

.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; gap: 6px; }
.btn-icon { min-height: 0; width: 44px; height: 44px; padding: 0; flex: none; }
.btn-icon.btn-sm { width: 36px; height: 36px; }
.btn-icon:not(.btn-primary):not(.btn-danger):not(.btn-ghost) { --btn-bg: transparent; --btn-bd: transparent; }
.btn-icon:not(.btn-primary):not(.btn-danger):not(.btn-ghost):hover { --btn-bg: rgba(255, 255, 255, 0.08); }

/* ---------- 6. Forms ----------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > label, .field > .field-label, .field > legend {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-2);
}
.field .field-opt { font-weight: 400; color: var(--text-3); margin-left: 4px; }
.field .hint { font-size: var(--fs-13); line-height: 1.5; color: var(--text-3); }
.field .error { font-size: var(--fs-13); line-height: 1.5; color: var(--danger); font-weight: 500; }
.field .error:empty { display: none; }

.fs-input,
.pin-input,
.field :where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"]), textarea, select) {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 13px 16px;
  font-family: var(--font-ui);
  font-size: 16px; /* never below 16px: iOS zooms smaller inputs */
  line-height: 1.4;
  color: var(--text);
  background-color: var(--well);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.fs-input::placeholder,
.pin-input::placeholder,
.field :where(input, textarea)::placeholder { color: var(--snow-400); opacity: 1; }
.fs-input:hover,
.pin-input:hover,
.field :where(input:not([type="checkbox"], [type="radio"]), textarea, select):hover { border-color: rgba(255, 255, 255, 0.24); }
.fs-input:focus,
.pin-input:focus,
.field :where(input:not([type="checkbox"], [type="radio"]), textarea, select):focus {
  outline: none;
  border-color: rgba(255, 217, 186, 0.72);
  background-color: rgba(6, 7, 28, 0.42);
  box-shadow: 0 0 0 3px rgba(255, 217, 186, 0.16), inset 0 1px 2px rgba(0, 0, 0, 0.28);
}
.fs-input[aria-invalid="true"],
.pin-input[aria-invalid="true"],
.field :where(input, textarea, select)[aria-invalid="true"] { border-color: var(--danger); }
/* radios and checkboxes are left out: .seg, .fs-swatches and .switch hide or draw their own
   inputs and show the disabled look on the visible part */
.fs-input:disabled,
.pin-input:disabled,
.field :where(input:not([type="radio"], [type="checkbox"]), textarea, select):disabled { opacity: 0.5; cursor: not-allowed; }
.field :where(textarea), textarea.fs-input { min-height: 108px; resize: vertical; line-height: 1.55; }
.field :where(select), select.fs-input {
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23D9D5F0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.field :where(select) option, select.fs-input option { background: var(--night-800); color: var(--text); }
.fs-input:-webkit-autofill,
.pin-input:-webkit-autofill,
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 100px #1B1D48 inset;
  caret-color: var(--text);
}

/* PIN: one numeric field, digits spaced like four little windows */
.pin-input {
  min-height: 60px;
  padding: 10px 16px 10px calc(16px + 0.62em);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.62em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.pin-input:placeholder-shown { padding-left: 16px; }
.pin-input::placeholder { font-size: 16px; font-weight: 400; letter-spacing: 0; }
/* the caret sits in the middle of a centered field: clear the hint so it does not cut through it */
.pin-input:focus::placeholder { color: transparent; }

/* segmented control: radios inside labels, or buttons with aria-pressed / aria-selected */
.seg {
  display: flex;
  width: 100%;
  padding: 4px;
  gap: 4px;
  border-radius: var(--radius-pill);
  background: var(--well);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.seg > label, .seg > button { position: relative; flex: 1 1 0; min-width: 0; display: flex; }
.seg > label > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg > label > input:disabled { cursor: not-allowed; }
.seg > label > span, .seg > button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px; /* touch target */
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  transition: background-color 0.22s var(--ease), color 0.22s, box-shadow 0.22s;
}
.seg > label:hover > span, .seg > button:hover { color: var(--text); }
.seg > label > input:checked + span,
.seg > button[aria-pressed="true"],
.seg > button[aria-selected="true"],
.seg > button.active {
  background: var(--snow-50);
  color: var(--ink);
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.55);
}
.seg > label > input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.seg > label > input:disabled + span, .seg > button:disabled { opacity: 0.45; }
.seg-sm > label > span, .seg-sm > button { min-height: 34px; font-size: 14px; }

/* switch: <input type="checkbox" role="switch" class="switch">, or wrap a checkbox in <label class="switch"> */
label.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  cursor: pointer;
  font-weight: 500;
}
input.switch,
.switch > input[type="checkbox"] {
  flex: none;
  width: 52px;
  height: 32px;
  margin: 0;
  border-radius: var(--radius-pill);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.14);
  background-image: radial-gradient(circle closest-side, #FFFFFF 90%, rgba(255, 255, 255, 0) 100%);
  background-size: 26px 26px;
  background-repeat: no-repeat;
  background-position: 3px 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  transition: background-position 0.24s var(--ease), background-color 0.24s;
}
input.switch:checked,
.switch > input[type="checkbox"]:checked {
  background-color: var(--lamp-300);
  background-position: calc(100% - 3px) 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 14px -2px rgba(255, 190, 145, 0.6);
}
input.switch:disabled, .switch > input[type="checkbox"]:disabled { opacity: 0.4; cursor: not-allowed; }
input.switch:focus-visible, .switch > input[type="checkbox"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-text small { font-size: var(--fs-13); font-weight: 400; color: var(--text-3); }

/* ---------- 7. Panes ----------------------------------------------------- */
.pane {
  position: relative;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--pane-bg);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  backdrop-filter: blur(16px) saturate(1.25);
  box-shadow: inset 0 1px 0 var(--pane-hi), inset 0 0 0 1px var(--pane-edge), var(--pane-shadow);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .pane { background: var(--pane-fallback); }
}
.pane-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: var(--fs-13);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  color: var(--text-2);
}
.pane-title > .icon { color: var(--lamp-200); }
.pane-title > .badge { margin-left: auto; }
.pane-flush { padding: 0; overflow: hidden; }
.pane-quiet { background: rgba(255, 255, 255, 0.05); }
.pane-glow {
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 220, 0.42),
    inset 0 0 0 1px rgba(255, 217, 186, 0.16),
    inset 0 30px 60px -40px rgba(255, 190, 145, 0.42),
    var(--pane-shadow);
}

/* ---------- 8. Chips, badges, dots --------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  max-width: 100%;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip > .avatar { --av: 24px; margin-left: -8px; box-shadow: none; }
.chip-rank {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--lamp-300);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
/* a pick whose person is no longer active: quieter, still readable */
.chip-inactive { color: var(--text-3); background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.chip-inactive > .chip-rank { background: rgba(255, 255, 255, 0.16); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--lamp-300);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-12);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.badge-soft { background: rgba(255, 255, 255, 0.13); color: var(--text); font-weight: 600; }
.badge-outline { background: transparent; color: var(--text-2); font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32); }
.badge-rose { background: var(--rose-300); }
.badge-ok { background: var(--ok); }
.badge-danger { background: var(--danger); }

.dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lamp-300);
  box-shadow: 0 0 0 3px rgba(255, 190, 145, 0.16), 0 0 10px rgba(255, 190, 145, 0.7);
}
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(169, 229, 207, 0.14); }
.dot-rose { background: var(--rose-300); box-shadow: 0 0 0 3px rgba(232, 166, 192, 0.16); }
.dot-danger { background: var(--danger); box-shadow: 0 0 0 3px rgba(255, 170, 170, 0.16); }
.dot-muted { background: var(--snow-600); box-shadow: none; }

/* ---------- 9. Avatars --------------------------------------------------- */
[data-color="snow"] { --pc: var(--pc-snow); }
[data-color="frost"] { --pc: var(--pc-frost); }
[data-color="lilac"] { --pc: var(--pc-lilac); }
[data-color="rose"] { --pc: var(--pc-rose); }
[data-color="peach"] { --pc: var(--pc-peach); }
[data-color="mint"] { --pc: var(--pc-mint); }
[data-color="sage"] { --pc: var(--pc-sage); }
[data-color="honey"] { --pc: var(--pc-honey); }

.avatar {
  --av: 44px;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--av);
  height: var(--av);
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0) 56%),
    var(--pc, var(--pc-snow));
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: calc(var(--av) * 0.42);
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), 0 6px 14px -8px rgba(0, 0, 0, 0.55);
  user-select: none;
  -webkit-user-select: none;
}
.avatar-sm { --av: 32px; }
.avatar-lg { --av: 88px; }
.avatar-anon {
  color: var(--snow-50);
  /* the same lamp halo as the illustrated avatars, so the svg fallback keeps the mood */
  background:
    radial-gradient(40% 40% at 50% 40%, rgba(255, 204, 166, 0.36) 0%, rgba(255, 204, 166, 0.12) 60%, rgba(255, 204, 166, 0) 100%),
    radial-gradient(130% 110% at 50% 6%, #4C4688 0%, #2D2964 55%, #1B1946 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 6px 14px -8px rgba(0, 0, 0, 0.55);
}
.avatar-anon > img { width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }
.avatar-anon > .crystal-svg { width: 52%; height: 52%; opacity: 0.85; }

/* ---------- 10. Tab bar -------------------------------------------------- */
.tabbar {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-b) + 10px);
  width: calc(100% - 24px - var(--safe-l) - var(--safe-r));
  max-width: calc(var(--page-max) - 24px);
  margin-inline: auto;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 6px;
  border-radius: 26px;
  background: var(--glass-deep);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 18px 40px -16px rgba(2, 3, 16, 0.85);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tabbar { background: rgba(21, 23, 60, 0.97); }
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 54px;
  border-radius: 20px;
  color: var(--text-3);
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
  -webkit-user-select: none;
  user-select: none;
}
.tab:hover { color: var(--text); }
.tab .icon { width: 24px; height: 24px; }
.tab.active, .tab[aria-current="page"] { color: var(--lamp-200); background: rgba(255, 255, 255, 0.07); }
.tab.active .icon, .tab[aria-current="page"] .icon { filter: drop-shadow(0 0 6px rgba(255, 190, 145, 0.55)); }
.tab .count {
  position: absolute;
  top: 4px;
  left: calc(50% + 6px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--lamp-300);
  color: var(--ink);
  font-size: var(--fs-12);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--night-900);
}
.tab .count:empty { display: none; }

/* ---------- 11. Toasts --------------------------------------------------- */
.toast-host {
  position: fixed;
  z-index: 90;
  top: calc(var(--safe-t) + 12px);
  left: 0;
  right: 0;
  margin-inline: auto;
  width: min(calc(100% - 32px), 420px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 12px 18px;
  border-radius: 20px;
  background: var(--glass-toast);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.09), 0 18px 40px -14px rgba(0, 0, 0, 0.75);
  color: var(--text);
  font-size: var(--fs-15);
  font-weight: 500;
  line-height: 1.45;
  cursor: default;
  animation: fs-toast-in 0.42s var(--ease) both;
}
.toast.is-leaving { animation: fs-toast-out 0.3s var(--ease-in) both; }
.toast > .icon { flex: none; color: var(--lamp-200); }
.toast-ok > .icon { color: var(--ok); }
.toast-danger > .icon { color: var(--danger); }
.toast-lamp {
  background: linear-gradient(120deg, rgba(64, 46, 92, 0.9), rgba(38, 30, 74, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 228, 206, 0.32), inset 0 0 0 1px rgba(255, 217, 186, 0.2), 0 16px 40px -14px rgba(255, 170, 120, 0.4);
}
.toast-lamp > .icon { color: var(--lamp-200); filter: drop-shadow(0 0 6px rgba(255, 190, 145, 0.8)); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .toast { background: rgba(21, 23, 60, 0.97); }
}

/* ---------- 12. Sheets (dialogs) ----------------------------------------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 22, 0.58);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.sheet-panel {
  position: relative;
  width: 100%;
  max-width: var(--page-max);
  max-height: calc(100% - var(--safe-t) - 28px);
  margin-bottom: var(--kb, 0px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 10px calc(var(--safe-r) + 22px) calc(var(--safe-b) + 18px) calc(var(--safe-l) + 22px);
  border-radius: 26px 26px 0 0;
  background: var(--glass-sheet);
  -webkit-backdrop-filter: blur(26px) saturate(1.4);
  backdrop-filter: blur(26px) saturate(1.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 -24px 60px -24px rgba(0, 0, 0, 0.7);
  text-align: center;
  transform: translateY(104%);
  transition: transform 0.38s var(--ease);
}
.sheet.is-open .sheet-backdrop { opacity: 1; }
.sheet.is-open .sheet-panel { transform: none; }
.sheet.is-closing .sheet-panel { transition-duration: 0.26s; transition-timing-function: var(--ease-in); }
.sheet-panel:focus, .sheet-panel:focus-visible { outline: none; }
.sheet-grabber { width: 38px; height: 5px; margin: 0 auto 18px; border-radius: 3px; background: rgba(255, 255, 255, 0.26); }
.sheet-title { font-size: 19px; font-weight: 700; line-height: 1.4; letter-spacing: -0.025em; color: var(--text); text-wrap: balance; }
/* pretty, not balance: balance narrows a two-sentence body into a column and splits pairs like
   "보낼 수"; pretty fills the width and only keeps the last line from being a lone word */
.sheet-body { margin-top: 8px; font-size: var(--fs-15); line-height: 1.6; color: var(--text-2); text-wrap: pretty; }
.sheet-content { margin-top: 18px; text-align: left; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; }
.sheet-actions .btn { width: 100%; }
.sheet-form .sheet-actions { margin-top: 20px; }
.sheet-list { display: flex; flex-direction: column; overflow: hidden; border-radius: 18px; background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); }
.sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background-color 0.15s;
}
.sheet-item + .sheet-item { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07); }
.sheet-item:hover, .sheet-item:active { background: rgba(255, 255, 255, 0.07); }
.sheet-item > .icon { color: var(--text-2); }
.sheet-item.is-danger, .sheet-item.is-danger > .icon { color: var(--danger); }
.sheet-item:disabled { opacity: 0.4; }
.sheet-actionsheet .sheet-actions { margin-top: 10px; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sheet-panel { background: rgb(29, 31, 74); }
}
@media (min-width: 640px) {
  .sheet { align-items: center; padding: 24px; }
  .sheet-panel {
    max-width: 440px;
    max-height: calc(100% - 48px);
    margin-bottom: 0;
    padding: 28px;
    border-radius: 26px;
    text-align: left;
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    transition: transform 0.3s var(--ease), opacity 0.22s;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 40px 80px -30px rgba(0, 0, 0, 0.8);
  }
  .sheet.is-open .sheet-panel { opacity: 1; transform: none; }
  .sheet-grabber { display: none; }
  .sheet-actions { flex-direction: row-reverse; justify-content: flex-start; }
  .sheet-actions .btn { width: auto; min-width: 108px; }
  .sheet-actionsheet .sheet-actions { flex-direction: column; }
  .sheet-actionsheet .sheet-actions .btn { width: 100%; }
}

/* ---------- 13. Empty state, skeleton ------------------------------------ */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 36px 20px;
}
.empty-art {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
  border-radius: 50%;
  color: var(--lamp-200);
  background: radial-gradient(circle, rgba(255, 210, 176, 0.18) 0%, rgba(255, 210, 176, 0) 70%);
}
.empty-art .icon, .empty-art .crystal-svg { filter: drop-shadow(0 0 8px rgba(255, 190, 145, 0.45)); }
.empty-title { font-family: var(--font-display); font-size: var(--fs-20); line-height: 1.45; color: var(--text); text-wrap: balance; }
.empty-text { max-width: 300px; font-size: 14px; line-height: 1.6; color: var(--text-2); text-wrap: balance; }
.empty > .btn { margin-top: 12px; }

.skeleton {
  position: relative;
  overflow: hidden;
  display: block;
  min-height: 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0) 100%);
  animation: fs-shimmer 1.8s ease-in-out infinite;
}
.skeleton-line { height: 12px; border-radius: 6px; }
.skeleton-circle { border-radius: 50%; }

/* ---------- 14. Banner (extra) ------------------------------------------- */
.fs-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.fs-banner > .icon { flex: none; color: var(--lamp-200); }
.fs-banner > .btn { margin-left: auto; }
.fs-banner-danger { box-shadow: inset 0 0 0 1px rgba(255, 170, 170, 0.32); }
.fs-banner-danger > .icon { color: var(--danger); }

/* ---------- 15. The sky -------------------------------------------------- */
.sky {
  position: fixed;
  z-index: -1;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  height: 100lvh;
  pointer-events: none;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 50%, var(--sky-bottom) 100%);
  opacity: 0;
  transition: opacity 0.9s ease;
}
.sky.is-ready { opacity: 1; }
/* horizon: city light under snow clouds, warmer at dawn and dusk */
.sky::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(150% 52% at 50% 108%, var(--sky-glow) 0%, rgba(0, 0, 0, 0) 70%);
}
/* fine grain: keeps the dark gradient from banding on phone screens */
.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 -.28'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}
.sky-snow { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ==========================================================================
   Patterns (fs-*) · reference styles for the participant screens.
   ========================================================================== */

/* ---------- 16. Received crystals (the emotional centre) ---------------- */
.fs-received { text-align: center; }
.fs-received .pane-title { justify-content: center; }
.fs-received.is-lit {
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 220, 0.38),
    inset 0 0 0 1px rgba(255, 217, 186, 0.12),
    inset 0 -40px 70px -50px rgba(255, 190, 145, 0.44),
    var(--pane-shadow);
}
.fs-received-line { font-family: var(--font-display); font-size: var(--fs-24); line-height: 1.42; color: var(--text); text-wrap: balance; }
.fs-received-line b { font-weight: 700; color: var(--lamp-200); }
.fs-received-line.is-quiet { font-size: var(--fs-20); color: var(--text-2); }
.fs-received-sub { margin-top: 6px; font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.fs-received-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: var(--fs-12); color: var(--text-2); }

.fs-crystals { position: relative; width: 100%; max-width: 300px; height: 100px; margin: 2px auto 10px; }
.fs-crystal {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  width: var(--s, 24px);
  height: var(--s, 24px);
  margin: calc(var(--s, 24px) * -0.5) 0 0 calc(var(--s, 24px) * -0.5);
  color: var(--snow-50);
  opacity: var(--o, 0.9);
  transform: rotate(var(--r, 0deg));
  filter: drop-shadow(0 0 2px rgba(255, 236, 222, 0.7)) drop-shadow(0 0 9px rgba(255, 190, 145, 0.32));
}
.fs-crystal > svg { width: 100%; height: 100%; overflow: visible; }
.fs-crystal.is-first { color: #FFF3E8; filter: drop-shadow(0 0 3px rgba(255, 236, 222, 0.9)) drop-shadow(0 0 12px rgba(255, 190, 145, 0.6)); }
.fs-crystal.is-hero { color: var(--lamp-200); filter: drop-shadow(0 0 3px rgba(255, 228, 206, 0.85)) drop-shadow(0 0 16px rgba(255, 190, 145, 0.55)); }
.fs-crystal.is-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -60%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 210, 176, 0.42) 0%, rgba(255, 190, 145, 0.14) 38%, rgba(255, 190, 145, 0) 68%);
  animation: fs-breathe 5.6s ease-in-out infinite;
}
.fs-crystal.is-hero > svg { animation: fs-turn 120s linear infinite; }
.fs-crystal.is-ghost { color: var(--snow-200); opacity: 0.26; filter: none; }
.fs-crystals.is-pending .fs-crystal.is-ghost { animation: fs-ghost 4.2s ease-in-out infinite; }
.fs-crystal.is-new { animation: fs-settle 1.2s var(--ease-settle) var(--d, 0s) both; }
.fs-crystal.is-hero.is-new { animation: fs-settle-hero 1.2s var(--ease-settle) both; }

/* ---------- 17. Vote name cards ----------------------------------------- */
.fs-namegrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fs-namecard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 150px;
  padding: 16px 14px 16px 16px;
  border-radius: 20px;
  text-align: left;
  color: var(--text);
  background: var(--pane-bg);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  backdrop-filter: blur(16px) saturate(1.25);
  box-shadow: inset 0 1px 0 var(--pane-hi), inset 0 0 0 1px var(--pane-edge);
  transition: box-shadow 0.35s var(--ease), background-color 0.35s, opacity 0.3s, transform 0.16s var(--ease);
  -webkit-user-select: none;
  user-select: none;
}
.fs-namecard:active { transform: scale(0.98); }
.fs-namecard > .avatar { margin-bottom: 10px; transition: opacity 0.3s, filter 0.3s; }
/* Name and intro wrap inside the card and stop after two lines.
   - name: nicknames run to 12 characters and are the only way to tell people apart, so a long one
     takes a second line instead of being cut ("겨울바다좋아하는민지" vs "…민수").
   - both: max-width keeps them inside the card (the card aligns items to flex-start, which sizes
     a child to its content), and overflow-wrap: anywhere breaks a long URL or ID with no spaces,
     or a Hangul name with no spaces, instead of pushing the page sideways. */
.fs-namecard-name,
.fs-namecard-intro {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fs-namecard-name { font-family: var(--font-display); font-size: var(--fs-20); line-height: 1.3; letter-spacing: -0.01em; }
.fs-namecard-intro { font-size: var(--fs-13); line-height: 1.5; color: var(--text-2); }
.fs-namecard[aria-pressed="true"], .fs-namecard.is-selected {
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 217, 186, 0.16) 0%, rgba(255, 217, 186, 0) 58%),
    rgba(255, 255, 255, 0.075);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 220, 0.55),
    inset 0 0 0 1px rgba(255, 217, 186, 0.5),
    0 0 0 1px rgba(255, 190, 145, 0.18),
    0 14px 34px -14px rgba(255, 178, 130, 0.5);
}
.fs-namecard[aria-pressed="true"] .fs-namecard-intro, .fs-namecard.is-selected .fs-namecard-intro { color: var(--text); }
/* max reached: the other cards step back but stay readable, since they still answer a tap with a
   hint. Quieter glass, a faded avatar and text one step down rather than opacity on the whole card
   (opacity 0.4 left the intro at 2.8:1, and even 0.7 stays under 4.5:1 on the daytime sky);
   this way name and intro keep 4.5:1 or more on every sky. */
.fs-namegrid.is-full .fs-namecard:not([aria-pressed="true"]):not(.is-selected) {
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.fs-namegrid.is-full .fs-namecard:not([aria-pressed="true"]):not(.is-selected) > .avatar { opacity: 0.5; filter: saturate(0.5); }
.fs-namegrid.is-full .fs-namecard:not([aria-pressed="true"]):not(.is-selected) .fs-namecard-name { color: var(--text-2); }
.fs-namegrid.is-full .fs-namecard:not([aria-pressed="true"]):not(.is-selected) .fs-namecard-intro { color: var(--text-3); }
.fs-rank {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--lamp-200), var(--lamp-300));
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 4px rgba(255, 190, 145, 0.16), 0 0 18px rgba(255, 190, 145, 0.55);
  animation: fs-pop 0.36s var(--ease) both;
}

/* ---------- 18. Inbox rows (Instagram DM-like) --------------------------- */
.fs-dm-list { list-style: none; margin: 0 -10px; padding: 0; }
.fs-dm-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: 20px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.18s;
}
.fs-dm-row:hover, .fs-dm-row:active { background: rgba(255, 255, 255, 0.06); }
.fs-dm-row > .avatar { --av: 52px; }
.fs-dm-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fs-dm-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.fs-dm-title { font-size: var(--fs-15); font-weight: 600; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-dm-top > .badge { flex: none; height: 20px; font-size: var(--fs-12); padding: 0 7px; }
.fs-dm-preview { display: flex; min-width: 0; gap: 4px; font-size: 14px; line-height: 1.4; color: var(--text-2); }
.fs-dm-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-dm-time { flex: none; color: var(--text-3); font-variant-numeric: tabular-nums; }
.fs-dm-row.is-unread .fs-dm-title, .fs-dm-row.is-unread .fs-dm-text { color: var(--text); font-weight: 700; }
.fs-dm-row > .dot { margin-right: 4px; }

/* ---------- 19. Chat ----------------------------------------------------- */
.fs-chathead {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
}
.fs-chathead-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.fs-chathead-title { font-size: 16px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-chathead-sub { font-size: var(--fs-12); line-height: 1.4; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.fs-chat-intro { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 12px 22px; text-align: center; }
.fs-chat-intro > .avatar { margin-bottom: 4px; }
.fs-chat-intro-title { font-family: var(--font-display); font-size: var(--fs-20); line-height: 1.4; }
.fs-chat-intro-text { max-width: 280px; font-size: 14px; color: var(--text-2); }

.fs-chat { display: flex; flex-direction: column; gap: 3px; padding: 4px 0 12px; }
.fs-timesep { align-self: center; margin: 16px 0 8px; font-size: var(--fs-12); color: var(--text-3); font-variant-numeric: tabular-nums; }
.fs-msg { position: relative; display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.fs-msg.mine { justify-content: flex-end; }
.fs-msg.group-start { margin-top: 10px; }
.fs-msg > .avatar { --av: 28px; align-self: flex-end; }
.fs-msg.theirs:not(.group-end) > .avatar { visibility: hidden; }
.fs-bubble {
  position: relative;
  max-width: min(76%, 340px);
  padding: 10px 15px;
  border-radius: 22px;
  font-size: var(--fs-15);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.fs-msg.theirs .fs-bubble {
  color: var(--text);
  background: rgba(255, 255, 255, 0.11);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13);
}
.fs-msg.mine .fs-bubble {
  color: var(--ink);
  background: linear-gradient(115deg, var(--violet-300) 0%, var(--rose-300) 52%, #FFC6A0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 8px 22px -14px rgba(232, 166, 192, 0.7);
}
.fs-msg.mine:not(.group-start) .fs-bubble { border-top-right-radius: 7px; }
.fs-msg.mine:not(.group-end) .fs-bubble { border-bottom-right-radius: 7px; }
.fs-msg.theirs:not(.group-start) .fs-bubble { border-top-left-radius: 7px; }
.fs-msg.theirs:not(.group-end) .fs-bubble { border-bottom-left-radius: 7px; }
/* hidden by the organisers: the same quiet italic line on both sides. ".fs-msg" in the second
   selector lifts it above ".fs-msg.mine .fs-bubble" (dark ink, which would vanish on the sky once
   the gradient is gone) and ".fs-msg.theirs .fs-bubble" (its blur). */
.fs-bubble.is-hidden,
.fs-msg .fs-bubble.is-hidden {
  color: var(--text-2);
  font-style: italic;
  background: transparent !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none !important;
  border: 1px dashed rgba(255, 255, 255, 0.26);
}
.fs-bubble.is-pending { opacity: 0.6; }
.fs-bubble.is-failed { box-shadow: inset 0 0 0 1px var(--danger); }
.fs-msg.has-heart { margin-bottom: 12px; }
.fs-heart {
  position: absolute;
  bottom: -11px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #2B2A5E;
  color: var(--rose-300);
  box-shadow: 0 0 0 2px rgba(10, 12, 36, 0.9);
  animation: fs-pop 0.32s var(--ease) both;
}
.fs-msg.theirs .fs-heart { left: 46px; }
.fs-msg.mine .fs-heart { right: 12px; }
.fs-heart .icon { width: 14px; height: 14px; }
/* the tappable heart (remove my heart) gets a 44px target; it reaches further down and sideways
   than up, so it takes as little as possible of the bubble it sits on */
button.fs-heart::after { content: ""; position: absolute; inset: -6px -10px -14px; border-radius: 50%; }
.fs-read { align-self: flex-end; margin: 3px 6px 0 0; font-size: var(--fs-12); color: var(--text-3); }
.fs-msg-fail { align-self: flex-end; display: flex; align-items: center; gap: 6px; margin: 4px 6px 0 0; font-size: var(--fs-12); color: var(--danger); }

.fs-composer {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 4px 4px 4px 18px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.09);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.fs-composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  max-height: 136px; /* about 5 lines */
  margin-block: 2px; /* one line sits level with the 44px send button */
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
}
.fs-composer textarea:focus { outline: none; }
.fs-composer textarea::placeholder { color: var(--snow-400); opacity: 1; }
.fs-composer:focus-within { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 1px rgba(255, 217, 186, 0.45); }
.fs-composer .btn-icon { width: 44px; height: 44px; } /* touch target; the composer stays 52px tall */
.fs-composer-count { position: absolute; right: 60px; top: -24px; font-size: var(--fs-12); color: var(--text-3); font-variant-numeric: tabular-nums; }
.fs-composer-count.is-over { color: var(--danger); }

/* ---------- 20. Action bar, color swatches ------------------------------ */
/* sticky bottom bar: "{k} / {max}" + 다음 (sits above the tab bar when there is one) */
.fs-actionbar {
  position: sticky;
  z-index: 30;
  bottom: calc(var(--safe-b) + var(--tabbar-h) + 12px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 20px;
  border-radius: 26px;
  background: var(--glass-deep);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 18px 40px -16px rgba(2, 3, 16, 0.85);
}
.fs-actionbar-count { font-size: 15px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fs-actionbar-count b { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--lamp-200); margin-right: 2px; }
.fs-actionbar > .btn { margin-left: auto; min-width: 124px; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .fs-actionbar { background: rgba(21, 23, 60, 0.97); }
}

/* name-tag color picker: radios inside labels that carry data-color */
.fs-swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; }
.fs-swatches > label { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.fs-swatches input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fs-swatch {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 56%), var(--pc, var(--pc-snow));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  transition: box-shadow 0.2s, transform 0.2s var(--ease);
}
.fs-swatch-name { font-size: var(--fs-12); color: var(--text-2); }
.fs-swatches input:checked + .fs-swatch { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), 0 0 0 3px var(--night-900), 0 0 0 5px var(--lamp-200); transform: scale(1.04); }
.fs-swatches input:checked ~ .fs-swatch-name { color: var(--text); font-weight: 600; }
.fs-swatches input:focus-visible + .fs-swatch { outline: 2px solid var(--focus); outline-offset: 6px; }
.fs-swatches input:disabled ~ * { opacity: 0.45; cursor: not-allowed; }

/* ---------- 21. Table (extra, for the admin) ---------------------------- */
.fs-table { width: 100%; font-size: 14px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.fs-table th { padding: 10px 12px; text-align: left; font-size: var(--fs-12); font-weight: 600; color: var(--text-3); white-space: nowrap; border-bottom: 1px solid var(--line-strong); }
.fs-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.fs-table tr:last-child td { border-bottom: 0; }
.fs-table tbody tr:hover td { background: rgba(255, 255, 255, 0.035); }

/* ---------- 22. Motion --------------------------------------------------- */
@keyframes fs-toast-in {
  from { opacity: 0; transform: translateY(-14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes fs-toast-out {
  to { opacity: 0; transform: translateY(-10px) scale(0.98); }
}
@keyframes fs-shimmer { to { transform: translateX(100%); } }
@keyframes fs-pop {
  from { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  to { transform: scale(1); }
}
/* a crystal drifts down onto the pane and settles */
@keyframes fs-settle {
  0% { opacity: 0; transform: translate(-6px, -34px) rotate(calc(var(--r, 0deg) - 55deg)) scale(0.5); }
  55% { opacity: 1; }
  80% { transform: translate(0, 2px) rotate(calc(var(--r, 0deg) + 3deg)) scale(1.04); }
  100% { opacity: var(--o, 0.9); transform: rotate(var(--r, 0deg)); }
}
@keyframes fs-settle-hero {
  0% { opacity: 0; transform: translateY(-30px) rotate(-50deg) scale(0.5); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
@keyframes fs-breathe {
  0%, 100% { opacity: 0.75; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.04); }
}
@keyframes fs-turn { to { transform: rotate(360deg); } }
@keyframes fs-ghost {
  0%, 100% { opacity: 0.18; }
  50% { opacity: 0.36; }
}
@keyframes fs-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.fs-rise { animation: fs-rise 0.5s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .fs-crystal.is-hero::before, .fs-crystal.is-hero > svg, .fs-crystals.is-pending .fs-crystal.is-ghost, .skeleton::after { animation: none !important; }
  .fs-crystal.is-new { animation: none !important; }
}
