/* 順番決め「ならぶ」（/junban/ だけで読み込む）。
   サイト共通の style.css（ヘッダー・色・書体・アイコン）の上に重ねる。主役は広場と行列。
   すべて .n-* と .junban-* に閉じていて、他のツールには当たらない。 */
.n-page {
  --n-ink: #2a221c;
  --n-muted: #6b6157;
  --n-soft: #8c8174;
  --n-line: #e8dfd1;
  --n-indigo: #4a62c8;
  --n-indigo-deep: #3a4fae;
  --n-indigo-tint: #eef1fc;
  --n-tag-bg: rgba(255, 255, 255, 0.94);
  --n-ease: cubic-bezier(0.3, 0.7, 0.2, 1);
}
.n-main { max-width: 1080px; margin: 0 auto; padding: 10px 16px 40px; box-sizing: border-box; }
.n-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- title ---------- */
.n-head { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 4px 0 12px; text-align: center; }
.n-title {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
  font-family: var(--font-display); font-weight: 800; font-size: clamp(1.35rem, 5.2vw, 1.8rem); letter-spacing: 0.03em; color: var(--n-ink);
}
.n-title::before {
  content: ""; width: 0.95em; height: 0.95em; background: var(--n-indigo);
  -webkit-mask: var(--ico-junban) center / contain no-repeat; mask: var(--ico-junban) center / contain no-repeat;
}
.n-lead { margin: 0; font-size: 0.86rem; color: var(--n-muted); }

.n-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.n-play { min-width: 0; }   /* a long name in the progress line must not widen the page */
@media (min-width: 960px) {
  .n-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 24px; }
  .n-input { position: sticky; top: 14px; }
}
@media (min-width: 1100px) {
  .n-main { max-width: 1180px; padding-left: 24px; padding-right: 24px; }
  .n-layout { gap: 28px; }
  .n-head { margin: 10px 0 16px; }
}

