/* 外部のフォント・画像・CDNは使わない(第三者にアクセス情報を渡さないため) */
:root {
  color-scheme: dark;
  --bg: #0a0e13;
  --card: rgba(255, 255, 255, .045);
  --card-line: rgba(255, 255, 255, .09);
  --ink: #eef3f7;
  --sub: #94a3b3;
  --accent: #34e3a4;
  --accent-2: #4cc9ff;
  --accent-ink: #03150e;
  --line: rgba(255, 255, 255, .16);
  --field: rgba(255, 255, 255, .06);
  --warn: #ff7b72;
  --note-bg: rgba(255, 205, 80, .08);
  --note-line: rgba(255, 205, 80, .32);
  --note-ink: #f1e2b4;
  --glow: 0 10px 30px -10px rgba(52, 227, 164, .55);
  --btn-1: #34e3a4;
  --btn-2: #4cc9ff;
  --soft: rgba(52, 227, 164, .08);
  --soft-line: rgba(52, 227, 164, .4);
  --halo-1: rgba(52, 227, 164, .16);
  --halo-2: rgba(76, 201, 255, .14);
  --card-shadow: none;
  /* 文字: 外部のフォントは読み込まず、各端末に入っている読みやすい書体を順に指定する */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto,
    "Hiragino Sans", "Noto Sans JP", "Noto Sans CJK JP", "BIZ UDPGothic", "Yu Gothic UI", Meiryo, sans-serif;
  --font-num: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Display", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
}
/* 端末が明るい表示に設定されているときの配色 */
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f3f6f9;
    --card: rgba(255, 255, 255, .86);
    --card-line: rgba(12, 24, 36, .08);
    --ink: #0d1722;
    --sub: #5a6878;
    --accent: #07966a;
    --accent-2: #1479c4;
    --accent-ink: #02140d;
    --line: rgba(12, 24, 36, .18);
    --field: rgba(12, 24, 36, .04);
    --warn: #c4302b;
    --note-bg: #fff6dc;
    --note-line: #ecd482;
    --note-ink: #5a4700;
    --glow: 0 10px 26px -12px rgba(16, 170, 120, .7);
    --btn-1: #2fd89d;
    --btn-2: #56c4f7;
    --soft: rgba(7, 150, 106, .08);
    --soft-line: rgba(7, 150, 106, .35);
    --halo-1: rgba(47, 216, 157, .22);
    --halo-2: rgba(86, 196, 247, .22);
    --card-shadow: 0 1px 2px rgba(12, 24, 36, .04), 0 12px 28px -18px rgba(12, 24, 36, .25);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 1rem; line-height: 1.75; letter-spacing: .01em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .4s ease, color .4s ease;
}
/* 背景のぼんやりした光。スクロールしても動かない */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60rem 30rem at 85% -10%, var(--halo-1), transparent 60%),
    radial-gradient(50rem 28rem at -15% 5%, var(--halo-2), transparent 60%);
  transition: opacity .4s ease;
}
main { max-width: 560px; margin: 0 auto; padding: 32px 16px 72px; }
h1 {
  font-size: 1.5rem; font-weight: 800; letter-spacing: 0; line-height: 1.35; margin: 0 0 6px;
  font-feature-settings: "palt";
}
h2 { font-size: .8rem; font-weight: 700; letter-spacing: .14em; color: var(--sub); margin: 0 0 12px; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-underline-offset: 3px; }
strong { font-weight: 700; }
.sub { color: var(--sub); font-size: .9rem; }
.center { text-align: center; }

