/* くじ引き「まほうの折り紙くじ」（/kuji/ だけで読み込む）。
   サイト共通の style.css（ヘッダー・色・書体・アイコン）の上に重ねる。主役は折り紙の舞台。
   すべて .kj-* と .kuji-* に閉じていて、他のツールには当たらない。 */
.kj-page {
  --kj-ink: #2b2620;
  --kj-line: var(--line, #e8dfd3);
  --kj-stage-h: clamp(380px, calc(100vh - 270px), 540px);
}
@supports (height: 100svh) {
  .kj-page { --kj-stage-h: clamp(380px, calc(100svh - 270px), 540px); }
}
/* 横向きのスマホ：舞台が画面より高いと、下の折り紙がはみ出して引けない（Safari のタブバーが出ると高さ292pxほど） */
@media (orientation: landscape) and (max-height: 520px) {
  .kj-page { --kj-stage-h: clamp(240px, calc(100vh - 16px), 440px); }
  @supports (height: 100svh) { .kj-page { --kj-stage-h: clamp(240px, calc(100svh - 16px), 440px); } }
}
@media (min-width: 1000px) {
  .kj-page { --kj-stage-h: clamp(420px, calc(100vh - 300px), 600px); }
  @supports (height: 100svh) { .kj-page { --kj-stage-h: clamp(420px, calc(100svh - 300px), 600px); } }
}

.kj-main { max-width: 1080px; margin: 0 auto; padding: 8px 12px 36px; }
.kj-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.kj-page button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.kj-page button:disabled { cursor: not-allowed; }

/* ---------- 並び：スマホは1列（中身 → 舞台 → 結果）。PCは右に「くじの中身」 ---------- */
.kj-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 1000px) {
  .kj-main { max-width: 1180px; padding: 12px 24px 44px; }
  .kj-layout { grid-template-columns: minmax(0, 1fr) 380px; column-gap: 24px; row-gap: 14px; align-items: start; }
  .kj-layout > * { grid-column: 1; }
  .kj-layout > .kj-setup { grid-column: 2; grid-row: 1 / span 5; }
}
@media (min-width: 1100px) {
  .kj-layout { grid-template-columns: minmax(0, 1fr) 440px; }
}

/* ---------- 題名 ---------- */
.kj-head { text-align: center; }
.kj-title {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
  font-family: var(--font-display); font-weight: 800; font-size: clamp(1.3rem, 5vw, 1.75rem); letter-spacing: 0.03em; color: var(--text);
}
.kj-title::before {
  content: ""; width: 0.95em; height: 0.95em; background: var(--c-kuji);
  -webkit-mask: var(--ico-kuji) center / contain no-repeat; mask: var(--ico-kuji) center / contain no-repeat;
}
.kj-lead { margin: 2px 0 0; font-size: 0.86rem; color: var(--muted); }
@media (max-width: 370px) { .kj-lead { display: none; } }

