@import url('https://fonts.googleapis.com/css2?family=DotGothic16&family=Silkscreen:wght@400;700&display=swap');
/* hamakenブラウザゲーム 共通シェル v1
   サイト本体(クリーム紙×インク×ハードシャドウ)と同系のデザイン言語 */
:root {
  --ink: #10162f;
  --paper: #f7f3e8;
  --paper-deep: #e9e1cf;
  --line: #c9bea8;
  --accent: #ff5b7f; /* 各ゲームがbodyのstyleで上書き */
  --field: #081438;  /* プレイフィールドの暗色地 */
  --display: "Arial Black", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --body: "Hiragino Sans", "Yu Gothic UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--ink); }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); font-family: var(--body);
  background:
    radial-gradient(circle at 85% 10%, color-mix(in srgb, var(--accent) 30%, transparent) 0 14%, transparent 14.3%),
    repeating-linear-gradient(90deg, transparent 0 47px, rgb(16 22 47 / 5%) 48px),
    var(--paper);
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
button { font: inherit; cursor: pointer; }
button:focus-visible { outline: 4px solid #fff; box-shadow: 0 0 0 7px var(--ink); }

.game-wrap { display: flex; flex-direction: column; min-height: 100dvh; width: min(560px, 100%); margin: 0 auto; padding: 10px clamp(10px, 3vw, 18px) 18px; }

/* ヘッダー */
.game-head { display: flex; align-items: center; gap: 12px; padding: 6px 0 10px; }
.game-head .back {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  color: var(--paper); border: 3px solid var(--ink); border-radius: 50%;
  background: var(--ink); box-shadow: 0 4px 0 var(--accent);
  font-size: 22px; line-height: 1; text-decoration: none; font-weight: 900;
}
.game-head .titles { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.game-head small { color: color-mix(in srgb, var(--accent) 75%, var(--ink)); font-size: 10px; font-weight: 900; letter-spacing: .18em; }
.game-head strong { font-family: var(--display); font-size: clamp(19px, 5vw, 26px); letter-spacing: -.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* スコア帯 */
.score-strip {
  display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px;
  padding: 10px 16px; border: 3px solid var(--ink); border-radius: 18px;
  background: var(--paper-deep); box-shadow: 5px 6px 0 var(--ink);
}
.score-strip > div { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.score-strip span { font-size: 10px; font-weight: 900; letter-spacing: .14em; color: #6b6252; }
.score-strip strong { font-family: var(--display); font-size: clamp(20px, 6vw, 28px); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.score-strip .is-accent strong { color: color-mix(in srgb, var(--accent) 80%, var(--ink)); }

/* プレイフィールド(canvas/DOMどちらでも) */
.playfield {
  position: relative; flex: 1; min-height: 0; overflow: hidden;
  border: 4px solid var(--ink); border-radius: 26px;
  background: radial-gradient(circle at 50% 0%, #14245c 0%, var(--field) 62%);
  box-shadow: 8px 9px 0 var(--ink), inset 0 0 0 1px rgb(255 255 255 / 12%);
}
.playfield > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* 操作ボタン列 */
.control-row { display: flex; gap: 10px; margin-top: 12px; }
.control-row button {
  flex: 1; padding: 15px 10px; color: var(--ink);
  border: 3px solid var(--ink); border-radius: 999px; background: var(--paper);
  box-shadow: 0 5px 0 var(--ink); font-weight: 900; font-size: 15px;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.control-row button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.control-row button.is-primary { color: var(--paper); background: var(--ink); box-shadow: 0 5px 0 var(--accent); }

/* オーバーレイ(開始/結果) */
.overlay {
  position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center;
  padding: 16px; background: rgb(8 14 40 / 62%); backdrop-filter: blur(3px); overflow-y: auto; overscroll-behavior: contain;
}
.overlay[hidden] { display: none; }
.overlay-card {
  width: min(420px, 100%); margin: auto; padding: clamp(22px, 6vw, 34px);
  border: 4px solid var(--ink); border-radius: 30px 30px 48px 30px;
  background: var(--paper-deep); box-shadow: 10px 12px 0 var(--ink); text-align: center;
}
.overlay-card .tag { display: inline-block; padding: 5px 14px; border-radius: 999px; color: var(--paper); background: var(--ink); font-size: 10px; font-weight: 900; letter-spacing: .18em; }
.overlay-card h1 { margin: 12px 0 4px; font-family: var(--display); font-size: clamp(24px, 7vw, 34px); letter-spacing: -.05em; line-height: 1.1; }
.overlay-card .big-score { margin: 6px 0 0; font-family: var(--display); font-size: clamp(44px, 15vw, 64px); letter-spacing: -.05em; color: color-mix(in srgb, var(--accent) 80%, var(--ink)); }
.overlay-card .stars { margin: 4px 0 10px; color: #c78100; font-size: 22px; letter-spacing: .1em; }
.overlay-card p { margin: 8px 0 16px; font-size: 13px; font-weight: 700; line-height: 1.7; }
.overlay-card .intro { margin: 8px 0 12px; font-size: 13px; font-weight: 700; line-height: 1.75; text-align: left; }
.overlay-card .play-button + .guide { margin-top: 16px; }
.overlay-card .guide { margin: 0 0 12px; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 16px; background: var(--paper); text-align: left; }
.overlay-card .guide strong { display: block; margin-bottom: 6px; font-size: 10px; font-weight: 900; letter-spacing: .16em; color: color-mix(in srgb, var(--accent) 70%, var(--ink)); }
.overlay-card .guide ol, .overlay-card .guide ul { margin: 0; padding-left: 1.4em; font-size: 12.5px; font-weight: 700; line-height: 1.7; }
.overlay-card .guide li + li { margin-top: 3px; }
.overlay-card .guide-tips { border-style: dashed; background: color-mix(in srgb, var(--accent) 8%, var(--paper)); }
.overlay-card .guide-tips ul { list-style: none; padding-left: 0; }
.overlay-card .guide-tips li::before { content: '★ '; color: #c78100; }
.overlay-card .goals { margin: 0 0 16px; font-size: 11px; font-weight: 900; color: #9b6800; }
.overlay-card .best-line { margin: 0 0 14px; font-size: 12px; font-weight: 900; color: #6b6252; }
.overlay-card .new-best { color: #d93c63; }
.play-button {
  width: 100%; padding: 16px 20px; color: var(--paper);
  border: 3px solid var(--ink); border-radius: 999px; background: var(--ink);
  box-shadow: 0 6px 0 var(--accent); font-weight: 900; font-size: 16px;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.play-button:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--accent); }
.secondary-button { width: 100%; margin-top: 10px; padding: 12px; color: var(--ink); border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); font-weight: 900; font-size: 13px; }

/* フィールド内メッセージ(コンボ表示など) */
.field-toast {
  position: absolute; left: 50%; top: 14%; z-index: 20; transform: translateX(-50%);
  padding: 6px 16px; color: #fff; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 82%, #000); font-weight: 900; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  white-space: nowrap;
}
.field-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* 画面シェイク */
.playfield.is-shake { animation: pa-shake .3s; }
@keyframes pa-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-5px, 3px); }
  40% { transform: translate(5px, -3px); }
  60% { transform: translate(-4px, -2px); }
  80% { transform: translate(3px, 2px); }
}

footer.game-foot { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 20px; padding-top: 12px; font-size: 10px; font-weight: 800; color: #6b6252; }
footer.game-foot a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
@media (min-height: 720px) { .game-wrap { padding-top: 16px; } }

/* ---- 記録所(ゲームセンター式ネームエントリー) ----
   夜のゲーセンの電光掲示板に合わせ、ここだけ暗色CRTパネル+ピクセル書体 */
.rank-in {
  position: relative; margin: 0 0 14px; padding: 12px 12px 14px; border-radius: 12px;
  color: #ffe9a3; background: #070b1f;
  border: 2px solid rgb(255 216 77 / 55%);
  box-shadow: inset 0 0 22px rgb(0 0 0 / 80%), 0 0 16px rgb(255 216 77 / 30%);
  background-image: repeating-linear-gradient(0deg, rgb(0 0 0 / 25%) 0 1px, transparent 1px 3px);
}
.rank-in > span {
  display: block; margin-bottom: 10px; font-family: 'DotGothic16', var(--display); font-size: 20px; letter-spacing: .14em;
  color: #fff; text-shadow: 0 0 6px #ffd84d, 0 0 16px rgb(255 216 77 / 70%);
}
.rank-in > span::before { content: 'RANK IN! '; font-family: 'Silkscreen', monospace; font-size: 11px; color: #7cf29a; text-shadow: 0 0 8px rgb(124 242 154 / 80%); animation: pa-blink 1.1s steps(2, start) infinite; }
.rank-in .play-button { color: #081438; background: linear-gradient(180deg, #ffe98a, #ffd84d); border-color: #b07a00; box-shadow: 0 6px 0 #b07a00, 0 0 18px rgb(255 216 77 / 45%); }
.rank-in .play-button:active { box-shadow: 0 2px 0 #b07a00; }

.name-entry { background: #0b1230 !important; color: #f7f3e8; border-color: #2a3570 !important; box-shadow: 10px 12px 0 #05081a, 0 0 40px rgb(53 182 255 / 25%) !important; }
.name-entry .tag { background: #ffd84d; color: #081438; font-family: 'Silkscreen', monospace; letter-spacing: .12em; }
.name-entry h1 { margin: 12px 0 0; font-family: 'DotGothic16', var(--display); font-weight: 400; font-size: clamp(20px, 6vw, 26px); letter-spacing: .14em; color: #fff; text-shadow: 0 0 8px #35b6ff, 0 0 20px rgb(53 182 255 / 60%); }
.name-entry .big-score { color: #ff8fa8 !important; font-family: 'Silkscreen', var(--display) !important; text-shadow: 0 0 10px rgb(255 91 127 / 80%); }
.name-entry .entry-note { color: #8c95c2 !important; }
.name-entry .secondary-button { color: #f7f3e8; background: transparent; border-color: #3a4780; box-shadow: 0 4px 0 #05081a; }
.name-slots { display: flex; justify-content: center; gap: 8px; margin: 6px 0 14px; }
.name-slots i {
  display: grid; place-items: center; width: 48px; height: 60px; flex: none;
  border-radius: 6px; background: #03050f; color: #ffe27a;
  border: 2px solid #23305f; box-shadow: inset 0 0 14px rgb(0 0 0 / 90%), inset 0 0 0 1px rgb(255 255 255 / 5%);
  background-image: repeating-linear-gradient(0deg, rgb(255 255 255 / 3%) 0 1px, transparent 1px 3px);
  font-family: 'DotGothic16', var(--display); font-size: 30px; font-style: normal; line-height: 1;
  text-shadow: 0 0 8px rgb(255 216 77 / 80%);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.name-slots i.is-filled { border-color: #ffd84d; box-shadow: inset 0 0 14px rgb(0 0 0 / 90%), 0 0 12px rgb(255 216 77 / 40%); transform: translateY(-2px); }
.name-slots i.is-cursor { border-color: #35b6ff; box-shadow: inset 0 0 14px rgb(0 0 0 / 90%), 0 0 14px rgb(53 182 255 / 60%); }
.name-slots i.is-cursor::after { content: '_'; color: #35b6ff; text-shadow: 0 0 8px #35b6ff; animation: pa-blink 1s steps(2, start) infinite; }
@keyframes pa-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.name-input {
  width: 100%; padding: 10px 12px; margin-bottom: 6px; text-align: center;
  border: 2px solid #23305f; border-radius: 8px; background: #060a1c; color: #fff;
  font-family: 'DotGothic16', var(--display); font-size: 16px; letter-spacing: .12em; caret-color: #35b6ff;
}
.name-input:focus { outline: 0; border-color: #35b6ff; box-shadow: 0 0 0 3px rgb(53 182 255 / 30%), 0 0 18px rgb(53 182 255 / 40%); }
.entry-note { margin: 4px 0 14px !important; font-size: 11px !important; color: #6b6252; letter-spacing: .04em; }
.entered-name {
  margin: 6px 0 2px; padding: 8px 18px; display: inline-block; border-radius: 6px;
  background: #03050f; border: 2px solid #ffd84d; color: #ffe27a;
  font-family: 'DotGothic16', var(--display); font-size: 28px; letter-spacing: .22em;
  text-shadow: 0 0 8px rgb(255 216 77 / 80%); box-shadow: 0 0 18px rgb(255 216 77 / 35%), inset 0 0 14px rgb(0 0 0 / 90%);
}
@media (max-width: 360px) { .name-slots i { width: 42px; height: 54px; font-size: 26px; } }
.name-entry .play-button { color: #081438; background: linear-gradient(180deg, #ffe98a, #ffd84d); border-color: #b07a00; box-shadow: 0 6px 0 #b07a00, 0 0 18px rgb(255 216 77 / 45%); }
.name-entry .play-button:active { box-shadow: 0 2px 0 #b07a00; }
@media (prefers-reduced-motion: reduce) {
  .rank-in > span::before, .name-slots i.is-cursor::after { animation: none; }
  .name-slots i { transition: none; }
}
