/* らくばる君のポスティング大作戦 — 見た目の設定
   配色：らくばる君の装束の朱色と、チラシの黄色を夜明け前の藍色にのせる */
:root {
  --ink: #1b2340;      /* 背景の藍色 */
  --panel: #252f57;    /* 枠の色 */
  --line: #3a4677;
  --text: #f4f1ff;
  --muted: #aab3d6;
  --vermilion: #e8541e; /* らくばる君の装束 */
  --flyer: #ffd23f;     /* チラシの黄色 */
  --display: "Dela Gothic One", "M PLUS Rounded 1c", "Hiragino Sans", Meiryo, sans-serif;
  --body: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", Meiryo, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.7;
}

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding-block: 20px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 16px;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.4rem, 4vw, 2rem);
  line-height: 1.25;
  text-wrap: balance;
}
h1 span { color: var(--flyer); }

.sub { margin: 0; color: var(--muted); font-size: 0.9rem; }

.stage {
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid var(--panel);
  box-shadow: 0 10px 0 var(--panel);
  max-width: 100%;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  touch-action: none;
  cursor: pointer;
  outline: none; /* クリックで入力先になったときの枠線は出さない */
}
.stage:focus-within { border-color: var(--line); }

/* スマホ用のボタン（指で操作する端末だけ表示） */
.pad {
  display: none;
  grid-template-columns: repeat(4, 1fr) 2fr;
  gap: 8px;
  user-select: none;
  -webkit-user-select: none;
}
@media (pointer: coarse) {
  .pad { display: grid; }
}
.pad button {
  font: 700 1.1rem var(--body);
  color: var(--text);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  min-height: 56px;
  touch-action: manipulation;
}
.pad button:active { background: var(--line); }
.pad .throw {
  background: var(--vermilion);
  border-color: #ff8a5c;
  font-size: 1rem;
}

.tools { display: flex; gap: 8px; }
.other-game {
  font: 700 0.85rem var(--body);
  color: var(--flyer);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 14px;
}
.tools button {
  font: 700 0.85rem var(--body);
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 14px;
  cursor: pointer;
}
button:focus-visible { outline: 3px solid var(--flyer); outline-offset: 2px; }

.howto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px 32px;
  color: var(--muted);
  font-size: 0.92rem;
}
.howto h2 {
  margin: 0 0 4px;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--flyer);
}
.howto dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.howto dt { white-space: nowrap; }
.howto dd { margin: 0; color: var(--text); }
.howto p { margin: 0; color: var(--text); }

kbd {
  font: 700 0.8rem var(--body);
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 0 6px;
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}
