:root {
  --bg: #12241a;
  --bg2: #1d3b2a;
  --panel: #fffaf0;
  --ink: #2a1d12;
  --muted: #7a6a58;
  --wood: #c8894a;
  --wood-d: #8a5427;
  --accent: #ff6a2b;
  --accent-d: #d94a10;
  --line: #e6d8c2;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #2f5a3f 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--ink);
  font-family: "M PLUS Rounded 1c", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
.site-header {
  max-width: 980px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { margin: 0; font-size: 20px; color: #fff; font-weight: 800; letter-spacing: .02em; }
.icon-btn { background: rgba(255,255,255,.12); border: 0; color: #fff; font-size: 18px; border-radius: 10px; padding: 6px 10px; cursor: pointer; }

#app { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.screen { display: none; }
.screen.active { display: block; }

.panel {
  background: var(--panel); border-radius: var(--radius); padding: 18px;
  margin: 12px 0; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.panel-title { margin: 0 0 12px; font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* hero */
.hero { text-align: center; color: #fff; padding: 24px 0 8px; }
.hero-badge { display: inline-block; font-size: 12px; letter-spacing: .2em; background: var(--wood-d); padding: 4px 10px; border-radius: 99px; }
.hero-title { font-size: clamp(32px, 7vw, 56px); line-height: 1.1; margin: 14px 0; font-weight: 800; text-shadow: 0 4px 0 #0a160f; }
.hero-lead { opacity: .9; margin: 0 0 18px; }
.howto { text-align: left; max-width: 620px; margin: 22px auto 8px; padding: 14px 14px 14px 34px; background: rgba(255,255,255,.08); border-radius: var(--radius); line-height: 1.7; font-size: 14px; }
@media (max-width: 600px) { .pc { display: none; } }

/* buttons */
.btn {
  font: inherit; font-weight: 800; border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer;
  background: #fff; color: var(--ink); box-shadow: 0 3px 0 rgba(0,0,0,.25); transition: transform .05s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 3px 0 var(--accent-d); }
.btn-ghost { background: #f1e6d4; }
.btn-big { font-size: 22px; padding: 16px 44px; }

/* stage */
.stage { position: relative; margin-top: 8px; }
#cv {
  display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius);
  background: #2b2016; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none;
}
.rotate-hint { display: none; }
@media (orientation: portrait) and (max-width: 600px) {
  .rotate-hint { display: block; text-align: center; color: #fff; opacity: .7; font-size: 12px; margin-top: 6px; }
}
.controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 12px 0; color: #fff; }
.controls .muted { color: #cfe3d4; }

/* bat */
.bat-canvas { width: 100%; height: auto; display: block; background: #f6ecdc; border-radius: 10px; }
.sel-wrap { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; }
.sel-wrap select { font: inherit; font-weight: 800; padding: 10px 8px; border-radius: 10px; border: 0; background: #f1e6d4; color: var(--ink); }
.controls .sel-wrap { color: #fff; }
.paintable { touch-action: none; }
.paint { margin: 10px 0; background: #f6ecdc; border-radius: 10px; padding: 8px 12px; }
.paint summary { cursor: pointer; font-weight: 800; padding: 4px 0; }
.paint p { margin: 4px 0 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px #c9b694; cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 3px var(--accent); }
.swatch.eraser { background: repeating-linear-gradient(45deg, #e3ad66 0 6px, #f0c98a 6px 12px); }
.paint-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.paint-tools .btn { padding: 8px 12px; font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 12px 0; }
.stat { background: #f6ecdc; border-radius: 10px; padding: 8px 10px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 800; }
.stat .bar { height: 6px; border-radius: 3px; background: #e2d2b8; margin-top: 4px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: var(--accent); }
.stat.warn { background: #ffe1d4; }
.comment { background: #fff; border-left: 4px solid var(--wood); padding: 8px 12px; margin: 8px 0 14px; line-height: 1.6; }
.row-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

/* result */
.result { text-align: center; }
.result-label { color: var(--muted); font-weight: 800; }
.result-dist { overflow-wrap: anywhere; font-size: clamp(40px, 11vw, 96px); font-weight: 800; line-height: 1; color: var(--accent-d); }
.result-dist small { font-size: .35em; margin-left: 4px; }
.result-title { font-size: 20px; font-weight: 800; margin: 6px 0 12px; }
.pitch-log { list-style: none; padding: 0; margin: 10px 0; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pitch-log li { background: #f1e6d4; border-radius: 8px; padding: 4px 10px; font-size: 13px; }
.pitch-log li.best { background: var(--accent); color: #fff; }
.submit { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.submit input { font: inherit; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); min-width: 0; flex: 1 1 200px; max-width: 280px; }
.share { margin: 16px 0 6px; }
.share-title { font-weight: 800; margin-bottom: 8px; }
.share-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.share-btns .btn { padding: 10px 14px; font-size: 14px; }
.share-x { background: #000; color: #fff; }
.share-line { background: #06c755; color: #fff; }
.share-fb { background: #1877f2; color: #fff; }

/* ranking */
.rank-mode { font-size: 12px; color: var(--muted); font-weight: 500; }
.rank-list { margin: 0; padding: 0; list-style: none; }
.rank-list li { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px dashed var(--line); }
.rank-list li.muted { display: block; }
.rank-list .no { font-weight: 800; text-align: center; color: var(--muted); }
.rank-list li:nth-child(1) .no { color: #d4a017; }
.rank-list li:nth-child(2) .no { color: #9aa3ad; }
.rank-list li:nth-child(3) .no { color: #b8733a; }
.rank-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .nm small { color: var(--muted); margin-left: 6px; }
.rank-list .ds { font-weight: 800; }
.rank-list li.me { background: #fff1c9; border-radius: 8px; }

/* ads */
.ad-slot { max-width: 980px; margin: 8px auto; padding: 0 16px; text-align: center; }
.ad-slot:empty { display: none; }
.ad-placeholder {
  border: 2px dashed rgba(255,255,255,.3); color: rgba(255,255,255,.5); border-radius: 10px;
  min-height: 90px; display: grid; place-items: center; font-size: 12px;
}
.ad-result .ad-placeholder { border-color: var(--line); color: var(--muted); min-height: 120px; }

.site-footer { max-width: 980px; margin: 20px auto; padding: 16px; display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; font-size: 12px; color: #b8cdbf; }

/* 読み物ページ（遊び方・運営者情報・お問い合わせ・プライバシー） */
.doc { max-width: 760px; margin: 20px auto; padding: 0 16px; }
.doc .panel { line-height: 1.8; }
.doc h1 { font-size: 22px; margin-top: 0; }
.doc h2 { font-size: 18px; margin-top: 28px; border-left: 4px solid var(--wood); padding-left: 10px; }
.doc h3 { font-size: 16px; margin-top: 20px; }
.doc ul, .doc ol { padding-left: 1.4em; }
.doc li { margin: 4px 0; }
.doc .cta { text-align: center; margin: 24px 0 8px; }
.logo-link { text-decoration: none; }
.form-row { margin: 14px 0; }
.form-row label { display: block; font-weight: 800; margin-bottom: 4px; }
.form-row input, .form-row textarea, .form-row select {
  font: inherit; width: 100%; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); background: #fff;
}
.form-row textarea { min-height: 160px; resize: vertical; }
.hp { position: absolute; left: -9999px; }
.site-footer a { color: #b8cdbf; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #000c; color: #fff; padding: 10px 16px; border-radius: 99px; opacity: 0; pointer-events: none; transition: .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
