:root {
  --bg: #15110e;
  --card: #221b16;
  --card2: #2c231c;
  --line: #3d3128;
  --text: #f3e9dc;
  --muted: #b8a893;
  --accent: #e8902a;
  --accent2: #f5be46;
  --ok: #8fd694;
  --warn: #ffb35c;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: env(safe-area-inset-bottom);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden { display: none !important; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 860px; margin: 0 auto; padding: 18px 16px 6px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 40px; height: 40px; border-radius: 8px; flex: none;
  background:
    linear-gradient(90deg, #1b2b4a 0 25%, #e8902a 25% 50%, #f5be46 50% 75%, #7a2a1a 75%),
    #222;
  background-size: 100% 50%;
  background-repeat: no-repeat;
  box-shadow: inset 0 -20px 0 #2d1c12;
  image-rendering: pixelated;
}
h1 { font-size: 21px; margin: 0; line-height: 1.2; }
.tag { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.lang select { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 14px; }

main { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.privacy { color: var(--ok); font-size: 14px; margin: 6px 0 14px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 0 0 16px;
}
.card h2 { font-size: 18px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #1b120a;
  display: inline-grid; place-items: center; font-size: 14px; font-weight: 700; flex: none;
}

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 2px dashed var(--line); border-radius: 12px; padding: 28px 16px; text-align: center;
  cursor: pointer; background: var(--card2); transition: border-color .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); }
.drop span { color: var(--muted); font-size: 14px; }

.seg { display: inline-flex; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.segbtn { border: 0; background: transparent; color: var(--muted); padding: 8px 12px; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer; }
.segbtn.active { background: var(--accent); color: #1b120a; font-weight: 600; }

.hint { color: var(--muted); font-size: 13px; margin: 8px 0; }
.srcwrap { position: relative; border-radius: 10px; overflow: hidden; background: #000; touch-action: none; }
#src { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: none; }

.row { display: flex; gap: 8px; margin-top: 12px; }
.row.wrap { flex-wrap: wrap; }
button {
  font: inherit; font-size: 15px; color: var(--text); background: var(--card2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary {
  width: 100%; background: var(--accent); color: #1b120a; border: 0; font-weight: 700;
  font-size: 18px; padding: 15px; margin-top: 6px;
}
button.primary:active { transform: scale(.99); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 18px; }
.ctl { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.ctl input[type=range] { width: 100%; accent-color: var(--accent); }
.ctl input[type=text], .ctl input[type=number], .ctl select {
  background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font: inherit; font-size: 16px; width: 100%;
}
.colors { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px; }
.colors label { display: flex; align-items: center; gap: 6px; }
input[type=color] { width: 40px; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: none; padding: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 12px 0 0; color: var(--text); }
.check.inline { margin: 0; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

details.sub { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
details summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
details.sub[open] summary { margin-bottom: 8px; }

.gamebox {
  background: #d8cbb6; border-radius: 12px; padding: 8px 10px;
  box-shadow: inset 0 0 0 4px #e8dcc8;
}
#preview { display: block; width: 100%; height: auto; image-rendering: pixelated; border-radius: 2px; }
.stats { color: var(--muted); font-size: 14px; margin: 10px 0 4px; }
.warn { color: var(--warn); font-size: 14px; margin: 6px 0; }
.ok { color: var(--ok); text-align: center; min-height: 1.5em; margin: 6px 0 0; font-size: 14px; }
textarea {
  width: 100%; margin-top: 12px; background: var(--card2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px; font: 11px/1.3 ui-monospace, Menlo, monospace; resize: vertical;
}
.howto { color: var(--muted); font-size: 14px; padding-left: 20px; margin: 14px 0 0; }
.howto li { margin: 4px 0; }

.faq p { color: var(--muted); font-size: 14px; }
.faq pre {
  white-space: pre-wrap; word-break: break-all; background: var(--card2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px; font-size: 11px; color: var(--muted);
}
footer { text-align: center; color: #7d6e5c; font-size: 12px; padding: 10px 16px 28px; }
