/* ナイスタちゃんのキャバ打
   色・フォントは よいどれキャッチ / ゾンビナイト と揃える（濃い夜色 + ネオンピンク） */
:root {
  --bg: #0b0a10;
  --panel: #17131f;
  --panel2: #221b2e;
  --line: #3a2f4a;
  --pink: #ff2d6f;
  --pink-soft: #ffd1e0;
  --cyan: #3ad6ff;
  --yellow: #ffd23f;
  --green: #4be08a;
  --text: #ffffff;
  --dim: #a49cb3;
  --font: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --font-title: "Dela Gothic One", var(--font);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 700;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
body {
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(255, 45, 111, .22), transparent 60%),
    radial-gradient(90% 50% at 100% 100%, rgba(58, 214, 255, .12), transparent 60%),
    var(--bg);
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ---------- 画面切り替え ---------- */
.screen {
  position: fixed; inset: 0;
  display: none;
  flex-direction: column;
  height: 100dvh;
}
.screen.active { display: flex; }
.box {
  width: 100%; max-width: 440px;
  margin: 0 auto;
  padding: 28px 18px calc(28px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  overflow-y: auto; height: 100%;
  text-align: center;
}

.brand { font-family: var(--font-title); font-size: 13px; letter-spacing: .25em; color: var(--dim); }
.brand b { color: var(--pink); font-weight: 400; }
.title { font-family: var(--font-title); font-weight: 400; line-height: 1.15; }
.title small { display: block; font-size: 16px; color: var(--pink-soft); }
.title span {
  display: block; font-size: 40px;
  background: linear-gradient(180deg, #fff 20%, var(--pink) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 45, 111, .55));
}
.title-sushi { font-size: 64px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-6deg); } }
.lead { font-size: 15px; line-height: 1.7; color: var(--pink-soft); }
.lead b { color: #fff; }
.h2 { font-family: var(--font-title); font-weight: 400; font-size: 26px; color: var(--pink); }
.h3 { font-size: 13px; color: var(--dim); margin-top: 4px; }

/* ---------- ボタン ---------- */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 50px; padding: 10px 16px;
  border-radius: 999px; font-size: 16px; font-weight: 900;
  transition: transform .08s;
}
.btn:active { transform: scale(.97); }
.btn-main { background: linear-gradient(180deg, #ff5a8d, var(--pink)); box-shadow: 0 6px 20px rgba(255, 45, 111, .45); }
.btn-sub { background: var(--panel2); border: 1px solid var(--line); font-size: 14px; }
.btn-ghost { border: 2px solid var(--line); color: var(--pink-soft); }
.row2 { display: flex; gap: 10px; width: 100%; }
.row2 > * { flex: 1; }

/* ---------- タイトル: ユーザー / コース ---------- */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: flex-end; padding: 10px 12px;
}
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.user-chip img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid var(--cyan); }
.user-chip .login { padding: 6px 14px; border-radius: 999px; background: #3a2456; border: 1px solid var(--line); }
.user-chip .reg { padding: 6px 12px; border-radius: 999px; background: var(--pink); }

.courses { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.course {
  display: grid; grid-template-columns: 1fr auto; align-items: center; text-align: left;
  padding: 12px 16px; border-radius: 16px;
  background: var(--panel); border: 2px solid var(--line);
  transition: transform .08s, border-color .15s;
}
.course:active { transform: scale(.98); border-color: var(--pink); }
.course .nm { font-family: var(--font-title); font-weight: 400; font-size: 20px; }
.course .pr { font-size: 13px; color: var(--yellow); }
.course .ds { grid-column: 1 / -1; font-size: 12px; color: var(--dim); font-weight: 500; margin-top: 2px; }
.course .bs { font-size: 12px; color: var(--cyan); text-align: right; }
.course[data-id="easy"] .nm { color: #7ee0ff; }
.course[data-id="std"] .nm { color: var(--pink-soft); }
.course[data-id="high"] .nm { color: var(--yellow); }

/* ---------- あそびかた ---------- */
.how { list-style: none; display: flex; flex-direction: column; gap: 10px; width: 100%; text-align: left; }
.how li { display: flex; gap: 12px; align-items: center; background: var(--panel); border-radius: 14px; padding: 10px 12px; }
.how .ic {
  flex: 0 0 44px; height: 44px; border-radius: 12px; background: var(--panel2);
  display: grid; place-items: center; font-size: 22px; color: var(--pink);
}
.how .txt { font-size: 13px; line-height: 1.6; font-weight: 500; }
.how b { color: var(--pink-soft); }

/* ---------- ゲーム画面 ---------- */
#screen-play { padding-top: env(safe-area-inset-top, 0px); }
.hud { display: flex; align-items: center; gap: 12px; padding: 10px 56px 6px 52px; }
.hud-time { flex: 1; display: flex; align-items: center; gap: 8px; }
.time-track { flex: 1; height: 10px; border-radius: 99px; background: var(--panel2); overflow: hidden; }
.time-bar { height: 100%; width: 100%; background: linear-gradient(90deg, var(--cyan), #9cf0ff); border-radius: 99px; transition: background .3s; }
.time-bar.low { background: linear-gradient(90deg, var(--pink), #ff8fb2); }
.time-num { font-family: var(--font-title); font-size: 18px; min-width: 2.2em; text-align: right; }
.hud-money { font-family: var(--font-title); font-size: 22px; white-space: nowrap; }
.hud-money small { font-size: 12px; margin-left: 2px; }
.hud-money em { font-style: normal; font-family: var(--font); font-size: 11px; color: var(--dim); margin-left: 4px; }
.hud-money.over { color: var(--yellow); }

.mute, .quit {
  position: absolute; top: calc(6px + env(safe-area-inset-top, 0px)); z-index: 5;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--panel2); border: 1px solid var(--line); font-size: 15px;
}
.quit { left: 10px; color: var(--dim); }
.mute { right: 10px; }
.mute.off { opacity: .4; text-decoration: line-through; }

/* レーン（グラスが流れるカウンター） */
.lane { position: relative; height: 92px; margin-top: 6px; overflow: hidden; flex: 0 0 auto; }
.belt {
  position: absolute; left: 0; right: 0; top: 50%; height: 64px; transform: translateY(-50%);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .06) 0 2px, transparent 2px 40px),
    linear-gradient(180deg, #2b2238, #1a1424);
  border-top: 2px solid var(--line); border-bottom: 2px solid var(--line);
  animation: belt 1.2s linear infinite;
}
@keyframes belt { to { background-position: -40px 0, 0 0; } }
.plate {
  position: absolute; top: 50%; left: 0; width: 76px; height: 76px; margin-top: -38px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  will-change: transform;
}
.plate::before {
  content: ""; position: absolute; left: 4px; right: 4px; bottom: 6px; height: 26px;
  border-radius: 50%; background: var(--pc, #6bb7ff); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .25), 0 0 0 3px rgba(255, 255, 255, .15);
}
.plate .neta { position: relative; font-size: 38px; line-height: 1; margin-bottom: 10px; }
.plate .yen { position: absolute; bottom: -6px; font-size: 11px; color: var(--dim); }
.plate.active::before { box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .25), 0 0 0 3px #fff, 0 0 18px var(--pink); }
.plate.active .yen { color: #fff; }
.plate.eaten { animation: eat .35s ease-in forwards; }
@keyframes eat { to { transform: var(--tf) translateY(-40px) scale(.3); opacity: 0; } }
.plate.lost { opacity: .35; filter: grayscale(1); }

/* お題ボード */
.board {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 0 14px; text-align: center; position: relative;
}
.word { font-size: clamp(24px, 7.4vw, 36px); font-weight: 900; line-height: 1.25; word-break: keep-all; overflow-wrap: anywhere; }
.reading { font-size: clamp(22px, 6.6vw, 30px); font-weight: 900; letter-spacing: .06em; color: var(--dim); min-height: 1.4em; }
.reading .done { color: var(--pink); }
.reading .pend { color: var(--yellow); border-bottom: 3px solid var(--yellow); }
.reading .next { color: #fff; border-bottom: 3px solid rgba(255, 255, 255, .5); }
/* PC キーボード: ローマ字の見本。フリックのときは出さない */
.roma { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: clamp(18px, 4.6vw, 26px); letter-spacing: .04em; color: var(--dim); min-height: 1.3em; }
.roma .done { color: var(--pink); }
body:not(.mode-kb) .roma { display: none; }
body.mode-kb .kb { display: none; }
body.mode-kb .word { font-size: clamp(28px, 5vw, 44px); }
.mode-note { font-size: 12px; color: var(--dim); margin-top: -4px; }
.board.miss { animation: shake .22s; }
.board.miss .next { color: var(--pink); }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.toast {
  position: absolute; top: 4px; left: 0; right: 0;
  font-size: 15px; font-weight: 900; color: var(--yellow);
  opacity: 0; transition: opacity .2s;
}
.toast.show { opacity: 1; }

/* フリックキーボード（スマホ標準の 3×4 配列） */
.kb {
  flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px;
  padding: 8px 8px calc(10px + var(--safe-b));
  background: #120f19; border-top: 1px solid var(--line);
  touch-action: none;
  max-width: 520px; width: 100%; margin: 0 auto;
}
.key {
  height: clamp(50px, 8.6dvh, 66px);
  border-radius: 10px; background: #2c2538; border-bottom: 3px solid #1b1623;
  font-size: 24px; font-weight: 900;
  display: grid; place-items: center;
  touch-action: none;
}
.key.mod { background: #3a2456; font-size: 17px; }
.key.dash { background: #3a2456; }
.key.press { background: var(--pink); border-bottom-color: #a3123f; }

/* フリック中に出るガイド（指の周りに5方向の候補） */
.flick-guide {
  position: fixed; z-index: 30; pointer-events: none; display: none;
  width: 0; height: 0;
}
.flick-guide.show { display: block; }
.flick-guide span {
  position: absolute; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 900; border-radius: 12px;
  background: rgba(34, 27, 46, .95); border: 1px solid var(--line); color: var(--dim);
}
.flick-guide span:empty { display: none; }
.flick-guide span.c { left: 0; top: 0; }
.flick-guide span.l { left: -54px; top: 0; }
.flick-guide span.u { left: 0; top: -54px; }
.flick-guide span.r { left: 54px; top: 0; }
.flick-guide span.d { left: 0; top: 54px; }
.flick-guide span.sel { background: var(--pink); color: #fff; border-color: #fff; transform: scale(1.12); }

.countdown {
  position: absolute; inset: 0; z-index: 20; display: none;
  place-items: center; background: rgba(11, 10, 16, .6);
  font-family: var(--font-title); font-size: 96px; color: var(--pink);
  text-shadow: 0 0 30px rgba(255, 45, 111, .7);
}
.countdown.show { display: grid; }
.countdown .msg { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 20px; text-align: center; }
.countdown .msg b { font-weight: 400; font-size: 34px; }
.countdown .msg span { font-family: var(--font); font-weight: 900; font-size: 18px; color: #fff; text-shadow: none; }
.countdown .msg small { font-family: var(--font); font-size: 12px; color: var(--dim); text-shadow: none; }
.countdown.ready { background: rgba(11, 10, 16, .82); cursor: pointer; }
.countdown.ready .msg span { animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
.countdown .back {
  margin-top: 14px; padding: 8px 18px; border-radius: 999px;
  border: 1px solid var(--line); font-family: var(--font); font-size: 13px; color: var(--pink-soft); text-shadow: none;
}
.countdown.finish { background: rgba(11, 10, 16, .88); }
.countdown.finish .msg b { font-size: clamp(40px, 13vw, 64px); color: var(--yellow); text-shadow: 0 0 30px rgba(255, 210, 63, .6); animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }

/* ---------- リザルト ---------- */
.result-cap { font-family: var(--font-title); font-size: 15px; color: var(--pink-soft); letter-spacing: .1em; }
.result-money { font-family: var(--font-title); }
.result-money span { font-size: 54px; color: var(--yellow); text-shadow: 0 0 20px rgba(255, 210, 63, .5); }
.result-money small { display: block; font-size: 16px; }
.result-diff { font-size: 20px; font-weight: 900; }
.result-diff.plus { color: var(--green); }
.result-diff.minus { color: var(--pink); }
.result-comment { font-size: 14px; color: var(--pink-soft); }
.stats { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 14px; overflow: hidden; font-size: 14px; }
.stats th, .stats td { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.stats tr:last-child th, .stats tr:last-child td { border-bottom: 0; }
.stats th { text-align: left; color: var(--dim); font-weight: 700; }
.stats td { text-align: right; }
.result-best { font-size: 13px; color: var(--cyan); min-height: 1em; }
.rank-chip {
  width: 100%; padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.6;
  background: var(--panel2); border: 1px solid var(--line);
}
.rank-chip:empty { display: none; }
.rank-chip b { color: var(--yellow); font-size: 16px; }
.rank-chip .links { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.rank-chip .links a { padding: 6px 14px; border-radius: 999px; background: #3a2456; font-size: 13px; }
.rank-chip .links a.reg { background: var(--pink); }

/* ---------- ランキング ---------- */
.tabs { display: flex; width: 100%; background: var(--panel); border-radius: 999px; padding: 4px; gap: 4px; }
.tabs button { flex: 1; padding: 9px 4px; border-radius: 999px; font-size: 14px; color: var(--dim); }
.tabs button.on { background: var(--pink); color: #fff; }
.tabs.small button { padding: 6px 4px; font-size: 13px; }
.tabs.small button.on { background: #3a2456; }
.rk-label { font-size: 12px; color: var(--dim); }
.rk-me { width: 100%; font-size: 13px; line-height: 1.6; }
.rk-me:empty { display: none; }
.rk-me .box2 { padding: 10px 14px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--cyan); }
.rk-me .box2.guest { border-color: var(--pink); }
.rk-me .links { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.rk-me .links a { padding: 6px 14px; border-radius: 999px; background: #3a2456; }
.rk-me .links a.reg { background: var(--pink); }
.rk-list { list-style: none; width: 100%; display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; }
.rk-list li {
  display: grid; grid-template-columns: 34px 34px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--panel); border-radius: 12px; text-align: left; font-size: 14px;
}
.rk-list li.me { border: 1px solid var(--cyan); }
.rk-list .no { font-family: var(--font-title); font-size: 16px; color: var(--dim); text-align: center; }
.rk-list li:nth-child(1) .no { color: var(--yellow); }
.rk-list li:nth-child(2) .no { color: #d7dde8; }
.rk-list li:nth-child(3) .no { color: #e3a46b; }
.rk-list img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--panel2); }
.rk-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-list .sc { font-family: var(--font-title); color: var(--yellow); }
.rk-list .empty { display: block; text-align: center; color: var(--dim); padding: 24px 12px; }