/* ---------- the plaza / the line ---------- */
.n-ground {
  position: relative; overflow: hidden; height: 340px; border-radius: 26px; box-sizing: border-box;
  background:
    radial-gradient(110% 60% at 50% -10%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, #fbf7ef 0%, #f3ecdf 100%);
  border: 1px solid #eae1d2;
  box-shadow: inset 0 1px 0 #fff, inset 0 -24px 40px rgba(150, 118, 74, 0.07), 0 1px 0 #efe6d7, 0 12px 26px rgba(90, 58, 24, 0.05);
  transition: height 0.42s var(--n-ease);
  -webkit-tap-highlight-color: transparent;
}
.n-ground.is-instant { transition: none; }
.n-ground::before { /* fine floor texture */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.55;
  background-image: radial-gradient(rgba(150, 118, 74, 0.16) 1px, transparent 1.3px); background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%, #000 80%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 80%, transparent);
}
.n-floor { position: absolute; inset: 0; pointer-events: none; }
.n-lanes { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.n-lanes line { stroke: rgba(74, 98, 200, 0.22); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 0.5 9; }
.n-hint {
  position: absolute; left: 20px; right: 20px; top: 50%; margin: 0; transform: translateY(-50%); text-align: center;
  font-size: 0.9rem; font-weight: 700; line-height: 1.6; color: var(--n-soft);
}
.n-hint[hidden] { display: none; }
.n-wait { /* the waiting area during the draw */
  position: absolute; left: 10px; right: 10px; top: 0; height: 0; border-radius: 18px; pointer-events: none; opacity: 0;
  background: rgba(255, 255, 255, 0.5); box-shadow: inset 0 0 0 1px rgba(232, 223, 209, 0.9);
  transition: opacity 0.3s, transform 0.4s var(--n-ease), height 0.4s var(--n-ease);
}
.n-ground.is-running .n-wait.is-on { opacity: 1; }

/* spots on the floor, shown when the line starts to form */
.n-marks { position: absolute; inset: 0; }
.n-mark {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; justify-content: center; box-sizing: border-box;
  border-radius: 50%; border: 1.5px dashed rgba(74, 98, 200, 0.32); background: rgba(74, 98, 200, 0.05);
  color: rgba(58, 79, 174, 0.62); font-family: var(--font-display); font-weight: 800; font-size: 11px; line-height: 1;
  transition: opacity 0.25s;
}
.n-mark.is-filled { opacity: 0; }
.n-sign {
  position: absolute; left: 0; top: 0; z-index: 3; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  font-size: 11px; font-weight: 800; line-height: 1.5; letter-spacing: 0.04em; color: var(--n-muted);
  background: rgba(255, 255, 255, 0.9); box-shadow: inset 0 0 0 1px #e3d9c9; pointer-events: none;
}

/* ---------- a person ---------- */
.n-pal { position: absolute; left: 0; top: 0; width: var(--s, 56px); height: var(--s, 56px); z-index: 2; will-change: transform; }
.n-pal.is-waiting { z-index: 1; }
.n-shadow {
  position: absolute; left: 14%; right: 14%; bottom: -5%; height: 16%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(84, 60, 30, 0.28), rgba(84, 60, 30, 0));
}
.n-size { position: absolute; inset: 0; transform-origin: 50% 100%; transition: transform 0.3s cubic-bezier(0.3, 1.25, 0.5, 1); }
.n-lift { position: absolute; inset: 0; transform-origin: 50% 100%; }
.n-body { display: block; width: var(--bw, 100%); height: 100%; margin-left: calc((100% - var(--bw, 100%)) / 2); overflow: visible; transform-origin: 50% 100%; }
.n-body .n-happy, .n-body .n-o { opacity: 0; }
.n-pal.is-happy .n-body .n-happy { opacity: 1; }
.n-pal.is-happy .n-body .n-eyes, .n-pal.is-happy .n-body .n-mouth { opacity: 0; }
.n-pal.is-hop .n-body .n-o { opacity: 1; }
.n-pal.is-hop .n-body .n-mouth { opacity: 0; }
.n-pal.is-called .n-body .n-eyes { transform: scale(1.18); }
.n-pal.is-called .n-tag { opacity: 1 !important; box-shadow: inset 0 0 0 1.5px var(--n-indigo), 0 2px 6px rgba(58, 79, 174, 0.18); }
.n-body .n-look { transition: transform 0.25s var(--n-ease); }
.n-ground.is-running .n-pal:not(.is-queued) .n-look { transform: translateY(-2.5px); }
.n-body .n-eyes { transform-box: fill-box; transform-origin: 50% 50%; transition: transform 0.12s ease-out; }
.n-ground.is-calm .n-pal .n-eyes { animation: n-blink 5.2s infinite; animation-delay: var(--blink, 0s); }
.n-ground.is-calm .n-pal .n-body { animation: n-breathe 2.9s ease-in-out infinite alternate; animation-delay: var(--breath, 0s); }
@keyframes n-blink { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(0.12); } }
@keyframes n-breathe { 0% { transform: scale(1, 1); } 100% { transform: scale(1.015, 1.035); } }

/* name tag: travels on the floor with its person (it does not bounce, so it stays readable) */
.n-tag {
  position: absolute; left: 50%; top: calc(100% + 5px); transform: translateX(-50%); box-sizing: border-box;
  width: max-content; max-width: var(--tag-w, 84px); padding: 2px 6px; border-radius: 9px;
  background: var(--n-tag-bg); box-shadow: inset 0 0 0 1px #eadfcf, 0 1px 2px rgba(90, 58, 24, 0.06);
  font-family: var(--font-display); font-weight: 800; font-size: var(--tag-font, 13px); line-height: 1.3; color: var(--n-ink);
  text-align: center; overflow-wrap: anywhere; transition: opacity 0.2s;
}
.n-tag small { display: block; font-size: 0.78em; font-weight: 800; color: #8a6420; }
.n-tag.is-long { font-size: var(--tag-long, 11.5px); line-height: 1.25; }
/* waiting (before or during the draw): the whole name, up to three lines (the crowd leaves room for it) */
.n-pal:not(.is-queued):not(.is-moving) .n-tag {
  max-width: var(--crowd-tag-w, 76px); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--crowd-lines, 3);
  font-size: var(--crowd-font, 13px);
}
.n-pal:not(.is-queued) .n-tag small { line-height: 1.15; }   /* 同名1 / 同名2 stay visible while waiting too */
.n-pal.is-moving .n-tag { max-width: var(--tag-w, 84px); }