.card {
  background: var(--card); border: 1px solid var(--card-line); border-radius: 20px;
  padding: 22px 20px; margin-top: 16px; box-shadow: var(--card-shadow);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.card > :last-child { margin-bottom: 0; }

/* 番号の表示 */
.big {
  font-size: clamp(5.5rem, 30vw, 9rem); font-weight: 800; line-height: 1.05; text-align: center;
  letter-spacing: -.04em; font-variant-numeric: tabular-nums; font-family: var(--font-num);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: 4px 0 8px;
}

button, .btn {
  display: inline-block; width: 100%; padding: 15px 16px; font-size: 1.05rem; font-weight: 700;
  border: 1px solid transparent; border-radius: 14px; cursor: pointer; font-family: inherit;
  background: linear-gradient(135deg, var(--btn-1), var(--btn-2)); color: var(--accent-ink);
  box-shadow: var(--glow); font-feature-settings: "palt"; letter-spacing: .02em;
  transition: transform .08s ease, opacity .2s ease, background-color .2s ease, border-color .2s ease;
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: scale(.98); }
button:disabled { opacity: .4; cursor: default; box-shadow: none; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.ghost, button.danger { background: transparent; box-shadow: none; font-weight: 600; font-size: 1rem; }
button.ghost { color: var(--ink); border-color: var(--line); }
button.ghost:hover { background: var(--field); }
button.danger { color: var(--warn); border-color: rgba(255, 123, 114, .5); }
button.danger:hover { background: rgba(255, 123, 114, .08); }
.card button + button { margin-top: 10px; }

input[type=text] {
  width: 100%; padding: 14px; font-size: 1rem; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; font-family: inherit;
}
input[type=text]::placeholder { color: var(--sub); opacity: .8; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row button + button { margin-top: 0; }

.note {
  background: var(--note-bg); border: 1px solid var(--note-line); color: var(--note-ink);
  border-radius: 16px; padding: 14px 16px; font-size: .9rem; margin-top: 16px;
}
.card .note { margin: 12px 0; }
.note .row { margin: 12px 0 0; }
.note p { margin: 8px 0 0; }
.note .sub { color: inherit; opacity: .75; }

/* マツダケちゃん(キャラクター)と、ふきだし。絵は public/chara/ にある */
.chara { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 0 0 10px; }
.chara img { flex: none; width: 84px; height: auto; animation: bob 2.6s ease-in-out infinite; }
.chara .say {
  position: relative; background: var(--bg); border: 2px solid var(--line); border-radius: 18px;
  padding: 7px 14px; font-weight: 700; font-size: .9rem; line-height: 1.5; font-feature-settings: "palt"; text-wrap: balance;
}
.chara .say::before {
  content: ""; position: absolute; left: -8px; top: 50%; width: 12px; height: 12px; margin-top: -6px;
  background: var(--bg); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg);
}
.chara.small img { width: 68px; }
.called .chara img { animation: hop .7s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
@keyframes hop { 30% { transform: translateY(-10px); } 60% { transform: translateY(0); } }

/* 管理画面ページのURLを保存するまでは、保存の案内だけを見せる */
.gated > :not(#gate):not(h1) { display: none !important; }
#gate h2 { font-size: 1.15rem; letter-spacing: 0; color: var(--ink); line-height: 1.5; }
#gate .step { font-weight: 700; margin: 20px 0 6px; }

/* 選択肢(管理画面の設定) */
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; cursor: pointer; }
.opt input { width: 22px; height: 22px; margin: 3px 0 0; flex: none; accent-color: var(--accent); }

/* 不在の番号の一覧(管理画面) */
#absentBox { border-top: 1px solid var(--card-line); margin-top: 18px; padding-top: 16px; }
.absent-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.absent-row strong {
  flex: none; min-width: 2.4em; text-align: center; font-size: 1.6rem; line-height: 1;
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
}
.card .absent-row button { flex: 1; margin-top: 0; padding: 11px 8px; font-size: .95rem; }

.err { color: var(--warn); min-height: 1.5em; font-size: .9rem; margin-top: 8px; }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 4px; }
.chips span {
  border: 1px solid var(--card-line); background: var(--field); border-radius: 999px;
  padding: 1px 12px; font-size: .9rem; font-variant-numeric: tabular-nums; color: var(--sub);
  font-family: var(--font-num);
}

/* トップページ */
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; font-weight: 800; margin-bottom: 26px; }
.brand svg { width: 38px; height: 38px; }
.eyebrow {
  display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .14em;
  color: var(--accent); border: 1px solid var(--soft-line); background: var(--soft);
  border-radius: 999px; padding: 3px 12px; margin-bottom: 14px;
}
.hero { font-size: clamp(2rem, 9vw, 2.9rem); line-height: 1.25; letter-spacing: -.01em; margin-bottom: 14px; }
.hero em {
  font-style: normal;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.steps { list-style: none; margin: 0 0 12px; padding: 0; counter-reset: step; }
.steps li { position: relative; padding: 2px 0 14px 44px; counter-increment: step; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: .9rem; color: var(--accent); font-family: var(--font-num);
  border: 1px solid var(--soft-line); background: var(--soft);
}

/* トップページの見本(画面の中だけで動く) */
.demo-label { font-size: .8rem; font-weight: 700; letter-spacing: .1em; color: var(--sub); margin: 18px 0 8px; }
.phone {
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 26px;
  padding: 20px 18px; transition: background-color .4s ease, color .4s ease;
}
.phone > :last-child, .phone > div > :last-child { margin-bottom: 0; }
.phone .big { font-size: clamp(4rem, 20vw, 5.5rem); }
#demo > button { margin-top: 14px; }
#demo > .sub:last-child { margin-top: 14px; }

/* 店頭に貼る貼り紙。画面でも紙と同じ見た目(白地)で見せる。
   印刷では背景色が出ないことが多いので、色は枠線とSVGの絵で付ける */
.poster {
  background: #fff; color: #3a2613; border-radius: 18px; padding: 22px 16px 18px; margin-bottom: 14px;
  text-align: center; overflow: hidden;
}
.poster-name { font-size: 1.5rem; font-weight: 800; margin: 0 0 12px; font-feature-settings: "palt"; }
.poster-name:empty { display: none; }
.poster-head { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 14px; }
.poster-chara { width: 104px; flex: none; }
.poster-bubble {
  position: relative; border: 3px solid #6b3f1c; border-radius: 22px; padding: 10px 16px;
  font-size: 1.15rem; font-weight: 800; line-height: 1.45; background: #fff; text-align: left;
}
.poster-bubble strong { color: #b9743a; font-size: 1.35rem; }
.poster-bubble::before {
  content: ""; position: absolute; left: -11px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  background: #fff; border-left: 3px solid #6b3f1c; border-bottom: 3px solid #6b3f1c; transform: rotate(45deg);
}
#qr {
  background: #fff; border: 6px solid #b9743a; border-radius: 26px; padding: 12px;
  width: fit-content; margin: 0 auto 16px;
}
#qr svg, #qr img { width: 210px; height: 210px; display: block; }
.poster-steps {
  list-style: none; counter-reset: pstep; margin: 0 auto 10px; padding: 0; width: fit-content; max-width: 100%;
  text-align: left; font-weight: 700;
}
.poster-steps li { position: relative; counter-increment: pstep; padding: 3px 0 9px 40px; }
.poster-steps li::before {
  content: counter(pstep); position: absolute; left: 0; top: 2px; width: 28px; height: 28px;
  border: 3px solid #b9743a; border-radius: 50%; display: grid; place-items: center;
  font-size: .9rem; font-weight: 800; color: #b9743a; line-height: 1;
}
.poster-note {
  display: inline-block; border: 2px dashed #b9743a; border-radius: 999px; padding: 4px 16px;
  font-size: .95rem; font-weight: 700; margin: 0 0 6px;
}
.poster-queue { display: block; width: 100%; max-width: 420px; margin: 0 auto; }
.poster-ad { font-size: .8rem; color: #7a654d; margin: 8px 0 0; }

/* ライセンスコード */
#code {
  font-family: var(--font-mono);
  background: var(--field); border: 1px dashed var(--line); border-radius: 14px; padding: 14px 10px;
}

/* 特定商取引法に基づく表記 */
dl { margin: 0; }
dt { font-size: .8rem; font-weight: 700; letter-spacing: .08em; color: var(--sub); margin-top: 16px; }
dt:first-child { margin-top: 0; }
dd { margin: 2px 0 0; }
/* よくある質問(トップ) */
.faq dt { font-size: 1rem; letter-spacing: 0; color: var(--ink); }
.faq dd { color: var(--sub); font-size: .9rem; }

/* 順番が来たとき: 画面全体を明るい色に切り替えて、暗い画面との差で気づかせる */
.called {
  color-scheme: light;
  --bg: #ffd84d; --ink: #1c1500; --sub: #5b4a00;
  --card: rgba(255, 255, 255, .5); --card-line: rgba(0, 0, 0, .12);
  --accent: #1c1500; --accent-2: #1c1500; --accent-ink: #ffd84d;
  --btn-1: #1c1500; --btn-2: #1c1500;
  --line: rgba(0, 0, 0, .28); --field: rgba(0, 0, 0, .06);
  --glow: 0 10px 26px -12px rgba(0, 0, 0, .6); --card-shadow: none;
}
body.called::before { opacity: 0; }
.called .big { animation: pulse 1.1s ease-in-out infinite; }
.called #state, .called #dState { font-size: 1.2rem; font-weight: 800; }
@keyframes pulse { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) {
  .called .big { animation: none; }
  .chara img, .called .chara img { animation: none; }
  * { transition: none !important; }
}

[hidden] { display: none !important; }

/* 印刷(店頭に貼るQR): 白い紙に黒で出す */
/* 貼り紙はA4縦1枚に収める */
@page { size: A4 portrait; margin: 11mm; }
@media print {
  :root {
    color-scheme: light;
    --bg: #fff; --ink: #000; --sub: #333; --card: transparent; --card-line: transparent;
    --card-shadow: none;
  }
  body::before { display: none; }
  .noprint { display: none !important; }
  .card { border: 0; padding: 0; margin: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  main { max-width: none; padding: 0; }
  /* 貼り紙は1枚に収め、絵の色もそのまま印刷する */
  .poster {
    padding: 0; margin: 0; border-radius: 0; overflow: visible; font-size: 1.25rem;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; break-inside: avoid;
  }
  .poster-name { font-size: 2.4rem; margin-bottom: 12px; }
  .poster-head { gap: 22px; margin-bottom: 16px; }
  .poster-chara { width: 150px; }
  .poster-bubble { font-size: 1.7rem; padding: 16px 26px; border-width: 4px; border-radius: 30px; }
  .poster-bubble strong { font-size: 2rem; }
  .poster-bubble::before { border-width: 4px; left: -12px; }
  #qr { border-width: 9px; border-radius: 36px; padding: 16px; margin-bottom: 18px; }
  #qr svg, #qr img { width: 290px; height: 290px; }
  .poster-steps li { padding: 4px 0 8px 50px; }
  .poster-steps li::before { width: 36px; height: 36px; font-size: 1.1rem; top: 3px; }
  .poster-note { font-size: 1.2rem; padding: 6px 24px; margin-bottom: 6px; }
  .poster-queue { max-width: 430px; }
  .poster-ad { font-size: .95rem; margin-top: 6px; }
}
