:root {
  --blue: #0198FF;
  --blue-dark: #0077cc;
  --blue-soft: #e6f5ff;
  --red: #CE0F0F;
  --red-soft: #fdecec;
  --gold: #D4AF37;
  --expire: #FFE566;
  --ink: #1a1a1a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #eef2f6;
  --card: #ffffff;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .10);
  --tap: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --head-h: calc(74px + var(--safe-t));
  --max: 480px;
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 120px);
  min-height: 100dvh;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { appearance: none; border: 0; background: none; cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
p, h1, h2, h3 { margin: 0; }

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-top: var(--head-h);
}
.app-head {
  padding: calc(12px + var(--safe-t)) var(--gutter) 10px;
  text-align: center;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(229, 231, 235, .8);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
}
.app-head h1 {
  margin: 0;
  font-size: 0;
  line-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 52px;
}
.app-head img {
  height: 52px;
  max-width: min(240px, 72vw);
  width: auto;
  object-fit: contain;
  margin: 0 auto;
}
.app-body {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 0 var(--gutter) calc(20px + var(--safe-b));
  flex: 1;
}
.app.is-master { --max: 1440px; }
.app.is-admin, .app.is-staff, .app.is-member { padding-bottom: 0; }
.app.is-admin .app-body, .app.is-staff .app-body, .app.is-member .app-body {
  padding-bottom: calc(84px + var(--safe-b));
}

.hero-wrap {
  width: 100%;
}
.hero-img {
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #dbeafe;
  border-radius: var(--radius);
}

