/* ぷろんぷと！ — ネオブルータリズム × ポップアート
   太い黒線・ズラした影・原色ベタ塗り・網点（ベンデイ・ドット）・吹き出しバースト */
:root {
  --bg: #fffdf5;
  --grid: #ece6d6;
  --card: #ffffff;
  --ink: #111111;
  --muted: #555049;
  --line: #111111;
  --shade: #111111;          /* ズラし影の色 */
  --red: #ff3d3d;
  --yellow: #ffe500;
  --blue: #2f5bff;
  --pink: #ff6ec7;
  --mint: #00d69b;
  --paper: #fffaf0;          /* 入力欄・本文ボックス */
  --on-color: #111111;       /* 原色の上の文字 */
  --bw: 3px;
  --off: 6px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--ink);
  font: 500 16px/1.8 "Zen Kaku Gothic New", system-ui, sans-serif;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
main { width: 100%; max-width: 860px; margin: 0 auto; padding: 8px 16px 48px; flex: 1; overflow-x: clip; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
code {
  font: 700 .88em ui-monospace, "BIZ UDGothic", monospace;
  background: var(--yellow); color: var(--on-color); border: 2px solid var(--line); padding: 0 5px;
}

/* ---------- ヘッダー ---------- */
.top { background: var(--card); border-bottom: var(--bw) solid var(--line); }
.top-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 860px; margin: 0 auto; padding: 14px 16px;
}
.logo {
  font-family: "Dela Gothic One", sans-serif; font-size: clamp(22px, 5.6vw, 30px); line-height: 1;
  color: var(--on-color); text-decoration: none;
  background: var(--yellow); border: var(--bw) solid var(--line); box-shadow: 4px 4px 0 var(--shade);
  padding: 8px 14px 10px; transform: rotate(-2deg); display: inline-block;
}
.logo .bang { color: var(--red); display: inline-block; transform: rotate(14deg) scale(1.15); -webkit-text-stroke: 1.5px #111; }
.logo:hover { animation: wobble .4s; }
@keyframes wobble { 30% { transform: rotate(2deg) scale(1.05); } 70% { transform: rotate(-4deg); } }

@media (prefers-reduced-motion: reduce) {
  .logo:hover, .btn.pop { animation: none; }
}

/* ---------- ヒーロー ---------- */
.hero { position: relative; padding: 36px 0 8px; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; z-index: -1; right: -40px; top: -10px; width: 320px; height: 260px;
  background: radial-gradient(var(--pink) 30%, transparent 33%) 0 0 / 14px 14px;
  -webkit-mask-image: radial-gradient(closest-side, #000 40%, transparent); mask-image: radial-gradient(closest-side, #000 40%, transparent);
}
.hero h1 {
  font-family: "Dela Gothic One", sans-serif; font-weight: 400;
  font-size: clamp(34px, 9vw, 64px); line-height: 1.15; margin: 0 0 18px;
}
.hero h1 .hl {
  background: var(--blue); color: #fff; padding: 0 12px 4px; border: var(--bw) solid var(--line);
  box-shadow: var(--off) var(--off) 0 var(--shade); display: inline-block; transform: rotate(-1.5deg); margin-top: 8px;
}
.hero p { margin: 0 0 18px; max-width: 30em; font-weight: 700; }
.stickers { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 26px; padding: 0; list-style: none; }
.stickers li {
  font: 900 14px/1 "Zen Kaku Gothic New", sans-serif; padding: 9px 12px; border: var(--bw) solid var(--line);
  box-shadow: 3px 3px 0 var(--shade); color: var(--on-color);
}
.stickers li:nth-child(4n+1) { background: var(--yellow); transform: rotate(-2deg); }
.stickers li:nth-child(4n+2) { background: var(--mint); transform: rotate(1.5deg); }
.stickers li:nth-child(4n+3) { background: var(--pink); transform: rotate(-1deg); }
.stickers li:nth-child(4n+4) { background: #fff; transform: rotate(2deg); }
.burst {
  position: absolute; right: 0; top: 18px; width: 128px; height: 128px;
  display: grid; place-items: center; text-align: center;
  font: 400 21px/1.1 "Dela Gothic One", sans-serif; color: var(--on-color);
  transform: rotate(12deg); isolation: isolate;
}
.burst::before, .burst::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  clip-path: polygon(50% 0%, 61% 17%, 79% 7%, 80% 27%, 100% 30%, 88% 46%, 100% 62%, 80% 67%, 82% 88%, 62% 81%, 50% 100%, 38% 81%, 18% 88%, 20% 67%, 0% 62%, 12% 46%, 0% 30%, 20% 27%, 21% 7%, 39% 17%);
}
.burst::before { background: #111; transform: translate(5px, 5px); }
.burst::after { background: var(--yellow); }

/* ---------- 共通パーツ ---------- */
.title {
  font-family: "Dela Gothic One", sans-serif; font-weight: 400;
  font-size: clamp(24px, 6vw, 38px); line-height: 1.3; margin: 26px 0 12px; overflow-wrap: anywhere;
}
.card {
  background: var(--card); border: var(--bw) solid var(--line); box-shadow: var(--off) var(--off) 0 var(--shade);
  padding: 20px; margin: 22px 0; position: relative;
}
.card > h2, .box-head h2 {
  display: inline-block; font: 400 15px/1 "Dela Gothic One", sans-serif; margin: 0 0 14px;
  padding: 8px 12px; border: var(--bw) solid var(--line); color: var(--on-color); background: var(--yellow);
}
.vars > h2 { background: var(--pink); }
.prompt-box h2 { background: var(--mint); }
.notes > h2 { background: var(--blue); color: #fff; }
.example h2 { display: inline-block; font: 400 15px/1 "Dela Gothic One", sans-serif; padding: 8px 12px; border: var(--bw) solid var(--line); background: var(--pink); color: var(--on-color); margin: 0; }
.center { text-align: center; }
.big-emoji { font: 400 44px "Dela Gothic One", sans-serif; margin: 0; }

.meta { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-block; background: var(--card); border: 2px solid var(--line); color: var(--ink);
  padding: 1px 10px; font-size: 13px; font-weight: 900;
}
.chip.model { background: var(--yellow); color: var(--on-color); }
.chip.fork { background: var(--pink); color: var(--on-color); }
.chip.fork a { color: inherit; }

.box-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.count { font-weight: 900; font-size: 13px; background: var(--ink); color: var(--card); padding: 2px 8px; }
.prompt {
  margin: 0; padding: 16px; background: var(--paper); border: var(--bw) solid var(--line);
  white-space: pre-wrap; overflow-wrap: anywhere; font: 500 15px/1.8 ui-monospace, "BIZ UDGothic", monospace;
  max-height: 70vh; overflow: auto;
}
mark.var { background: var(--pink); color: var(--on-color); padding: 0 4px; border: 2px solid var(--line); font-weight: 700; }
mark.var.filled { background: var(--mint); }

/* ---------- ボタン ---------- */
.actions, .foot-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; align-items: center; }
.foot-actions { margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap;
  font: 900 15px/1 "Zen Kaku Gothic New", sans-serif; color: var(--on-color); text-decoration: none;
  background: #fff; border: var(--bw) solid var(--line); padding: 11px 16px;
  box-shadow: 4px 4px 0 var(--shade); transition: transform .06s, box-shadow .06s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--shade); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--shade); }
.btn.primary { background: var(--red); color: #fff; }
.btn.alt { background: var(--yellow); }
.btn.blue { background: var(--blue); color: #fff; }
.btn.big { font: 400 20px/1 "Dela Gothic One", sans-serif; padding: 16px 28px; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: none; border-style: dashed; }
.btn.ghost:hover { box-shadow: 4px 4px 0 var(--shade); border-style: solid; }
.btn.danger { background: var(--card); color: var(--red); border-color: var(--red); box-shadow: none; margin-left: auto; }
.btn.disabled { opacity: .4; pointer-events: none; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.pop { animation: pop .3s; background: var(--mint); color: var(--on-color); }
@keyframes pop { 50% { transform: scale(1.1) rotate(-3deg); } }
.top .btn { padding: 9px 12px; font-size: 14px; }

/* ---------- フォーム ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; flex: 1; min-width: 0; }
.field > span { font-weight: 900; }
.field small { font-weight: 500; color: var(--muted); }
.req { font-size: 11px; background: var(--red); color: #fff; border: 2px solid var(--line); padding: 0 6px; margin-left: 6px; vertical-align: 2px; }
input, textarea {
  width: 100%; font: 500 15px/1.7 "Zen Kaku Gothic New", sans-serif; color: var(--ink); background: var(--paper);
  border: var(--bw) solid var(--line); border-radius: 0; padding: 10px 12px;
}
textarea[name="prompt"] { font-family: ui-monospace, "BIZ UDGothic", monospace; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--blue); background: #fff; }
.hint { color: var(--muted); }
#var-detect { color: var(--on-color); font-weight: 900; background: var(--pink); padding: 0 4px; margin-left: 4px; }
#var-detect:empty { display: none; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .field { min-width: 220px; }
.slug { display: flex; align-items: center; border: var(--bw) solid var(--line); background: var(--paper); overflow: hidden; }
.slug:focus-within { border-color: var(--blue); background: #fff; }
.slug-prefix { padding: 0 2px 0 10px; color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.slug input { border: 0; padding-left: 2px; background: transparent; }
details.more { margin: 4px 0 16px; border: var(--bw) dashed var(--line); padding: 10px 14px 0; }
details.more[open] { border-style: solid; }
details.more summary { cursor: pointer; font-weight: 900; margin-bottom: 10px; }
.example summary { cursor: pointer; list-style: none; }
.example summary::-webkit-details-marker { display: none; }
.example summary::after { content: " ▼ ひらく"; font-weight: 900; font-size: 13px; }
.example details[open] summary::after { content: " ▲ とじる"; }
.example pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 14px 0 0; font: 500 15px/1.8 "Zen Kaku Gothic New", sans-serif; }
.error { background: var(--red); color: #fff; border: var(--bw) solid var(--line); padding: 10px 14px; font-weight: 900; }
.notice { background: var(--yellow); color: var(--on-color); border: var(--bw) solid var(--line); padding: 8px 14px; font-weight: 700; }
.notice a { color: inherit; }
.stamp { color: var(--muted); font-size: 13px; font-weight: 700; text-align: right; }

.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md pre { background: var(--paper); border: 2px solid var(--line); padding: 10px; overflow: auto; }
.md img { max-width: 100%; border: 2px solid var(--line); }

.vars .var-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }

.history { list-style: none; padding: 0; margin: 0; }
.history li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 2px dashed var(--line); }
.history li:last-child { border-bottom: 0; }
.history li > a { font: 400 15px "Dela Gothic One", sans-serif; background: var(--yellow); color: var(--on-color); border: 2px solid var(--line); padding: 0 8px; text-decoration: none; }
.history small { color: var(--muted); }

dialog.done {
  border: var(--bw) solid var(--line); box-shadow: 10px 10px 0 var(--shade);
  background: var(--card); color: var(--ink); width: min(500px, calc(100vw - 32px)); padding: 26px;
}
dialog.done::backdrop {
  background-color: rgb(17 17 17 / .55);
  background-image: radial-gradient(rgb(255 229 0 / .45) 25%, transparent 27%); background-size: 12px 12px;
}
dialog.done h2 {
  font: 400 34px/1 "Dela Gothic One", sans-serif; margin: 0 0 8px; display: inline-block;
  background: var(--yellow); color: var(--on-color); border: var(--bw) solid var(--line); padding: 8px 14px; transform: rotate(-3deg);
}
dialog.done p { margin: 14px 0 6px; font-weight: 900; }
.copy-line { display: flex; gap: 10px; }
.copy-line .btn { box-shadow: 3px 3px 0 var(--shade); }

.foot {
  text-align: center; font-weight: 900; font-size: 13px; padding: 16px;
  background: var(--ink); color: var(--bg); border-top: var(--bw) solid var(--line);
}
.foot p { margin: 0; }

@media (max-width: 560px) {
  :root { --off: 4px; }
  .card { padding: 16px; }
  .btn { font-size: 14px; padding: 10px 12px; }
  .btn.danger { margin-left: 0; }
  .burst { width: 92px; height: 92px; font-size: 15px; top: 8px; right: -2px; }
  .hero { padding-top: 76px; }
}