/* ---------- いまのくじ（舞台の上） ---------- */
.kj-bar {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 6px 6px 14px;
  border: 1px solid var(--kj-line); border-radius: 16px; background: #fff; box-shadow: 0 2px 0 #efe5d7;
}
.kj-bar-text { flex: 1; min-width: 0; margin: 0; font-size: 13.5px; font-weight: 700; line-height: 1.5; color: var(--text); }
.kj-bar-kind { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 999px; background: #fff1ee; color: #a8301a; font-size: 12px; font-weight: 800; }
.kj-bar-meta { margin-right: 6px; font-weight: 800; color: var(--text); }
.kj-bar-summary { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-weight: 700; }
.kj-edit {
  flex: none; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid #f0cdb8;
  background: #fff7f0; color: var(--primary-dark); font-weight: 800; font-size: 13.5px; white-space: nowrap;
}
.kj-edit[aria-expanded="true"] { background: var(--kj-ink); border-color: var(--kj-ink); color: #fff; }

/* ---------- くじの中身（設定） ---------- */
.kj-setup { min-width: 0; border: 1px solid var(--kj-line); border-radius: 18px; background: #fff; box-shadow: 0 2px 0 #efe5d7; }
.kj-setup-body { padding: 14px; }
@media (max-width: 999.98px) { .kj-setup:not(.is-open) { display: none; } }
@media (min-width: 1000px) {
  .kj-edit { display: none; }
  /* PC：右の「くじの中身」は画面に収まる高さの枠にして、中身だけを枠の中でスクロールする。
     「このくじにする」の帯は枠のいちばん下に並べるので、中身の上に重ならない（枠の高さは kuji.js が画面に合わせる） */
  .kj-layout > .kj-setup { display: flex; flex-direction: column; max-height: var(--kj-panel-h, none); overflow: hidden; }
  .kj-setup-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
}
.kj-setup-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
/* 見出しの横の「このくじにする」。下のボタンと同じ反映（画面の端に固定しないので、広告などが重なっても押せる方が残る） */
.kj-apply-top {
  flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 0; white-space: nowrap;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 900; box-shadow: 0 3px 0 var(--primary-press);
}
.kj-apply-top:disabled { background: #efe8de; color: #6b6157; box-shadow: none; }
.kj-note-top { margin: -4px 0 10px; }
.kj-setup.is-dirty .kj-note-top { color: #7a4f00; }
.kj-msg-slot .kj-msg { margin: 0 0 10px; }
.kj-setup-foot .kj-msg-slot .kj-msg { margin: 6px 0 0; }
.kj-setup-head h2 { margin: 0; font-family: var(--font-display); font-size: 17px; }
.kj-setup-head h2:focus { outline: none; }
.kj-modes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.kj-modes button {
  min-height: 58px; padding: 6px 8px; border-radius: 14px; border: 1.5px solid var(--kj-line); background: #faf6f0; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; line-height: 1.3;
}
.kj-modes b { font-size: 15px; color: var(--text); }
.kj-modes small { font-size: 11.5px; font-weight: 700; }
.kj-modes button[aria-pressed="true"] { border-color: var(--c-kuji); background: #fff1ee; box-shadow: inset 0 0 0 1px var(--c-kuji); color: #8f2a18; }
.kj-modes button[aria-pressed="true"] b { color: #a8301a; }
.kj-pane { display: grid; gap: 8px; margin-top: 12px; min-width: 0; }
.kj-label { font-size: 13px; font-weight: 800; color: var(--text); }
.kj-pane textarea {
  width: 100%; min-height: 150px; padding: 10px 12px; border: 1.5px solid var(--kj-line); border-radius: 12px;
  font-size: 16px; line-height: 1.5; resize: vertical; background: #fff; color: var(--text);
}
.kj-help { margin: 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.kj-pane-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; }
.kj-samples { display: flex; flex-wrap: wrap; gap: 6px; }
.kj-total { margin: 0; font-size: 13px; font-weight: 800; color: var(--muted); }
.kj-total.is-bad { color: var(--danger, #b42318); }
.kj-mini { min-height: 44px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--kj-line); background: #fff; color: var(--text); font-size: 13px; font-weight: 700; }
.kj-mini:disabled { opacity: 0.45; }
.kj-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.kj-preset {
  display: inline-flex; align-items: baseline; justify-content: center; gap: 5px; min-height: 44px; padding: 0 12px;
  border-radius: 999px; border: 1px solid #f0cdb8; background: #fff7f0; color: var(--primary-dark); font-size: 13px; line-height: 44px; text-align: left; white-space: nowrap;
}
.kj-preset b { font-weight: 800; }
.kj-preset small { font-size: 11px; font-weight: 700; color: #7c4f33; }
.kj-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; container-type: inline-size; }
.kj-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 6px; padding: 6px; border-radius: 12px; border: 1px solid var(--kj-line); background: #faf6f0; }
.kj-row.kind-big { border-color: #ecd28a; background: #fff8e1; }
.kj-row.kind-win { border-color: #f2c4bb; background: #fff1ee; }
.kj-row-name {
  grid-column: 2; grid-row: 1; width: 100%; min-width: 0; min-height: 44px; padding: 0 10px;
  border: 1.5px solid var(--kj-line); border-radius: 10px; font-size: 16px; background: #fff; color: var(--text);
}
.kj-row-tools { display: contents; }
/* 種類のプルダウン：WebKit の標準の見た目は高さ（44px）を無視するので、見た目だけ自前にする（選ぶのは標準のまま） */
.kj-row-kind {
  grid-column: 1; grid-row: 1; height: 44px; padding: 0 28px 0 10px; border-radius: 10px; border: 1.5px solid var(--kj-line);
  -webkit-appearance: none; appearance: none; color: var(--text); font-size: 16px; font-weight: 800; line-height: 1.2;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%235a5047' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 12px 8px;
}
.kj-row.kind-big .kj-row-kind { border-color: #c9a227; background-color: #fff3c4; color: #5a3d00; }
.kj-row.kind-win .kj-row-kind { border-color: #e59a8d; background-color: #ffe3dc; color: #8f2a18; }
.kj-stepper { grid-column: 1 / 3; grid-row: 2; justify-self: start; display: inline-flex; align-items: center; border: 1.5px solid var(--kj-line); border-radius: 999px; overflow: hidden; background: #fff; }
.kj-step { width: 44px; height: 44px; padding: 0; border: 0; background: #faf6f0; color: var(--text); font-size: 18px; font-weight: 800; }
.kj-step:disabled { color: #b5ab9e; }
.kj-row-count {
  width: 48px; height: 44px; padding: 0; border: 0; text-align: center; font-size: 16px; font-weight: 800; color: var(--text); background: #fff;
  -moz-appearance: textfield; appearance: textfield;
}
.kj-row-count::-webkit-outer-spin-button, .kj-row-count::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.kj-row-del { grid-column: 1 / 3; grid-row: 2; justify-self: end; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 18px; }
@container (min-width: 400px) {
  .kj-row { grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; }
  .kj-stepper { grid-column: 3; grid-row: 1; }
  .kj-row-del { grid-column: 4; grid-row: 1; }
  .kj-row-count { width: 44px; }
}
.kj-add { display: flex; flex-wrap: wrap; gap: 6px; }
.kj-field { display: grid; gap: 6px; justify-items: start; margin-top: 14px; }
.kj-seg { display: inline-flex; max-width: 100%; border: 1.5px solid var(--kj-line); border-radius: 999px; overflow: hidden; background: #fff; }
.kj-seg button { min-height: 44px; padding: 0 16px; border: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 800; }
.kj-seg button + button { border-left: 1px solid var(--kj-line); }
.kj-seg button[aria-pressed="true"] { background: var(--kj-ink); color: #fff; }
/* 設定のいちばん下の「このくじにする」：ふつうの並びの中に置く（スマホで画面の下に固定しない＝画面の下の広告と重ならない）。
   PCでは右の枠のいちばん下に並ぶので、枠が画面に収まっている間はいつも見える */
.kj-setup-foot { padding: 10px 14px 14px; border-top: 1px solid var(--kj-line); border-radius: 0 0 18px 18px; background: #fff; }
@media (min-width: 1000px) {
  .kj-setup-foot { flex: none; padding-bottom: 12px; }
  /* 枠の中にまだ続きがあるときだけ、帯の上に影を出す */
  .kj-setup.is-more .kj-setup-foot { box-shadow: 0 -10px 14px -10px rgba(90, 58, 24, 0.3); }
}
.kj-note { margin: 0; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.kj-setup.is-dirty .kj-note { color: #7a4f00; }
.kj-apply-row { display: flex; gap: 8px; margin-top: 6px; }
.kj-apply {
  flex: 1; min-height: 50px; padding: 0 16px; border-radius: 999px; border: 0;
  background: var(--primary); color: #fff; font-size: 16px; font-weight: 900; box-shadow: 0 4px 0 var(--primary-press);
}
.kj-apply:disabled { background: #e8dfd3; color: #6b6157; box-shadow: none; }
.kj-cancel { min-height: 50px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--kj-line); background: #fff; color: var(--muted); font-size: 14px; font-weight: 700; }
.kj-msg { margin: 6px 0 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.kj-msg:empty { display: none; }
.kj-msg.is-error { color: var(--danger, #b42318); }
.kj-msg.is-ok { color: var(--accent, #12705e); }
.kj-undo { min-height: 40px; margin-left: 2px; padding: 0 12px; border-radius: 999px; border: 1px solid currentColor; background: #fff; color: inherit; font-size: 12.5px; font-weight: 800; }
.kj-setup.is-locked .kj-apply-row { opacity: 0.8; }

/* ---------- 舞台 ---------- */
.kj-play { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.kj-stage {
  position: relative; height: var(--kj-stage-h); border-radius: 20px; overflow: hidden; isolation: isolate;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  background: radial-gradient(110% 80% at 50% 30%, #fffaf1, #f1e6d6);
  box-shadow: 0 2px 0 #efe5d7, 0 14px 30px rgba(90, 58, 24, 0.12);
}
.kj-scene { position: absolute; inset: 0; z-index: 8; width: 100%; height: 100%; display: block; pointer-events: none; overflow: visible; }
.kj-hand { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.kj-sheet { position: absolute; padding: 0; border: 0; background: transparent; pointer-events: auto; touch-action: none; cursor: grab; transform: rotate(var(--ang)); transform-origin: 50% 120%; transition: transform 0.15s; border-radius: 8px; }
.kj-sheet-face { position: absolute; inset: 6px; border-radius: 3px; background: linear-gradient(135deg, color-mix(in srgb, var(--paper) 82%, #fff), var(--paper)); box-shadow: 0 3px 0 color-mix(in srgb, var(--paper) 60%, #000), 0 6px 14px rgba(60, 40, 20, 0.2); }
.kj-sheet-face::after { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, transparent 49%, rgba(255, 255, 255, 0.35) 50%, transparent 51%); }
.kj-sheet.is-lift { transform: rotate(0deg) scale(1.12); transition: transform 0.12s; z-index: 2; }
.kj-sheet:focus-visible { outline: 3px solid var(--kj-ink); outline-offset: 2px; }
.kj-busy .kj-sheet { pointer-events: none; opacity: 0.75; }
/* スクロールした直後は紙をつかまない（kuji.js が is-scrolling をつける）：指はそのままページをスクロールする */
.kj-hand.is-scrolling .kj-sheet { touch-action: pan-y; }
/* 最初の1回だけ、まんなかの紙が控えめに浮く（つまむ場所の合図）。動きひかえめでは出さない */
.kj-sheet.is-nudge { animation: kj-nudge 1.3s ease-in-out; }
@keyframes kj-nudge { 0%, 100% { translate: 0 0; } 28% { translate: 0 -9px; } 52% { translate: 0 -2px; } 72% { translate: 0 -6px; } }
.is-reduced .kj-sheet.is-nudge { animation: none; }
@media (prefers-reduced-motion: reduce) { .kj-sheet.is-nudge { animation: none; } }
/* 紙を持ち上げている間は、前の結果を薄くする（やめたら元にもどる。結果の紙の不透明度は kuji.js が直接持つので filter で薄くする） */
.kj-stage.is-lifting .kj-card { filter: opacity(0.18); transition: filter 0.15s; }
.kj-stage.is-lifting .kj-papers, .kj-stage.is-lifting .kj-front { opacity: 0.18; transition: opacity 0.15s; }
.kj-stage-count { position: absolute; z-index: 7; right: 10px; bottom: 6px; margin: 0; padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); font-size: 12px; font-weight: 800; color: #5e4433; pointer-events: none; }
/* 縦長のスマホでは手元の紙が舞台の幅いっぱいに並ぶので、舞台の中の「のこり」は出さない（すぐ下の行に同じ数がある） */
@media (max-width: 560px) { .kj-stage-count { display: none; } }
.kj-hint { position: absolute; z-index: 7; left: 50%; top: 12px; transform: translateX(-50%); margin: 0; padding: 3px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.92); box-shadow: 0 2px 8px rgba(90, 60, 30, 0.15); font-size: 13px; font-weight: 800; color: #5a3d1e; white-space: nowrap; pointer-events: none; transition: opacity 0.3s; }
.kj-hint b { color: #b0461a; }
.kj-hint.is-off { opacity: 0; }
.kj-fx { position: absolute; inset: 0; z-index: 30; width: 100%; height: 100%; pointer-events: none; }

/* 金色確定演出の見出し */
.kj-caption {
  position: absolute; z-index: 22; left: 50%; top: 12px; transform: translateX(-50%); margin: 0; padding: 4px 16px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  background: linear-gradient(110deg, #8a5a0a, #e2a400 30%, #fff1b8 50%, #e2a400 70%, #8a5a0a); background-size: 220% 100%;
  color: #3a2600; font-family: var(--font-display); font-weight: 900; font-size: 14px; letter-spacing: 0.08em; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(255, 240, 180, 0.7), 0 6px 18px rgba(140, 90, 0, 0.35);
}
.kj-caption.is-in { animation: kj-cap-in 0.35s cubic-bezier(0.2, 1.5, 0.4, 1), kj-cap-shine 1.6s linear 0.2s infinite; }
@keyframes kj-cap-in { from { opacity: 0; transform: translateX(-50%) scale(0.6); } }
.kj-caption.is-out { opacity: 0; transition: opacity 0.3s; }
@keyframes kj-cap-shine { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.kj-demo-tag { position: absolute; z-index: 23; left: 10px; bottom: 8px; margin: 0; padding: 3px 10px; border-radius: 8px; background: var(--kj-ink); color: #fff; font-size: 11.5px; font-weight: 800; pointer-events: none; }

/* 結果の紙：紙そのものは SVG の8面（動物を作っていた紙）。ここは、その上に重ねる文字だけ */
.kj-card { position: absolute; z-index: 24; left: 0; top: 0; display: flex; flex-direction: column; justify-content: center; margin: 0; padding: 12px 14px; text-align: center; color: #32241b; pointer-events: none; }
.kj-card-ribbon { margin: 0; font-size: 12px; font-weight: 900; line-height: 1.4; letter-spacing: 0.02em; color: #755129; }
.kj-card.is-gold .kj-card-ribbon { color: #624007; }
.kj-card-label {
  margin: 7px 0 5px; font-family: var(--font-display); font-weight: 900; line-height: 1.22; color: #30251b; text-shadow: 0 1px 0 #fff9;
  overflow-wrap: anywhere; word-break: auto-phrase; text-wrap: balance; pointer-events: auto; touch-action: pan-y; user-select: text; -webkit-user-select: text;
}
.kj-card-label:focus-visible { outline: 2px solid #9b7333; outline-offset: 2px; }
.kj-card-meta { margin: 0; font-size: 11px; font-weight: 700; line-height: 1.4; color: #6a563c; }
.kj-card.is-gold .kj-card-meta { color: #5a3d00; }
.kj-card-stamp { position: absolute; right: 4px; top: -9px; z-index: 2; padding: 2px 6px; border-radius: 6px; border: 2px solid var(--kj-ink); color: var(--kj-ink); background: rgba(255, 255, 255, 0.85); font-size: 10px; font-weight: 900; transform: rotate(8deg); }

/* ---------- 舞台の下：のこり・おまかせ・内訳 ---------- */
.kj-controls { display: flex; align-items: center; gap: 10px; min-height: 52px; }
.kj-left { flex: 1; min-width: 0; margin: 0; display: flex; align-items: baseline; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.kj-left b { font-family: var(--font-display); font-size: 26px; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.kj-left-label { margin-right: 2px; }
.kj-left-done { font-size: 15px; font-weight: 800; color: var(--text); white-space: normal; }
.kj-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--kj-line); background: #fff; color: var(--text); font-size: 15px; font-weight: 800; white-space: nowrap; }
.kj-btn:disabled { opacity: 0.45; }
.kj-auto { border-color: #f0cdb8; background: #fff7f0; color: var(--primary-dark); }
.kj-skip { border-color: var(--kj-ink); background: var(--kj-ink); color: #fff; }
.kj-skip kbd { font: inherit; font-size: 10.5px; font-weight: 700; padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.18); }
.kj-again { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 3px 0 var(--primary-press); }
.kj-busy .kj-auto { display: none; }
@media (max-width: 420px) { .kj-skip kbd { display: none; } .kj-btn { padding: 0 14px; font-size: 14px; } }
.kj-counts { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.kj-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; min-height: 30px; padding: 2px 10px 2px 6px; border-radius: 999px; border: 1px solid var(--kj-line); background: #fff; font-size: 13px; font-weight: 700; }
.kj-chip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kj-chip b { font-variant-numeric: tabular-nums; }
.kj-chip.is-out { color: var(--muted); text-decoration: line-through; background: #f6f1ea; }
.kj-counts-more { width: 100%; }
.kj-counts-more summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-size: 13px; font-weight: 800; color: var(--muted); }
.kj-counts-list { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.kj-dot { flex: none; display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--dot-deep); background: radial-gradient(circle at 35% 30%, #fff 0 12%, var(--dot) 40%, var(--dot-deep) 100%); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); }

/* ---------- 引いた結果・演出 ---------- */
.kj-card-box { min-width: 0; padding: 14px; border: 1px solid var(--kj-line); border-radius: 18px; background: #fff; box-shadow: 0 2px 0 #efe5d7; }
.kj-card-box h2 { margin: 0; font-family: var(--font-display); font-size: 16px; }
.kj-box-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.kj-history-count { margin-left: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.kj-box-actions { display: flex; gap: 6px; }
.kj-restart-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: #fff4ec; }
.kj-restart-ask p { flex: 1 1 100%; margin: 0; font-size: 13px; font-weight: 700; }
.kj-danger { border-color: var(--danger, #b42318); color: var(--danger, #b42318); }
.kj-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 288px; overflow-y: auto; overscroll-behavior: contain; }
.kj-history li { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 38px; padding: 4px 10px; border-radius: 10px; background: #faf6f0; font-size: 14px; font-weight: 700; }
.kj-history li.kind-big { background: #fff4cf; }
.kj-history li.kind-win { background: #fff0ec; }
.kj-hn { flex: none; min-width: 22px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kj-hl { min-width: 0; overflow-wrap: anywhere; }
.kj-hkind { flex: none; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--kj-line); background: #fff; color: var(--muted); font-size: 11.5px; font-weight: 800; }
.kj-hgold { flex: none; margin-left: auto; padding: 1px 7px; border-radius: 6px; background: linear-gradient(135deg, #fff1b8, #e2a400 60%, #b8860b); color: #3a2600; font-size: 11px; font-weight: 900; box-shadow: inset 0 0 0 1px rgba(120, 80, 0, 0.3); }
.kj-history-empty { color: var(--muted); font-weight: 600 !important; background: transparent !important; padding-left: 0 !important; }
.kj-fx-box { display: grid; gap: 8px; }
.kj-field-row { margin-top: 2px; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; }
.kj-switch { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 700; cursor: pointer; }
.kj-switch input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.kj-switch-track { position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; background: #cbbda8; transition: background 0.2s; }
.kj-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s; }
.kj-switch input:checked + .kj-switch-track { background: var(--primary); }
.kj-switch input:checked + .kj-switch-track::after { transform: translateX(18px); }
.kj-switch input:focus-visible + .kj-switch-track { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.kj-demo { padding-top: 6px; border-top: 1px dashed var(--kj-line); }
.kj-demo-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.kj-gold-btn { border-color: #b8860b; background: linear-gradient(135deg, #fff1b8, #f4c430 60%, #d9a520); color: #3a2600; font-weight: 800; }

/* 動きひかえめ */
.is-reduced .kj-caption.is-in { animation: none; }
.is-reduced .kj-sheet, .is-reduced .kj-hint { transition: none; }

/* ---------- 下の説明 ---------- */
.kuji-info { padding-top: clamp(28px, 6vw, 56px); }
.kuji-faq { margin-top: 8px; }
.kuji-faq h2 { margin-bottom: 8px; }
.kuji-faq dl { margin: 0; }
.kuji-faq dt { font-weight: 800; margin-top: 12px; }
.kuji-faq dd { margin: 4px 0 0; color: var(--muted); }