.page-title {
  font-size: clamp(20px, 5vw, 24px);
  font-weight: 800;
  text-align: center;
  letter-spacing: .01em;
  line-height: 1.3;
}
.page-sub {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
  line-height: 1.4;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.row-between > * { min-width: 0; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 13px; }
.bold { font-weight: 700; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(229, 231, 235, .9);
  padding: 16px;
}
.card-tap {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(229, 231, 235, .9);
  padding: 14px 16px;
  min-height: var(--tap);
  transition: transform .08s ease, box-shadow .15s ease;
}
.card-tap:active { transform: scale(.99); }
.card-tap + .card-tap, .card + .card { margin-top: 10px; }

.hero-card {
  background: linear-gradient(145deg, #0198FF 0%, #005fa3 100%);
  color: #fff;
  border-radius: 20px;
  padding: 20px 18px 18px;
  box-shadow: 0 14px 30px rgba(1, 152, 255, .22);
  border: 0;
}
.hero-card .welcome { font-size: 14px; opacity: .92; }
.hero-card .pts {
  font-size: clamp(32px, 9vw, 42px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
  margin: 8px 0 2px;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.hero-card .pts small { font-size: 16px; font-weight: 700; margin-left: 4px; }
.hero-card .limited { font-size: 13px; opacity: .9; }
.hero-card .expire {
  font-size: 13px;
  color: var(--expire);
  font-weight: 600;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  vertical-align: middle;
  max-width: 100%;
}
.rank-badge-label { min-width: 0; text-align: center; }
.rank-badge-icon { width: 14px; height: 14px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.rank-badge-icon-spacer { visibility: hidden; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 700;
  width: 100%;
  font-size: 15px;
  line-height: 1.2;
  transition: transform .08s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 4px 12px rgba(1, 152, 255, .25); }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: #fff; color: var(--blue); border: 1px solid #cfe8ff; }
.btn-soft { background: var(--blue-soft); color: var(--blue-dark); }
.btn-sm { min-height: 40px; width: auto; padding: 0 12px; font-size: 14px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.btn-row-3 .btn { padding: 0 6px; font-size: 13px; }
.link {
  display: block;
  text-align: center;
  font-weight: 700;
  min-height: var(--tap);
  line-height: var(--tap);
  color: var(--blue-dark);
}

.expiry-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.expiry-presets .btn { width: auto; }
.expiry-example {
  margin: 10px 0 14px;
  padding: 12px 14px;
  background: var(--blue-soft);
  border-radius: var(--radius-sm);
  color: var(--ink);
}
.expiry-example-title { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.expiry-example ul {
  margin: 0;
  padding-left: 1.2em;
  font-size: 13px;
  line-height: 1.6;
}
.expiry-example li + li { margin-top: 4px; }

.field { display: block; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}
.field-label em {
  font-style: normal;
  color: var(--red);
  font-size: 11px;
  margin-left: 6px;
}
.field-input, .field-area, .field-select {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  font-size: 16px;
}
.field-area { min-height: 96px; resize: vertical; }
.field-hint { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.field-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  font-weight: 700;
}
.field-check input { width: 20px; height: 20px; flex-shrink: 0; }

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: calc(12px + var(--safe-t));
  z-index: 80;
  width: min(calc(100% - 32px), var(--max));
  border-radius: 12px;
  padding: 12px 14px;
  color: #fff;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.toast-error { background: var(--red); }
.toast-ok { background: var(--blue); }

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.sheet {
  width: 100%;
  max-width: var(--max);
  max-height: min(92dvh, 860px);
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 8px var(--gutter) calc(16px + var(--safe-b));
  overflow: auto;
  animation: sheet-up .22s ease;
  box-shadow: var(--shadow-lg);
}
.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: #d1d5db;
  margin: 6px auto 10px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.sheet-head h2 { font-size: 18px; font-weight: 800; }
.sheet-close {
  min-height: var(--tap);
  min-width: var(--tap);
  color: var(--muted);
  font-weight: 700;
  flex-shrink: 0;
}
@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  background: #fff;
  padding: 6px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(229, 231, 235, .9);
  margin-bottom: 14px;
}
.tabs button {
  min-height: 40px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabs button.on { background: var(--blue); color: #fff; }
.tabs-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.tabs-5 button { font-size: 11px; }

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(16, 24, 40, .06);
  padding-bottom: var(--safe-b);
}
.bottom-nav-inner {
  width: min(100%, var(--max));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 10px;
}
.bottom-nav-inner.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.bottom-nav-inner.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bottom-nav-inner.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bottom-nav-inner.cols-1 {
  display: flex;
  justify-content: center;
  padding-left: 24px;
  padding-right: 24px;
}
.bottom-nav-inner.cols-1 button {
  min-width: min(220px, 72%);
  padding-left: 28px;
  padding-right: 28px;
}
.bottom-nav button {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 8px 6px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.bottom-nav-inner.cols-5 button { font-size: 12px; padding: 8px 4px; }
.bottom-nav button.on {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 12px rgba(1, 152, 255, .28);
}

.search {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px 10px 40px;
  background: #fff url("/assets/img/search_ico.png") 12px 50% / 16px no-repeat;
  font-size: 16px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: var(--tap);
  font-weight: 700;
  margin-top: 8px;
}
.pager button {
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--blue);
  font-size: 20px;
  border: 1px solid var(--line);
}

.qr-box { display: flex; justify-content: center; padding: 8px 0; }
.qr-box canvas, .qr-box img { margin: 0 auto; max-width: 100%; height: auto; }
#qr_reader, #staff_qr { width: 100%; max-width: 100%; border-radius: 12px; overflow: hidden; }

.staff-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.staff-grid .btn { min-height: 56px; font-size: 14px; padding: 8px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat {
  background: #fff;
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid rgba(229, 231, 235, .9);
}
.stat b {
  display: block;
  font-size: clamp(16px, 4.5vw, 20px);
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.stat span { font-size: 11px; color: var(--muted); }

.shop-grid { display: grid; gap: 10px; }
@media (min-width: 768px) {
  .shop-grid { grid-template-columns: 1fr 1fr; }
}

.color-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.color-row input[type="color"] {
  width: 100%;
  height: var(--tap);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.rank-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  background: var(--blue-soft);
  border-radius: 12px;
}

.img-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  background: var(--blue-soft);
  border-radius: 12px;
  overflow: hidden;
}
.img-preview img {
  display: block;
  max-width: 100%;
  object-fit: contain;
}
.img-preview-logo {
  min-height: 80px;
  padding: 12px;
}
.img-preview-logo img {
  max-height: 80px;
}
.img-preview-top {
  width: 100%;
  min-height: 0;
}
.img-preview-top img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 700;
  margin-top: 8px;
}
.chip-off { background: #f3f4f6; color: var(--muted); }

.hist-amt {
  font-size: clamp(16px, 4.8vw, 22px);
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.plus { color: var(--blue); }
.minus { color: var(--red); }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 16px 0 4px;
}

.file-btn {
  position: relative;
  overflow: hidden;
}
.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ops { display: flex; flex-wrap: wrap; gap: 8px; }
.ops .btn { width: auto; flex: 1 1 calc(50% - 4px); min-width: 120px; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 8px;
}

.section-head {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 10px;
  padding-left: 2px;
}

@media (max-width: 359px) {
  .btn-row-3 { grid-template-columns: 1fr 1fr; }
  .btn-row-3 .btn:last-child { grid-column: 1 / -1; }
  .tabs-5 button { font-size: 10px; }
}

@media (min-width: 481px) {
  :root { --gutter: 20px; }
  .app-body { padding-left: var(--gutter); padding-right: var(--gutter); }
}

/* Master admin (manager.point-sys.jp only) */
.app.is-master .app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
}
.app.is-master .app-head img { margin: 0; }
.app-head-label {
  display: none;
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .04em;
}
.app.is-master .app-head-label { display: block; }

.app.is-master:not(.is-master-app) .app-body > .stack {
  width: min(100%, 420px);
  margin-left: auto;
  margin-right: auto;
  padding-top: 24px;
}

.master-shell { display: flex; flex-direction: column; gap: 14px; }
.master-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.master-nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: var(--tap);
  height: var(--tap);
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.master-nav-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 99px;
}
.master-nav-current {
  font-size: 16px;
  font-weight: 800;
  min-width: 0;
}
.master-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .4);
  z-index: 45;
}
.master-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(280px, 86vw);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: calc(16px + var(--safe-t)) 12px calc(16px + var(--safe-b));
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateX(-105%);
  transition: transform .2s ease;
  overflow: auto;
}
.master-nav.open { transform: translateX(0); }
.master-nav-brand {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .06em;
  padding: 4px 10px 12px;
}
.master-nav-shop {
  font-size: 14px;
  font-weight: 800;
  padding: 10px 10px 6px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}
.master-nav-item {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
  width: 100%;
}
.master-nav-item.on {
  background: var(--blue);
  color: #fff;
}
.master-nav-logout {
  margin-top: auto;
  color: var(--red);
}
.master-nav-foot {
  margin-top: 8px;
  padding: 8px 12px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.master-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.master-page-title { display: none; }
.master-shop-head .page-sub { text-align: left; margin-top: 2px; }
.master-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(229, 231, 235, .9);
  padding: 16px;
}
.master-dash { display: flex; flex-direction: column; gap: 14px; }
.master-table-wrap { overflow-x: auto; }
.master-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.master-table th,
.master-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.master-table th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}
.master-table.is-link tbody tr { cursor: pointer; }
.master-table.is-link tbody tr:hover { background: #f8fafc; }
.master-table .chip { margin-top: 0; }
.master-table .nowrap { white-space: nowrap; }
.app.is-master-app .app-body > .foot,
.app.is-admin .app-body > .foot,
.app.is-staff .app-body > .foot,
.app.is-member .app-body > .foot { display: none; }
.master-preview { display: none; }

@media (min-width: 1024px) {
  .app.is-master-app {
    background: #f1f5f9;
    height: 100dvh;
    overflow: hidden;
  }
  .app.is-master-app .app-head {
    padding-left: 24px;
    padding-right: 24px;
    flex-shrink: 0;
  }
  .app.is-master-app .app-body {
    width: 100%;
    max-width: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  .master-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr) 360px;
    align-items: stretch;
    gap: 0;
    flex: 1;
    min-height: 0;
  }
  .master-shell.is-preview-collapsed {
    grid-template-columns: 248px minmax(0, 1fr) 40px;
  }
  .master-toolbar,
  .master-nav-backdrop,
  .master-tabs-mobile { display: none; }
  .master-nav {
    position: relative;
    top: auto;
    left: auto;
    bottom: auto;
    width: auto;
    height: auto;
    transform: none;
    box-shadow: none;
    border-right: 1px solid var(--line);
    border-radius: 0;
    padding: 20px 12px 16px;
    z-index: 1;
    transition: none;
  }
  .master-main {
    padding: 24px 28px 32px;
    max-width: none;
    width: 100%;
    overflow: auto;
  }
  .master-page-title { display: block; text-align: left; }
  .master-dash {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr);
    gap: 16px;
    align-items: start;
  }
  .app.is-master .stat {
    padding: 18px 12px;
  }
  .app.is-master .stat b { font-size: 26px; }
  .app.is-master .stat span { font-size: 13px; }
  .master-preview {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: #e8eef4;
    border-left: 1px solid var(--line);
  }
  .master-preview.collapsed {
    align-items: stretch;
  }
  .master-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px 10px;
    flex-shrink: 0;
  }
  .master-preview-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
  }
  .master-preview-min {
    font-size: 12px;
    font-weight: 700;
    color: var(--blue-dark);
    min-height: 32px;
    padding: 0 8px;
    border-radius: 8px;
  }
  .master-preview-min:hover { background: #fff; }
  .master-preview-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0 16px 20px;
  }
  .master-preview-empty {
    margin: 48px 12px 0;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    line-height: 1.6;
  }
  .master-preview-rail {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    writing-mode: vertical-rl;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .12em;
    color: var(--blue-dark);
    background: #e8eef4;
  }
  .master-preview-rail:hover { background: #dce6ef; }
  .master-phone {
    width: 300px;
    max-width: 100%;
    margin: 0 auto;
    background: #111827;
    border-radius: 28px;
    padding: 10px 8px 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .28);
  }
  .master-phone-notch {
    width: 96px;
    height: 8px;
    margin: 0 auto 8px;
    background: #374151;
    border-radius: 999px;
  }
  .master-phone-screen {
    border-radius: 20px;
    overflow: hidden;
    pointer-events: none;
    user-select: none;
  }
  .master-phone-head {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, .86);
    border-bottom: 1px solid rgba(229, 231, 235, .8);
  }
  .master-phone-head img {
    height: 32px;
    max-width: 160px;
    width: auto;
    object-fit: contain;
  }
  .master-phone-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 0 16px;
  }
  .master-phone-inner .hero-card,
  .master-phone-inner .btn-row-3,
  .master-phone-inner .card,
  .master-phone-inner .bold.mb {
    margin-left: 12px;
    margin-right: 12px;
  }
  .master-phone-hero {
    height: 120px;
    border-radius: 0;
  }
  .master-phone-screen .hero-card {
    padding: 14px 14px 12px;
  }
  .master-phone-screen .hero-card .welcome { font-size: 12px; }
  .master-phone-screen .hero-card .pts { font-size: 26px; }
  .master-phone-screen .hero-card .pts small { font-size: 13px; }
  .master-phone-screen .hero-card .limited { font-size: 11px; }
  .master-phone-screen .btn { min-height: 36px; font-size: 12px; cursor: default; }
  .master-phone-screen .btn-row-3 .btn { font-size: 11px; }
  .master-phone-screen .card { padding: 12px; }
  .master-phone-screen .link { min-height: 32px; line-height: 32px; font-size: 13px; }
  .master-phone-screen .card-tap { margin-left: 12px; margin-right: 12px; padding: 10px 12px; }
  .master-phone-qr {
    width: 88px;
    height: 88px;
    margin: 4px auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-conic-gradient(#111 0% 25%, #f3f4f6 0% 50%) 50% / 12px 12px;
    border-radius: 8px;
    font-size: 0;
  }
  body.is-master-host .sheet-overlay {
    align-items: center;
    padding: 24px;
  }
  body.is-master-host .sheet {
    max-width: 560px;
    border-radius: 16px;
    padding: 16px 20px 20px;
  }
  body.is-master-host .sheet-handle { display: none; }
  .master-create-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .master-create-form > .btn { grid-column: 1 / -1; }
}

