/* デザインは Clary Works（portfolio.noraly-clary.com）に合わせている */
:root {
  --bg: #ffffff;
  --bg-soft: #f1fafe;
  --card: #ffffff;
  --border: #e0eef6;
  --text: #15293a;
  --muted: #5b7488;
  --accent: #06b6d4;
  --accent-2: #0ea5e9;
  --accent-3: #3b82f6;
  --accent-strong: #0284c7; /* 小さい文字用（白地でも読める濃さ） */
  --accent-soft: rgba(6, 182, 212, 0.1);
  --ok: #059669;
  --warn: #dc2626;
  --max: 1180px;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(6, 182, 212, 0.1);
  --shadow-hover: 0 16px 36px rgba(14, 165, 233, 0.2);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 14px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- ナビバー ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: inherit;
  text-decoration: none;
}
.brand-name span { color: var(--accent); }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  position: relative;
  background:
    radial-gradient(circle at 72% 72%, #fff 0 3px, transparent 3.5px),
    linear-gradient(135deg, var(--accent), var(--accent-3));
}
.brand-mark::before, .brand-mark::after {
  content: ""; position: absolute; width: 7px; height: 7px; border-radius: 2px; background: #fff;
}
.brand-mark::before { left: 5px; top: 5px; box-shadow: 9px 0 0 #fff; }
.brand-mark::after { left: 5px; top: 14px; }
.navbar-links { display: flex; gap: 24px; }
.navbar-links a {
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
  transition: color 0.2s;
}
.navbar-links a:hover { color: var(--text); }

/* ---------- ヒーロー ---------- */
.hero {
  position: relative;
  padding: 56px 0 36px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -140px;
  right: -80px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.22), rgba(6, 182, 212, 0.14) 45%, transparent 70%);
  z-index: 0;
}
.hero .container { position: relative; z-index: 1; }
.eyebrow {
  color: var(--accent-2);
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
}
.hero h1 {
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  line-height: 1.25;
  margin: 0 0 16px;
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  width: fit-content;
}
.hero-sub {
  color: var(--muted);
  max-width: 620px;
  font-size: 1.02rem;
  margin: 0;
}

/* ---------- レイアウト ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 28px;
  align-items: start;
  padding-bottom: 24px;
}
.controls { display: grid; gap: 20px; min-width: 0; }
.preview-col { position: sticky; top: 76px; min-width: 0; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .preview-col { position: static; order: -1; }
}

.panel, .preview-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px 24px;
}

/* 見出し：左にグラデーションの縦バー */
.panel h2 {
  position: relative;
  font-size: 1.1rem;
  margin: 0 0 16px;
  padding-left: 14px;
  line-height: 1.4;
}
.panel h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(var(--accent), var(--accent-2));
}

.hint { color: var(--muted); font-size: 12px; margin: 4px 0 12px; }

.label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
.label output { color: var(--accent-strong); font-variant-numeric: tabular-nums; margin-left: 4px; }

.field { display: block; }
.field.inline { display: flex; align-items: center; gap: 10px; }
.field.inline .label { margin: 0; }

textarea, input[type="text"], select {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea { resize: vertical; min-height: 48px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
textarea:focus, input[type="text"]:focus, select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
  background: #fff;
}
.field.inline select { width: auto; padding: 6px 10px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px; background: transparent; cursor: pointer;
  --pct: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)) 0 / var(--pct) 100% no-repeat, var(--border);
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--border); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent-2);
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.35);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent-2);
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.35);
}
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.25); }

.row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.row.wrap { flex-wrap: wrap; }

/* ---------- セグメント ---------- */
.seg {
  display: inline-flex; flex-wrap: wrap;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: 0; background: transparent; border-radius: 999px;
  padding: 5px 14px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px;
  transition: color 0.2s, background 0.2s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 3px 10px rgba(6, 182, 212, 0.3);
}
.seg.small button { padding: 3px 12px; font-size: 12px; }

/* ---------- 色 ---------- */
.color {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 14px 4px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-soft);
  font-size: 13px; font-weight: 600;
  transition: border-color 0.2s;
}
.color:hover { border-color: var(--accent-2); }
.color input {
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  background: none; cursor: pointer; overflow: hidden;
}
.color input::-webkit-color-swatch-wrapper { padding: 0; }
.color input::-webkit-color-swatch { border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 50%; }
.color input::-moz-color-swatch { border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 50%; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin-top: 12px; font-size: 13px; }
.row .check { margin-top: 0; }
.check input { accent-color: var(--accent-2); width: 16px; height: 16px; }