/* order number: a small badge on the shoulder */
.n-num {
  position: absolute; left: -9%; top: -7%; z-index: 2; display: none; align-items: center; justify-content: center; box-sizing: border-box;
  min-width: var(--num, 22px); height: var(--num, 22px); padding: 0 5px; border-radius: 999px;
  background: var(--n-indigo); color: #fff; border: 2px solid #fff; box-shadow: 0 1px 2px rgba(40, 50, 110, 0.25);
  font-family: var(--font-display); font-weight: 800; font-size: calc(var(--num, 22px) * 0.55); line-height: 1; font-variant-numeric: tabular-nums;
}
.n-pal.is-queued .n-num { display: inline-flex; }
.n-pal.is-queued.is-fresh .n-num { animation: n-pop 0.34s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes n-pop { 0% { transform: scale(0.2); } 100% { transform: scale(1); } }

/* a crowded plaza (many names on a small screen): faces only while waiting */
.n-ground.is-dense:not(.is-running):not(.is-done) .n-pal:not(.is-queued) .n-tag { opacity: 0; }

/* waiting people step back a little (smaller, no tag) while the line forms — not for very few people */
.n-ground.is-running:not(.t-S) .n-pal.is-waiting .n-size { transform: scale(0.82); }
.n-ground.is-running:not(.t-S) .n-pal.is-waiting .n-tag { opacity: 0; }
.n-ground.is-resizing .n-pal.is-waiting .n-tag { transition: none; }   /* switching to the compact rows: no names left floating */

/* many people: compact rows — number · person · name */
.n-ground.k-row .n-acc { display: none; }
.n-ground.k-row .n-tag {
  left: calc(100% + 6px); top: 50%; transform: translateY(-50%); width: var(--tag-w, 70px); max-width: none;
  padding: 0; background: none; box-shadow: none; text-align: left; line-height: 1.22;
}
.n-ground.k-row .n-tag small { display: inline; margin-left: 4px; font-size: 0.74em; white-space: nowrap; }
.n-ground.k-row .n-pal:not(.is-queued):not(.is-moving) .n-tag { opacity: 0; }
.n-ground.k-row .n-num {
  left: auto; right: calc(100% + 3px); top: 50%; transform: translateY(-50%); min-width: 0; height: auto; padding: 0;
  background: none; border: 0; box-shadow: none; color: var(--n-indigo-deep); font-size: var(--num-font, 13px); justify-content: flex-end; width: var(--num-w, 18px);
}
.n-ground.k-row .n-pal.is-queued.is-fresh .n-num { animation: n-fade 0.3s ease-out; }
/* very small phones with many people: the number sits on the person as a small badge */
.n-ground.k-row.is-narrow .n-num {
  left: -6px; right: auto; top: -6px; transform: none; width: auto; min-width: var(--num, 16px); height: var(--num, 16px); padding: 0 3px;
  justify-content: center; border-radius: 999px; background: var(--n-indigo); color: #fff; border: 1.5px solid #fff; font-size: 10.5px;
}
/* the finished roster for many people: bigger, calmer, a rule under each row */
.n-ground.is-roster .n-tag { line-height: 1.3; }
.n-ground.is-roster .n-tag small { font-size: 0.8em; }
.n-ground.is-roster .n-num { font-weight: 800; letter-spacing: -0.02em; }
.n-lanes .n-rule { stroke: rgba(150, 118, 74, 0.16); stroke-width: 1; stroke-dasharray: none; }
/* the line spreading into the roster: people grow a little as they move */
.n-ground.is-spreading .n-pal, .n-ground.is-resizing .n-pal { transition: width 0.4s var(--n-ease), height 0.4s var(--n-ease); }
.n-ground.is-spreading .n-tag { animation: n-fade 0.42s ease-out 0.1s both; }   /* the name settles in beside / under its person */
/* small screens while the line forms: faces and numbers only, names come with the result */
.n-ground.is-dots .n-tag { opacity: 0 !important; }
.n-ground.is-dots .n-num {
  left: -6px; right: auto; top: -6px; transform: none; width: auto; min-width: var(--num, 17px); height: var(--num, 17px); padding: 0 3px;
  justify-content: center; border-radius: 999px; background: var(--n-indigo); color: #fff; border: 1.5px solid #fff; font-size: 10.5px;
}
.n-ground.is-dots .n-acc { display: none; }
/* a puff of dust on landing */
.n-puff { position: absolute; left: 0; top: 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(168, 140, 100, 0.45), rgba(168, 140, 100, 0)); pointer-events: none; }
@keyframes n-fade { 0% { opacity: 0; } 100% { opacity: 1; } }