.app-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.app-head h1 { grid-column: 2; }
.app-head-label { grid-column: 1; justify-self: start; }
.demo-head-btn {
  grid-column: 1;
  justify-self: start;
  min-height: var(--tap);
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 800;
  font-size: 13px;
}
.demo-head-btn.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.app.is-demo-settings .app-head { z-index: 50; }
.ai-wrap { grid-column: 3; justify-self: end; position: relative; }
.ai-head-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  border-radius: 999px;
  background: linear-gradient(145deg, #4db6ff 0%, #0198FF 48%, #6a5cff 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(1, 152, 255, .28);
}
.ai-head-ico { display: block; }
.ai-full {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.ai-full-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + var(--safe-t)) 16px 12px;
  border-bottom: 1px solid var(--line);
}
.ai-full-title { font-weight: 800; }
.ai-full-back {
  min-height: var(--tap);
  font-weight: 700;
  color: var(--blue);
}
.ai-full-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-msg { padding: 10px 12px; border-radius: 12px; background: #f3f4f6; }
.ai-msg.user { background: var(--blue-soft); align-self: flex-end; max-width: 92%; }
.ai-msg.assistant { max-width: 100%; }
.ai-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 1.2em;
  padding: 2px 0;
}
.ai-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: ai-dot 1s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: .2s; }
.ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ai-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: .4; }
  40% { transform: translateY(-4px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ai-typing span { animation: none; opacity: .7; }
}
.ai-msg-link { color: var(--blue); font-weight: 700; word-break: break-all; }
.ai-inquiry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}
.ai-full-foot {
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(12px + var(--safe-b));
}
.ai-page-btn {
  width: 100%;
  min-height: 44px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 1px solid var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 800;
}
.ai-drawer-form {
  display: flex;
  gap: 8px;
}