/* ---------- タイル ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
}
.tiles.frame { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }

.tile {
  display: grid; justify-items: center; gap: 4px;
  padding: 10px 6px 6px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); cursor: pointer;
  color: var(--text);
  transition: transform 0.18s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.tile:hover { transform: translateY(-3px); border-color: var(--accent-2); box-shadow: var(--shadow-hover); }
.tile[aria-pressed="true"] {
  border-color: var(--accent-2);
  background: var(--bg-soft);
  box-shadow: 0 0 0 1px var(--accent-2) inset, 0 6px 16px rgba(14, 165, 233, 0.18);
}
.tile-art { width: 40px; height: 40px; display: grid; place-items: center; }
.tile-art svg { width: 100%; height: 100%; display: block; }
.tiles.frame .tile-art { width: 64px; height: 64px; }
.tile-label { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tile[aria-pressed="true"] .tile-label { color: var(--accent-strong); }

/* ---------- プリセット ---------- */
.presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
}
.preset {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
  padding: 12px 8px 8px; cursor: pointer; display: grid; gap: 6px; justify-items: center;
  box-shadow: var(--shadow);
  transition: transform 0.18s, border-color 0.2s, box-shadow 0.2s;
}
.preset:hover { transform: translateY(-4px); border-color: var(--accent-2); box-shadow: var(--shadow-hover); }
.preset-art { width: 72px; height: 72px; display: grid; place-items: center; }
.preset-art svg { width: 100%; height: 100%; display: block; }
.preset-name { font-size: 12px; font-weight: 700; }

/* ---------- ロゴ ---------- */
.drop {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  min-height: 84px; padding: 14px 16px;
  border: 1.5px dashed #c5e3f0; border-radius: 14px;
  background: var(--bg-soft); cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--accent-2); background: #e6f6fd; outline: none; }
.drop.has { border-style: solid; }
.drop-text { color: var(--muted); font-size: 13px; }
.drop-text strong { color: var(--accent-strong); }
.drop-text small { display: block; font-size: 11px; margin-top: 2px; }
#logoThumb {
  width: 56px; height: 56px; object-fit: contain; border-radius: 10px;
  background: repeating-conic-gradient(#e3eef4 0 25%, #fff 0 50%) 0 0 / 12px 12px;
}

/* ---------- ボタン（ピル型） ---------- */
.btn, button.ghost {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.btn:hover, button.ghost:hover { transform: translateY(-2px); border-color: var(--accent-2); color: var(--accent-strong); }
.btn-primary {
  border: 0;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 16px rgba(6, 182, 212, 0.35);
}
.btn-primary:hover { color: #fff; box-shadow: 0 10px 22px rgba(14, 165, 233, 0.45); }
button.ghost { margin-left: auto; padding: 6px 14px; font-size: 13px; }

/* ---------- プレビュー ---------- */
.stage {
  border-radius: 12px;
  background:
    repeating-conic-gradient(rgba(14, 165, 233, 0.06) 0 25%, transparent 0 50%) 0 0 / 20px 20px,
    var(--bg-soft);
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  padding: 24px;
}
.qr { width: 100%; height: 100%; display: grid; place-items: center; }
.qr svg { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; filter: drop-shadow(0 8px 20px rgba(6, 182, 212, 0.18)); }
.empty { color: var(--muted); text-align: center; }

.status {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 14px; font-size: 13px; font-weight: 600;
}
.status .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--muted); }
.status[data-kind="ok"] { color: var(--ok); }
.status[data-kind="ok"] .dot { background: #10b981; box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15); }
.status[data-kind="warn"] { color: #b45309; }
.status[data-kind="warn"] .dot { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18); }
.status[data-kind="bad"] { color: var(--warn); }
.status[data-kind="bad"] .dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15); }
.status[data-kind="pending"] .dot { background: var(--accent-2); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.meta { color: var(--muted); font-size: 12px; margin: 2px 0 0 18px; }

.export { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 4px; }
.buttons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 14px; }
.buttons .btn { padding: 10px 8px; }

button.link {
  display: block; margin: 12px auto 0; border: 0; background: none;
  color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline;
}
button.link:hover { color: var(--accent-strong); }

.terms-note { margin: 12px 0 0; font-size: 11px; color: var(--muted); text-align: center; }
.terms-note a { color: inherit; }
.terms-note a:hover { color: var(--accent-strong); }

