/*
  처음 한 번 — «내 밑줄은 무슨 색?» → «내 클립은 어떤 글자?» (2026-09-30 하니 님 시안 E2 · E2c)
  _shell.html 의 openColorPick 이 그린다. shell.css 뒤에 불러온다(종이·잉크 값을 그대로 쓴다).

  판 한 장이 아래에서 올라온다. 위는 흐르는 칸(.fp-scroll), 아래는 고정 칸(.fp-foot —
  미리보기 + 먹 단추). 두 단계는 같은 판 안에서 갈아 끼운다(.fp-step.on).
    · 색 칸에는 이름을 적지 않는다(하니 «밑줄색에 이름 빼줘»). 화면 읽기 도구에만 이름을 준다.
    · 누르는 자리는 모두 44px 넘게.
    · 움직임을 줄인 폰에서는 판이 올라오는 움직임도 없다.
*/
@font-face{
  font-family: 'HS Yeolum Mulbit';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: local('HS여름물빛체'), local('HSYeolumMulbit'), url(ilryeok/fonts/HSYeolumMulbit.woff2) format('woff2');
}

.fp{
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  justify-content: center;
  background: rgb(17 17 17 / .45);
}
.fp-sheet{
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  /* 키 = 내용만큼(10/5 하니 «영역이 과하게 커») — 색 무리를 누르거나 클립 단계로 넘어가면 그만큼 자라고(_shell.html 의 grow),
     화면보다 길어지면 위 칸(.fp-scroll)만 흐른다. 전에는 화면 위 56px 부터 바닥까지 늘 꽉 찼다. */
  max-height: calc(100% - max(56px, calc(env(safe-area-inset-top, 0px) + 40px)));
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  border-top: 2px solid var(--ink);
  overflow: hidden;   /* 자라는 동안 잠깐 키가 모자라도 밖으로 안 넘친다 */
}
@media (prefers-reduced-motion: no-preference){
  .fp-sheet{ animation: sheet-in .26s var(--sig) both; }
}
.fp-step{ display: none; flex: 0 1 auto; min-height: 0; flex-direction: column; }
.fp-step.on{ display: flex; }
.fp-scroll{
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 16px;
}
.fp-tag{
  margin: 0;
  font: 600 11px var(--font-mono);
  letter-spacing: .08em;
  color: var(--ink);
}
.fp-title{
  margin: 8px 0 0;
  font: 700 24px/1.45 'HS Yeolum Mulbit', var(--font-ui);
  letter-spacing: .08em;
  color: var(--ink);
}
.fp-sub{
  margin: 14px 0 0;   /* 큰 글자와 작은 글자 사이를 넓게(10/5 하니) */
  font: 13.5px/1.6 var(--font-ui);
  color: var(--ink-soft);
  word-break: keep-all;
}
.fp button{
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fp-sheet:focus{ outline: none; }
.fp button:focus-visible,
.fp [role="slider"]:focus-visible{ outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---- 첫째: 열네 색 — 색 네모 + 그 색 밑줄. 이름 없음(10/5 전엔 다섯 무리 대표) ---- */
.fp-fams{
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));   /* 열네 색 = 일곱 × 두 줄(10/5 «색 전체로 다») */
  gap: 2px;
  margin-top: 18px;
}
.fp .fp-fam{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px 0 8px;
  border: 1.5px solid transparent;
}
.fp .fp-fam.on{ border-color: var(--ink); }
.fp .fp-fam{ position: relative; gap: 6px; padding: 4px 0 6px; }
.fp .fp-fam .ful{ font-size: 11px; }
/* 같은 회차 사람이 똑같이 쓰는 색 — 흐리게 + 먹 대각선 한 줄(아래 .fp-vc.x 와 같은 그림) */
.fp .fp-fam.x{ cursor: default; }
.fp-fam.x .fsq, .fp-fam.x .ful{ opacity: .35; }
.fp-fam.x::after{
  content: "";
  position: absolute;
  top: 4px; left: 4px; right: 4px;
  aspect-ratio: 1;
  background: var(--ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='%23000' stroke-width='1.6' vector-effect='non-scaling-stroke' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='%23000' stroke-width='1.6' vector-effect='non-scaling-stroke' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.fp-fam .fsq{ display: block; width: calc(100% - 8px); aspect-ratio: 1; background: var(--s); }   /* 정사각형(10/5 하니 «세로 줄여») */
/* 칸은 «진한 판»(흰 글자용, 명도 50%) 그대로면 거무죽죽해 보인다(10/5 하니). 같은 색상·채도로 명도만 올려 맑게.
   oklch(from …) 를 모르는 옛 브라우저는 위 줄(진한 판)을 그대로 쓴다. */
@supports (color: oklch(from red l c h)){
  .fp-fam .fsq{ background: oklch(from var(--s) calc(l + 0.17) calc(c * 1.08) h); }
  .fp .fp-vc i{ background: oklch(from var(--v) calc(l + 0.17) calc(c * 1.08) h); }
}
.fp-fam .ful{
  font: 500 12px var(--font-book);
  color: var(--text);
  padding: 0 3px;
  background: var(--u);
}

.fp-low{ margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--ink); }
.fp-low[hidden]{ display: none; }
/* 펼쳐지는 칸은 판이 자라는 동안 살짝 늦게 떠오른다 */
@media (prefers-reduced-motion: no-preference){
  .fp-low:not([hidden]){ animation: fp-rise .32s var(--sig) .06s both; }
  .fp-step.on{ animation: fp-rise .28s var(--sig) both; }
}
@keyframes fp-rise{ from{ opacity: 0; transform: translateY(8px); } }
.fp-lab{
  margin: 0;
  font: 600 10.5px var(--font-mono);
  letter-spacing: .1em;
  color: var(--ink-soft);
}
.fp-lab.m{ margin-top: 16px; }
.fp-vgrid{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.fp .fp-vc{
  position: relative;
  display: block;
  height: 44px;
  border: 1.5px solid transparent;
}
.fp-vgrid[hidden]{ display: none; }
.fp-vc i{ position: absolute; inset: 3px; background: var(--v); }
.fp .fp-vc.on{ border-color: var(--ink); }
.fp .fp-vc.x{ cursor: default; }
.fp-vc.x i{ opacity: .35; }
.fp-vc.x::after{
  content: "";
  position: absolute;
  inset: 3px;
  /* 대각선은 그림(벡터) 한 줄로 — 색 띠(gradient)로 그으면 계단처럼 우글우글해 보인다(10/5 하니). 색은 먹(var(--ink)), 모양만 그림이 정한다. */
  background: var(--ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='%23000' stroke-width='1.6' vector-effect='non-scaling-stroke' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='%23000' stroke-width='1.6' vector-effect='non-scaling-stroke' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.fp-vc em{
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  z-index: 1;
  overflow: hidden;
  font: 600 10px var(--font-ui);
  font-style: normal;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

/* 직접 고르기 — 열네 색을 색결 차례로 이은 띠. 끌거나 눌러서 고른다. */
.fp-cust{
  position: relative;
  height: 44px;
  margin-top: 8px;
  border: 1.5px solid transparent;
  touch-action: none;
  cursor: pointer;
}
.fp-cust.on{ border-color: var(--ink); }
.fp-cust .band{ position: absolute; inset: 5px 3px; background: var(--band); }
.fp-cust .knob{
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: var(--hx, 50%);
  width: 4px;
  margin-left: -2px;
  background: var(--ink);
  box-shadow: 0 0 0 2px var(--paper);
}
.fp-cust:not(.on) .knob{ display: none; }

/* ---- 아래 고정 칸: 미리보기 + 먹 단추 ---- */
.fp-foot{
  flex: none;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 2px solid var(--ink);
  background: var(--paper);
}
.fp-pv{ display: flex; align-items: center; gap: 12px; min-height: 30px; }
.fp-pv[hidden]{ display: none; }
.fp-pv i{ flex: none; width: 30px; height: 30px; background: var(--pv-s); }
.fp-pv q{
  quotes: none;
  font: 15px var(--font-book);
  color: var(--text);
  padding: 0 3px;
  background: var(--pv-u);
}
.fp-hint{ margin: 0; font: 13px/1.5 var(--font-ui); color: var(--ink-soft); }
.fp-hint[hidden]{ display: none; }
.fp .fp-cta{
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  margin-top: 12px;
  padding: 0 18px;
  background: var(--ink);
  color: var(--on-ink);
  font: 700 15px var(--font-ui);
}
.fp-cta .ar{ font: 700 15px var(--font-mono); }
.fp .fp-cta:disabled{ opacity: .3; cursor: default; }

/* ---- 둘째: 내 클립 ---- */
.fp-mine{
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  padding-top: 2px;
  border-top: 1px solid var(--ink);
  font: 600 10.5px var(--font-mono);
  letter-spacing: .1em;
  color: var(--ink-soft);
}
.fp-mine i{ width: 14px; height: 14px; background: var(--me); }
.fp .fp-back{
  min-height: 44px;
  margin-left: auto;
  padding: 0 2px;
  font: 600 12px var(--font-ui);
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* 클립은 종이 윗변에 «꽂힌다»(10/5 하니 «26자 꽂은 모습» · «그림자 보이게 · 종이끼리 그림자도»).
   책상(.fp-kgrid) 위에 종이 다섯 장(.fp-pp) — 줄마다 6px 씩 오른쪽으로 비껴, 앞 장이 뒤 장 아랫단을 덮고
   윗변 그림자를 드리운다. 클립 한 자 = 그림 셋: 뒷다리(종이 밑) · 종이에 비친 뒷다리 · 앞다리(종이 위, 그림자).
   그림들이 장과 한 무대에서 겹치도록 칸(.fp-kb)은 쌓임 맥락을 만들지 않는다(z-index · transform · filter 없음). */
.fp-kgrid{
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 84px;
  margin: 8px -4px 0;
  padding: 2px 20px 18px 2px;   /* 오른쪽 20px — 줄마다 비껴 선 맨 끝 클립이 안 잘린다 */
  background: color-mix(in oklch, var(--ink) 6%, var(--paper, #fff));
  overflow: hidden;
}
.fp-pp{
  grid-column: 1 / -1;
  align-self: start;
  height: calc(100% + 40px);
  margin: 22px -32px 0 calc(var(--k) * 6px);   /* 오른쪽은 책상 밖까지 */
  background: var(--paper, #fff);
  pointer-events: none;
  box-shadow:
    0 0 0 .5px rgb(0 0 0 / .12),
    0 -1px 1px rgb(0 0 0 / .05),
    0 -6px 12px -6px rgb(0 0 0 / .22);
}
.fp .fp-kb{
  position: relative;
  left: calc(var(--k) * 6px);
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
}
.fp-kb .clip{ position: absolute; left: 50%; pointer-events: none; }
.fp-kb .clip.ghost{ opacity: .14; filter: blur(.7px); }
.fp-kb .clip.front{
  /* 철사가 종이에서 살짝 떠 있다 — 종이에 떨어지는 그림자 */
  filter: drop-shadow(.6px 1.6px 1.2px rgb(0 0 0 / .22)) drop-shadow(1px 3px 4px rgb(0 0 0 / .10));
  transition: filter .18s var(--sig, ease-out);
}
.fp .fp-kb.on .clip.front{ filter: drop-shadow(.8px 3px 2px rgb(0 0 0 / .30)) drop-shadow(1px 6px 7px rgb(0 0 0 / .14)); }
.fp-kb em{
  position: absolute;
  left: 0; right: 0;
  top: 64px;
  overflow: hidden;
  font: 600 9.5px var(--font-mono);
  font-style: normal;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  pointer-events: none;
}
/* 고른 클립을 똑똑히(10/5 하니 «누른 건지 안 누른 건지 모르겠어»): 하나를 고르면 나머지는 흐려지고,
   고른 것은 그 자리 종이에 내 밑줄 색이 깔리고 글자가 먹 딱지로 바뀐다. */
.fp-kgrid.has-pick .fp-kb:not(.on) .clip.front,
.fp-kgrid.has-pick .fp-kb:not(.on) .clip.back{ opacity: .38; transition: opacity .18s var(--sig, ease-out); }
.fp-kgrid.has-pick .fp-kb:not(.on) em{ opacity: .5; }
.fp .fp-kb.on::before{
  content: "";
  position: absolute;
  left: 3px; right: 3px; top: 24px; height: 52px;
  background: var(--pv-u, var(--select-bg));
  z-index: var(--zs, 1);
  pointer-events: none;
}
.fp .fp-kb.on em{
  left: 50%; right: auto;
  transform: translateX(-50%);
  padding: 1px 6px;
  background: var(--ink);
  color: var(--paper, #fff);
  font-weight: 800;
}
.fp .fp-kb:focus-visible{ outline: 1.5px solid var(--ink); outline-offset: -2px; }
@media (prefers-reduced-motion: reduce){ .fp-kb .clip.front{ transition: none; } }

.fp-stage[hidden]{ display: none; }
.fp-stage{
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 84px;
  padding: 0 4px 8px;
  overflow: hidden;
  border-bottom: 3px solid var(--text);
}
.fp-stage > span{ display: flex; flex: none; flex-direction: column; align-items: center; gap: 2px; }
.fp-stage small{
  max-width: 56px;
  overflow: hidden;
  font: 600 10.5px var(--font-ui);
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
}
.fp-stage .empty{ display: block; width: 30px; height: 40px; border: 1.5px solid var(--rule); box-sizing: border-box; }
.fp-foot .fp-hint.s2{ margin-top: 8px; }
