.mlb-demo {
  --mlb-ink: #24302a;
  --mlb-muted: #5d6a62;
  --mlb-line: #d9dfd6;
  --mlb-card: #ffffff;
  --mlb-soft: #f3f6f1;
  --mlb-accent: #2f5d4a;
  --mlb-focus: #c65d1e;
  
  --mlb-ui-bar: #2b8ff0;
  --mlb-ui-num: #2b8ff0;
  --mlb-ui-red: #c62828;
  --mlb-ui-blue: #3a5bc7;
  --mlb-ui-green: #138a2e;
  --mlb-ui-pink: #f06aa8;
  --mlb-ui-yellow: #f7d417;
  --mlb-ui-gray: #6b6b6b;
  --mlb-ui-purple: #7a1c8c;
  --mlb-ui-navy: #0b2a7a;
  --mlb-ui-clear: #b9b9b9;
  --mlb-ui-ok: #ffa500;
  --mlb-ui-total: #6e6e6e;

  box-sizing: border-box;
  color: var(--mlb-ink);
  font-family: inherit;
  line-height: 1.6;
}
.mlb-demo *,
.mlb-demo *::before,
.mlb-demo *::after {
  box-sizing: border-box;
}
.mlb-demo button {
  font: inherit;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}
.mlb-demo [hidden] {
  display: none !important;
}

.mlb-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 900px) {
  .mlb-layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
    grid-template-areas:
      'store customer'
      'steps steps';
    gap: 24px 28px;
  }
  .mlb-panel--store { grid-area: store; }
  .mlb-panel--customer { grid-area: customer; }
  .mlb-panel--steps { grid-area: steps; }
}
@media (min-width: 1180px) {
  .mlb-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 0.9fr);
    grid-template-areas: 'store customer steps';
  }
}

.mlb-panel {
  background: var(--mlb-card);
  border: 1px solid var(--mlb-line);
  border-radius: 20px;
  padding: 18px 16px 20px;
  min-width: 0;
}
@media (min-width: 600px) {
  .mlb-panel { padding: 22px 22px 24px; }
}
.mlb-panel__label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--mlb-ink);
}
.mlb-panel__tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--mlb-accent);
  color: #fff;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.mlb-panel__tag--cust { background: #7e9c82; }
.mlb-panel__tag--guide { background: #8a7f6c; }
.mlb-panel__note {
  margin: 14px 0 0;
  font-size: 0.82rem;
  color: var(--mlb-muted);
}

.mlb-tablet {
  background: #2a2522;
  border-radius: 22px;
  padding: 18px 12px 20px;
  max-width: 460px;
  margin: 0 auto;
  box-shadow: 0 14px 30px rgba(36, 48, 42, 0.18);
}
.mlb-screen {
  position: relative;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  font-family: 'Noto Sans JP', system-ui, sans-serif;
}
.mlb-screen:focus-visible {
  outline: 3px solid var(--mlb-focus);
  outline-offset: 3px;
}
.mlb-screen__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--mlb-ui-bar);
  color: #fff;
  font-size: 0.75rem;
  padding: 6px 10px;
}
.mlb-screen__bar-sub {
  font-size: 0.7rem;
  opacity: 0.9;
}
.mlb-screen__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: minmax(34px, auto) repeat(4, minmax(46px, auto)) repeat(4, minmax(48px, 1fr));
  gap: 1px;
  background: #e6e6e6;
}