/* ---------- フッター ---------- */
.footer {
  margin-top: 72px;
  padding: 40px 0;
  text-align: center;
  background: linear-gradient(180deg, #0ea5e9 0%, #0369a1 60%, #082f49 100%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
}
.footer p { margin: 4px 0; }
.footer .small { font-size: 0.75rem; color: rgba(255, 255, 255, 0.7); }
.footer a { color: #fff; }
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 12px !important; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* ---------- 利用規約などの文書ページ ---------- */
.doc-wrap { padding: 12px 0 0; }
.doc { max-width: 760px; margin: 0 auto; padding: 32px 36px 36px; line-height: 1.85; }
.doc h1 { font-size: 1.6rem; margin: 0 0 4px; position: relative; padding-left: 16px; line-height: 1.4; }
.doc h1::before {
  content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px; border-radius: 4px;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.doc h2 { font-size: 1rem; margin: 28px 0 8px; padding-left: 12px; border-left: 4px solid var(--accent); line-height: 1.5; }
.doc h2::before { display: none; }
.doc p, .doc li { font-size: 14px; }
.doc ol { padding-left: 1.6em; margin: 8px 0; }
.doc li + li { margin-top: 4px; }
.doc a { color: var(--accent-strong); }
.doc-date { color: var(--muted); font-size: 12px !important; margin: 0 0 20px 16px; }
.doc-end { text-align: right; margin-top: 28px; }

@media (max-width: 600px) {
  .navbar-links { gap: 16px; }
  .hero { padding: 36px 0 24px; }
  .panel, .preview-card { padding: 18px; }
  .stage { padding: 14px; }
  .buttons { grid-template-columns: 1fr 1fr; }
  .buttons .btn-primary { grid-column: 1 / -1; }
  .doc { padding: 22px 18px 26px; }
}

/* ---------- プレビューボタン（右下固定） ---------- */
.fab {
  position: fixed;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 22px 0 18px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px rgba(6, 182, 212, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.fab svg { width: 22px; height: 22px; }
.fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(14, 165, 233, 0.5); }
.fab:focus-visible { outline: 3px solid rgba(14, 165, 233, 0.4); outline-offset: 3px; }

/* ---------- プレビューモーダル ---------- */
html.modal-open { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  background: rgba(8, 20, 32, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.2s;
}
.modal.is-open { opacity: 1; }
.modal-inner {
  width: 100%;
  max-width: 520px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.modal.is-open .modal-inner { transform: none; }
.modal-card {
  width: 100%;
  background: var(--card);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.modal-stage { max-height: calc(100vh - 220px); max-height: calc(100dvh - 220px); aspect-ratio: auto; height: min(480px, calc(100dvh - 220px)); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.modal-close {
  gap: 6px;
  padding: 10px 26px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}
.modal-close svg { width: 18px; height: 18px; }

@media (max-width: 600px) {
  .fab { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); height: 50px; padding: 0 18px 0 14px; }
  .modal-card { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .modal, .modal-inner, .fab { transition: none; }
}
.modal-close:focus-visible { outline: 3px solid rgba(14, 165, 233, 0.5); outline-offset: 2px; }

/* ---------- ライセンスページ ---------- */
.license-list { display: grid; gap: 16px; margin-top: 20px; }
.license-item { border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; background: var(--bg-soft); }
.license-item h2 { margin: 0 0 4px; border: 0; padding: 0; font-size: 1.05rem; }
.license-meta { margin: 0; font-size: 13px !important; color: var(--muted); }
.license-meta dt { float: left; clear: left; width: 6.5em; }
.license-meta dd { margin: 0 0 2px 6.5em; color: var(--text); overflow-wrap: anywhere; }
.license-tag {
  display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 1px 10px; margin-left: 8px;
  border-radius: 999px; color: var(--accent-strong); background: var(--accent-soft); vertical-align: 2px;
}
.license-item details { margin-top: 10px; }
.license-item summary { cursor: pointer; color: var(--accent-strong); font-weight: 600; font-size: 13px; }
.license-item pre {
  margin: 10px 0 0; padding: 14px; max-height: 360px; overflow: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  font: 12px/1.6 ui-monospace, Consolas, monospace; white-space: pre-wrap;
}

/* PCは右側のプレビューが常に見えているので、1カラム表示（スマホ・タブレット縦）のときだけ出す */
@media (min-width: 901px) {
  .fab { display: none; }
}
