* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #07120b; color: #fff; overflow: hidden;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  -webkit-user-select: none; user-select: none; touch-action: none; overscroll-behavior: none; }
#stage { position: fixed; inset: 0; overflow: hidden; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .15s;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 45%, rgba(0,0,0,.65) 100%),
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,.0) 0deg 4deg, rgba(255,255,255,.07) 4deg 5deg); }
#vignette.on { opacity: 1; }
#flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }

#pops { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pop { position: absolute; left: 50%; top: 19%; transform: translate(-50%, -50%); white-space: nowrap;
  font-weight: 900; font-size: clamp(34px, 7vw, 84px); letter-spacing: .02em; font-style: italic;
  color: #fff; -webkit-text-stroke: 3px #111; paint-order: stroke fill;
  text-shadow: 0 6px 0 #111, 0 0 30px rgba(255,200,0,.6); animation: pop 1.1s cubic-bezier(.2,1.6,.4,1) forwards; }
.pop.perfect { color: #ffe14d; font-size: clamp(40px, 7.5vw, 92px); }
.pop.chain { color: #ff7a3c; top: 31%; font-size: clamp(30px, 5.5vw, 66px); }
.pop.foul { color: #ffd800; }
.pop.red { color: #ff3b3b; }
.pop.bad { color: #9fd0ff; }
.pop.sub { font-size: clamp(20px, 3.4vw, 40px); top: 70%; color: #fff; font-style: normal; text-shadow: 0 3px 0 #111; }
@keyframes pop {
  0% { transform: translate(-50%, -50%) scale(.2) rotate(-8deg); opacity: 0; }
  15% { transform: translate(-50%, -50%) scale(1.15) rotate(-3deg); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1) rotate(-3deg); }
  80% { opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(1) rotate(-3deg); opacity: 0; }
}

#hud { position: absolute; inset: 0; pointer-events: none; padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); }
#hud.hide, #touch.hide { display: none; }
.h-left { position: absolute; left: max(16px, env(safe-area-inset-left)); top: max(10px, env(safe-area-inset-top)); }
.h-mid { position: absolute; left: 50%; top: max(8px, env(safe-area-inset-top)); transform: translateX(-50%); text-align: center; }
.h-right { position: absolute; right: max(16px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); text-align: right; }
.h-label { font-size: 13px; font-weight: 700; opacity: .85; letter-spacing: .08em; }
.h-num { font-size: 34px; font-weight: 900; line-height: 1; text-shadow: 0 2px 0 #000; }
.h-num.small { font-size: 26px; margin-left: 6px; }
.h-time { font-size: 40px; font-weight: 900; line-height: 1; text-shadow: 0 2px 0 #000; font-variant-numeric: tabular-nums; }
.h-time.warn { color: #ff5c5c; }
.h-wave { font-size: 14px; font-weight: 700; opacity: .9; }
.h-cards { margin-top: 6px; display: flex; gap: 6px; justify-content: flex-end; min-height: 30px; }
.card { width: 21px; height: 30px; border-radius: 3px; background: #ffd800; box-shadow: 0 2px 0 #000; }
.card.red { background: #ff2d2d; }
.hint { position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%); font-size: 19px; font-weight: 700;
  background: rgba(0,0,0,.55); padding: 8px 16px; border-radius: 999px; white-space: nowrap; opacity: 0; transition: opacity .3s; }
.hint.on { opacity: 1; }

#touch { position: absolute; inset: 0; }
#stickBase { position: absolute; width: 150px; height: 150px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.18); left: 40px; bottom: 40px; display: none; pointer-events: none; }
#stickKnob { position: absolute; width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.55); left: 43px; top: 43px; }
#btnTackle { position: absolute; right: max(28px, env(safe-area-inset-right)); bottom: 34px; width: 150px; height: 150px; border-radius: 50%;
  border: 4px solid #fff; background: radial-gradient(circle at 40% 35%, #ff9a3c, #e03a10); color: #fff;
  font-size: 22px; font-weight: 900; box-shadow: 0 6px 0 rgba(0,0,0,.5); touch-action: none; }
#btnTackle.down { transform: translateY(4px) scale(.96); box-shadow: 0 2px 0 rgba(0,0,0,.5); }

.screen { position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(4,12,7,.55), rgba(4,12,7,.82)); padding: 16px;
  /* iPhone を横にしたとき、カメラの出っぱりに文字がかからないように */
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.screen.on { display: flex; }
.t-box { max-width: 760px; width: 100%; text-align: center; max-height: 100%; overflow-y: auto; }
.t-small { font-size: 14px; letter-spacing: .2em; opacity: .8; font-weight: 700; }
.t-name { margin: 6px 0 4px; font-size: clamp(48px, 9vw, 104px); font-weight: 900; font-style: italic; line-height: 1;
  -webkit-text-stroke: 3px #111; paint-order: stroke fill; text-shadow: 0 8px 0 #111; letter-spacing: .02em; }
.t-name span { color: #ff6a2b; }
.t-lead { font-size: 20px; font-weight: 700; margin: 10px 0 14px; line-height: 1.5; }
.t-how { text-align: left; list-style: none; padding: 12px 18px; margin: 0 auto 16px; max-width: 640px;
  background: rgba(0,0,0,.4); border-radius: 12px; font-size: 16px; line-height: 1.6; }
.t-how li + li { margin-top: 4px; }
.t-how b.y { color: #ffe14d; }
.btn { border: 0; border-radius: 999px; padding: 14px 40px; font-size: 22px; font-weight: 900; color: #fff; cursor: pointer;
  background: linear-gradient(180deg, #ff8a3c, #e0450f); box-shadow: 0 5px 0 #7a2200; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #7a2200; }
.btn.big { font-size: 26px; padding: 16px 56px; }
.t-opts { margin-top: 16px; display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; font-size: 15px; }
.fz { border: 2px solid rgba(255,255,255,.5); background: transparent; color: #fff; border-radius: 8px; padding: 6px 12px; font-size: 15px; font-weight: 700; cursor: pointer; }
.fz.sel { background: #fff; color: #111; }
.linkbtn { display: block; margin: 12px auto 0; background: none; border: 0; color: #fff; opacity: .8; font-size: 16px; text-decoration: underline; cursor: pointer; }
.r-rank { font-size: 120px; font-weight: 900; font-style: italic; line-height: 1; color: #ffe14d; -webkit-text-stroke: 3px #111; paint-order: stroke fill; text-shadow: 0 8px 0 #111; }
.r-score { font-size: 46px; font-weight: 900; }
.r-score small { font-size: 20px; margin-left: 4px; }
.r-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px auto; max-width: 620px; }
.r-grid div { background: rgba(0,0,0,.4); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.r-grid span { font-size: 14px; opacity: .85; }
.r-grid b { font-size: 26px; }
.r-comment { font-size: 18px; font-weight: 700; margin: 6px 0 14px; }

/* 文字の大きさ */
body.fz1 #hud > div, body.fz1 .t-box { zoom: 1.15; }
body.fz2 #hud > div, body.fz2 .t-box { zoom: 1.3; }

/* 小さい画面（スマホの横向き） */
@media (max-height: 480px) {
  .t-name { font-size: 54px; }
  .t-lead { font-size: 17px; margin: 4px 0 8px; }
  .t-how { font-size: 14px; padding: 8px 12px; margin-bottom: 10px; }
  .btn.big { font-size: 22px; padding: 12px 44px; }
  .t-opts { margin-top: 10px; }
  .r-rank { font-size: 54px; display: inline-block; vertical-align: middle; margin-right: 14px; }
  .r-score { font-size: 34px; display: inline-block; vertical-align: middle; }
  .r-grid { margin: 6px auto; gap: 6px; }
  .r-grid div { padding: 4px 6px; flex-direction: row; justify-content: space-between; align-items: center; }
  .r-grid b { font-size: 19px; }
  .r-comment { margin: 4px 0 8px; font-size: 16px; }
  .linkbtn { margin-top: 6px; }
  /* タイトルは左右2列にして、1画面に収める */
  #title .t-box { max-width: 900px; display: grid; grid-template-columns: 1fr 1.25fr; column-gap: 18px; align-items: center;
    grid-template-areas: "s how" "n how" "l how" "b how" "o how"; }
  #title .t-small { grid-area: s; font-size: 13px; }
  #title .t-name { grid-area: n; font-size: 50px; }
  #title .t-lead { grid-area: l; font-size: 16px; }
  #title .t-how { grid-area: how; margin: 0; font-size: 15px; }
  #title .btn { grid-area: b; justify-self: center; }
  #title .t-opts { grid-area: o; margin-top: 10px; }
  .pop { top: 30%; }
  .pop.perfect { font-size: 54px; }
  .pop.chain { top: 44%; font-size: 40px; }
  #btnTackle { width: 120px; height: 120px; bottom: 22px; font-size: 19px; }
  #stickBase { width: 130px; height: 130px; }
  #stickKnob { left: 33px; top: 33px; }
}

/* v2：飛距離の表示と、文字の迫力 */
.pop.dist { top: 62%; font-size: clamp(24px, 4vw, 48px); color: #7ff0ff; font-style: italic; text-shadow: 0 4px 0 #111, 0 0 24px rgba(0,220,255,.7); }
.pop.perfect { background: linear-gradient(180deg, #fff6b0 0%, #ffd400 45%, #ff7a00 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 3px #1a0a00; filter: drop-shadow(0 6px 0 #1a0a00) drop-shadow(0 0 26px rgba(255,180,0,.85)); text-shadow: none; }
.pop.chain { top: 33%; background: linear-gradient(180deg, #ffd0a0, #ff5a1f); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 3px #1a0500; filter: drop-shadow(0 5px 0 #1a0500) drop-shadow(0 0 20px rgba(255,90,0,.8)); text-shadow: none; }
#title.screen { background: linear-gradient(90deg, rgba(3,6,14,.0) 0%, rgba(3,6,14,.25) 40%, rgba(3,6,14,.78) 100%); justify-content: flex-end; }
#title .t-box { max-width: 620px; text-align: left; }
#title .t-opts { justify-content: flex-start; }
.t-name { background: linear-gradient(180deg, #ffffff 30%, #c9d6ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 8px 0 #111); text-shadow: none; }
.t-name span { background: linear-gradient(180deg, #ffb36b, #ff4d12); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (max-height: 480px) {
  #title.screen { background: linear-gradient(90deg, rgba(3,6,14,.35) 0%, rgba(3,6,14,.72) 45%, rgba(3,6,14,.85) 100%); }
  #title .t-box { max-width: 900px; }
}
/* v3：当たった所に出る漫画の効果の文字 */
.ono { position: absolute; transform: translate(-50%, -50%) rotate(var(--r)); font-weight: 900; white-space: nowrap; pointer-events: none;
  font-size: clamp(30px, 5vw, 64px); color: #fff; -webkit-text-stroke: 4px #160700; paint-order: stroke fill;
  text-shadow: 0 0 18px rgba(255,140,0,.9); animation: ono .95s cubic-bezier(.2,1.8,.4,1) forwards; letter-spacing: -.02em; }
.ono.big { font-size: clamp(48px, 8.5vw, 120px); background: linear-gradient(180deg, #ffffff 0%, #ffe95a 40%, #ff3d00 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 0 #160700) drop-shadow(0 0 30px rgba(255,90,0,.9)); text-shadow: none; }
.ono.chain { color: #ffb14a; }
@keyframes ono {
  0% { transform: translate(-50%, -50%) rotate(var(--r)) scale(2.6); opacity: 0; }
  12% { transform: translate(-50%, -50%) rotate(var(--r)) scale(0.9); opacity: 1; }
  22% { transform: translate(-48%, -52%) rotate(var(--r)) scale(1.05); }
  32% { transform: translate(-52%, -49%) rotate(var(--r)) scale(1); }
  75% { opacity: 1; }
  100% { transform: translate(-50%, -62%) rotate(var(--r)) scale(1.1); opacity: 0; }
}
/* v4：画面の外のボールを指す矢印 */
#ballArrow { position: absolute; transform: translate(-50%, -50%); pointer-events: none; display: none; width: 64px; height: 64px; }
#ballArrow.on { display: block; }
#ballArrow i { position: absolute; inset: 0; transform: rotate(var(--a)); }
#ballArrow i::before { content: ''; position: absolute; right: 0; top: 50%; transform: translateY(-50%); border-left: 30px solid #ffd400; border-top: 18px solid transparent; border-bottom: 18px solid transparent; filter: drop-shadow(0 0 6px rgba(0,0,0,.9)); }
#ballArrow b { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 15px; font-weight: 900; color: #fff; background: rgba(0,0,0,.65); border: 2px solid #ffd400; border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
/* v4：画面を切る光と、連鎖の大きな帯 */
.slash { position: absolute; left: -20%; top: 50%; width: 140%; height: 10px; transform: rotate(-14deg) scaleX(0); transform-origin: left center;
  background: linear-gradient(90deg, rgba(255,255,255,0), #fff 30%, #fff6a0 70%, rgba(255,255,255,0)); box-shadow: 0 0 30px 10px rgba(255,200,60,.7);
  animation: slash .5s cubic-bezier(.2,.9,.3,1) forwards; }
@keyframes slash { 0% { transform: rotate(-14deg) scaleX(0); opacity: 1; } 45% { transform: rotate(-14deg) scaleX(1); opacity: 1; height: 10px; } 100% { transform: rotate(-14deg) scaleX(1); opacity: 0; height: 2px; } }
.banner { position: absolute; left: 0; right: 0; top: 54%; height: 92px; transform: translateY(-50%) skewY(-6deg);
  background: linear-gradient(90deg, rgba(255,60,0,0) 0%, rgba(255,60,0,.92) 18%, rgba(255,140,0,.92) 82%, rgba(255,140,0,0) 100%);
  display: flex; align-items: center; justify-content: center; gap: 18px; animation: banner 1.5s cubic-bezier(.2,.9,.3,1) forwards; box-shadow: 0 0 40px rgba(255,120,0,.6); }
.banner .b-main { font-size: clamp(30px, 5vw, 60px); font-weight: 900; font-style: italic; color: #fff; -webkit-text-stroke: 3px #3a0d00; paint-order: stroke fill; }
.banner .b-sub { font-size: clamp(18px, 2.6vw, 32px); font-weight: 900; font-style: italic; color: #ffe95a; -webkit-text-stroke: 2px #3a0d00; paint-order: stroke fill; letter-spacing: .06em; }
@keyframes banner { 0% { clip-path: inset(0 100% 0 0); } 18% { clip-path: inset(0 0 0 0); } 78% { clip-path: inset(0 0 0 0); opacity: 1; } 100% { clip-path: inset(0 0 0 100%); opacity: .9; } }
@media (max-height: 480px) { .banner { height: 64px; } }
/* v6：タックルボタンを小さく、すみに。文字やプレーのじゃまをしない */
#btnTackle { width: 96px; height: 96px; right: max(18px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  font-size: 15px; border-width: 3px; opacity: .78; background: radial-gradient(circle at 40% 35%, rgba(255,154,60,.9), rgba(224,58,16,.85)); }
#btnTackle.down { opacity: 1; }
#stickBase { width: 120px; height: 120px; opacity: .8; }
#stickKnob { width: 52px; height: 52px; left: 31px; top: 31px; }
@media (max-height: 480px) {
  #btnTackle { width: 78px; height: 78px; font-size: 13px; bottom: max(12px, env(safe-area-inset-bottom)); }
  #stickBase { width: 104px; height: 104px; }
  #stickKnob { width: 46px; height: 46px; left: 26px; top: 26px; }
  .hint { bottom: 12%; font-size: 16px; }
}
/* v7：縦に持たれたときは舞台を90度回す（JSで大きさと回転を指定） */
body.rot #stage { inset: auto; left: 0; top: 0; transform-origin: top left; }
.rot-hint { display: none; margin: 6px auto 4px; padding: 6px 14px; border-radius: 999px; background: #ffd400; color: #111; font-weight: 900; font-size: 15px; width: fit-content; }
body.rot .rot-hint { display: block; }
/* 文字が切れないように：ヒントは折り返す */
.hint { white-space: normal; max-width: min(88%, 720px); text-align: center; line-height: 1.4; }
.pop.sub { white-space: normal; max-width: 90%; text-align: center; }

/* 縦に持って舞台を回したときも、背の低い画面の決まりを使う */
body.rot .t-name { font-size: 54px; }
body.rot .t-lead { font-size: 17px; margin: 4px 0 8px; }
body.rot .t-how { font-size: 14px; padding: 8px 12px; margin-bottom: 10px; }
body.rot .btn.big { font-size: 22px; padding: 12px 44px; }
body.rot .t-opts { margin-top: 10px; }
body.rot .r-rank { font-size: 54px; display: inline-block; vertical-align: middle; margin-right: 14px; }
body.rot .r-score { font-size: 34px; display: inline-block; vertical-align: middle; }
body.rot .r-grid { margin: 6px auto; gap: 6px; }
body.rot .r-grid div { padding: 4px 6px; flex-direction: row; justify-content: space-between; align-items: center; }
body.rot .r-grid b { font-size: 19px; }
body.rot .r-comment { margin: 4px 0 8px; font-size: 16px; }
body.rot .linkbtn { margin-top: 6px; }
body.rot /* タイトルは左右2列にして、1画面に収める */
  #title .t-box { max-width: 900px; display: grid; grid-template-columns: 1fr 1.25fr; column-gap: 18px; align-items: center;
    grid-template-areas: "s how" "n how" "l how" "b how" "o how"; }
body.rot #title .t-small { grid-area: s; font-size: 13px; }
body.rot #title .t-name { grid-area: n; font-size: 50px; }
body.rot #title .t-lead { grid-area: l; font-size: 16px; }
body.rot #title .t-how { grid-area: how; margin: 0; font-size: 15px; }
body.rot #title .btn { grid-area: b; justify-self: center; }
body.rot #title .t-opts { grid-area: o; margin-top: 10px; }
body.rot .pop { top: 30%; }
body.rot .pop.perfect { font-size: 54px; }
body.rot .pop.chain { top: 44%; font-size: 40px; }
body.rot #btnTackle { width: 120px; height: 120px; bottom: 22px; font-size: 19px; }
body.rot #stickBase { width: 130px; height: 130px; }
body.rot #stickKnob { left: 33px; top: 33px; }
body.rot #title.screen { background: linear-gradient(90deg, rgba(3,6,14,.35) 0%, rgba(3,6,14,.72) 45%, rgba(3,6,14,.85) 100%); }
body.rot #title .t-box { max-width: 900px; }
body.rot .banner { height: 64px; }
body.rot #btnTackle { width: 78px; height: 78px; font-size: 13px; bottom: max(12px, env(safe-area-inset-bottom)); }
body.rot #stickBase { width: 104px; height: 104px; }
body.rot #stickKnob { width: 46px; height: 46px; left: 26px; top: 26px; }
body.rot .hint { bottom: 12%; font-size: 16px; }

/* v8：ゲーム名「パラグアイ 4部リーグ」 */
.t-name { display: flex; flex-direction: column; line-height: 1.02; }
.t-name small { font-size: .42em; letter-spacing: .12em; }
.t-name .t-dv { font-size: .22em; letter-spacing: .3em; margin-top: 6px; font-style: normal; background: none; -webkit-background-clip: border-box; background-clip: border-box; color: #ffd400; -webkit-text-stroke: 0; filter: none; }
/* v8：観客のヤジの吹き出し */
.yaji { position: absolute; transform: translate(-50%, -100%) rotate(var(--r)); background: #fff; color: #111; font-weight: 900; font-size: 17px;
  padding: 7px 13px; border-radius: 16px; border: 3px solid #111; white-space: nowrap; pointer-events: none; box-shadow: 0 4px 0 rgba(0,0,0,.35);
  animation: yaji 2.3s ease-out forwards; z-index: 2; }
.yaji::after { content: ''; position: absolute; left: 22px; bottom: -13px; border-left: 9px solid transparent; border-right: 9px solid transparent; border-top: 13px solid #111; }
.yaji.angry { background: #fff1ef; border-color: #c41a12; color: #a30d06; }
.yaji.angry::after { border-top-color: #c41a12; }
@keyframes yaji {
  0% { transform: translate(-50%, -80%) rotate(var(--r)) scale(.4); opacity: 0; }
  8% { transform: translate(-50%, -100%) rotate(var(--r)) scale(1.08); opacity: 1; }
  14% { transform: translate(-50%, -100%) rotate(var(--r)) scale(1); }
  85% { opacity: 1; }
  100% { transform: translate(-50%, -120%) rotate(var(--r)) scale(1); opacity: 0; }
}
@media (max-height: 480px) { .yaji { font-size: 14px; padding: 5px 10px; border-width: 2px; } }
body.rot .yaji { font-size: 14px; padding: 5px 10px; border-width: 2px; }
.t-name small { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: #fff; -webkit-text-stroke: 2px #111; }