.demo-settings-catch {
  position: fixed;
  inset: 0;
  z-index: 40;
}
.demo-settings-panel {
  position: absolute;
  top: calc(var(--safe-t) + 76px);
  left: 12px;
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100dvh - var(--safe-t) - 96px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.demo-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.demo-settings-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.demo-settings-panel > .demo-bar-btn,
.demo-settings-panel .demo-tut-launch {
  width: 100%;
}
.demo-bar-btn {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 13px;
}
.demo-bar-btn.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.demo-gate-code {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: .2em;
  text-align: center;
  padding: 16px;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.demo-pick-card {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.demo-setup .field { margin-bottom: 4px; }
.demo-pick-kicker { display: block; color: var(--blue); font-weight: 800; font-size: 13px; margin-bottom: 4px; }
.demo-pick-card strong { display: block; font-size: 20px; margin-bottom: 6px; }
.demo-pick-card span { color: var(--muted); font-size: 14px; }
.demo-tut { position: relative; }
.demo-tut-launch {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}
.demo-tut-menu {
  position: fixed;
  top: 120px;
  left: 12px;
  z-index: 80;
  width: min(340px, calc(100vw - 24px));
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.demo-tut-item {
  text-align: left;
  padding: 8px;
  border-radius: 10px;
  font-weight: 700;
}
.demo-tut-item:hover { background: var(--blue-soft); }
.demo-tut-layer { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.demo-tut-spot {
  position: fixed;
  border: 3px solid var(--blue);
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, .35);
  pointer-events: none;
}
.demo-tut-card {
  pointer-events: auto;
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-b));
  transform: translateX(-50%);
  width: min(440px, calc(100% - 24px));
  max-height: min(280px, 38vh);
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rank-pending {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--expire);
}
