/* HALF-IT gameplay; managed only in half-it/. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #090a0b; color: #eee; font-family: Meiryo,"メイリオ","Noto Sans JP",sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; border: 1px solid #454748; border-radius: 0; color: #eee; background: #191b1dcc; padding: 8px; touch-action: manipulation; }
button:hover { filter: brightness(1.2); }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible { outline: 3px solid #c3d825; outline-offset: 2px; }
button:disabled { opacity: .35; cursor: default; }
h2 { font-size: clamp(22px,3cqw,36px); margin: 0 0 20px; }
:root { --game-title-height: calc(clamp(10px,1.2dvmax,16px) * 1.5 + clamp(6px,1.2dvmin,14px) + clamp(6px,1.2dvmin,14px)); }
.viewport { position: fixed; inset: 0; width: 100dvw; height: 100dvh; container-type: size; display: grid; grid-template-columns: 20% minmax(0,1fr) 22%; --footer-height: clamp(56px,15cqh,120px); grid-template-rows: minmax(0,1fr) var(--footer-height); background: radial-gradient(ellipse at 52% 25%,#292b2c,#0b0d0e 65%,#050607); }
.rail { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 0 clamp(6px,1.2cqw,18px) clamp(6px,1.2cqw,18px); border-right: 1px solid #ffffff12; }
.game-info { margin-inline: calc(-1 * clamp(6px,1.2cqw,18px)); padding: 0 clamp(6px,1.2cqh,14px); background: #EB6238; color: #fff; line-height: 1.5; height: var(--game-title-height); min-height: var(--game-title-height); flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.game-info h1 { margin: 0; font-size: clamp(10px,1.2cqw,16px); font-weight: 900; line-height: 1.5; white-space: pre-line; overflow: hidden; text-overflow: ellipsis; }
.round-heading { font-size: clamp(11px,1.5cqw,23px); padding-bottom: 8px; border-bottom: 3px solid #c3d825; margin-top: clamp(8px,1.2cqh,14px); }
.history { flex: 1; overflow: auto; min-height: 0; margin-top: 5px; scrollbar-width: thin; }
.history-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; justify-content: space-between; align-items: center; border-bottom: 1px solid #ffffff25; padding: 5px 2px; font-size: clamp(9px,1cqw,15px); gap: 5px; min-height: 30px; }
.history-row strong { font-size: clamp(14px,1.6cqw,25px); font-weight: 400; }
.history-row small { color: #aaa; font-size: .7em; grid-column: 3; text-align: right; }
.history-row.current { color: #c3d825; }
.half-it-game .history-row.halved { border-left: 2px solid #bd7268; }
@keyframes targetGlow { 0%,100% { stroke-opacity: .45; filter: drop-shadow(0 0 1px currentColor); } 50% { stroke-opacity: 1; filter: drop-shadow(0 0 14px currentColor); } }
.history-darts { font-size: clamp(9px,.95cqw,14px); line-height: 1.5; overflow-wrap: anywhere; text-align: center; }
.rail-actions { display: grid; gap: 5px; margin-top: 8px; min-height: 0; overflow-y: auto; }
.rail-actions button { font-size: clamp(9px,1cqw,14px); min-height: 28px; }
.rail-actions a { text-align: center; padding: 6px; color: inherit; font-size: clamp(9px,1cqw,14px); }
.arena { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; align-items: center; min-height: 0; min-width: 0; padding: clamp(6px,1cqh,14px) 8px; }
.board-wrap { position: relative; flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.board-wrap svg { display: block; width: 100%; height: 100%; max-width: 100%; user-select: none; touch-action: manipulation; }
.light { fill-opacity: .47; stroke-width: 3; stroke-opacity: .8; }
.light-bull { fill-opacity: .6; stroke-width: 2; }
/* Keep the board size unchanged when feedback first receives text. */
.feedback { font-size: clamp(9px,1cqw,14px); color: #bfc5c7; height: 1.5em; min-height: 1.5em; line-height: 1.5; overflow: auto; width: 100%; margin: 6px 0 0; text-align: center; flex-shrink: 0; }
.footer { grid-column: 1/-1; grid-row: 2; display: grid; grid-template-columns: minmax(0,1.2fr) 1fr 1fr 1fr; background: #050505; min-height: 0; }
.player { background: #c3d825; color: #17252c; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 5px; overflow: hidden; }
.player span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(15px,2.5cqw,40px); font-weight: 600; }
.player small { font-size: clamp(8px,1cqw,15px); }
.footer-cell { display: flex; align-items: center; justify-content: center; gap: clamp(5px,1cqw,14px); padding: 6px; border-left: 1px solid #ffffff18; min-width: 0; }
.footer-cell span { font-size: clamp(8px,1cqw,15px); color: #aaa; }
.footer-cell strong { font-size: clamp(20px,3.5cqw,56px); font-weight: 500; white-space: nowrap; }
#recordStatus { position: absolute; left: 8px; right: 8px; bottom: 0; z-index: 30; background: #343638; font-size: 11px; padding: 8px; }
.round-start-overlay { position: absolute; inset: 0; z-index: 40; overflow: hidden; pointer-events: none; }
.round-start-position { position: absolute; text-align: center; transform: translate(-50%,-50%); }
.round-start-position[data-placement="below"] { transform: translateX(-50%); }
.round-start-text { display: block; color: #fff; font-family: Arial,Helvetica,sans-serif; font-weight: 900; line-height: 1.1; letter-spacing: .06em; white-space: nowrap; text-shadow: 0 2px 18px #000,0 0 40px #000; animation: iwashi-round-pass 1.3s ease-in-out both; }
@keyframes iwashi-round-pass { 0% { transform: translateX(-150%); opacity: 0; } 24%,70% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(150%); opacity: 0; } }
@media (orientation:portrait) {
  .viewport { inset: auto; top: 50%; left: 50%; width: 100dvh; height: 100dvw; transform: translate(-50%,-50%) rotate(90deg); }
  .viewport.setting-up { inset: 0; width: 100dvw; height: 100dvh; transform: none; }
}
@media (max-height:550px), (pointer:coarse) {
  :root { --game-title-height: calc(clamp(9px,1.15dvmax,12px) * 1.5 + 6px); }
  .viewport { --footer-height: clamp(28px,7.5cqh,60px); }
  .rail { padding: 0 8px 6px; }
  .game-info { margin-inline: -8px; padding-inline: 6px; }
  .game-info h1 { font-size: clamp(9px,1.15cqw,12px); }
  .round-heading { padding-bottom: 4px; }
  .history-row { padding: 3px 1px; }
  .rail-actions { gap: 3px; }
  .rail-actions button { min-height: 23px; padding: 3px; }
  .arena { padding: 4px; }
  .feedback { margin-top: 3px; font-size: 10px; }
  .footer-cell { flex-direction: column; gap: 0; }
  .footer-cell, .player { padding: 2px; }
  .footer-cell span, .player small { font-size: 8px; line-height: 1; }
  .footer-cell strong { font-size: clamp(13px,4cqh,22px); line-height: 1; }
  .player span { font-size: clamp(12px,3.4cqh,18px); line-height: 1; }
}
@media (prefers-reduced-motion:reduce) {
  * { scroll-behavior: auto; }
  .round-start-text { animation: none; }
}
