body {
  margin: 0;
  padding-bottom: 40px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: #f5f6fa;
}

/* === No.0 基準UI（親切） === */
.ui-base {
  border: 2px solid #22c55e;
  background: #f0fdf4;
}
.ui-base .title {
  color: #15803d;
}
.ui-base button {
  background: #22c55e;
}
.ui-base button:hover {
  background: #16a34a;
}

/* === UI 番号バッジ === */
.ui-number {
  position: absolute;
  top: 12px;
  left: 14px;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: .5px;
  user-select: none;
}

.ui { position: relative; }

.ui-list {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.ui {
  background: #fff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.title {
  font-size: 18px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.title small {
  display: block;
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

.row {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

select,
input[type="number"],
input[type="text"],
input[type="password"],
input[type="email"] {
  padding: 10px 12px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid #ccc;
  box-sizing: border-box;
  background: #fff;
}

select,
input[type="number"] {
  min-width: 110px;
}

button {
  padding: 10px 12px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid #ccc;
  background: #0078d7;
  color: white;
  border: none;
  cursor: pointer;
  min-width: 90px;
}

button:hover { background: #005bb5; }
button:disabled { background: #ccc; cursor: not-allowed; }

.result {
  margin-top: 14px;
  min-height: 1.5em;
  font-size: 14px;
  color: #333;
  white-space: pre-line;
}

/* === 逃げるボタン === */
.ui-esc-card {
  min-height: 240px;
}
.escape-arena {
  height: 72px;
  margin: 12px auto;
  border: 1px dashed #ccc;
  border-radius: 8px;
  max-width: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.escape-arena-hint {
  font-size: 0.78em;
  color: #aaa;
  pointer-events: none;
}

/* === シャッフルチェックボックス（目立たない） === */
.shuffle-cb {
  accent-color: #d1d5db;
  opacity: 0.45;
  width: 13px;
  height: 13px;
}

/* === シャッフルラジオ === */
.shuffle-options {
  text-align: left;
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  gap: 2px 8px;
  width: 100%;
  margin: 8px 0 12px;
}

/* === テンキー === */
.numpad-fields {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.numpad-field-item {
  padding: 6px 14px;
  background: #f1f5f9;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #64748b;
  font-family: monospace;
}

.numpad-field-item.np-active {
  border-color: #0078d7;
  background: #dbeafe;
  color: #1e40af;
}

.numpad-step {
  font-size: 13px;
  color: #0078d7;
  font-weight: 600;
  margin-bottom: 6px;
}

.numpad-display {
  font-size: 2rem;
  font-weight: 700;
  color: #1a202c;
  background: #f1f5f9;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px 24px;
  display: inline-block;
  min-width: 80px;
  text-align: center;
  margin-bottom: 10px;
  font-family: monospace;
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 6px;
  width: fit-content;
  margin-inline: auto;
}

.numpad .numpad-btn:last-child {
  grid-column: 1 / -1;
  justify-self: center;
}

.numpad-zero {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
}

.numpad-btn {
  padding: 14px 0;
  font-size: 18px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: #f9fafb;
  cursor: pointer;
  width: 64px;
  min-width: unset;
  color: #1a202c;
}

.numpad-btn:hover { background: #e2e8f0; }

/* === ドラッグ誕生日 === */
.drag-slots {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 12px 0 4px;
}

.drag-slot {
  min-width: 90px;
  padding: 10px 14px;
  border: 2px dashed #aaa;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 15px;
  font-weight: 600;
  color: #666;
  display: flex;
  align-items: center;
  gap: 4px;
}

.drag-slot.filled {
  border-color: #0078d7;
  background: #e8f3ff;
  color: #003f88;
}

.drag-pool {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 8px 0;
  max-height: 160px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
}

.drag-tile {
  padding: 7px 12px;
  background: #fff;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: grab;
  user-select: none;
  font-family: monospace;
  flex-shrink: 0;
}

.drag-tile:active { cursor: grabbing; }
.drag-tile.used { background: #dbeafe; border-color: #3b82f6; color: #1d4ed8; }

/* === 白文字入力 === */
.invis-input {
  color: #fff;
  caret-color: #999;
  min-width: 160px;
}

.invis-count {
  position: absolute;
  bottom: -18px;
  left: 0;
  font-size: 11px;
  color: #aaa;
  white-space: nowrap;
}

/* === OK/キャンセル逆 === */
.ok-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 14px;
  align-items: center;
}

/* 「キャンセル」— 青くて目立つ → 実際は送信 */
.ok-cancel-style {
  background: #0078d7;
  color: #fff;
  font-size: 16px;
  padding: 10px 28px;
}
.ok-cancel-style:hover { background: #005bb5; }

/* 「OK」— 枠なし・下線のみ → 実際はキャンセル */
.ok-confirm-style {
  background: transparent;
  color: #555;
  border: none !important;
  text-decoration: underline;
  font-size: 14px;
  padding: 10px 16px;
  min-width: unset;
}
.ok-confirm-style:hover { background: transparent; color: #333; }

/* === スライダー誕生日 === */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 16px 0;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.slider-label {
  width: 1.5em;
  text-align: right;
  font-weight: 700;
  color: #444;
  font-size: 15px;
}

.slider-val {
  width: 3em;
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  font-family: monospace;
  color: #0078d7;
}

input[type="range"] {
  width: 240px;
  accent-color: #0078d7;
}

.sl-date-display {
  font-size: 22px;
  font-weight: 700;
  font-family: monospace;
  color: #1a202c;
  margin: 12px 0 10px;
}

/* === 複素数年齢スライダー === */
.cslider-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 16px 0;
}

.cslider-labels {
  display: flex;
  justify-content: space-between;
  width: 280px;
  font-size: 12px;
  color: #888;
  padding: 0 2px;
}

.cslider-arena {
  position: relative;
  width: 280px;
  height: 80px;
  cursor: ew-resize;
  overflow: visible;
}

.cslider-track {
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 6px;
  background: #ddd;
  border-radius: 3px;
  transform: translateY(-50%);
}

.cslider-handle {
  position: absolute;
  width: 22px;
  height: 22px;
  background: #0078d7;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  pointer-events: none;
  transition: top 0s;
}

.cslider-display {
  font-size: 24px;
  font-weight: 700;
  font-family: monospace;
  color: #1a202c;
  margin: 4px 0 14px;
  min-height: 1.5em;
}

/* === ドット絵QRコード === */
.qr-toolbar {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
}

#qr-grid {
  display: inline-grid;
  grid-template-columns: repeat(21, 14px);
  gap: 1px;
  background: #bbb;
  border: 2px solid #bbb;
  border-radius: 4px;
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}

.qr-cell {
  width: 14px;
  height: 14px;
  background: #fff;
}

.qr-cell.filled {
  background: #000;
}

.qr-cell.qr-fixed {
  cursor: not-allowed;
}

/* === 地図住所選択 === */
#address-map {
  height: 300px;
  border-radius: 10px;
  margin: 12px 0;
  border: 1px solid #ccc;
}

.address-selected {
  font-size: 13px;
  color: #555;
  padding: 10px 14px;
  background: #f1f5f9;
  border-radius: 8px;
  margin-bottom: 12px;
  min-height: 2.5em;
  text-align: left;
  line-height: 1.5;
  word-break: break-all;
}

/* === 郵便番号自動入力 === */
.addr-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
  text-align: left;
  max-width: 420px;
  margin-inline: auto;
}

.addr-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.addr-label {
  width: 80px;
  font-size: 14px;
  font-weight: 600;
  color: #444;
  flex-shrink: 0;
}

.addr-zip-wrap {
  display: flex;
  gap: 8px;
  flex: 1;
}

.addr-zip-wrap input {
  flex: 1;
  min-width: unset;
}

.addr-input {
  flex: 1;
  min-width: unset;
}

.pref-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.suffix-btns {
  display: flex;
  gap: 4px;
}

.suffix-btn,
.city-btn {
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 700;
  min-width: unset;
  border-radius: 6px;
  background: #f1f5f9;
  color: #444;
  border: 1.5px solid #ccc;
}

.suffix-btn:hover,
.city-btn:hover { background: #e2e8f0; }

.suffix-btn.active {
  background: #0078d7;
  color: #fff;
  border-color: #0078d7;
}


/* === 電話番号1文字区切り === */
.phone-split {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: center;
}

.phone-char {
  width: 28px;
  min-width: unset;
  padding: 8px 0;
  text-align: center;
  font-size: 16px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  color: #aaa;
  box-sizing: border-box;
}

.phone-char:focus {
  outline: none;
  border-color: #0078d7;
  box-shadow: 0 0 0 2px #bfdbfe;
}

.phone-hyphen {
  font-size: 18px;
  font-weight: 700;
  color: #888;
  padding: 0 1px;
}

/* === 偽プレースホルダー === */
.ghost-input {
  color: #aaa;
  font-style: normal;
  min-width: 230px;
}

.hint { font-size: 0.8em; color: #888; margin-top: 4px; }

/* === 偽オートコンプリート === */
.fake-ac {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  margin: 0;
  padding: 0;
  list-style: none;
  background: #fff;
  border: 1px solid #bbb;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 8px rgba(0,0,0,.15);
  min-width: 160px;
  font-size: 0.9em;
  color: #1a202c;
}
.fake-ac.open { display: block; }
.fake-ac li {
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.fake-ac li:hover { background: #e8f0fe; }
.fake-ac li .ac-sub { font-size: 0.75em; color: #888; margin-left: 6px; }

/* === 住所入力ふりがな === */
.furi-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
  text-align: left;
  max-width: 440px;
  margin-inline: auto;
}

.furi-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.furi-label {
  width: 90px;
  font-size: 14px;
  font-weight: 600;
  color: #444;
  flex-shrink: 0;
  padding-top: 8px;
}

.furi-req {
  color: #dc2626;
}

.furi-note {
  font-size: 11px;
  color: #888;
  font-weight: normal;
  display: block;
  margin-top: 2px;
}

.furi-inputs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.furi-input {
  flex: 1;
  min-width: unset;
}

.furi-kana {
  font-size: 13px;
  border-color: #f59e0b;
  background: #fffbeb;
}

/* === 電話番号目押し === */
.tel-num-display {
  font-size: 26px;
  font-weight: 900;
  font-family: monospace;
  letter-spacing: 2px;
  margin: 12px 0 4px;
  color: #1a202c;
}

.tel-hyphen {
  margin: 0 3px;
  color: #94a3b8;
}

.tel-phase-label {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 12px;
}

.tel-reel-window {
  width: 120px;
  margin: 0 auto;
  border: 3px solid #0078d7;
  border-radius: 14px;
  overflow: hidden;
  background: #eff6ff;
  display: flex;
  flex-direction: column;
}

.tel-reel-prev,
.tel-reel-next {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-family: monospace;
  font-weight: 700;
  color: #bfdbfe;
  background: #eff6ff;
}

.tel-reel-cur {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-family: monospace;
  font-weight: 900;
  color: #0078d7;
  background: #fff;
  border-top: 2px solid #bfdbfe;
  border-bottom: 2px solid #bfdbfe;
}

/* === 新規登録フォーム === */
.reg-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
  text-align: left;
  max-width: 400px;
  margin-inline: auto;
}

.reg-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reg-label {
  font-size: 13px;
  font-weight: 600;
  color: #444;
}

.reg-input {
  width: 100%;
  min-width: unset;
  box-sizing: border-box;
}


/* === 性別選択 === */
.gender-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px auto;
  width: fit-content;
}

.gender-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  cursor: pointer;
  padding: 8px 20px;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  min-width: 180px;
  transition: background 0.1s;
}

.gender-label:hover {
  background: #e2e8f0;
}

.gender-label input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: #0078d7;
  min-width: unset;
}

/* === ログイン確認ウィザード (No.21) === */
.lwiz-wrap {
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin: 14px 0;
}

.lwiz-slides {
  display: flex;
  width: 500%;
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.lwiz-slide {
  position: relative;
  width: 20%;
  min-height: 220px;
  padding: 28px 20px 70px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
}

/* External service slide (step 0) */
.lwiz-slide-service {
  background: #f9fafb;
  align-items: center;
  gap: 10px;
}

.lwiz-service-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lwiz-service-icon {
  font-size: 22px;
}

.lwiz-service-name {
  font-size: 20px;
  font-weight: 800;
  color: #1a202c;
  letter-spacing: -0.5px;
}

.lwiz-univ-btn {
  background: #1c3557;
  border-radius: 6px;
  font-size: 14px;
  min-width: 200px;
  padding: 11px 20px;
  letter-spacing: 0.2px;
}

.lwiz-univ-btn:hover { background: #162840; }

/* SSO (学認-style) slides */
.lwiz-slide-sso {
  background: #fff;
  align-items: flex-start;
  padding-left: 32px;
  padding-right: 32px;
}

.lwiz-sso-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 16px;
  font-weight: 700;
  color: #2a2a2a;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}

.lwiz-sso-dots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.lwiz-sso-dots span { border-radius: 50%; }
.lwiz-sso-dots span:nth-child(1) { background: #d94f3d; }
.lwiz-sso-dots span:nth-child(2) { background: #3a7dc9; }
.lwiz-sso-dots span:nth-child(3) { background: #f0b429; }
.lwiz-sso-dots span:nth-child(4) { background: #2eaa60; }

.lwiz-slide-sso .lwiz-step-title {
  font-size: 20px;
  font-weight: 600;
  color: #1a1a1a;
  text-align: left;
  width: 100%;
}

.lwiz-slide-sso .lwiz-step-sub {
  color: #999;
  font-size: 12px;
  text-align: left;
  width: 100%;
}

.lwiz-sso-input {
  width: 100%;
  max-width: 100%;
  min-width: unset;
  box-sizing: border-box;
  border-radius: 3px;
  border: 1.5px solid #888;
  padding: 9px 10px;
  font-size: 15px;
}

.lwiz-sso-input:focus {
  outline: none;
  border-color: #2a6db5;
  box-shadow: 0 0 0 1px #2a6db5;
}

.lwiz-sso-btn {
  background: #2a6db5;
  border-radius: 3px;
  font-size: 15px;
  padding: 9px 20px;
  min-width: 80px;
}

.lwiz-sso-btn:hover { background: #1f5a9a; }

/* Done slide */
.lwiz-slide-done {
  background: #f0fdf4;
  align-items: center;
}

.lwiz-dialog-icon {
  font-size: 40px;
  line-height: 1;
}

.lwiz-step-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a202c;
  line-height: 1.5;
}

.lwiz-step-sub {
  font-size: 12px;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.lwiz-input {
  width: 100%;
  max-width: 260px;
  box-sizing: border-box;
  min-width: unset;
}

.lwiz-ok-btn {
  min-width: 90px;
  padding: 10px 20px;
  font-size: 15px;
}

.lwiz-progress {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 6px;
}

.lwiz-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: background 0.3s;
  display: inline-block;
}

.lwiz-dot-active {
  background: #0078d7;
}

@keyframes numpad-clear-flash {
  0%   { background: #dc2626; color: #fff; transform: scale(1.35); box-shadow: 0 0 0 4px #fca5a5; }
  20%  { background: #ef4444; color: #fff; transform: scale(1.25); box-shadow: 0 0 0 8px #fca5a5; }
  40%  { background: #dc2626; color: #fff; transform: scale(1.35); box-shadow: 0 0 0 4px #fca5a5; }
  70%  { background: #ef4444; color: #fff; transform: scale(1.25); box-shadow: 0 0 0 8px #fca5a5; }
  90%  { background: #dc2626; color: #fff; transform: scale(1.2);  box-shadow: 0 0 0 4px #fca5a5; }
  100% { background: "";      color: "";   transform: scale(1);    box-shadow: none; }
}

.numpad-clear-flash {
  animation: numpad-clear-flash 1.2s ease forwards;
}

/* Reset back-fab overridden by global button rule */
.back-fab {
  padding: 0;
  font-size: inherit;
  border-radius: 999px;
  background: #ffffffcc;
  color: #333;
  border: 1px solid #e4e4e4;
  min-width: unset;
  width: 40px;
  height: 40px;
}

.back-fab:hover { background: #fff; }

/* Mobile overlay */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: #f5f6fa;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-overlay-box {
  text-align: center;
  padding: 40px 32px;
}

.mobile-overlay-icon {
  font-size: 56px;
  margin-bottom: 20px;
}

.mobile-overlay-msg {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}
