:root {
  --bg: #0a0510;
  --pink: #ff2d87;
  --pink-soft: #ff8cc0;
  --gold: #ffd54a;
  --violet: #9b4dff;
  --cyan: #3ce7ff;
  --red: #ff3646;
  --text: #fff4fa;
  --muted: #bfaecd;
  --card: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.13);
  --display: 'Dela Gothic One', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  --logo: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', sans-serif;
  --logo-pink: #fa3682;
  --script: 'Niconne', cursive;
  --body: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { background: var(--bg); color: var(--text); font-family: var(--body); overscroll-behavior: none; }
body {
  min-height: 100vh; min-height: 100dvh;
  /* いちばん上の層はうっすらした粒子(背景の一部なので連打の邪魔をしない) */
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.07'/></svg>") 0 0 / 240px 240px,
    radial-gradient(520px 380px at 0% 0%, rgba(255, 45, 135, 0.26), transparent 62%),
    radial-gradient(520px 460px at 100% 100%, rgba(155, 77, 255, 0.26), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
ol, ul { list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  padding: calc(9px + env(safe-area-inset-top)) 16px 9px; background: rgba(10, 5, 16, 0.9); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.me { display: flex; align-items: center; justify-content: center; gap: 12px; min-width: 0; max-width: 100%; }
.me-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-weight: 800; font-size: 16px; }
.me-bal { font-family: var(--display); color: var(--gold); font-size: 22px; line-height: 1.2; white-space: nowrap; }
.me-bal b { font-weight: 400; margin: 0 2px 0 3px; }
.me-bal small { font-size: 13px; }
.me.broke .me-bal { color: #8f8199; }
.broke-tag { flex: none; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; color: #fff; background: #6b2a3c; }

main { flex: 1; display: flex; flex-direction: column; padding: 16px; }
.pview { display: none; flex-direction: column; gap: 16px; flex: 1; }
.pview.active { display: flex; animation: viewIn 0.35s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.hint { text-align: center; color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.6; }
.gold { color: var(--gold); text-shadow: 0 2px 0 #4a2a00, 0 0 18px rgba(255, 213, 74, 0.45); }
.red { color: var(--red); text-shadow: 0 0 18px rgba(255, 54, 70, 0.6); }

.btn { width: 100%; padding: 16px 12px; border-radius: 16px; border: none; font-family: var(--display); font-size: 19px; color: #fff; line-height: 1.3; }
.btn-main { background: linear-gradient(135deg, #ff2d87, #ff6a3d); box-shadow: 0 6px 0 #8c0f45, 0 0 28px rgba(255, 45, 135, 0.45); }
.btn-main:active { transform: translateY(3px); box-shadow: 0 3px 0 #8c0f45; }
.btn:disabled { background: #3a2f45; box-shadow: none; color: #9a8aa8; transform: none; }

/* ---------- 参戦 ---------- */
/* ラヴ上等のポスター風: 暗いネオン → ピンクの部屋 */
.hero {
  position: relative; text-align: center; padding: calc(22px + env(safe-area-inset-top)) 12px 18px; margin: -16px -16px 0; overflow: hidden;
  background:
    radial-gradient(260px 140px at 18% 10%, rgba(60, 120, 255, 0.28), transparent 70%),
    linear-gradient(180deg, #07050d 0%, #120819 46%, #3a0619 66%, #b5195c 100%);
  border-bottom: 3px solid #ff2b93;
}
.hero-kicker { display: inline-block; font-size: 14px; letter-spacing: 0.14em; color: #fff; font-weight: 800; text-shadow: 0 1px 6px #000; }
.hero-kicker:empty { display: none; }
.hero-logo.has-img { transform: none; }
.hero-logo img { display: block; width: min(330px, 86vw); height: auto; margin: 4px auto 0; filter: drop-shadow(0 3px 0 rgba(60, 0, 30, 0.6)); }
.hero-logo {
  margin-top: 10px; font-family: var(--logo); font-weight: 900; font-size: 74px; line-height: 1; letter-spacing: -0.05em; color: var(--logo-pink);
  -webkit-text-stroke: 0.025em var(--logo-pink);
  transform: scaleY(1.2); transform-origin: 50% 70%;
  text-shadow: 0 3px 0 rgba(60, 0, 30, 0.6), 0 0 22px rgba(248, 16, 152, 0.45);
}
.hero-script {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px;
  font-family: var(--script); font-size: 34px; line-height: 1.1; color: var(--logo-pink); text-shadow: 0 2px 0 rgba(60, 0, 30, 0.5);
}
.hero-script::before, .hero-script::after { content: ''; width: 30px; height: 3px; border-radius: 2px; background: var(--logo-pink); }
.hero-sub {
  display: inline-block; margin-top: 6px; padding: 1px 10px 2px 16px; border-radius: 6px; font-family: var(--display); font-size: 20px; letter-spacing: 0.3em;
  color: #fff; background: #ff2b93; box-shadow: 0 0 14px rgba(255, 43, 147, 0.6);
}
.hero-sub:empty { display: none; }
/* 「ラヴ上等」のロゴ表記(参戦画面のロゴと同じ書体・色・光) */
img.logo-mark { display: inline-block; height: 1.15em; width: auto; vertical-align: -0.26em; margin: 0 0.04em; }
span.logo-mark {
  display: inline-block; font-family: var(--logo); font-weight: 900; font-style: normal; letter-spacing: -0.05em; white-space: nowrap;
  color: var(--logo-pink); -webkit-text-fill-color: var(--logo-pink); -webkit-text-stroke: 0.025em var(--logo-pink);
  transform: scaleY(1.18); transform-origin: 50% 72%;
  text-shadow: 0 2px 0 rgba(60, 0, 30, 0.55);
}
.hero-tag { margin-top: 8px; font-size: 15px; font-weight: 800; color: #fff; text-shadow: 0 0 12px rgba(255, 45, 135, 0.9); }
.hero-tag rt { font-size: 8px; color: var(--pink-soft); }
.join { display: grid; gap: 12px; }
.join label { font-weight: 800; font-size: 14px; color: var(--muted); }
.join input {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 2px solid rgba(255, 140, 192, 0.5); background: rgba(0, 0, 0, 0.35);
  color: #fff; font-size: 18px; font-weight: 800; outline: none; -webkit-user-select: text; user-select: text;
}
.join input:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 45, 135, 0.3); }
.err { color: #ff8a8a; font-weight: 800; font-size: 13px; min-height: 1em; }
.rules { display: grid; gap: 10px; counter-reset: r; }
.rules li { position: relative; padding: 12px 14px 12px 52px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); counter-increment: r; }
.rules li::before {
  content: counter(r); position: absolute; left: 12px; top: 12px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--display); font-size: 15px; background: var(--pink); color: #fff;
}
.rules b { display: block; font-size: 15px; }
.rules span { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted); font-weight: 700; line-height: 1.55; }
.rules.compact li { background: transparent; border: none; padding: 6px 0 6px 40px; }
.rules.compact li::before { left: 0; top: 6px; }
.guide-title { font-family: var(--display); font-size: 18px; margin-bottom: 8px; }

.big-msg { text-align: center; padding: 30px 0 10px; }
.big-msg .em { font-family: var(--display); font-size: 52px; line-height: 1.2; }
.big-msg p { margin-top: 12px; font-size: 16px; font-weight: 800; line-height: 1.7; }
.big-msg p b { color: var(--gold); }

/* ---------- 投票 ---------- */
.race-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rno { font-family: var(--display); font-size: 15px; padding: 4px 12px; border-radius: 8px; background: linear-gradient(135deg, var(--pink), #ff6a3d); white-space: nowrap; }
.rname { font-family: var(--display); font-size: 22px; color: var(--gold); line-height: 1.5; }
.rname rt { font-size: 9px; color: var(--pink-soft); }
.timer-row { display: flex; align-items: baseline; justify-content: center; gap: 8px; font-weight: 800; color: var(--muted); }
.timer-row b { font-family: var(--display); font-weight: 400; font-size: 44px; color: #fff; line-height: 1; }
.timer-row.hurry b { color: var(--red); animation: pulse 0.5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.1); } }
.broke-note { display: grid; gap: 4px; text-align: center; padding: 14px 12px; border-radius: 14px; background: rgba(120, 30, 60, 0.35); border: 1px solid rgba(255, 120, 150, 0.55); }
.broke-note b { font-family: var(--display); font-weight: 400; font-size: 24px; color: #ffb3c4; }
/* 救済(第3Rの前に、ラヴが尽きた人へ配る)の知らせ */
.relief-note { display: grid; gap: 4px; text-align: center; padding: 14px 12px; border-radius: 14px; background: rgba(255, 213, 74, 0.16); border: 2px solid rgba(255, 213, 74, 0.8); animation: reliefPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.relief-note b { font-family: var(--display); font-weight: 400; font-size: 24px; color: #ffd54a; }
.relief-note > span { font-size: 13.5px; font-weight: 800; line-height: 1.6; color: #fff3cf; }
@keyframes reliefPop { 0% { transform: scale(0.7); opacity: 0; } 100% { transform: none; opacity: 1; } }
.broke-note span { font-size: 13.5px; font-weight: 800; line-height: 1.6; color: #f2dbe4; }
#p-bet.broke .racer-list { opacity: 0.55; pointer-events: none; }

/* 投票: 黒板に貼った1〜6のキャラの写真から選ぶ */
#p-bet {
  margin: -16px -16px 0; padding: 18px 14px 0; color: rgba(246, 248, 242, 0.95);
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(220, 235, 225, 0.08), transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 0.9  0 0 0 0 0.95  0 0 0 0 0.9  0 0 0 0.08 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"),
    linear-gradient(180deg, #24443a, #1f3c32 60%, #22413a);
  border-top: 6px solid #b9bec3; box-shadow: inset 0 8px 14px rgba(0, 0, 0, 0.35); overflow-x: clip;
}
#p-bet .race-title .rno { font-family: 'Yomogi', sans-serif; font-weight: 400; color: #ff8fca; background: none; border: 2px solid rgba(255, 143, 202, 0.85); box-shadow: none; }
#p-bet .race-title .rname { font-family: 'Yomogi', sans-serif; font-weight: 400; }
#p-bet .race-title, #p-bet .timer-row, #p-bet .hint, #p-bet .wx-line { font-family: 'Yomogi', 'Zen Kurenaido', sans-serif; font-weight: 400; }
#p-bet .race-title .rname { color: #fff; }
#p-bet .timer-row b { font-family: 'Yomogi', sans-serif; color: #f6e27a; }
#p-bet .wx-line { color: #93d2ff; background: none; border: 2px solid rgba(147, 210, 255, 0.7); border-radius: 12px 16px 10px 14px; }
#p-bet .hint { color: rgba(246, 248, 242, 0.85); }
.racer-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; padding: 12px 6px 6px; }
.rcard { position: relative; min-width: 0; display: grid; gap: 8px; align-content: start; width: 100%; padding: 0; text-align: center; background: none; border: 0; color: inherit; -webkit-tap-highlight-color: transparent; }
.pol {
  position: relative; display: block; padding: 7px 7px 0; background: linear-gradient(170deg, #fffefb, #efeae0); transform: rotate(var(--rot, -2deg));
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.18s ease;
}
.pol .mag { position: absolute; left: 50%; top: -11px; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; z-index: 3; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.75), var(--c) 42%, rgba(0, 0, 0, 0.35) 100%); box-shadow: 0 3px 5px rgba(0, 0, 0, 0.45); }
.pol .ph { position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden; background: linear-gradient(160deg, var(--c), rgba(0, 0, 0, 0.35) 140%), var(--c); }
.pol .ph::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(-55deg, rgba(255, 255, 255, 0.08) 0 8px, transparent 8px 20px); }
.pol .ph-img { position: absolute; left: 50%; bottom: -14%; height: 112%; transform: translateX(-50%); z-index: 1; }
.pol .ph-img:not([src]) { display: none; }
.pol .ph-no { position: absolute; left: 6px; top: 2px; z-index: 2; font-family: var(--display); font-size: 40px; line-height: 1; color: var(--ink); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
.pol .nm { display: block; height: 34px; padding: 2px 2px 0; font-family: 'Zen Kurenaido', 'Yomogi', sans-serif; font-size: 20px; line-height: 30px; color: #1b1b1b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 選んだ写真はピンクのチョークで丸 */
.pol .ring { position: absolute; left: -12%; top: -9%; width: 124%; height: 118%; overflow: visible; pointer-events: none; z-index: 4; opacity: 0; }
.pol .ring path { fill: none; stroke: #ff7fc0; stroke-width: 3.2; stroke-linecap: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 2px rgba(255, 140, 200, 0.7)); stroke-dasharray: var(--len, 1400); stroke-dashoffset: var(--len, 1400); }
.rcard.sel .pol { transform: rotate(0deg) scale(1.04); }
.rcard.sel .ring { opacity: 1; }
.rcard.sel .ring path { animation: drawRing 0.45s ease-out forwards; }
@keyframes drawRing { to { stroke-dashoffset: 0; } }
.pol .mine { position: absolute; right: -8px; top: 30px; z-index: 5; padding: 2px 10px; font-size: 12px; font-weight: 800; color: #1a1000; background: rgba(246, 226, 122, 0.95); transform: rotate(8deg); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35); }
/* 写真の下のチョークの字 */
.cinfo { display: grid; gap: 3px; font-family: 'Yomogi', 'Zen Kurenaido', sans-serif; }
.rcard .od { display: flex; align-items: baseline; justify-content: center; gap: 6px; white-space: nowrap; }
.rcard .od b { font-family: 'Yomogi', sans-serif; font-weight: 400; font-size: 28px; line-height: 1.1; color: #fff; }
.rcard .od b small { font-size: 14px; margin-left: 2px; }
.rcard .od .pp { font-size: 12px; color: rgba(246, 248, 242, 0.75); }
.rcard .tt { display: grid; justify-items: center; font-size: 13px; line-height: 1.35; color: #f6e27a; white-space: normal; overflow: visible; }
.rcard .tp { display: block; font-size: 11px; color: rgba(246, 226, 122, 0.8); }
.rcard .tp:empty { display: none; }
.rcard .ti { display: block; max-width: 100%; overflow-wrap: anywhere; }
.rstats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; }
.rs { display: grid; justify-items: center; gap: 2px; min-width: 0; }
.rs em { font-style: normal; font-size: 9px; color: rgba(246, 248, 242, 0.75); white-space: nowrap; letter-spacing: -0.04em; }
.rs .sb { display: flex; gap: 1px; }
.rs .sb i { display: block; width: 4px; height: 9px; border-radius: 1px; border: 1px solid rgba(246, 248, 242, 0.5); }
.rs .sb i.on { background: rgba(246, 248, 242, 0.9); }
.racer-list[data-wx='sunny'] .rs[data-k='spd'] i.on,
.racer-list[data-wx='rain'] .rs[data-k='han'] i.on,
.racer-list[data-wx='rain'] .rs[data-k='wgt'] i.on { background: #93d2ff; border-color: #93d2ff; }
.racer-list[data-wx='sunny'] .rs[data-k='spd'] em,
.racer-list[data-wx='rain'] .rs[data-k='han'] em,
.racer-list[data-wx='rain'] .rs[data-k='wgt'] em { color: #93d2ff; }
.wx-line { text-align: center; padding: 8px 10px; border-radius: 12px; font-weight: 800; font-size: 13.5px; color: var(--cyan); background: rgba(60, 231, 255, 0.1); border: 1px solid rgba(60, 231, 255, 0.4); }
.badge {
  display: grid; place-items: center; width: 50px; height: 50px; border-radius: 12px; flex: none;
  font-family: var(--display); font-size: 32px; line-height: 1; background: var(--c); color: var(--ink);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(255, 255, 255, 0.18);
}
.badge.dark { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(255, 255, 255, 0.7); }

/* 下にまだレーサーがいるときの案内(投票パネルのすぐ上で上下に揺れる。押すとそこまでスクロール) */
.more-hint {
  position: absolute; left: 50%; top: -48px; z-index: 11; display: flex; align-items: center; gap: 5px;
  padding: 6px 14px 6px 12px; border: 0; border-radius: 999px; white-space: nowrap; cursor: pointer;
  font-family: 'Yomogi', 'Zen Kurenaido', sans-serif; font-size: 15px; color: #1a1000; background: rgba(246, 226, 122, 0.97);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); transform: translateX(-50%); animation: moreBob 1.1s ease-in-out infinite;
}
.more-hint.hidden { display: none; }
.more-hint .ar { font-size: 15px; line-height: 1; }
.more-hint .mb { display: inline-grid; place-items: center; width: 21px; height: 21px; border-radius: 6px; background: var(--c); color: var(--ink); font-family: var(--display); font-size: 13px; line-height: 1; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); }
@keyframes moreBob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 5px); } }
.bet-panel {
  position: sticky; bottom: 0; z-index: 10; margin: auto -14px 0; padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  display: grid; gap: 10px; background: rgba(24, 46, 38, 0.97); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 5px solid #b9bec3;
}
#p-bet .chip { font-family: 'Yomogi', sans-serif; font-weight: 400; font-size: 15px; color: rgba(246, 248, 242, 0.95); background: none; border: 2px solid rgba(246, 248, 242, 0.55); border-radius: 10px 14px 9px 13px; }
#p-bet .chip.on { color: #f6e27a; border-color: #f6e27a; background: rgba(246, 226, 122, 0.1); }
#p-bet .amount-info { font-family: 'Yomogi', sans-serif; font-weight: 400; color: rgba(246, 248, 242, 0.85); }
#p-bet .bet-done { font-family: 'Yomogi', sans-serif; font-weight: 400; color: #f6e27a; }
.amount-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.chip { padding: 10px 0; border-radius: 12px; border: 2px solid var(--line); background: rgba(255, 255, 255, 0.05); font-weight: 800; font-size: 13px; white-space: nowrap; }
.chip.on { border-color: var(--gold); background: rgba(255, 213, 74, 0.16); color: var(--gold); }
.chip:disabled { opacity: 0.3; }
.amount-info { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 800; font-size: 13px; color: var(--muted); }
.amount-info b { font-family: var(--display); font-weight: 400; font-size: 22px; color: #fff; margin: 0 2px; }
.amount-info #pb-return { color: var(--gold); }
.bet-done { text-align: center; font-weight: 800; font-size: 13px; color: var(--gold); }

.mybet { display: flex; align-items: center; gap: 14px; }
.mybet .nm { font-family: var(--display); font-size: 22px; }
.mybet .sub { font-size: 13px; color: var(--muted); font-weight: 800; margin-top: 2px; }
.mybet.none { justify-content: center; color: var(--muted); font-weight: 800; }

/* ---------- レース ---------- */
.race-top { display: grid; gap: 10px; }
.my-racer { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--card); border: 2px solid var(--c, var(--line)); }
.my-text { flex: 1; min-width: 0; }
.my-racer .lbl { font-size: 11px; color: var(--muted); font-weight: 800; }
.my-racer .nm { font-family: var(--display); font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.my-racer .rank { font-family: var(--display); white-space: nowrap; }
.my-racer .rank b { font-weight: 400; font-size: 44px; line-height: 1; }
.my-racer .rank small { font-size: 16px; margin-left: 2px; }
.my-racer.first .rank b { color: var(--gold); text-shadow: 0 0 16px rgba(255, 213, 74, 0.7); }
.mini { display: grid; gap: 5px; padding: 10px 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); }
.mrow { display: grid; grid-template-columns: 18px 1fr; align-items: center; gap: 8px; }
.mrow .mb { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-size: 11px; font-weight: 900; background: var(--c); color: var(--ink); }
.mrow .mt { position: relative; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); }
.mrow .mt::after { content: ''; position: absolute; right: 0; top: -3px; bottom: -3px; width: 3px; background: repeating-linear-gradient(180deg, #fff 0 3px, #111 3px 6px); }
.mrow .md { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--c); border: 2px solid rgba(255, 255, 255, 0.85); transition: left 0.25s linear; }
.mrow.me .mt { background: rgba(255, 213, 74, 0.2); }
.mrow.me .md { width: 18px; height: 18px; margin: -9px 0 0 -9px; box-shadow: 0 0 10px var(--gold); border-color: var(--gold); }

.wet-badge { display: inline-block; margin-top: 3px; padding: 1px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; background: #1e9bff; color: #fff; }
.mrow.wet .md { box-shadow: 0 0 0 3px #3cc8ff, 0 0 10px #3cc8ff; }
.splash-overlay {
  position: fixed; inset: 0; z-index: 65; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(214, 242, 255, 0.85), rgba(70, 170, 255, 0.45) 45%, rgba(10, 60, 160, 0) 80%);
  animation: phoneSplash 0.8s ease-out forwards;
}
@keyframes phoneSplash { from { opacity: 1; } to { opacity: 0; } }
.gauge-wrap { display: grid; gap: 6px; }
.gauge-lbl { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; color: var(--muted); }
.gauge { height: 14px; border-radius: 7px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.gauge i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff7a00, var(--gold)); transition: width 0.2s linear; }
.gauge-wrap.boost .gauge i { width: 100% !important; background: linear-gradient(90deg, var(--pink), var(--gold), var(--pink)); background-size: 200% 100%; animation: flow 0.5s linear infinite; }
.gauge-wrap.boost .gauge-lbl span:first-child { color: var(--gold); }
@keyframes flow { to { background-position: -200% 0; } }

.tap-area { position: relative; display: grid; place-items: center; padding: 6px 0; flex: 1; min-height: 240px; }
.tap-btn {
  position: relative; width: min(74vw, 330px); aspect-ratio: 1 / 1; border-radius: 50%; border: none; touch-action: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 38%),
    radial-gradient(circle at 50% 60%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.38) 100%),
    var(--c, var(--pink));
  color: var(--ink, #fff);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.16), 0 0 44px var(--c, var(--pink)), inset 0 -14px 0 rgba(0, 0, 0, 0.25);
}
.tap-btn.dark { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.6), 0 0 44px rgba(255, 255, 255, 0.4), inset 0 -14px 0 rgba(0, 0, 0, 0.25); }
.tap-btn.wait { filter: saturate(0.6) brightness(0.8); }
.tap-btn.boost { animation: boostGlow 0.3s ease-in-out infinite alternate; }
@keyframes boostGlow { to { box-shadow: 0 0 0 10px rgba(255, 213, 74, 0.7), 0 0 70px #ff8a00, inset 0 -14px 0 rgba(0, 0, 0, 0.25); } }
.tap-main { font-family: var(--display); font-size: 54px; line-height: 1; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.22); pointer-events: none; }
.tap-sub { margin-top: 8px; font-size: 13px; font-weight: 900; opacity: 0.85; pointer-events: none; }
.tap-count { position: absolute; bottom: 17%; font-family: var(--display); font-size: 22px; pointer-events: none; opacity: 0.9; }
.tap-fx { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.tap-fx span { position: absolute; font-family: var(--display); font-size: 22px; color: #fff; text-shadow: 0 0 8px var(--pink); animation: tapUp 0.6s ease-out forwards; }
@keyframes tapUp { from { transform: translate(-50%, -50%) scale(0.6); opacity: 1; } to { transform: translate(-50%, -150%) scale(1.2); opacity: 0; } }

.watch { text-align: center; padding: 20px 10px; border-radius: 18px; background: var(--card); border: 1px dashed var(--line); }
.watch .em { font-family: var(--display); font-size: 30px; color: var(--muted); }
.watch p { margin-top: 8px; font-size: 14px; font-weight: 800; line-height: 1.7; color: var(--muted); }

/* 応援スタンプ: 名言の画像を2段で横にスワイプ */
.stamps { display: grid; gap: 6px; }
.stamps-lbl { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 800; color: var(--muted); }
.stamps-lbl small { font-size: 11px; font-weight: 700; opacity: 0.8; }
.stamp-row {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, 78px); grid-auto-columns: 78px; gap: 6px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 2px 2px 6px; -webkit-overflow-scrolling: touch;
}
.stamp-btn {
  position: relative; width: 78px; height: 78px; padding: 0; border-radius: 10px; overflow: hidden; scroll-snap-align: start;
  border: 2px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.07); transition: opacity 0.2s, transform 0.12s;
}
.stamp-btn img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.stamp-btn:active { transform: scale(0.94); }
.stamp-btn.sent { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 45, 135, 0.55); }
.stamps.cool .stamp-btn:not(.sent) { opacity: 0.35; }

/* ---------- 結果 ---------- */
.res-head { text-align: center; font-family: var(--display); font-size: 64px; line-height: 1.15; padding-top: 20px; }
.res-head.hit { color: var(--gold); text-shadow: 0 3px 0 #4a2a00, 0 0 30px rgba(255, 213, 74, 0.6); animation: hitPop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1); }
.res-head.miss { color: #c7b9d3; }
.res-head.wait { font-size: 34px; color: #fff; animation: blink 0.8s steps(2, start) infinite; }
@keyframes hitPop { from { transform: scale(0.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes blink { 50% { opacity: 0.3; } }
.res-amount { text-align: center; font-family: var(--display); font-size: 40px; }
.res-amount.plus { color: var(--gold); }
.res-amount.minus { color: #ff8a8a; }
.res-detail { text-align: center; font-size: 14px; font-weight: 800; color: var(--muted); line-height: 1.6; }
.res-win { display: grid; gap: 8px; text-align: center; }
.res-win .rw-lbl { font-size: 12px; color: var(--muted); font-weight: 800; }
.res-win .rw-name { display: flex; justify-content: center; align-items: center; gap: 10px; font-family: var(--display); font-size: 22px; }
.res-win .rw-name .badge { width: 36px; height: 36px; font-size: 22px; border-radius: 9px; }
.res-win .rw-line { font-size: 14px; font-weight: 800; line-height: 1.6; color: var(--pink-soft); }
.res-bal { text-align: center; font-weight: 800; color: var(--muted); }
.res-bal b { font-family: var(--display); font-weight: 400; font-size: 26px; color: var(--gold); margin-left: 6px; }

/* ---------- ランキング・表彰 ---------- */
.lbl-top { text-align: center; font-family: var(--display); font-size: 30px; color: var(--gold); padding-top: 16px; text-shadow: 0 2px 0 #4a2a00; }
.my-rank { text-align: center; font-family: var(--display); }
.my-rank b { font-weight: 400; font-size: 88px; line-height: 1; }
.my-rank small { font-size: 26px; margin-left: 4px; }
.my-rank > span { display: block; font-family: var(--body); font-size: 14px; font-weight: 800; color: var(--muted); margin-top: 4px; }
.mini-rank { display: grid; gap: 6px; }
.mini-rank li { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: center; padding: 9px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-weight: 800; font-size: 14px; }
.mini-rank li .r { font-family: var(--display); color: var(--muted); }
.mini-rank li.top .r { color: var(--gold); }
.mini-rank li .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-rank li .bl { font-family: var(--display); font-weight: 400; color: var(--gold); }
.final-msg { text-align: center; font-family: var(--display); font-size: 26px; line-height: 1.5; padding: 14px 0; }
.awards { display: grid; gap: 10px; }
/* 表彰式: スクリーンと同じ順番で、発表された賞から埋まる */
.fin-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.fin-row { display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'award who' 'award what'; column-gap: 12px; align-items: center; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); border: 1.5px solid rgba(255, 255, 255, 0.12); }
.fin-row .fn-award { grid-area: award; font-family: var(--display); font-size: 15px; color: var(--muted); min-width: 6.4em; }
.fin-row .fn-who { grid-area: who; font-family: var(--display); font-size: 20px; line-height: 1.25; overflow-wrap: anywhere; }
.fin-row .fn-what { grid-area: what; font-size: 12px; font-weight: 800; color: var(--muted); }
.fin-row:not(.open) .fn-who { color: rgba(255, 255, 255, 0.35); }
.fin-row.open { border-color: rgba(255, 213, 74, 0.55); }
.fin-row.open .fn-award { color: var(--gold); }
/* 総長以外の賞の名前の色(スクリーンと同じ 黄・緑・赤・青) */
.fin-row.open.k-yoroshiku .fn-award { color: #ffd93b; }
.fin-row.open.k-quick .fn-award { color: #3fe07c; }
.fin-row.open.k-chikoku .fn-award { color: #ff4d4d; }
.fin-row.open.k-hata .fn-award { color: #4aa6ff; }
.fin-row.champ.open { background: linear-gradient(135deg, rgba(255, 45, 135, 0.3), rgba(255, 213, 74, 0.25)); border-color: var(--gold); }
.fin-row.me { box-shadow: 0 0 0 2px #ff2b93 inset; }
.fin-row.new { animation: hitPop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1); }
.award-card { text-align: center; padding: 18px; border-radius: 18px; background: linear-gradient(135deg, rgba(255, 45, 135, 0.3), rgba(255, 213, 74, 0.25)); border: 2px solid var(--gold); animation: hitPop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1); }
.award-card b { display: block; font-family: var(--display); font-weight: 400; font-size: 26px; color: var(--gold); }
.award-card > span { display: block; margin-top: 4px; font-size: 13px; font-weight: 800; }

/* ---------- 共通オーバーレイ ---------- */
.countdown { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; background: rgba(5, 2, 10, 0.72); pointer-events: none; }
.countdown.show { display: grid; }
.countdown .num { font-family: var(--display); font-size: 42vw; color: #fff; text-shadow: 0 0 30px var(--pink), 0 8px 0 #4a0020; animation: cd 0.9s ease-out; }
.countdown .num.go { font-size: 24vw; color: var(--gold); text-shadow: 0 0 30px rgba(255, 213, 74, 0.8), 0 6px 0 #4a2a00; }
@keyframes cd { from { transform: scale(2); opacity: 0; } 30% { transform: scale(1); opacity: 1; } to { transform: scale(0.9); opacity: 0.9; } }

body.racing #toasts { top: calc(150px + env(safe-area-inset-top)); }
#toasts { position: fixed; left: 0; right: 0; top: calc(62px + env(safe-area-inset-top)); z-index: 70; display: grid; gap: 8px; padding: 0 12px; pointer-events: none; justify-items: center; }
.toast {
  width: 100%; max-width: 496px; padding: 12px 16px; border-radius: 14px; font-weight: 800; font-size: 15px; line-height: 1.5;
  background: rgba(30, 12, 44, 0.97); border: 2px solid var(--pink); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s ease, toastOut 0.4s ease 2.6s forwards;
}
.toast.good { border-color: var(--gold); }
.toast.bad { border-color: var(--red); }
@keyframes toastIn { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(-20px); opacity: 0; } }
.conn { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; padding: 8px 16px; border-radius: 999px; background: #b00020; color: #fff; font-size: 13px; font-weight: 800; }

/* 張る額: カスタム(好きな額を入力) */
.custom-row { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 800; font-size: 14px; color: var(--muted); }
.custom-row > span { flex: none; }
.custom-row.hidden { display: none; }
.custom-row input { flex: 1 1 0; width: 100%; min-width: 0; font: inherit; font-family: var(--display); font-size: 22px; text-align: right; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--gold); background: rgba(255, 255, 255, 0.06); color: #fff; outline: none; }
#p-bet .custom-row { font-family: 'Yomogi', sans-serif; font-weight: 400; color: rgba(246, 248, 242, 0.9); }
#p-bet .custom-row input { border: 2px solid #f6e27a; border-radius: 10px 14px 9px 13px; background: rgba(246, 226, 122, 0.08); color: #f6e27a; }
