/* つなげて10（ファミコン風）— 本体のクリーム色とえんじ色をイメージ */
:root {
  --bg: #efe9dc;
  --ink: #1b1a17;
  --muted: #6e6858;
  --line: #d9d1bf;
  --maroon: #8c1d24;
  --gold: #c9a54a;
  --pink: #f878f8;
  --font: "DotGothic16", "Hiragino Kaku Gothic ProN", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: none;
}
h1, p { margin: 0; }
button { font: inherit; cursor: pointer; }

.wrap {
  width: min(520px, 100% - 32px);
  margin: 0 auto;
  padding: 24px 0 40px;
}

/* ===== 見出し ===== */
.head { text-align: center; }
.title { font-size: 2.2rem; font-weight: 400; letter-spacing: 0.06em; line-height: 1.1; }
.title span { color: var(--maroon); text-shadow: 3px 3px 0 var(--pink); }
.lead { margin-top: 10px; font-size: 0.88rem; color: var(--muted); line-height: 1.7; }

/* ===== 画面 ===== */
.console {
  margin-top: 18px;
  padding: 12px;
  border-radius: 6px;
  background: #222;
  box-shadow: 0 0 0 4px var(--ink), 6px 6px 0 4px rgba(0, 0, 0, 0.18);
  display: flex;
  justify-content: center;
}
.screen { position: relative; line-height: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
#cv {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
}

/* ファミコンのメッセージ窓っぽいダイアログ */
.dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(86%, 300px);
  padding: 18px 16px 16px;
  background: #000;
  color: #fcfcfc;
  border: 3px solid #fcfcfc;
  outline: 3px solid #000;
  line-height: 1.6;
  text-align: center;
}
.dialog[hidden] { display: none; }
.dialog__title { font-size: 1.35rem; }
.dialog__title em { font-style: normal; color: var(--pink); }
.dialog__text { margin-top: 8px; font-size: 0.85rem; }
.dialog__text strong { font-weight: 400; color: #f8d878; }
.dialog__btns { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dbtn {
  min-width: 10em;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: #fcfcfc;
  font-size: 0.95rem;
  text-align: left;
}
.dbtn:hover, .dbtn:focus-visible { background: #fcfcfc; color: #000; outline: none; }
.dbtn[hidden] { display: none; }

/* ===== コントローラー ===== */
.pad {
  margin-top: 18px;
  padding: 16px 20px;
  border-radius: 6px;
  background: var(--maroon);
  box-shadow: inset 0 0 0 4px var(--gold), 0 0 0 3px var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  flex: none;
}
.d { border: 0; background: #1b1a17; padding: 0; position: relative; }
.d--up { grid-area: 1 / 2; border-radius: 4px 4px 0 0; }
.d--left { grid-area: 2 / 1; border-radius: 4px 0 0 4px; }
.d--mid { grid-area: 2 / 2; }
.d--right { grid-area: 2 / 3; border-radius: 0 4px 4px 0; }
.d--down { grid-area: 3 / 2; border-radius: 0 0 4px 4px; }
/* 三角の目印 */
.d::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border: 7px solid transparent;
  transform: translate(-50%, -50%);
}
.d--up::after { border-bottom-color: #555; border-top-width: 0; }
.d--down::after { border-top-color: #555; border-bottom-width: 0; }
.d--left::after { border-right-color: #555; border-left-width: 0; }
.d--right::after { border-left-color: #555; border-right-width: 0; }
.d--mid::after { display: none; }
.d:active, .d.is-on { background: #3a3833; }

.sys { display: flex; gap: 18px; }
.sys__item { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sys__item span { font-size: 0.66rem; letter-spacing: 0.08em; color: var(--gold); text-align: center; line-height: 1.4; }
.sys__item b { font-weight: 400; color: #fcfcfc; letter-spacing: 0; }
.pill {
  width: 52px;
  height: 18px;
  border: 0;
  border-radius: 9px;
  background: #1b1a17;
  box-shadow: 0 0 0 3px #5a1015;
}
.pill:active { background: #3a3833; }

.howto { margin-top: 16px; font-size: 0.8rem; color: var(--muted); text-align: center; }
.foot { margin-top: 28px; padding-top: 16px; border-top: 2px dashed var(--line); text-align: center; font-size: 0.85rem; }
.foot a { color: var(--ink); text-decoration: none; }
.foot a:hover { color: var(--maroon); }

@media (max-width: 400px) {
  .pad { padding: 14px; }
  .dpad { grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); }
  .sys { gap: 12px; }
}