/* ---------- status, buttons ---------- */
.n-statusrow { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 32px; margin-top: 6px; padding: 0 4px; }
.n-status { min-width: 0; overflow-wrap: anywhere; }
.n-statusrow.is-live { min-height: 48px; }
.n-status {
  margin: 0; text-align: center; font-size: 0.92rem; font-weight: 700; color: var(--n-muted);
  font-variant-numeric: tabular-nums; transition: color 0.2s;
}
.n-status.is-done { color: var(--n-indigo-deep); font-family: var(--font-display); font-size: 1rem; }
.n-status.is-done::before {
  content: ""; display: inline-block; width: 1.05em; height: 1.05em; margin-right: 6px; vertical-align: -0.16em; border-radius: 50%;
  background: var(--n-indigo) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.4l2.6 2.5L12 5.4' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat;
}
.n-status:empty { display: none; }
.n-callnum {
  display: inline-block; min-width: 2.6em; margin-right: 8px; padding: 2px 9px; border-radius: 999px; box-sizing: border-box;
  background: var(--n-indigo); color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 0.92rem; text-align: center;
}
.n-status.is-call { display: flex; align-items: center; white-space: nowrap; }
.n-callnum { flex: 0 0 auto; }
.n-callname { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-display); font-weight: 800; font-size: 1.02rem; color: var(--n-ink); }
.n-callrest { flex: 0 0 auto; margin-left: 10px; font-size: 0.84rem; font-weight: 700; color: var(--n-soft); white-space: nowrap; }
/* phones: the name gets the whole line, 「のこり」 goes under it (same row height, nothing shifts) */
@media (max-width: 420px) {
  .n-status.is-call { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; align-items: center; text-align: left; }
  .n-status.is-call .n-callnum { grid-row: 1 / span 2; margin-right: 0; }
  .n-status.is-call .n-callname { line-height: 1.25; }
  .n-status.is-call .n-callrest { margin-left: 0; font-size: 0.76rem; line-height: 1.25; }
}
.n-status.is-error { color: var(--danger); }
.n-status.is-nudge { animation: n-nudge 0.36s ease; }
@keyframes n-nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.n-cta { display: flex; gap: 10px; justify-content: center; margin-top: 4px; }
.n-draw {
  flex: 1 1 auto; max-width: 440px; min-height: 58px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--primary); color: #fff; font: inherit; font-family: var(--font-display); font-weight: 800; font-size: 1.12rem; letter-spacing: 0.06em;
  box-shadow: 0 4px 0 var(--primary-press), 0 12px 22px rgba(194, 83, 28, 0.2);
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.n-draw:hover { background: var(--primary-hover); }
.n-draw:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--primary-press), 0 6px 14px rgba(194, 83, 28, 0.18); }
.n-draw[aria-disabled="true"] { opacity: 0.5; cursor: default; transform: none; box-shadow: 0 4px 0 var(--primary-press); }
.n-draw[aria-disabled="true"]:hover { background: var(--primary); }
.n-copy {
  flex: 0 0 auto; min-height: 58px; padding: 0 20px; border-radius: 999px; cursor: pointer; box-sizing: border-box;
  border: 1.5px solid #d6dcf3; background: #fff; color: var(--n-indigo-deep);
  font: inherit; font-family: var(--font-display); font-weight: 800; font-size: 0.98rem; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.n-copy[hidden] { display: none; }
.n-copy:hover { background: var(--n-indigo-tint); }
.n-copy.is-copied { background: var(--n-indigo); border-color: var(--n-indigo); color: #fff; }
.n-skip {
  flex: 0 0 auto; white-space: nowrap; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--line-strong); cursor: pointer;
  background: #fff; color: var(--n-ink); font: inherit; font-weight: 800; font-size: 0.9rem;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
/* only when its row is scrolled out of view (many people on a short screen) */
.n-skip.is-floating {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 700; min-height: 48px;
  background: rgba(255, 255, 255, 0.97); box-shadow: 0 8px 22px rgba(40, 30, 20, 0.18);
}
.n-skip[hidden] { display: none; }

/* ---------- names ---------- */
.n-input { background: #fff; border: 1px solid var(--n-line); border-radius: 20px; padding: 14px 16px 12px; box-shadow: var(--card-shadow); }
.n-input-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.n-input-head label { font-weight: 800; color: var(--n-ink); font-size: 0.98rem; }
.n-count {
  min-width: 3.2em; padding: 3px 10px; border-radius: 999px; text-align: center; box-sizing: border-box;
  background: var(--n-indigo-tint); color: var(--n-indigo-deep); font-weight: 800; font-size: 0.9rem; font-variant-numeric: tabular-nums;
}
.n-count.is-over { background: #fde9e7; color: var(--danger); }
.n-input textarea {
  display: block; box-sizing: border-box; width: 100%; height: 148px; margin-top: 8px; padding: 10px 12px; resize: vertical;
  border: 1.5px solid #ddd2c2; border-radius: 14px; background: #fffdf9; color: var(--n-ink);
  font: inherit; font-size: 16px; line-height: 1.6;
}
.n-input textarea::placeholder { color: #a99d8f; }
.n-input textarea:focus { outline: none; border-color: var(--n-indigo); box-shadow: 0 0 0 3px rgba(74, 98, 200, 0.18); }
.n-help { margin: 6px 2px 0; font-size: 0.8rem; color: var(--n-soft); line-height: 1.5; }
.n-notice { margin: 8px 0 0; padding: 8px 10px; border-radius: 12px; background: #fff8e6; color: #6b4e00; font-size: 0.82rem; line-height: 1.5; }
.n-notice[hidden] { display: none; }
.n-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-top: 10px; }
.n-tools-left { display: flex; gap: 6px; }
.n-chip {
  min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid #ddd2c2; background: #fff; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 0.86rem; color: var(--n-ink); touch-action: manipulation;
}
.n-chip:hover { background: #fbf6ee; }
.n-switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 800; font-size: 0.88rem; color: var(--n-ink); }
.n-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.n-switch-track {
  position: relative; flex: 0 0 auto; width: 40px; height: 24px; border-radius: 999px; background: #ddd5c8; transition: background 0.2s;
}
.n-switch-track::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s var(--n-ease);
}
.n-switch input:checked + .n-switch-track { background: var(--n-indigo); }
.n-switch input:checked + .n-switch-track::after { transform: translateX(16px); }
.n-switch input:focus-visible + .n-switch-track { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

.n-draw:focus-visible, .n-copy:focus-visible, .n-skip:focus-visible, .n-chip:focus-visible {
  outline: 3px solid var(--focus-ring); outline-offset: 2px;
}
@media (max-width: 480px) {
  .n-main { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 370px) { .n-lead { display: none; } }
@media (max-width: 360px) {
  .n-copy { padding: 0 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .n-ground, .n-size, .n-wait, .n-tag, .n-mark, .n-body .n-look, .n-switch-track, .n-switch-track::after { transition: none !important; }
  .n-ground .n-pal .n-eyes, .n-ground .n-pal .n-body, .n-pal.is-queued .n-num, .n-status.is-nudge { animation: none !important; }
}

/* ---------- the guide below the tool (moved here from style.css with the old tool) ---------- */
.junban-info { padding-top: clamp(28px, 6vw, 56px); }
.junban-faq { margin-top: 8px; }
.junban-faq h2 { margin-bottom: 8px; }
.junban-faq dl { margin: 0; }
.junban-faq dt { font-weight: 800; margin-top: 12px; }
.junban-faq dd { margin: 4px 0 0; color: var(--muted); }