.mlb-row {
  grid-column: 1 / 4;
  background: #fff;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: end;
  padding: 3px 8px 4px;
  min-width: 0;
}
.mlb-row__label {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  font-size: 0.68rem;
  color: #333;
}
.mlb-row__sub {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  font-size: 0.66rem;
  color: #333;
  white-space: nowrap;
}
.mlb-row__value {
  grid-column: 1 / 3;
  grid-row: 2;
  justify-self: end;
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mlb-row__value--sm {
  grid-row: 1;
  grid-column: 2;
  align-self: center;
  font-size: 0.72rem;
  font-weight: 500;
  color: #333;
}
.mlb-row--member {
  align-items: center;
}
.mlb-row--member .mlb-row__label { align-self: center; }
.mlb-row.is-active {
  background: #eef6ff;
  box-shadow: inset 3px 0 0 var(--mlb-ui-bar);
}
.mlb-row--use.is-active .mlb-row__value { color: var(--mlb-ui-green); }
.mlb-row.is-inactive .mlb-row__value { color: #999; }
.mlb-row--balance {
  background: var(--mlb-ui-total);
  color: #fff;
}
.mlb-row--balance .mlb-row__label { color: #fff; }
.mlb-c-blue { color: var(--mlb-ui-bar) !important; }
.mlb-c-green { color: var(--mlb-ui-green) !important; }
.mlb-c-pink { color: var(--mlb-ui-pink) !important; }

.mlb-key {
  appearance: none;
  border: 0;
  border-radius: 0;
  min-height: 46px;
  min-width: 0;
  padding: 4px 2px;
  color: #fff;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
  transition: filter 0.15s ease, transform 0.08s ease;
}
.mlb-key:hover { filter: brightness(1.08); }
.mlb-key:active { transform: scale(0.97); }
.mlb-key:focus-visible {
  outline: 3px solid var(--mlb-focus);
  outline-offset: -3px;
  position: relative;
  z-index: 1;
}
.mlb-key--num {
  background: var(--mlb-ui-num);
  font-size: 1.25rem;
}
.mlb-key--select { background: var(--mlb-ui-navy); font-size: 0.8rem; }
.mlb-key--clear { background: var(--mlb-ui-clear); font-size: 1.1rem; }
.mlb-key--ok { background: var(--mlb-ui-ok); font-size: 1.3rem; }
.mlb-key--side {
  font-size: clamp(0.64rem, 2.5vw, 0.8rem);
  word-break: normal;
  overflow-wrap: anywhere;
  line-break: strict;
}
.mlb-bg-red { background: var(--mlb-ui-red); }
.mlb-bg-blue { background: var(--mlb-ui-blue); }
.mlb-bg-green { background: var(--mlb-ui-green); }
.mlb-bg-pink { background: var(--mlb-ui-pink); }
.mlb-bg-yellow { background: var(--mlb-ui-yellow); color: #111; font-size: 1rem; }
.mlb-bg-gray { background: var(--mlb-ui-gray); }
.mlb-bg-purple { background: var(--mlb-ui-purple); }
.mlb-key.is-selected {
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px rgba(0, 0, 0, 0.35);
}
.mlb-key.is-unsupported {
  cursor: not-allowed;
  filter: grayscale(0.55) opacity(0.55);
}
.mlb-key.is-unsupported:hover { filter: grayscale(0.55) opacity(0.6); }

.mlb-history {
  position: absolute;
  inset: 28px 0 0 0;
  background: rgba(255, 255, 255, 0.98);
  display: flex;
  flex-direction: column;
  z-index: 2;
}
.mlb-history__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--mlb-ui-purple);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}
.mlb-history__close {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: transparent;
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  min-height: 36px;
  font-size: 0.78rem;
  cursor: pointer;
}
.mlb-history__close:focus-visible { outline: 3px solid var(--mlb-ui-ok); outline-offset: 2px; }
.mlb-history__list,
.mlb-phone__history {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
}
.mlb-history__list li,
.mlb-phone__history li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 8px;
  padding: 7px 10px;
  border-bottom: 1px solid #ececec;
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}
.mlb-history__list li.is-empty,
.mlb-phone__history li.is-empty {
  display: block;
  color: #888;
  text-align: center;
  padding: 14px 8px;
}
.mlb-h__at { color: #666; }
.mlb-h__type { justify-self: end; font-weight: 700; }
.mlb-h__amount { font-weight: 700; }
.is-plus .mlb-h__amount { color: var(--mlb-ui-blue); }
.is-minus .mlb-h__amount { color: var(--mlb-ui-green); }
.mlb-h__bal { justify-self: end; color: #444; }

.mlb-action {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 460px;
  min-height: 52px;
  margin: 16px auto 0;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid var(--mlb-accent);
  background: var(--mlb-accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.mlb-action:hover { background: #24493a; }
.mlb-action:focus-visible { outline: 3px solid var(--mlb-focus); outline-offset: 3px; }
.mlb-action--scan.is-done {
  background: var(--mlb-soft);
  color: var(--mlb-accent);
}
.mlb-action--restart {
  background: #fff;
  color: var(--mlb-accent);
  margin-top: 14px;
}
.mlb-action--restart:hover { background: var(--mlb-soft); }

.mlb-phone {
  position: relative;
  max-width: 270px;
  margin: 0 auto;
  background: #1f1f1f;
  border-radius: 38px;
  padding: 12px;
  box-shadow: 0 14px 30px rgba(36, 48, 42, 0.18);
}
.mlb-phone__notch {
  position: absolute;
  top: 18px;
  left: 50%;
  width: 70px;
  height: 18px;
  margin-left: -35px;
  border-radius: 999px;
  background: #1f1f1f;
  z-index: 1;
}
.mlb-phone__screen {
  background: #fff;
  border-radius: 28px;
  overflow: hidden;
  padding-bottom: 10px;
  font-family: 'Noto Sans JP', system-ui, sans-serif;
}
.mlb-phone__banner {
  height: 76px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 12px;
  background: linear-gradient(135deg, #dfe8dc, #c9d8c6 60%, #b7c9b3);
  color: #2f5d4a;
  font-family: 'Noto Serif JP', serif;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.mlb-phone__sec {
  margin: 0;
  padding: 3px 10px;
  background: #eeeeee;
  font-size: 0.7rem;
  color: #444;
}
.mlb-phone__qrwrap {
  padding: 10px 10px 8px;
  text-align: center;
}
.mlb-phone__qr {
  width: 96px;
  height: 96px;
  margin: 0 auto;
  border-radius: 4px;
  transition: box-shadow 0.3s ease;
}
.mlb-phone__qr svg { display: block; width: 100%; height: 100%; }
.mlb-phone__qr.is-scanned { box-shadow: 0 0 0 3px #7e9c82; }
.mlb-phone__qr-state {
  margin: 6px 0 0;
  font-size: 0.72rem;
  color: #666;
}
.mlb-phone__qr-state.is-done { color: #2f5d4a; font-weight: 700; }
.mlb-phone__info { padding: 6px 10px 8px; }
.mlb-phone__row {
  margin: 0;
  font-size: 0.72rem;
  color: #444;
}
.mlb-phone__row--label {
  margin-top: 4px;
  font-size: 0.85rem;
  color: #222;
}
.mlb-phone__balance {
  margin: 0;
  text-align: right;
  font-size: 1.45rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: #222;
  border-radius: 6px;
}
.mlb-phone__history {
  max-height: 150px;
}
.mlb-phone__history li { padding: 6px 10px; font-size: 0.68rem; }

.mlb-steps__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.mlb-steps__item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--mlb-soft);
  font-size: 0.9rem;
  color: var(--mlb-muted);
  transition: background 0.2s ease, color 0.2s ease;
}
.mlb-steps__item strong { color: var(--mlb-ink); }
.mlb-steps__num {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--mlb-line);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--mlb-accent);
}
.mlb-steps__item.is-done .mlb-steps__num {
  background: #7e9c82;
  border-color: #7e9c82;
  color: #fff;
}
.mlb-steps__item.is-current {
  background: #fff4ea;
  color: var(--mlb-ink);
  box-shadow: inset 0 0 0 2px #f0b98b;
}
.mlb-steps__item.is-current .mlb-steps__num {
  background: var(--mlb-focus);
  border-color: var(--mlb-focus);
  color: #fff;
}
.mlb-status {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  background: var(--mlb-soft);
  border-left: 4px solid #7e9c82;
}
.mlb-status[data-tone='success'] { background: #edf5ea; border-left-color: #2f7d4a; }
.mlb-status[data-tone='warn'] { background: #fff6e8; border-left-color: #e0952b; }
.mlb-status[data-tone='error'] { background: #fdeeee; border-left-color: #c62828; }
.mlb-status[data-tone='muted'] { background: #f2f2f2; border-left-color: #999; }

.mlb-notice {
  margin: 18px 0 0;
  font-size: 0.8rem;
  color: var(--mlb-muted);
  line-height: 1.7;
}

.mlb-flash { animation: mlb-flash 0.9s ease; }
@keyframes mlb-flash {
  0% { background-color: #fff3c4; }
  100% { background-color: transparent; }
}
.mlb-row--balance.mlb-flash { animation-name: mlb-flash-dark; }
@keyframes mlb-flash-dark {
  0% { background-color: #9a8a3a; }
  100% { background-color: var(--mlb-ui-total); }
}

@media (prefers-reduced-motion: reduce) {
  .mlb-demo *,
  .mlb-demo *::before,
  .mlb-demo *::after {
    animation: none !important;
    transition: none !important;
  }
}

.mlb-row--member-2 { row-gap: 2px; }
.mlb-row__label--extra { grid-row: 2; }
.mlb-row__value--extra { grid-row: 2; grid-column: 2; }

.mlb-row--balance.is-short { background: #c62828; }
.mlb-row--balance.is-short .mlb-row__value { font-size: 0.95rem; }
