/* شكل مشترك لألعاب السكور اللي يحكمها الخادم */
.site-bar-inner { padding-block: 8px; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 10px; white-space: nowrap; }

/* عرض اللعبة يتبع طول الشاشة عشان تبان كاملة بدون نزول */
.arena {
  width: min(100%, calc((100vh - 112px) * 2 / 3));
  width: min(100%, calc((100dvh - 112px) * 2 / 3));
  min-width: 270px; margin-inline: auto; padding: 4px 12px 12px;
}
.arena-hud { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.arena-hud b { color: var(--ink); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.arena-stage {
  position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 4px;
  box-shadow: 0 0 90px 30px rgba(2, 16, 24, .7);
}
/* touch-action: none يمنع الصفحة تتحرك لما اللاعب يلمس اللعبة */
.arena-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }

.arena-overlay {
  position: absolute; inset: 0; z-index: 3; padding: 18px; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 11px;
  text-align: center; background: rgba(6, 16, 24, .74); backdrop-filter: blur(5px);
}
.arena-overlay[hidden] { display: none; }
.arena-overlay h2 { font-weight: 700; font-size: clamp(25px, 6vw, 36px); }
.arena-overlay p { margin: 0; line-height: 1.65; white-space: pre-line; font-size: 15px; color: #e6ecef; }
.arena-overlay p.score-lines { display: grid; gap: 5px; white-space: normal; font-family: var(--display); font-size: 17px; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.score-lines b { font-size: 23px; font-weight: 800; }
.score-now { color: #7fe3ff; }
.score-best { color: #ffd257; }
.score-rank { color: #6ff2b5; }
.arena-overlay p.score-lines .score-note { font-size: 13.5px; font-weight: 500; color: #ffffff; }
.arena-form { display: grid; gap: 8px; width: min(100%, 270px); }
.arena-form[hidden] { display: none; }
.arena-form input {
  width: 100%; min-width: 0; padding: 11px 12px; border: 0; border-radius: 11px; text-align: center;
  background: rgba(255, 255, 255, .13); color: var(--ink); font-family: var(--body); font-size: 16px;
}
.arena-form input::placeholder { color: #b9c8d0; }
.arena-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.arena-actions [hidden] { display: none; }
/* قائمة اللاعبين بعد الجولة */
.arena-board { flex: 0 1 auto; width: min(100%, 320px); max-height: 46%; min-height: 72px; overflow-y: auto; text-align: start; }
.arena-board[hidden] { display: none; }
.skin-picker { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; font-size: 14px; color: #e6ecef; }
/* شاشة بداية بصرية: البحر يبان من وراها، والسمك بصوره بدل الفقرات */
.arena-overlay.has-guide {
  gap: 9px; padding: 14px 16px; justify-content: safe center;
  background: linear-gradient(to bottom, rgba(4, 28, 42, .78), rgba(4, 28, 42, .62) 45%, rgba(4, 22, 34, .86));
  backdrop-filter: blur(3px);
}
.has-guide h2 { font-size: clamp(25px, 5vw, 32px); text-shadow: 0 2px 14px rgba(0, 0, 0, .5); }
.has-guide p { font-size: 13.5px; line-height: 1.55; }
.arena-guide { width: 100%; display: grid; gap: 8px; text-align: start; }
.arena-guide[hidden] { display: none; }
.guide-head { display: flex; justify-content: space-between; gap: 8px; padding-bottom: 3px; border-bottom: 1px solid rgba(255, 255, 255, .16); font-size: 12px; font-weight: 700; color: #7df0e8; }
.guide-head small { font-size: 11px; font-weight: 500; color: #c4d6de; }
.guide-head.danger { color: #ff9dbc; }
.guide-fish { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 3px; }
.guide-item { display: flex; align-items: center; gap: 6px; min-width: 0; }
.guide-item canvas { flex: none; width: 54px; height: 36px; cursor: default; }
.guide-item b { display: block; font-size: 13px; font-weight: 600; line-height: 1.25; }
.guide-values { display: flex; gap: 6px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.guide-values .pts { color: #ffd56b; }
.guide-values .sec { color: #7df0ff; }
.guide-values.bad .pts, .guide-values.bad .sec { color: #ff9dbc; }
.guide-jellies { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 3px; text-align: center; }
.guide-jellies .guide-item { flex-direction: column; gap: 1px; }
.guide-jellies canvas { width: 46px; height: 46px; }
.guide-jellies .guide-values { justify-content: center; }
.guide-treasure { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.guide-treasure canvas { flex: none; width: 46px; height: 40px; }
.guide-treasure div { flex: 1; min-width: 0; line-height: 1.35; }
.guide-treasure b { display: block; font-weight: 700; color: #ffd56b; }
.guide-treasure strong { flex: none; font-size: 20px; font-weight: 800; color: #ffd56b; }
.has-guide .arena-form { width: calc(100% + 32px); grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; }
/* زر البداية يبقى ظاهر تحت حتى لو الشرح طويل */
.has-guide .arena-form { position: sticky; bottom: 0; z-index: 2; flex: none; margin: 0 -16px -14px; padding: 8px 16px 14px; background: rgba(4, 22, 34, .96); }
.guide-rules { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 12.5px; line-height: 1.5; color: #e6ecef; }
.guide-rules b { margin-inline-end: 5px; font-weight: 700; color: #ffd56b; }
.arena-form:not(.has-guide *) { grid-template-columns: auto minmax(0, 1fr); }
.arena-form:not(.has-guide *) .btn { grid-column: 1 / -1; }
.arena-countdown {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; pointer-events: none;
  font-size: clamp(90px, 28vw, 170px); font-weight: 700; color: #fff; text-shadow: 0 6px 34px rgba(0, 0, 0, .7);
}
.arena-countdown[hidden] { display: none; }
