/* スマホ（公開版）だけで使う見た目：データ読み込み画面とデータ管理シート */

.needs-data .app { display: none; }

/* ===== データがまだないときの画面 ===== */
.importer {
  position: fixed; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: grid; place-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.importer-card, .data-card {
  position: relative;
  width: min(440px, 100%);
  background: var(--glass);
  -webkit-backdrop-filter: blur(26px) saturate(175%);
  backdrop-filter: blur(26px) saturate(175%);
  box-shadow: var(--glass-inset), var(--glass-shadow);
}
.importer-card { padding: 30px 24px 24px; border-radius: 30px; animation: imp-rise .7s var(--spring) both; }
.importer-card::before, .data-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, var(--glass-edge-a), var(--glass-edge-b) 32%, var(--glass-edge-b) 68%, var(--glass-edge-a));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .7;
}
.importer .brand { margin-bottom: 18px; }
.importer .brand-mark { font-size: 34px; }
.importer .brand-sub { font-size: 13px; }
.imp-lead { margin: 0 0 18px; color: var(--muted); font-size: 15px; }
.imp-lead b, .imp-steps b { color: var(--text); font-weight: 600; }
.imp-hint {
  margin: 0 0 18px; padding: 12px 14px; border-radius: 16px;
  background: var(--marker-soft); box-shadow: inset 0 0 0 1px var(--marker-soft);
  font-size: 13.5px; line-height: 1.6;
}
.imp-hint b { display: block; margin-bottom: 2px; }

.imp-btn {
  position: relative; display: grid; place-items: center;
  width: 100%; height: 52px; border-radius: 999px;
  background: var(--marker); color: #141726;
  font: 600 16px/1 var(--sans); cursor: pointer;
  box-shadow: 0 8px 24px rgba(245, 205, 85, .28), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: transform .35s var(--spring);
  -webkit-tap-highlight-color: transparent;
}
:root[data-theme="light"] .imp-btn { background: #f5c33b; }
.imp-btn:active { transform: scale(.96); }
.imp-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.imp-btn:focus-within { outline: 2px solid var(--text); outline-offset: 3px; }

.imp-status { min-height: 1.6em; margin: 10px 0 6px; text-align: center; font-size: 13.5px; color: var(--muted); }
.imp-status.error { color: var(--fix); }
.imp-steps { margin: 4px 0 14px; padding-left: 1.4em; color: var(--muted); font-size: 13.5px; }
.imp-steps li { margin: 4px 0; }
.imp-note { margin: 0; color: var(--faint); font-size: 12px; }

@keyframes imp-rise { from { opacity: 0; transform: translateY(18px) scale(.97); } }

/* ===== データ管理シート ===== */
.data-sheet {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0);
  transition: background-color .3s var(--ease);
}
.data-sheet.open {
  background: rgba(0, 0, 0, .42);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.data-card {
  padding: 22px 22px 18px; border-radius: 28px;
  background-color: color-mix(in srgb, var(--bg) 84%, transparent);
  opacity: 0; transform: translateY(24px) scale(.97);
  transition: opacity .3s var(--ease), transform .45s var(--spring);
}
.data-sheet.open .data-card { opacity: 1; transform: none; }
.data-card h2 { margin: 0 0 12px; font: italic 600 22px/1.2 var(--serif); }
.data-card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 6px; font-size: 14px; }
.data-card dt { color: var(--faint); }
.data-card dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.sheet-btn {
  display: block; width: 100%; height: 46px; margin-top: 8px; border-radius: 999px;
  background: var(--glass-flat); box-shadow: var(--glass-inset);
  font-size: 15px; color: var(--text);
  transition: transform .35s var(--spring), background-color .2s;
}
.sheet-btn:active { transform: scale(.96); }
.sheet-btn.danger { color: var(--fix); }
.data-card .imp-note { margin-top: 14px; }

@media (max-width: 860px) {
  .data-sheet { place-items: end center; padding: 0 10px calc(10px + env(safe-area-inset-bottom)); }
}

#data-btn[hidden] { display: none; }

/* ===== ウィジェット用のリンクを作る ===== */
.data-card { max-height: calc(100% - 20px); overflow-y: auto; overscroll-behavior: contain; }
.wm-open { margin-top: 10px; }
.wm-lead { margin: 0 0 14px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.wm-row { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.wm-label { flex: none; width: 2.6em; font-size: 13px; color: var(--faint); }
.wm-num {
  width: 5.2em; height: 40px; padding: 0 12px; border-radius: 999px; border: 0;
  background: var(--pane); box-shadow: var(--glass-inset), inset 0 0 0 1px var(--glass-edge-b);
  color: var(--text); font: italic 17px var(--serif); text-align: center;
  -webkit-appearance: none; appearance: none;
}
.wm-num:focus { outline: none; box-shadow: var(--glass-inset), 0 0 0 2px var(--marker-strong); }
.wm-tilde { color: var(--faint); }
.wm-seg {
  position: relative; flex: 1; display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 4px; border-radius: 999px; background: var(--pane); box-shadow: var(--glass-inset);
}
.wm-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3); border-radius: 999px;
  background: var(--thumb); box-shadow: var(--glass-inset), 0 4px 12px rgba(0, 0, 0, .2);
  transform: translateX(calc(100% * var(--k, 2))); transition: transform .55s var(--spring);
}
.wm-seg button { position: relative; z-index: 1; height: 34px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: color .3s; }
.wm-seg button[aria-checked="true"] { color: var(--text); }
.wm-preview {
  --wk: 1;
  position: relative; width: 100%; aspect-ratio: 338 / 158; margin: 6px 0 8px;
  border-radius: calc(22px * var(--wk)); overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35), 0 0 0 1px var(--glass-edge-b);
}
.wm-preview iframe {
  position: absolute; top: 0; left: 0; width: 338px; height: 158px; border: 0;
  transform: scale(var(--wk)); transform-origin: 0 0; pointer-events: none;
}
.wm-meta { min-height: 1.5em; margin: 0 0 6px; text-align: center; font: 12px var(--mono); color: var(--faint); }
.wm-meta.error { color: var(--fix); font-family: var(--sans); }
