:root {
  --bg: #0b0f14;
  --fg: #e9eef5;
  --acc: #10d090;
  --miss: #ff5b6e;
  --dim: #7f8da3;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  height: 100%;
  overflow: hidden; /* 横スクロール抑制（縦端末でキャンバスが幅広でも中央を見せる） */
}

canvas#game { position: fixed; top: 0; left: 50%; transform: translateX(-50%); display: block; }

.overlay-ui {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: env(safe-area-inset-top) 10px 10px 10px;
  pointer-events: none;
}

.overlay-ui * { pointer-events: auto; }

.seed-block {
  display: flex;
  align-items: center;
  gap: 8px;
}

.seed-block input[type="text"] {
  background: #1a1d22;
  color: var(--fg);
  border: 1px solid #2b2f36;
  padding: 6px 8px;
  border-radius: 6px;
  width: 160px;
}

.seed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--dim);
  user-select: none;
}

#linkTop {
  background: rgba(16, 208, 144, 0.15);
  color: var(--fg);
  border: 1px solid #2b2f36;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}

.overlay-ui .ctrl {
  background: #1a1d22;
  color: var(--fg);
  border: 1px solid #2b2f36;
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 600;
  outline: none;
  user-select: none;
}

/* 初回スタートボタン（バー配置） */
.start-bar { position: fixed; left: 50%; top: calc(50% + 125px); transform: translateX(-50%); display: grid; place-items: center; z-index: 12; }
.start-btn { font-weight: 900; font-size: 20px; padding: 14px 24px; border-radius: 12px; border: none; color: #052e2b; background: var(--acc); box-shadow: 0 10px 24px rgba(16,208,144,0.35); cursor: pointer; }
.start-btn:focus { outline: 3px solid #ffdd57; outline-offset: 2px; }

/* モーダル（簡易） */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 30; }
.modal.hidden { display: none; }
.modal-content { background: #111827; color: var(--fg); width: min(92vw, 420px); border-radius: 16px; padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal-actions { display: flex; justify-content: flex-end; margin-top: 12px; gap: 8px; }

/* トースト */
.toast { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); background: #111827; color: #e5e7eb; padding: 10px 14px; border-radius: 999px; box-shadow: 0 12px 30px rgba(0,0,0,.5); opacity: 0; transition: .25s ease; z-index: 70; }
.toast.show { opacity: 1; }


/* タイトル用ランキング */
.lb-container { position: fixed; left: 50%; top: calc(50% + 200px); transform: translateX(-50%); width: min(92vw, 640px); max-height: 32vh; overflow: auto; padding: 8px 12px; background: rgba(17,24,39,.55); border: 1px solid #2b2f36; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.35); z-index: 10; }
.lb-container.hidden { display: none; }
.lb-title { margin: 6px 8px; font: 900 16px system-ui, sans-serif; color: var(--fg); }
.lb-list { list-style: none; margin: 0; padding: 0 8px 8px 8px; }
.lb-list li { padding: 6px 0; color: var(--fg); font: 600 14px system-ui, sans-serif; line-height: 1.2; }
.lb-line1 { font-weight: 800; }
.lb-line2 { color: #9ca3af; font-weight: 600; font-size: 12px; margin-top: 2px; }


/* リザルト操作ボタン */
.result-actions { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); display: flex; gap: 16px; z-index: 12; }
.result-actions.hidden { display: none; }
.result-actions .start-btn { font-size: 18px; padding: 12px 20px; }

@media (max-width: 640px) {
  .result-actions { bottom: 96px; gap: 12px; }
  .result-actions .start-btn { font-size: 16px; padding: 10px 16px; }
}


