:root {
  --bg: #f6f5f2; --ink: #1d1d1f; --sub: #6b6b70; --line: #e3e1dc; --accent: #1d9bf0; --card: #fff;
  --danger: #e5484d;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

/* ===== TOP ===== */
.top { max-width: 1100px; margin: 0 auto; padding: 40px 24px 80px; }
.top h1 { font-size: 30px; margin: 0 0 8px; letter-spacing: .02em; }
.top .lead { color: var(--sub); margin: 0 0 32px; line-height: 1.8; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.08); }
.card .frame { display: flex; align-items: center; justify-content: center; height: 170px;
  background: #efede8; border-radius: 10px; margin-bottom: 14px; }
.card .shape { background-size: cover; background-position: center; border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.card .shape.round { border-radius: 50%; }
.card h2 { font-size: 18px; margin: 0; }
.card .what { color: var(--sub); font-size: 13px; margin: 2px 0 8px; }
.card .px { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.card .tip { color: var(--sub); font-size: 12.5px; line-height: 1.7; margin: 8px 0 0; flex: 1; }
.card .go { margin-top: 14px; text-align: center; padding: 10px; border-radius: 10px;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; }
.top .foot { margin-top: 40px; color: var(--sub); font-size: 12.5px; line-height: 1.9; }
.top .hub { margin-top: 12px; font-size: 12.5px; }
.top .hub a { color: var(--sub); }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #fff3d6;
  color: #8a5a00; margin-left: 6px; vertical-align: 2px; }

/* ===== エディター ===== */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; background: rgba(246,245,242,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.bar .back { text-decoration: none; color: var(--sub); font-size: 14px; }
.bar h1 { font-size: 17px; margin: 0; }
.bar .size { font-family: ui-monospace, Consolas, monospace; color: var(--sub); font-size: 13px; }
.bar .grow { flex: 1; }
.bar select { padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.primary { background: var(--accent); color: #fff !important; border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 700; }

.ed { display: grid; grid-template-columns: 1fr 380px; gap: 20px; padding: 20px; max-width: 1500px; margin: 0 auto; }
@media (max-width: 1000px) { .ed { grid-template-columns: 1fr; } }
.left { min-width: 0; }
.stage { position: relative; margin: 0 auto; background:
  repeating-conic-gradient(#e7e5e0 0 25%, #f3f2ee 0 50%) 0 0 / 20px 20px; border-radius: 6px; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.08); touch-action: none; }
.stage canvas { display: block; width: 100%; height: 100%; }
.stage #ov { position: absolute; inset: 0; pointer-events: none; }
.stage.circle { border-radius: 50%; }
.hint { color: var(--sub); font-size: 12.5px; margin: 10px 2px 0; line-height: 1.7; }
.sec { font-size: 14px; margin: 26px 0 12px; }

.previews { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.pv h4 { font-size: 12px; color: var(--sub); margin: 0 0 6px; font-weight: 600; }
.pv .box { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pv .crop { position: relative; display: block; }
.pv .crop canvas { display: block; width: 100%; height: 100%; }
.pv .crop.circle { border-radius: 50%; overflow: hidden; border: 1px solid var(--line); }
.pv .ovl { position: absolute; border-radius: 50%; display: grid; place-items: center; }
.pv .ovl.icon { background: #cfd9de center / cover no-repeat; border: solid #fff; }
.pv .ovl.btn { background: rgba(15,20,25,.75); color: #fff; }
.pv .prof { padding: 0 12px 12px; }
.pv .prof .nm { font-weight: 800; }
.pv .prof .hn { color: #536471; font-size: .85em; }
.pv.dark .box { background: #000; border-color: #2f3336; color: #e7e9ea; }
.pv.dark .ovl.icon { border-color: #000; }
.pv.dark .prof .hn { color: #71767b; }
.show-cover .pv .ovl { outline: 3px solid #ff3b30; outline-offset: -3px; }

.panel { display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.panel details { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.panel summary { font-weight: 700; cursor: pointer; margin-bottom: 10px; }
.lbl { display: block; font-size: 12px; color: var(--sub); margin: 12px 0 6px; font-weight: 600; }
.lbl.inl { display: inline; margin: 0 4px 0 8px; }
.lbl b { color: var(--ink); font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button, .chips button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.seg button.on, .chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }
.chips button { padding: 3px 10px; font-size: 12px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=color] { width: 36px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
input[type=text], textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; resize: vertical; }
.wide { width: 100%; padding: 10px; border-radius: 10px; border: 1px dashed var(--accent); background: #f2f9ff; color: var(--accent); font-weight: 700; }
.wide.ghost { border: 1px solid var(--line); background: #fff; color: var(--sub); font-weight: 400; }
.small { margin-top: 8px; font-size: 12px; padding: 4px 10px; border: 1px solid var(--line); background: #fff; border-radius: 6px; }
.btns { margin-top: 14px; }
.btns button { font-size: 12.5px; padding: 6px 10px; border: 1px solid var(--line); background: #fff; border-radius: 8px; }
.btns .danger { color: var(--danger); border-color: #f3c4c5; }
.note { font-size: 12px; color: var(--sub); line-height: 1.6; margin: 6px 0 0; }

.layers { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.layers button { text-align: left; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layers button.on { border-color: var(--accent); background: #f2f9ff; }

.fontlist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow-x: hidden; gap: 6px; max-height: 236px; overflow-y: auto; padding: 2px; }
.fontlist button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 8px; text-align: left; }
.fontlist button.on { border-color: var(--accent); box-shadow: 0 0 0 2px #bfe3fc; }
.fontlist .s { display: block; font-size: 19px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fontlist .n { display: block; font-size: 10.5px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.opt { display: grid; grid-template-columns: 96px 36px 1fr; gap: 8px; align-items: center; margin-top: 10px; }
.swatches { display: flex; gap: 4px; }
.swatches button { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); padding: 0; }

.mats { display: grid; grid-template-columns: repeat(var(--mat-cols, 2), minmax(0, 1fr)); gap: 6px; max-height: 420px; overflow-y: auto; }
.colrow { justify-content: space-between; margin-bottom: 10px; flex-wrap: nowrap; }
.cols { display: flex; gap: 4px; flex-wrap: wrap; }
.cols button { width: 18px; height: 18px; border-radius: 50%; padding: 0; border: 1px solid rgba(0,0,0,.18); }
.cols button.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.count { font-size: 12px; color: var(--sub); white-space: nowrap; }
.more { width: 100%; margin-top: 8px; padding: 8px; }
.mats button { padding: 0; border: 2px solid transparent; border-radius: 6px; background: none; }
.mats button.on { border-color: var(--accent); }
.mats img { display: block; width: 100%; aspect-ratio: var(--mat-ar, 3 / 1); object-fit: cover; border-radius: 4px; }
.iconnow { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #cfd9de; }

/* ミニ窓 */
.mini { position: fixed; left: 16px; bottom: 16px; z-index: 30; background: #fff; border-radius: 12px; padding: 0 8px 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25); border: 1px solid var(--line); animation: miniIn .2s ease; }
@keyframes miniIn { from { transform: translateY(12px); opacity: 0; } }
.mini-bar { display: flex; align-items: center; gap: 6px; padding: 6px 2px; cursor: move; user-select: none; font-size: 12px; color: var(--sub); }
.mini-bar span { flex: 1; font-weight: 600; }
.mini-bar button { font-size: 11.5px; padding: 3px 9px; border: 1px solid var(--line); background: #fff; border-radius: 6px; }
.mini-stage { border-radius: 6px; overflow: hidden; background: repeating-conic-gradient(#e7e5e0 0 25%, #f3f2ee 0 50%) 0 0 / 16px 16px; }
.mini-stage.circle { border-radius: 50%; }
.mini-stage canvas { display: block; touch-action: none; cursor: grab; }
