/* ============================================================
PASA GAME - Responsive & Eye-Friendly Stylesheet
Supports: Mobile portrait, Mobile landscape, Tablet, Desktop
============================================================ */

/* ------- Design Tokens ------- */
:root {
--bg-deep: #12131f;
--bg-mid: #1c1e30;
--bg-panel: rgba(255, 255, 255, 0.075);
--bg-panel-border: rgba(255, 255, 255, 0.16);

--text-primary: #eef0f6;
--text-secondary: #9ca3b8;
--text-muted: #5a6080;

--accent-red: #f8312f;
--accent-yellow: #ffe600;
--accent-green: #00c86b;

--cell-light: #E8EDEE;
--cell-dark: #2a7a7b;
--cell-green: #5ecf87;
--cell-center: #F6AD55;

--touch-min: 48px;
--board-scale: 1;
--panel-scale: 1;
--controls-w: clamp(200px, 22vw, 300px);

--radius-sm: 8px;
--radius-md: 14px;
--radius-lg: 22px;
--radius-xl: 30px;

/* Action button height — unified across all layouts */
--action-h: 48px;
}

/* ------- Reset ------- */
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}

html { height: 100%; }

body {
min-height: 100%;
background: linear-gradient(160deg, #0e0f1c 0%, #1c1e30 50%, #0e0f1c 100%);
color: var(--text-primary);
font-family: 'Outfit', system-ui, -apple-system, sans-serif;
font-size: 17px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
overscroll-behavior: none;
touch-action: manipulation;
}

/* ------- Setup Screen ------- */
.setup-screen {
position: fixed;
inset: 0;
z-index: 500;
display: flex;
align-items: center;
justify-content: center;
padding: 16px;
background: rgba(8, 10, 18, 0.88);
backdrop-filter: blur(8px);
}
.setup-screen.is-hidden { display: none; }

.setup-card {
width: min(92vw, 520px);
background: rgba(18, 20, 36, 0.96);
border: 1px solid rgba(255, 255, 255, 0.16);
border-radius: 16px;
padding: 18px 16px;
display: flex;
flex-direction: column;
gap: 12px;
box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}
.setup-card h2 { text-align: center; font-size: 1.5rem; }

.setup-section { display: flex; flex-direction: column; gap: 8px; }
.setup-section h3 { font-size: 1rem; color: var(--text-secondary); }

.setup-options {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 8px;
}

.online-panel.is-hidden { display: none; }

.online-row {
display: grid;
grid-template-columns: minmax(120px, 1fr) auto auto;
gap: 8px;
}

#room-id-input {
min-height: 44px;
border-radius: 10px;
border: 1px solid rgba(255, 255, 255, 0.22);
background: rgba(255, 255, 255, 0.06);
color: #fff;
padding: 0 10px;
}

.online-status { font-size: 0.86rem; color: var(--text-secondary); }

.setup-option-btn {
min-height: 48px;
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.2);
background: rgba(255, 255, 255, 0.06);
color: var(--text-primary);
font-size: 16px;
font-weight: 700;
padding: 10px 12px;
cursor: pointer;
}
.setup-option-btn.is-selected {
border-color: #4dd9ff;
background: rgba(77, 217, 255, 0.2);
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.24) inset;
}
.setup-start-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============================================================
TOP-LEVEL LAYOUT
game-container is always column: header + main-content
main-content is row on desktop/landscape, column on portrait
============================================================ */

.game-container {
display: flex;
flex-direction: column;
width: 100%;
height: 100svh;
min-height: 100svh;
overflow: hidden;
}

/* ------- Header ------- */
header {
flex: 0 0 auto;
text-align: center;
padding: 10px 56px 4px;
z-index: 10;
}
header h1 {
font-size: clamp(1.4rem, 3.6vw, 2.6rem);
font-weight: 600;
letter-spacing: 0.05em;
background: linear-gradient(90deg, #ff8c8c, #f8312f);
background-clip: text;
-webkit-background-clip: text;
color: transparent;
-webkit-text-fill-color: transparent;
line-height: 1;
}

/* ------- Hamburger menu ------- */
.menu-btn {
position: fixed;
top: 12px;
left: 12px;
z-index: 300;
background: rgba(20, 22, 40, 0.92);
color: #fff;
border: 1px solid rgba(255, 255, 255, 0.22);
border-radius: var(--radius-md);
padding: 0;
width: var(--touch-min);
height: var(--touch-min);
font-size: 1.25rem;
font-weight: 700;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
-webkit-tap-highlight-color: transparent;
}

.menu-panel {
position: fixed;
top: 70px;
left: 12px;
z-index: 300;
background: rgba(18, 20, 36, 0.97);
border: 1px solid rgba(255, 255, 255, 0.18);
border-radius: var(--radius-md);
padding: 10px;
display: none;
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.menu-panel.is-open { display: block; }

.ui-size-settings {
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid rgba(255, 255, 255, 0.14);
display: grid;
gap: 6px;
}
.ui-size-row {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.82rem;
color: var(--text-secondary);
font-weight: 600;
}
.ui-size-row output {
color: #d8deef;
font-weight: 700;
font-variant-numeric: tabular-nums;
}
.ui-size-slider { width: 100%; accent-color: #4dd9ff; }

.menu-action-btn,
.menu-restart-btn {
width: 220px;
margin-bottom: 8px;
}
.menu-action-btn:last-child,
.menu-restart-btn:last-child { margin-bottom: 0; }

/* ============================================================
MAIN CONTENT — desktop default (row layout)
board on left, controls-column on right
============================================================ */
.main-content {
flex: 1 1 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
gap: clamp(10px, 1.4vw, 18px);
padding: 8px 12px 12px;
overflow: hidden;
min-height: 0;
}

/* ------- Board wrapper ------- */
.board-wrapper {
position: relative;
flex: 0 0 auto;
display: flex;
justify-content: center;
align-items: center;
padding: clamp(8px, 1.2vw, 14px);
background: rgba(255, 255, 255, 0.05);
border-radius: var(--radius-lg);
border: 1px solid rgba(255, 255, 255, 0.09);
box-shadow: 0 10px 44px rgba(0, 0, 0, 0.46);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}

.board-wrapper.rotate-for-p1-online #board {
transform: rotate(180deg);
}

/* Board: always square, sized to fit viewport */
#board {
--board-size: min(
calc(100vw - 24px),
calc(100svh - 80px)
);
width: calc(var(--board-size) * var(--board-scale));
height: calc(var(--board-size) * var(--board-scale));
max-width: 1120px;
max-height: 1120px;
aspect-ratio: 1 / 1;
flex-shrink: 0;
}

.board {
width: 100%;
height: 100%;
display: grid;
grid-template-columns: repeat(19, 1fr);
grid-template-rows: repeat(19, 1fr);
background: transparent;
gap: 0;
}

/* ------- Controls column hidden ------- */
.controls-column { display: none !important; }
.board-controls { display: none !important; }

/* ------- Dice arm on left arm of board (rows 9-11, cols 1-8) ------- */
#dice-arm {
grid-row: 9 / span 3;
grid-column: 1 / span 8;
display: flex;
flex-direction: column;
gap: 6px;
justify-content: center;
align-items: center;
z-index: 20;
cursor: pointer;
background: none;
padding: 0;
position: relative;
}
#dice-arm-total {
position: absolute;
bottom: -14px;
left: 50%;
transform: translateX(-50%);
font-size: 10px;
font-weight: 700;
color: rgba(255,255,255,0.5);
white-space: nowrap;
pointer-events: none;
}

/* Allow dice to overflow during roll animation */
#dice-arm,
.board,
#board,
.board-wrapper {
overflow: visible !important;
}

/* ------- Floating action buttons per player ------- */
.pasa-action {
position: absolute;
display: flex;
flex-direction: row;
gap: 6px;
z-index: 50;
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: opacity 0.18s ease;
}
.pasa-action.is-visible {
opacity: 1;
visibility: visible;
pointer-events: auto;
}
/* P1 buttons top-right (near base-p1) */
.pasa-action-p1 {
top: 8%;
right: 3%;
}
/* P2 buttons bottom-right (near base-p2) */
.pasa-action-p2 {
bottom: 8%;
right: 3%;
}
.pasa-action .btn-primary,
.pasa-action .btn-secondary {
height: 36px;
min-height: 36px;
width: auto;
flex: none;
padding: 0 14px;
font-size: 0.8rem;
border-radius: 20px;
}

/* ------- Controls panel ------- */
.controls {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 10px;
background: var(--bg-panel);
padding: 12px;
border-radius: var(--radius-lg);
border: 1px solid var(--bg-panel-border);
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.34);
}

/* ------- Board resize handle ------- */
.board-resize-handle {
position: absolute;
right: 8px;
bottom: 8px;
width: 18px;
height: 18px;
border-radius: 5px;
border: 1px solid rgba(255, 255, 255, 0.32);
background: rgba(255, 255, 255, 0.14);
cursor: nwse-resize;
z-index: 30;
touch-action: none;
}
.board-resize-handle::before {
content: '';
position: absolute;
inset: 4px;
border-right: 2px solid rgba(255, 255, 255, 0.65);
border-bottom: 2px solid rgba(255, 255, 255, 0.65);
}

/* ------- Turn indicator ------- */
.turn-indicator {
color: var(--text-secondary);
font-weight: 760;
font-size: clamp(0.9rem, 1.6vw, 1.2rem);
text-align: center;
line-height: 1.4;
letter-spacing: 0.01em;
}

/* ============================================================
BUTTONS — unified, consistent across all breakpoints
--action-h controls the height of all action buttons.
Never override height per-breakpoint; only override font-size.
============================================================ */

/* Base for all interactive buttons */
.btn-primary,
.btn-secondary {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: var(--action-h);
min-height: var(--action-h);
border-radius: var(--radius-xl);
font-family: inherit;
font-weight: 700;
font-size: clamp(0.85rem, 1.6vw, 1rem);
line-height: 1;
cursor: pointer;
border: none;
transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
-webkit-tap-highlight-color: transparent;
padding: 0 12px;
white-space: nowrap;
}

.btn-primary:hover,
.btn-secondary:hover {
transform: translateY(-2px);
filter: brightness(1.1);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}
.btn-primary:active,
.btn-secondary:active { transform: translateY(1px); }

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.stack-choice-btn:focus-visible,
.setup-option-btn:focus-visible {
outline: 3px solid rgba(77, 217, 255, 0.92);
outline-offset: 2px;
}

/* Secondary (Pull Back) */
.btn-secondary {
background: linear-gradient(135deg, #3a3a4a, #25252f);
color: #eef0f6;
border: 1px solid rgba(255, 255, 255, 0.18);
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}
.btn-secondary:hover { background: linear-gradient(135deg, #4d4f61, #333445); }
.btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Roll button */
#roll-btn {
background: linear-gradient(135deg, #f8312f, #bd1b19);
color: #fff;
border: 3px solid rgba(0,0,0,0.3);
box-shadow: 0 4px 14px rgba(248, 49, 47, 0.4);
margin-bottom: 0;
flex: none;
}
#roll-btn.turn-p1 {
background: linear-gradient(135deg, #f8312f, #bd1b19);
border-color: #111;
}
#roll-btn.turn-p2 {
background: linear-gradient(135deg, #ffe600, #cca300);
border-color: #00b86b;
color: #111;
}
#roll-btn.is-hidden {
visibility: hidden;
opacity: 0;
pointer-events: none;
}

/* Confirm Move */
.confirm-action {
background: linear-gradient(135deg, #00c850, #00885a) !important;
color: #fff !important;
box-shadow: 0 4px 14px rgba(0, 200, 80, 0.4) !important;
}

/* Restart */
.restart-action {
background: linear-gradient(135deg, #7c3aed, #4c1d95);
color: #fff;
}

/* ============================================================
ACTION BUTTONS ROW (Pull Back + Confirm Move)
Both buttons are always equal height and equal width (50/50)
============================================================ */
.action-buttons {
display: flex;
flex-direction: row;
gap: 8px;
width: 100%;
align-items: stretch;
/* Reserve space even when hidden so layout doesn't jump */
min-height: var(--action-h);
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: opacity 0.18s ease;
}
.action-buttons.is-visible {
opacity: 1;
visibility: visible;
pointer-events: auto;
}
.action-buttons .btn-primary,
.action-buttons .btn-secondary {
flex: 1 1 0; /* equal width */
width: 0; /* let flex grow decide, not content */
height: var(--action-h);
min-height: var(--action-h);
}
.action-buttons .btn-hidden {
opacity: 0;
visibility: hidden;
pointer-events: none;
}

/* ------- Dice ------- */
.dice-container {
display: flex;
flex-direction: column;
gap: 8px;
justify-content: center;
align-items: center;
}
#dice-arm .stick-dice {
width: 150px;
height: 50px;
background: linear-gradient(180deg, #E3BE4F 0%, #bc8952 100%);
border-radius: 999px;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 6px rgba(0, 0, 0, 0.35);
border: 1px solid rgba(86, 53, 26, 0.55);
display: flex;
justify-content: center;
align-items: center;
padding: 9px;
flex-shrink: 0;
}
/* Player 1: rolls from top of board down to dice arm (at bottom) */
@keyframes rollDown {
0% { transform: translateY(var(--travel-start, -500px)); opacity: 0; }
8% { opacity: 1; }
100% { transform: translateY(0px); opacity: 1; }
}

/* Player 2: rolls from bottom of board up to dice arm (at top) */
@keyframes rollUp {
0% { transform: translateY(var(--travel-start, 500px)); opacity: 0; }
8% { opacity: 1; }
100% { transform: translateY(0px); opacity: 1; }
}

.stick-dice.roll-down {
animation: rollDown 2.5s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.stick-dice.roll-up {
animation: rollUp 2.5s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
@keyframes rollStick {
0% { transform: rotateX(0deg); }
100% { transform: rotateX(36000deg); }
}
.dots-container {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
gap: 38px;
padding: 11 8px;
}
/* Each dot-col is a vertical stack of 1 or 2 dots */
.dot-col {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 7px;
height: 100%;
}
.dot-col--center {
justify-content: center;
}
/* Keep legacy dot-row hidden (not used anymore) */
.dot-row { display: none; }
.dot-row--center { display: none; }
.dot {
width: 11px;
height: 11px;
background-color: #111;
border-radius: 50%;
box-shadow: none;
}
.dice-fallback-value {
margin: auto;
font-weight: 800;
font-size: clamp(0.8rem, 1.1vw, 1rem);
color: #121212;
}
.dice-total {
font-size: clamp(1rem, 1.6vw, 1.2rem);
font-weight: 800;
color: #ff8c8c;
text-align: center;
text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* ------- Cells ------- */
.cell {
width: 100%;
height: 100%;
border: 0.5px solid rgba(0,0,0,0.14);
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
gap: 1px;
}
.cell-red { background-color: var(--cell-light); }
.cell-black { background-color: var(--cell-dark); }
.cell-green { background-color: var(--cell-green); }
.home-cell { background-color: #F6AD55 !important; }
.counting-marker-cell { background-color: var(--cell-center) !important; }

/* ------- Center block ------- */
.center-block {
background-color: var(--cell-center);
border: 1px solid rgba(0,0,0,0.2);
position: relative;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-content: center;
gap: 2px;
padding: 3px;
overflow: hidden;
}
.center-block .token { width: 22%; height: 22%; }

/* ------- Special zone ------- */
.special-zone {
position: relative;
border: 1px solid rgba(0,0,0,0.28);
overflow: hidden;
background-color: #d1c8b8;
background-image:
linear-gradient(45deg, transparent 45%, #f8312f 45%, #f8312f 55%, transparent 55%),
linear-gradient(-45deg, transparent 45%, #00b86b 45%, #00b86b 55%, transparent 55%),
linear-gradient(90deg, transparent 49%, #888 49%, #888 51%, transparent 51%),
linear-gradient(0deg, transparent 49%, #888 49%, #888 51%, transparent 51%);
background-size: 100% 100%;
}
.special-zone::after {
content: '';
position: absolute;
inset: 10%;
border: 2px dashed rgba(0,0,0,0.25);
}

/* ------- Tokens ------- */
.token {
position: relative;
width: 40%;
height: 40%;
border-radius: 50% 50% 15% 15%;
box-shadow:
0 3px 6px rgba(0,0,0,0.4),
inset 0 -3px 5px rgba(0,0,0,0.2),
inset 0 2px 3px rgba(255,255,255,0.4);
z-index: 10;
cursor: pointer;
transition: transform 0.18s ease;
display: flex;
justify-content: center;
-webkit-tap-highlight-color: transparent;
}
.token:hover { transform: scale(1.12); }
.token:active { transform: scale(0.96); }
.token::after {
content: '';
position: absolute;
top: 5%;
width: 40%;
height: 40%;
border-radius: 50%;
box-shadow: inset 0 -2px 3px rgba(0,0,0,0.2), inset 0 2px 3px rgba(255,255,255,0.4);
}
.token-red { background: radial-gradient(circle at 30% 30%, #ff5555, #cc0000); }
.token-red::after { background-color: #111; }
.token-black { background: radial-gradient(circle at 30% 30%, #555, #111); }
.token-black::after { background-color: #f8312f; }
.token-yellow { background: radial-gradient(circle at 30% 30%, #ffe600, #cca300); }
.token-yellow::after { background-color: #00b86b; }
.token-green { background: radial-gradient(circle at 30% 30%, #00e68a, #00995c); }
.token-green::after { background-color: #ffe600; }

/* ------- Base containers ------- */
.base-container {
background: rgba(0,0,0,0.35);
border: 2px dashed rgba(255,255,255,0.25);
border-radius: var(--radius-md);
display: flex;
flex-wrap: wrap;
gap: 6px;
padding: 8px;
justify-content: center;
align-content: flex-start;
}
.base-container .token {
width: clamp(18px, 2.2vw, 26px);
height: clamp(18px, 2.2vw, 26px);
}
.base-title {
width: 100%;
text-align: center;
font-size: clamp(0.88rem, 1vw, 1rem);
color: var(--text-secondary);
margin-bottom: 4px;
font-weight: 600;
}
.base-p1 {
background: linear-gradient(135deg, rgba(248,49,47,0.08), rgba(40,40,50,0.25));
border-color: rgba(248,49,47,0.35);
width: 100%; height: 100%; box-sizing: border-box;
}
.base-p2 {
background: linear-gradient(135deg, rgba(255,230,0,0.07), rgba(40,40,50,0.25));
border-color: rgba(255,230,0,0.35);
width: 100%; height: 100%; box-sizing: border-box;
}

/* ------- Finished container ------- */
.finished-container {
background: rgba(0,0,0,0.35);
padding: 10px;
border-radius: var(--radius-md);
text-align: center;
}
.hidden-finished { display: none !important; }
.finished-container h3 {
margin-bottom: 8px;
font-size: clamp(0.88rem, 1.2vw, 1rem);
color: #ffd700;
font-weight: 700;
}
.finished-row {
display: flex;
justify-content: center;
gap: 8px;
margin-bottom: 6px;
}
.finished-zone {
width: clamp(40px, 4.5vw, 56px);
min-height: 34px;
border: 2px dashed rgba(255,255,255,0.25);
border-radius: var(--radius-sm);
display: flex;
flex-wrap: wrap;
gap: 2px;
padding: 2px;
justify-content: center;
align-items: center;
}
.red-zone { background: rgba(255,60,60,0.1); border-color: #ff3c3c; }
.black-zone { background: rgba(50,50,50,0.5); border-color: #555; }
.yellow-zone { background: rgba(255,230,0,0.1); border-color: #ffe600; }
.green-zone { background: rgba(0,200,80,0.1); border-color: #00c850; }

/* ------- Highlights ------- */
.token-selected {
filter: brightness(1.28) drop-shadow(0 0 9px rgba(255,255,255,0.95));
transform: scale(1.15) !important;
}
.token-selectable {
animation: tokenPulse 1.4s infinite alternate;
cursor: pointer;
}
@keyframes tokenPulse {
from { filter: brightness(1); }
to { filter: brightness(1.3) drop-shadow(0 0 4px rgba(255,255,180,0.8)); }
}
.token-manual-selected {
box-shadow: 0 0 14px 5px rgba(80,208,255,0.9), inset 0 -3px 5px rgba(0,0,0,0.2) !important;
transform: scale(1.15);
}
.cell-highlight {
background-color: rgba(248,240,100,0.62) !important;
border: 2px solid rgba(255,255,255,0.95);
box-shadow: 0 0 0 2px rgba(255,255,255,0.28) inset, 0 0 8px rgba(248,240,100,0.45);
cursor: pointer;
z-index: 5;
}
.cell-highlight:hover {
background-color: rgba(248,240,100,0.85) !important;
transform: scale(1.04);
z-index: 20;
}
.single-highlight { border: 2px solid rgba(255,255,255,0.95) !important; }
.pair-highlight {
background-color: rgba(120,220,255,0.62) !important;
border: 4px solid #4dd9ff !important;
box-shadow: 0 0 0 1px rgba(255,255,255,0.44) inset, 0 0 10px rgba(77,217,255,0.45);
}
.stack-choice-bubble {
position: absolute;
transform: translate(-50%, -100%);
display: flex;
gap: 10px;
padding: 10px;
border-radius: 12px;
background: rgba(10,14,28,0.95);
border: 1px solid rgba(255,255,255,0.22);
z-index: 60;
box-shadow: 0 10px 24px rgba(0,0,0,0.5);
max-width: calc(100% - 12px);
}
.stack-choice-btn {
border: 1px solid rgba(255,255,255,0.24);
background: rgba(255,255,255,0.08);
color: #eef0f6;
border-radius: 10px;
padding: 10px 16px;
min-height: 44px;
font-size: clamp(0.9rem, 1.3vw, 1rem);
font-weight: 700;
line-height: 1.1;
cursor: pointer;
}
.stack-choice-btn:hover {
background: rgba(77,217,255,0.22);
border-color: rgba(77,217,255,0.75);
}
.stack-choice-btn:focus-visible {
outline: 3px solid rgba(77,217,255,0.92);
outline-offset: 2px;
}
.chain-highlight {
background-color: rgba(255,215,0,0.68) !important;
border: 3px solid #ffd700 !important;
animation: goldPulse 1.5s infinite alternate;
}
@keyframes goldPulse {
from { box-shadow: 0 0 4px 2px rgba(255,215,0,0.5); }
to { box-shadow: 0 0 14px 5px rgba(255,215,0,0.9); }
}
.requires-double-high {
border: 3px solid #ff0000 !important;
opacity: 0.8;
}
.requires-double-high::before {
content: '!';
position: absolute;
top: -14px;
left: 50%;
transform: translateX(-50%);
color: #ff3c3c;
font-weight: 800;
font-size: 18px;
text-shadow: 0 0 2px white;
}

/* ============================================================
RESPONSIVE BREAKPOINTS
============================================================ */

/* ---------- Large desktop (1280px+) ---------- */
@media (min-width: 1280px) {
:root { --controls-w: clamp(240px, 22vw, 320px); }
#board {
--board-size: min(
calc(100vw - var(--controls-w) - 80px),
calc(100svh - 80px)
);
}
}

/* ---------- Standard desktop ---------- */
@media (max-width: 1280px) and (min-width: 1025px) {
:root { --controls-w: clamp(200px, 20vw, 280px); }
#board {
--board-size: min(
calc(100vw - var(--controls-w) - 60px),
calc(100svh - 80px)
);
}
}

/* ---------- Tablet landscape (769px–1024px) ---------- */
@media (max-width: 1024px) and (min-width: 769px) {
:root { --controls-w: clamp(180px, 22vw, 240px); }
.main-content { gap: 10px; padding: 6px 10px 10px; }
#board {
--board-size: min(
calc(100vw - var(--controls-w) - 40px),
calc(100svh - 72px)
);
}
.controls { gap: 8px; padding: 10px; }
.btn-primary, .btn-secondary { font-size: 0.9rem; }
.dice-container { height: clamp(52px, 9vh, 80px); }
.stick-dice { height: clamp(52px, 9vh, 80px); width: clamp(26px, 3vw, 36px); }
}

/* ============================================================
MOBILE PORTRAIT (≤768px, portrait)
Layout: column — board top, controls below
============================================================ */
@media (max-width: 768px) and (orientation: portrait) {
:root {
--action-h: 46px;
--controls-w: 100%;
}

body { overflow: hidden; height: 100svh; }

.game-container { height: 100svh; overflow: hidden; }

header {
padding: 4px 50px 2px;
}
header h1 { font-size: clamp(1rem, 4vw, 1.3rem); line-height: 1.1; }

.menu-btn { top: 6px; left: 8px; width: 40px; height: 40px; font-size: 1rem; }

/* Column layout: board on top, controls below */
.main-content {
flex-direction: column;
align-items: center;
justify-content: flex-start;
gap: 6px;
padding: 4px 6px 8px;
height: calc(100svh - 40px);
overflow: hidden;
}

.board-wrapper {
flex: 0 0 auto;
width: 96vw;
padding: 5px;
border-radius: 10px;
background: rgba(255,255,255,0.02);
border-color: rgba(255,255,255,0.04);
box-shadow: none;
}

#board {
--board-size: min(94vw, 54vh);
width: calc(var(--board-size) * var(--board-scale));
height: calc(var(--board-size) * var(--board-scale));
max-width: none;
max-height: none;
}

/* Controls column: sits below the board, full width, row-like */
.controls-column {
flex: 0 0 auto;
width: 96vw;
flex-direction: column;
gap: 6px;
overflow-y: auto;
}

/* Main controls panel (roll, dice, turn indicator) */
.board-controls-top-right.controls {
padding: 8px 10px;
gap: 6px;
border-radius: 10px;
}

/* Action buttons row panel */
.board-controls-middle-right {
padding: 0;
background: none;
border: none;
box-shadow: none;
}

/* Roll button */
#roll-btn {
height: var(--action-h);
min-height: var(--action-h);
font-size: 1rem;
border-radius: 10px;
}

/* Action buttons — consistent equal-height pair */
.action-buttons {
min-height: var(--action-h);
gap: 8px;
}
.action-buttons .btn-primary,
.action-buttons .btn-secondary {
height: var(--action-h);
min-height: var(--action-h);
font-size: 0.9rem;
border-radius: 10px;
}

.turn-indicator {
font-size: 0.82rem;
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

/* Dice — compact */
.dice-container { height: 46px; gap: 6px; }
.stick-dice { width: 30px; height: 46px; padding: 4px 0; border-radius: 7px; }
.dot { width: 5px; height: 5px; }
.dice-total { font-size: 0.85rem; }

/* Finished tokens */
.finished-container { padding: 7px; }
.finished-container h3 { font-size: 0.78rem; margin-bottom: 4px; }
.finished-zone { width: clamp(36px, 10vw, 48px); min-height: 28px; }
}

/* ============================================================
MOBILE LANDSCAPE (≤768px, landscape)
Layout: row — board left, controls column right
Board is sized to leave exactly --controls-w on the right
============================================================ */
@media (max-width: 768px) and (orientation: landscape) {
:root {
--action-h: 42px;
--controls-w: clamp(150px, 24vw, 210px);
}

body { overflow: hidden; height: 100svh; }
.game-container { height: 100svh; overflow: hidden; }

header { padding: 2px 56px 1px; flex: 0 0 auto; }
header h1 { font-size: clamp(0.82rem, 2.4vw, 0.95rem); line-height: 1; }

.menu-btn { top: 4px; left: 8px; width: 36px; height: 36px; font-size: 0.95rem; }

/* Row layout */
.main-content {
flex-direction: row;
align-items: center;
justify-content: center;
gap: 6px;
padding: 3px 6px 5px;
height: calc(100svh - 30px);
overflow: hidden;
}

/* Board wrapper: just enough padding, no decorative chrome */
.board-wrapper {
flex: 0 0 auto;
padding: 4px;
background: rgba(255,255,255,0.02);
border: 1px solid rgba(255,255,255,0.05);
box-shadow: none;
border-radius: 8px;
}

/* Board: square that fits in the remaining space */
#board {
--board-size: min(
calc(100vw - var(--controls-w) - 22px),
calc(100svh - 34px)
);
width: calc(var(--board-size) * var(--board-scale));
height: calc(var(--board-size) * var(--board-scale));
max-width: none;
max-height: none;
}

/* Controls column: right side, fixed width */
.controls-column {
flex: 0 0 var(--controls-w);
width: var(--controls-w);
flex-direction: column;
justify-content: center;
gap: 5px;
overflow-y: auto;
overflow-x: hidden;
scrollbar-width: thin;
}

/* All board-controls panels: in-flow, full column width */
.board-controls {
position: relative;
width: 100%;
right: auto; top: auto; bottom: auto; left: auto;
transform: none;
}

/* Main controls panel */
.board-controls-top-right.controls {
padding: 6px 8px;
gap: 5px;
border-radius: 10px;
}

/* Action buttons panel */
.board-controls-middle-right {
background: none;
border: none;
box-shadow: none;
padding: 0;
}

/* Roll button */
#roll-btn {
height: var(--action-h);
min-height: var(--action-h);
font-size: clamp(0.78rem, 1.9vw, 0.9rem);
border-radius: 9px;
margin-bottom: 0;
}

/* Action buttons — same height as roll button, equal width */
.action-buttons {
min-height: var(--action-h);
gap: 6px;
}
.action-buttons .btn-primary,
.action-buttons .btn-secondary {
height: var(--action-h);
min-height: var(--action-h);
font-size: clamp(0.72rem, 1.7vw, 0.84rem);
border-radius: 9px;
padding: 0 6px;
}

.turn-indicator {
font-size: clamp(0.68rem, 1.5vw, 0.78rem);
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

/* Dice */
.dice-container { height: clamp(32px, 5.5vh, 44px); gap: 5px; }
.stick-dice {
width: clamp(22px, 3.5vw, 30px);
height: clamp(32px, 5.5vh, 44px);
padding: 3px 0;
border-radius: 6px;
}
.dot { width: 4px; height: 4px; }
.dice-total { font-size: clamp(0.7rem, 1.5vw, 0.82rem); }

/* Finished tokens */
.finished-container { padding: 5px; }
.finished-container h3 { font-size: 0.72rem; margin-bottom: 3px; }
.finished-zone { width: clamp(28px, 4.5vw, 40px); min-height: 24px; }
.base-container .token { width: 18px; height: 18px; }
.base-title { font-size: 0.65rem; }
}

/* ---------- Very short landscape (e.g. iPhone SE) ---------- */
@media (max-width: 768px) and (orientation: landscape) and (max-height: 360px) {
:root {
--action-h: 34px;
--controls-w: clamp(130px, 22vw, 180px);
}
header h1 { font-size: 0.78rem; }
.controls { padding: 4px 6px; gap: 3px; }
#roll-btn { font-size: 0.74rem; }
.action-buttons .btn-primary,
.action-buttons .btn-secondary { font-size: 0.7rem; }
.dice-container { height: 28px; }
.stick-dice { height: 28px; width: 20px; }
.turn-indicator { font-size: 0.64rem; }
.dice-total { font-size: 0.65rem; }
}

/* ---------- Very small portrait phones (≤390px) ---------- */
@media (max-width: 390px) and (orientation: portrait) {
#board { --board-size: min(93vw, 50vh); }
.controls { padding: 6px 8px; gap: 4px; }
.dice-container { height: 40px; }
.stick-dice { height: 40px; width: 28px; }
}

/* ============================================================
ACCESSIBILITY
============================================================ */
@media (prefers-reduced-motion: reduce) {
.stick-dice.rolling,
.token-selectable,
.chain-highlight,
.token { animation: none !important; transition: none !important; }
}

/* ============================================================
TUTORIAL OVERLAY
============================================================ */
.tutorial-overlay {
position: fixed;
inset: 0;
z-index: 650;
background: rgba(8,10,18,0.76);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
padding: 16px;
}
.tutorial-overlay.is-hidden { display: none; }

.tutorial-card {
width: min(92vw, 760px);
max-height: min(84vh, 760px);
overflow-y: auto;
background: rgba(18,20,36,0.96);
border: 1px solid rgba(255,255,255,0.2);
border-radius: 16px;
box-shadow: 0 18px 48px rgba(0,0,0,0.45);
padding: 16px 16px 14px;
position: relative;
}
.tutorial-card h2 {
margin-right: 40px;
margin-bottom: 10px;
font-size: clamp(1.1rem, 2.6vw, 1.45rem);
}
.tutorial-step h3 { margin: 0 0 8px; font-size: 1.05rem; }
.tutorial-step p { color: var(--text-secondary); margin-bottom: 8px; }
.tutorial-step ul { padding-left: 20px; margin-bottom: 10px; }
.tutorial-step li { margin-bottom: 6px; }
.tutorial-step pre {
background: rgba(255,255,255,0.06);
border: 1px solid rgba(255,255,255,0.14);
border-radius: 10px;
padding: 10px;
font-size: 0.88rem;
white-space: pre-wrap;
}
.tutorial-nav {
display: flex;
flex-wrap: wrap;
gap: 8px;
justify-content: flex-end;
margin-top: 12px;
}
.tutorial-close {
position: absolute;
top: 10px;
right: 12px;
background: transparent;
border: none;
color: #f8fbff;
font-size: 1.9rem;
line-height: 1;
cursor: pointer;
padding: 2px 4px;
}
.tutorial-highlight { position: relative; }
.tutorial-highlight::after {
content: "";
position: absolute;
inset: 3px;
border-radius: 8px;
border: 1px solid rgba(255,210,80,0.7);
box-shadow: 0 0 8px rgba(255,210,80,0.6);
animation: tutorialPulse 1.9s ease-in-out infinite;
pointer-events: none;
}
@keyframes tutorialPulse {
0%, 100% { opacity: 0.35; transform: scale(1); }
50% { opacity: 0.9; transform: scale(1.02); }
}
@media (prefers-reduced-motion: reduce) {
.tutorial-highlight::after { animation: none; opacity: 0.7; }
}
/* ── Action buttons centered on each player base ── */
.pasa-action-p1 {
top: calc((4.5 / 18) * 100%);
left: calc((15.5 / 18) * 100%);
transform: translate(-50%, -50%);
flex-direction: column;
gap: 8px;
}
.pasa-action-p2 {
top: calc((15.5 / 18) * 100%);
left: calc((15.5 / 18) * 100%);
transform: translate(-50%, -50%);
flex-direction: column;
gap: 8px;
}
.pasa-action .btn-primary,
.pasa-action .btn-secondary {
width: 110px;
height: 36px;
min-height: 36px;
font-size: 0.78rem;
border-radius: 20px;
padding: 0 10px;
}
/* ── Action buttons inside player bases ── */
.action-buttons {
position: absolute;
display: flex;
flex-direction: column;
gap: 8px;
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: opacity 0.18s ease;
z-index: 50;
width: auto;
min-height: unset;
}
.action-buttons.is-visible {
opacity: 1;
visibility: visible;
pointer-events: auto;
}
/* P1 buttons — centered in base-p1 */
#action-container {
top: calc((4.5 / 18) * 100%);
left: calc((15.5 / 18) * 100%);
width: 120px;
transform: translate(-50%, -50%);
right: auto;
bottom: auto;
}
/* P2 buttons — centered in base-p2 */
#action-container-p2 {
top: calc((15.5 / 18) * 100%);
left: calc((15.5 / 18) * 100%);
width: 120px;
transform: translate(-50%, -100%);
right: auto;
bottom: auto;
}
.action-buttons .btn-primary,
.action-buttons .btn-secondary {
width: 120px;
height: 36px;
min-height: 36px;
flex: none;
font-size: 0.8rem;
border-radius: 20px;
padding: 0 10px;
}
/* ============================================================
DICE OVERLAY ANIMATION (used by dice-anim.js)
============================================================ */

/* Wrapper sits on top of the board, pointer-events off */
.dice-overlay-wrap {
position: absolute;
inset: 0;
pointer-events: none;
z-index: 40;
overflow: hidden;
border-radius: inherit;
}

/* Trail stripe that grows along the left arm as dice travel */
.dice-trail {
position: absolute;
border-radius: 6px;
background: transparent;
border: 0;
opacity: 0;
transition: opacity 0.3s ease;
pointer-events: none;
}

/* Direction arrows floating ahead of the stack */
.dice-arrows {
position: absolute;
text-align: center;
font-size: 13px;
font-weight: 700;
letter-spacing: 4px;
opacity: 0;
pointer-events: none;
transition: opacity 0.18s ease;
display: none;
}

/* The three-dice stack */
.dice-stack {
position: absolute;
display: flex;
flex-direction: column;
gap: 3px;
pointer-events: none;
}

/* Each individual overlay stick — horizontal */
.overlay-stick {
border-radius: 7px;
border: 1px solid #7d603a;
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
box-shadow: 1px 3px 8px rgba(0, 0, 0, 0.6);
overflow: hidden;
}
.overlay-stick.os-light {
background: linear-gradient(to bottom, #cfb489, #fdeca1, #b5905d);
}
.overlay-stick.os-dark {
background: linear-gradient(to bottom, #2e2e2e, #1a1a1a, #282828);
border-color: #555;
}

/* Dot columns inside each stick */
.os-dot-col {
display: flex;
flex-direction: column;
gap: 2px;
align-items: center;
justify-content: center;
height: 100%;
padding: 3px 0;
}
.os-dot {
border-radius: 50%;
flex-shrink: 0;
}
.overlay-stick.os-light .os-dot { background: #111; }
.overlay-stick.os-dark .os-dot { background: #f8312f; }

/* Dim the board slightly while dice are rolling */
.board-wrapper.dice-rolling #board {
opacity: 0.72;
transition: opacity 0.2s ease;
}
.board-wrapper #board {
transition: opacity 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
.overlay-stick { animation: none !important; }
}/* ============================================================
PASA GAME - Responsive & Eye-Friendly Stylesheet
Supports: Mobile portrait, Mobile landscape, Tablet, Desktop
============================================================ */

/* ------- Design Tokens ------- */
:root {
--bg-deep: #12131f;
--bg-mid: #1c1e30;
--bg-panel: rgba(255, 255, 255, 0.075);
--bg-panel-border: rgba(255, 255, 255, 0.16);

--text-primary: #eef0f6;
--text-secondary: #9ca3b8;
--text-muted: #5a6080;

--accent-red: #f8312f;
--accent-yellow: #ffe600;
--accent-green: #00c86b;

--cell-light: #E8EDEE;
--cell-dark: #2a7a7b;
--cell-green: #5ecf87;
--cell-center: #F6AD55;

--touch-min: 48px;
--board-scale: 1;
--panel-scale: 1;
--controls-w: clamp(200px, 22vw, 300px);

--radius-sm: 8px;
--radius-md: 14px;
--radius-lg: 22px;
--radius-xl: 30px;

/* Action button height — unified across all layouts */
--action-h: 48px;
}

/* ------- Reset ------- */
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}

html { height: 100%; }

body {
min-height: 100%;
background: linear-gradient(160deg, #0e0f1c 0%, #1c1e30 50%, #0e0f1c 100%);
color: var(--text-primary);
font-family: 'Outfit', system-ui, -apple-system, sans-serif;
font-size: 17px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
overscroll-behavior: none;
touch-action: manipulation;
}

/* ------- Setup Screen ------- */
.setup-screen {
position: fixed;
inset: 0;
z-index: 500;
display: flex;
align-items: center;
justify-content: center;
padding: 16px;
background: rgba(8, 10, 18, 0.88);
backdrop-filter: blur(8px);
}
.setup-screen.is-hidden { display: none; }

.setup-card {
width: min(92vw, 520px);
background: rgba(18, 20, 36, 0.96);
border: 1px solid rgba(255, 255, 255, 0.16);
border-radius: 16px;
padding: 18px 16px;
display: flex;
flex-direction: column;
gap: 12px;
box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}
.setup-card h2 { text-align: center; font-size: 1.5rem; }

.setup-section { display: flex; flex-direction: column; gap: 8px; }
.setup-section h3 { font-size: 1rem; color: var(--text-secondary); }

.setup-options {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 8px;
}

.online-panel.is-hidden { display: none; }

.online-row {
display: grid;
grid-template-columns: minmax(120px, 1fr) auto auto;
gap: 8px;
}

#room-id-input {
min-height: 44px;
border-radius: 10px;
border: 1px solid rgba(255, 255, 255, 0.22);
background: rgba(255, 255, 255, 0.06);
color: #fff;
padding: 0 10px;
}

.online-status { font-size: 0.86rem; color: var(--text-secondary); }

.setup-option-btn {
min-height: 48px;
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.2);
background: rgba(255, 255, 255, 0.06);
color: var(--text-primary);
font-size: 16px;
font-weight: 700;
padding: 10px 12px;
cursor: pointer;
}
.setup-option-btn.is-selected {
border-color: #4dd9ff;
background: rgba(77, 217, 255, 0.2);
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.24) inset;
}
.setup-start-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============================================================
TOP-LEVEL LAYOUT
game-container is always column: header + main-content
main-content is row on desktop/landscape, column on portrait
============================================================ */

.game-container {
display: flex;
flex-direction: column;
width: 100%;
height: 100svh;
min-height: 100svh;
overflow: hidden;
}

/* ------- Header ------- */
header {
flex: 0 0 auto;
text-align: center;
padding: 10px 56px 4px;
z-index: 10;
}
header h1 {
font-size: clamp(1.4rem, 3.6vw, 2.6rem);
font-weight: 600;
letter-spacing: 0.05em;
background: linear-gradient(90deg, #ff8c8c, #f8312f);
background-clip: text;
-webkit-background-clip: text;
color: transparent;
-webkit-text-fill-color: transparent;
line-height: 1;
}

/* ------- Hamburger menu ------- */
.menu-btn {
position: fixed;
top: 12px;
left: 12px;
z-index: 300;
background: rgba(20, 22, 40, 0.92);
color: #fff;
border: 1px solid rgba(255, 255, 255, 0.22);
border-radius: var(--radius-md);
padding: 0;
width: var(--touch-min);
height: var(--touch-min);
font-size: 1.25rem;
font-weight: 700;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
-webkit-tap-highlight-color: transparent;
}

.menu-panel {
position: fixed;
top: 70px;
left: 12px;
z-index: 300;
background: rgba(18, 20, 36, 0.97);
border: 1px solid rgba(255, 255, 255, 0.18);
border-radius: var(--radius-md);
padding: 10px;
display: none;
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.menu-panel.is-open { display: block; }

.ui-size-settings {
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid rgba(255, 255, 255, 0.14);
display: grid;
gap: 6px;
}
.ui-size-row {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.82rem;
color: var(--text-secondary);
font-weight: 600;
}
.ui-size-row output {
color: #d8deef;
font-weight: 700;
font-variant-numeric: tabular-nums;
}
.ui-size-slider { width: 100%; accent-color: #4dd9ff; }

.menu-action-btn,
.menu-restart-btn {
width: 220px;
margin-bottom: 8px;
}
.menu-action-btn:last-child,
.menu-restart-btn:last-child { margin-bottom: 0; }

/* ============================================================
MAIN CONTENT — desktop default (row layout)
board on left, controls-column on right
============================================================ */
.main-content {
flex: 1 1 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
gap: clamp(10px, 1.4vw, 18px);
padding: 8px 12px 12px;
overflow: hidden;
min-height: 0;
}

/* ------- Board wrapper ------- */
.board-wrapper {
position: relative;
flex: 0 0 auto;
display: flex;
justify-content: center;
align-items: center;
padding: clamp(8px, 1.2vw, 14px);
background: rgba(255, 255, 255, 0.05);
border-radius: var(--radius-lg);
border: 1px solid rgba(255, 255, 255, 0.09);
box-shadow: 0 10px 44px rgba(0, 0, 0, 0.46);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}

.board-wrapper.rotate-for-p1-online #board {
transform: rotate(180deg);
}

/* Board: always square, sized to fit viewport */
#board {
--board-size: min(
calc(100vw - 24px),
calc(100svh - 80px)
);
width: calc(var(--board-size) * var(--board-scale));
height: calc(var(--board-size) * var(--board-scale));
max-width: 1120px;
max-height: 1120px;
aspect-ratio: 1 / 1;
flex-shrink: 0;
}

.board {
width: 100%;
height: 100%;
display: grid;
grid-template-columns: repeat(19, 1fr);
grid-template-rows: repeat(19, 1fr);
background: transparent;
gap: 0;
}

/* ------- Controls column hidden ------- */
.controls-column { display: none !important; }
.board-controls { display: none !important; }

/* ------- Dice arm on left arm of board (rows 9-11, cols 1-8) ------- */
#dice-arm {
grid-row: 9 / span 3;
grid-column: 1 / span 8;
display: flex;
flex-direction: column;
gap: 6px;
justify-content: center;
align-items: center;
z-index: 20;
cursor: pointer;
background: none;
padding: 0;
position: relative;
}
#dice-arm-total {
position: absolute;
bottom: -14px;
left: 50%;
transform: translateX(-50%);
font-size: 10px;
font-weight: 700;
color: rgba(255,255,255,0.5);
white-space: nowrap;
pointer-events: none;
}

/* Allow dice to overflow during roll animation */
#dice-arm,
.board,
#board,
.board-wrapper {
overflow: visible !important;
}

/* ------- Floating action buttons per player ------- */
.pasa-action {
position: absolute;
display: flex;
flex-direction: row;
gap: 6px;
z-index: 50;
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: opacity 0.18s ease;
}
.pasa-action.is-visible {
opacity: 1;
visibility: visible;
pointer-events: auto;
}
/* P1 buttons top-right (near base-p1) */
.pasa-action-p1 {
top: 8%;
right: 3%;
}
/* P2 buttons bottom-right (near base-p2) */
.pasa-action-p2 {
bottom: 8%;
right: 3%;
}
.pasa-action .btn-primary,
.pasa-action .btn-secondary {
height: 36px;
min-height: 36px;
width: auto;
flex: none;
padding: 0 14px;
font-size: 0.8rem;
border-radius: 20px;
}

/* ------- Controls panel ------- */
.controls {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 10px;
background: var(--bg-panel);
padding: 12px;
border-radius: var(--radius-lg);
border: 1px solid var(--bg-panel-border);
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.34);
}

/* ------- Board resize handle ------- */
.board-resize-handle {
position: absolute;
right: 8px;
bottom: 8px;
width: 18px;
height: 18px;
border-radius: 5px;
border: 1px solid rgba(255, 255, 255, 0.32);
background: rgba(255, 255, 255, 0.14);
cursor: nwse-resize;
z-index: 30;
touch-action: none;
}
.board-resize-handle::before {
content: '';
position: absolute;
inset: 4px;
border-right: 2px solid rgba(255, 255, 255, 0.65);
border-bottom: 2px solid rgba(255, 255, 255, 0.65);
}

/* ------- Turn indicator ------- */
.turn-indicator {
color: var(--text-secondary);
font-weight: 760;
font-size: clamp(0.9rem, 1.6vw, 1.2rem);
text-align: center;
line-height: 1.4;
letter-spacing: 0.01em;
}

/* ============================================================
BUTTONS — unified, consistent across all breakpoints
--action-h controls the height of all action buttons.
Never override height per-breakpoint; only override font-size.
============================================================ */

/* Base for all interactive buttons */
.btn-primary,
.btn-secondary {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: var(--action-h);
min-height: var(--action-h);
border-radius: var(--radius-xl);
font-family: inherit;
font-weight: 700;
font-size: clamp(0.85rem, 1.6vw, 1rem);
line-height: 1;
cursor: pointer;
border: none;
transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
-webkit-tap-highlight-color: transparent;
padding: 0 12px;
white-space: nowrap;
}

.btn-primary:hover,
.btn-secondary:hover {
transform: translateY(-2px);
filter: brightness(1.1);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}
.btn-primary:active,
.btn-secondary:active { transform: translateY(1px); }

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.stack-choice-btn:focus-visible,
.setup-option-btn:focus-visible {
outline: 3px solid rgba(77, 217, 255, 0.92);
outline-offset: 2px;
}

/* Secondary (Pull Back) */
.btn-secondary {
background: linear-gradient(135deg, #3a3a4a, #25252f);
color: #eef0f6;
border: 1px solid rgba(255, 255, 255, 0.18);
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}
.btn-secondary:hover { background: linear-gradient(135deg, #4d4f61, #333445); }
.btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Roll button */
#roll-btn {
background: linear-gradient(135deg, #f8312f, #bd1b19);
color: #fff;
border: 3px solid rgba(0,0,0,0.3);
box-shadow: 0 4px 14px rgba(248, 49, 47, 0.4);
margin-bottom: 0;
flex: none;
}
#roll-btn.turn-p1 {
background: linear-gradient(135deg, #f8312f, #bd1b19);
border-color: #111;
}
#roll-btn.turn-p2 {
background: linear-gradient(135deg, #ffe600, #cca300);
border-color: #00b86b;
color: #111;
}
#roll-btn.is-hidden {
visibility: hidden;
opacity: 0;
pointer-events: none;
}

/* Confirm Move */
.confirm-action {
background: linear-gradient(135deg, #00c850, #00885a) !important;
color: #fff !important;
box-shadow: 0 4px 14px rgba(0, 200, 80, 0.4) !important;
}

/* Restart */
.restart-action {
background: linear-gradient(135deg, #7c3aed, #4c1d95);
color: #fff;
}

/* ============================================================
ACTION BUTTONS ROW (Pull Back + Confirm Move)
Both buttons are always equal height and equal width (50/50)
============================================================ */
.action-buttons {
display: flex;
flex-direction: row;
gap: 8px;
width: 100%;
align-items: stretch;
/* Reserve space even when hidden so layout doesn't jump */
min-height: var(--action-h);
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: opacity 0.18s ease;
}
.action-buttons.is-visible {
opacity: 1;
visibility: visible;
pointer-events: auto;
}
.action-buttons .btn-primary,
.action-buttons .btn-secondary {
flex: 1 1 0; /* equal width */
width: 0; /* let flex grow decide, not content */
height: var(--action-h);
min-height: var(--action-h);
}
.action-buttons .btn-hidden {
opacity: 0;
visibility: hidden;
pointer-events: none;
}

/* ------- Dice ------- */
.dice-container {
display: flex;
flex-direction: column;
gap: 8px;
justify-content: center;
align-items: center;
}
#dice-arm .stick-dice {
width: 150px;
height: 50px;
background: linear-gradient(180deg, #E3BE4F 0%, #bc8952 100%);
border-radius: 999px;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 6px rgba(0, 0, 0, 0.35);
border: 1px solid rgba(86, 53, 26, 0.55);
display: flex;
justify-content: center;
align-items: center;
padding: 9px;
flex-shrink: 0;
}
/* Player 1: rolls from top of board down to dice arm (at bottom) */
@keyframes rollDown {
0% { transform: translateY(var(--travel-start, -500px)); opacity: 0; }
8% { opacity: 1; }
100% { transform: translateY(0px); opacity: 1; }
}

/* Player 2: rolls from bottom of board up to dice arm (at top) */
@keyframes rollUp {
0% { transform: translateY(var(--travel-start, 500px)); opacity: 0; }
8% { opacity: 1; }
100% { transform: translateY(0px); opacity: 1; }
}

.stick-dice.roll-down {
animation: rollDown 2.5s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.stick-dice.roll-up {
animation: rollUp 2.5s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
@keyframes rollStick {
0% { transform: rotateX(0deg); }
100% { transform: rotateX(36000deg); }
}
.dots-container {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
gap: 38px;
padding: 11 8px;
}
/* Each dot-col is a vertical stack of 1 or 2 dots */
.dot-col {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 7px;
height: 100%;
}
.dot-col--center {
justify-content: center;
}
/* Keep legacy dot-row hidden (not used anymore) */
.dot-row { display: none; }
.dot-row--center { display: none; }
.dot {
width: 11px;
height: 11px;
background-color: #111;
border-radius: 50%;
box-shadow: none;
}
.dice-fallback-value {
margin: auto;
font-weight: 800;
font-size: clamp(0.8rem, 1.1vw, 1rem);
color: #121212;
}
.dice-total {
font-size: clamp(1rem, 1.6vw, 1.2rem);
font-weight: 800;
color: #ff8c8c;
text-align: center;
text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* ------- Cells ------- */
.cell {
width: 100%;
height: 100%;
border: 0.5px solid rgba(0,0,0,0.14);
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
gap: 1px;
}
.cell-red { background-color: var(--cell-light); }
.cell-black { background-color: var(--cell-dark); }
.cell-green { background-color: var(--cell-green); }
.home-cell { background-color: #F6AD55 !important; }
.counting-marker-cell { background-color: var(--cell-center) !important; }

/* ------- Center block ------- */
.center-block {
background-color: var(--cell-center);
border: 1px solid rgba(0,0,0,0.2);
position: relative;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-content: center;
gap: 2px;
padding: 3px;
overflow: hidden;
}
.center-block .token { width: 22%; height: 22%; }

/* ------- Special zone ------- */
.special-zone {
position: relative;
border: 1px solid rgba(0,0,0,0.28);
overflow: hidden;
background-color: #d1c8b8;
background-image:
linear-gradient(45deg, transparent 45%, #f8312f 45%, #f8312f 55%, transparent 55%),
linear-gradient(-45deg, transparent 45%, #00b86b 45%, #00b86b 55%, transparent 55%),
linear-gradient(90deg, transparent 49%, #888 49%, #888 51%, transparent 51%),
linear-gradient(0deg, transparent 49%, #888 49%, #888 51%, transparent 51%);
background-size: 100% 100%;
}
.special-zone::after {
content: '';
position: absolute;
inset: 10%;
border: 2px dashed rgba(0,0,0,0.25);
}

/* ------- Tokens ------- */
.token {
position: relative;
width: 40%;
height: 40%;
border-radius: 50% 50% 15% 15%;
box-shadow:
0 3px 6px rgba(0,0,0,0.4),
inset 0 -3px 5px rgba(0,0,0,0.2),
inset 0 2px 3px rgba(255,255,255,0.4);
z-index: 10;
cursor: pointer;
transition: transform 0.18s ease;
display: flex;
justify-content: center;
-webkit-tap-highlight-color: transparent;
}
.token:hover { transform: scale(1.12); }
.token:active { transform: scale(0.96); }
.token::after {
content: '';
position: absolute;
top: 5%;
width: 40%;
height: 40%;
border-radius: 50%;
box-shadow: inset 0 -2px 3px rgba(0,0,0,0.2), inset 0 2px 3px rgba(255,255,255,0.4);
}
.token-red { background: radial-gradient(circle at 30% 30%, #ff5555, #cc0000); }
.token-red::after { background-color: #111; }
.token-black { background: radial-gradient(circle at 30% 30%, #555, #111); }
.token-black::after { background-color: #f8312f; }
.token-yellow { background: radial-gradient(circle at 30% 30%, #ffe600, #cca300); }
.token-yellow::after { background-color: #00b86b; }
.token-green { background: radial-gradient(circle at 30% 30%, #00e68a, #00995c); }
.token-green::after { background-color: #ffe600; }

/* ------- Base containers ------- */
.base-container {
background: rgba(0,0,0,0.35);
border: 2px dashed rgba(255,255,255,0.25);
border-radius: var(--radius-md);
display: flex;
flex-wrap: wrap;
gap: 6px;
padding: 8px;
justify-content: center;
align-content: flex-start;
}
.base-container .token {
width: clamp(18px, 2.2vw, 26px);
height: clamp(18px, 2.2vw, 26px);
}
.base-title {
width: 100%;
text-align: center;
font-size: clamp(0.88rem, 1vw, 1rem);
color: var(--text-secondary);
margin-bottom: 4px;
font-weight: 600;
}
.base-p1 {
background: linear-gradient(135deg, rgba(248,49,47,0.08), rgba(40,40,50,0.25));
border-color: rgba(248,49,47,0.35);
width: 100%; height: 100%; box-sizing: border-box;
}
.base-p2 {
background: linear-gradient(135deg, rgba(255,230,0,0.07), rgba(40,40,50,0.25));
border-color: rgba(255,230,0,0.35);
width: 100%; height: 100%; box-sizing: border-box;
}

/* ------- Finished container ------- */
.finished-container {
background: rgba(0,0,0,0.35);
padding: 10px;
border-radius: var(--radius-md);
text-align: center;
}
.hidden-finished { display: none !important; }
.finished-container h3 {
margin-bottom: 8px;
font-size: clamp(0.88rem, 1.2vw, 1rem);
color: #ffd700;
font-weight: 700;
}
.finished-row {
display: flex;
justify-content: center;
gap: 8px;
margin-bottom: 6px;
}
.finished-zone {
width: clamp(40px, 4.5vw, 56px);
min-height: 34px;
border: 2px dashed rgba(255,255,255,0.25);
border-radius: var(--radius-sm);
display: flex;
flex-wrap: wrap;
gap: 2px;
padding: 2px;
justify-content: center;
align-items: center;
}
.red-zone { background: rgba(255,60,60,0.1); border-color: #ff3c3c; }
.black-zone { background: rgba(50,50,50,0.5); border-color: #555; }
.yellow-zone { background: rgba(255,230,0,0.1); border-color: #ffe600; }
.green-zone { background: rgba(0,200,80,0.1); border-color: #00c850; }

/* ------- Highlights ------- */
.token-selected {
filter: brightness(1.28) drop-shadow(0 0 9px rgba(255,255,255,0.95));
transform: scale(1.15) !important;
}
.token-selectable {
animation: tokenPulse 1.4s infinite alternate;
cursor: pointer;
}
@keyframes tokenPulse {
from { filter: brightness(1); }
to { filter: brightness(1.3) drop-shadow(0 0 4px rgba(255,255,180,0.8)); }
}
.token-manual-selected {
box-shadow: 0 0 14px 5px rgba(80,208,255,0.9), inset 0 -3px 5px rgba(0,0,0,0.2) !important;
transform: scale(1.15);
}
.cell-highlight {
background-color: rgba(248,240,100,0.62) !important;
border: 2px solid rgba(255,255,255,0.95);
box-shadow: 0 0 0 2px rgba(255,255,255,0.28) inset, 0 0 8px rgba(248,240,100,0.45);
cursor: pointer;
z-index: 5;
}
.cell-highlight:hover {
background-color: rgba(248,240,100,0.85) !important;
transform: scale(1.04);
z-index: 20;
}
.single-highlight { border: 2px solid rgba(255,255,255,0.95) !important; }
.pair-highlight {
background-color: rgba(120,220,255,0.62) !important;
border: 4px solid #4dd9ff !important;
box-shadow: 0 0 0 1px rgba(255,255,255,0.44) inset, 0 0 10px rgba(77,217,255,0.45);
}
.stack-choice-bubble {
position: absolute;
transform: translate(-50%, -100%);
display: flex;
gap: 10px;
padding: 10px;
border-radius: 12px;
background: rgba(10,14,28,0.95);
border: 1px solid rgba(255,255,255,0.22);
z-index: 60;
box-shadow: 0 10px 24px rgba(0,0,0,0.5);
max-width: calc(100% - 12px);
}
.stack-choice-btn {
border: 1px solid rgba(255,255,255,0.24);
background: rgba(255,255,255,0.08);
color: #eef0f6;
border-radius: 10px;
padding: 10px 16px;
min-height: 44px;
font-size: clamp(0.9rem, 1.3vw, 1rem);
font-weight: 700;
line-height: 1.1;
cursor: pointer;
}
.stack-choice-btn:hover {
background: rgba(77,217,255,0.22);
border-color: rgba(77,217,255,0.75);
}
.stack-choice-btn:focus-visible {
outline: 3px solid rgba(77,217,255,0.92);
outline-offset: 2px;
}
.chain-highlight {
background-color: rgba(255,215,0,0.68) !important;
border: 3px solid #ffd700 !important;
animation: goldPulse 1.5s infinite alternate;
}
@keyframes goldPulse {
from { box-shadow: 0 0 4px 2px rgba(255,215,0,0.5); }
to { box-shadow: 0 0 14px 5px rgba(255,215,0,0.9); }
}
.requires-double-high {
border: 3px solid #ff0000 !important;
opacity: 0.8;
}
.requires-double-high::before {
content: '!';
position: absolute;
top: -14px;
left: 50%;
transform: translateX(-50%);
color: #ff3c3c;
font-weight: 800;
font-size: 18px;
text-shadow: 0 0 2px white;
}

/* ============================================================
RESPONSIVE BREAKPOINTS
============================================================ */

/* ---------- Large desktop (1280px+) ---------- */
@media (min-width: 1280px) {
:root { --controls-w: clamp(240px, 22vw, 320px); }
#board {
--board-size: min(
calc(100vw - var(--controls-w) - 80px),
calc(100svh - 80px)
);
}
}

/* ---------- Standard desktop ---------- */
@media (max-width: 1280px) and (min-width: 1025px) {
:root { --controls-w: clamp(200px, 20vw, 280px); }
#board {
--board-size: min(
calc(100vw - var(--controls-w) - 60px),
calc(100svh - 80px)
);
}
}

/* ---------- Tablet landscape (769px–1024px) ---------- */
@media (max-width: 1024px) and (min-width: 769px) {
:root { --controls-w: clamp(180px, 22vw, 240px); }
.main-content { gap: 10px; padding: 6px 10px 10px; }
#board {
--board-size: min(
calc(100vw - var(--controls-w) - 40px),
calc(100svh - 72px)
);
}
.controls { gap: 8px; padding: 10px; }
.btn-primary, .btn-secondary { font-size: 0.9rem; }
.dice-container { height: clamp(52px, 9vh, 80px); }
.stick-dice { height: clamp(52px, 9vh, 80px); width: clamp(26px, 3vw, 36px); }
}

/* ============================================================
MOBILE PORTRAIT (≤768px, portrait)
Layout: column — board top, controls below
============================================================ */
@media (max-width: 768px) and (orientation: portrait) {
:root {
--action-h: 46px;
--controls-w: 100%;
}

body { overflow: hidden; height: 100svh; }

.game-container { height: 100svh; overflow: hidden; }

header {
padding: 4px 50px 2px;
}
header h1 { font-size: clamp(1rem, 4vw, 1.3rem); line-height: 1.1; }

.menu-btn { top: 6px; left: 8px; width: 40px; height: 40px; font-size: 1rem; }

/* Column layout: board on top, controls below */
.main-content {
flex-direction: column;
align-items: center;
justify-content: flex-start;
gap: 6px;
padding: 4px 6px 8px;
height: calc(100svh - 40px);
overflow: hidden;
}

.board-wrapper {
flex: 0 0 auto;
width: 96vw;
padding: 5px;
border-radius: 10px;
background: rgba(255,255,255,0.02);
border-color: rgba(255,255,255,0.04);
box-shadow: none;
}

#board {
--board-size: min(94vw, 54vh);
width: calc(var(--board-size) * var(--board-scale));
height: calc(var(--board-size) * var(--board-scale));
max-width: none;
max-height: none;
}

/* Controls column: sits below the board, full width, row-like */
.controls-column {
flex: 0 0 auto;
width: 96vw;
flex-direction: column;
gap: 6px;
overflow-y: auto;
}

/* Main controls panel (roll, dice, turn indicator) */
.board-controls-top-right.controls {
padding: 8px 10px;
gap: 6px;
border-radius: 10px;
}

/* Action buttons row panel */
.board-controls-middle-right {
padding: 0;
background: none;
border: none;
box-shadow: none;
}

/* Roll button */
#roll-btn {
height: var(--action-h);
min-height: var(--action-h);
font-size: 1rem;
border-radius: 10px;
}

/* Action buttons — consistent equal-height pair */
.action-buttons {
min-height: var(--action-h);
gap: 8px;
}
.action-buttons .btn-primary,
.action-buttons .btn-secondary {
height: var(--action-h);
min-height: var(--action-h);
font-size: 0.9rem;
border-radius: 10px;
}

.turn-indicator {
font-size: 0.82rem;
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

/* Dice — compact */
.dice-container { height: 46px; gap: 6px; }
.stick-dice { width: 30px; height: 46px; padding: 4px 0; border-radius: 7px; }
.dot { width: 5px; height: 5px; }
.dice-total { font-size: 0.85rem; }

/* Finished tokens */
.finished-container { padding: 7px; }
.finished-container h3 { font-size: 0.78rem; margin-bottom: 4px; }
.finished-zone { width: clamp(36px, 10vw, 48px); min-height: 28px; }
}

/* ============================================================
MOBILE LANDSCAPE (≤768px, landscape)
Layout: row — board left, controls column right
Board is sized to leave exactly --controls-w on the right
============================================================ */
@media (max-width: 768px) and (orientation: landscape) {
:root {
--action-h: 42px;
--controls-w: clamp(150px, 24vw, 210px);
}

body { overflow: hidden; height: 100svh; }
.game-container { height: 100svh; overflow: hidden; }

header { padding: 2px 56px 1px; flex: 0 0 auto; }
header h1 { font-size: clamp(0.82rem, 2.4vw, 0.95rem); line-height: 1; }

.menu-btn { top: 4px; left: 8px; width: 36px; height: 36px; font-size: 0.95rem; }

/* Row layout */
.main-content {
flex-direction: row;
align-items: center;
justify-content: center;
gap: 6px;
padding: 3px 6px 5px;
height: calc(100svh - 30px);
overflow: hidden;
}

/* Board wrapper: just enough padding, no decorative chrome */
.board-wrapper {
flex: 0 0 auto;
padding: 4px;
background: rgba(255,255,255,0.02);
border: 1px solid rgba(255,255,255,0.05);
box-shadow: none;
border-radius: 8px;
}

/* Board: square that fits in the remaining space */
#board {
--board-size: min(
calc(100vw - var(--controls-w) - 22px),
calc(100svh - 34px)
);
width: calc(var(--board-size) * var(--board-scale));
height: calc(var(--board-size) * var(--board-scale));
max-width: none;
max-height: none;
}

/* Controls column: right side, fixed width */
.controls-column {
flex: 0 0 var(--controls-w);
width: var(--controls-w);
flex-direction: column;
justify-content: center;
gap: 5px;
overflow-y: auto;
overflow-x: hidden;
scrollbar-width: thin;
}

/* All board-controls panels: in-flow, full column width */
.board-controls {
position: relative;
width: 100%;
right: auto; top: auto; bottom: auto; left: auto;
transform: none;
}

/* Main controls panel */
.board-controls-top-right.controls {
padding: 6px 8px;
gap: 5px;
border-radius: 10px;
}

/* Action buttons panel */
.board-controls-middle-right {
background: none;
border: none;
box-shadow: none;
padding: 0;
}

/* Roll button */
#roll-btn {
height: var(--action-h);
min-height: var(--action-h);
font-size: clamp(0.78rem, 1.9vw, 0.9rem);
border-radius: 9px;
margin-bottom: 0;
}

/* Action buttons — same height as roll button, equal width */
.action-buttons {
min-height: var(--action-h);
gap: 6px;
}
.action-buttons .btn-primary,
.action-buttons .btn-secondary {
height: var(--action-h);
min-height: var(--action-h);
font-size: clamp(0.72rem, 1.7vw, 0.84rem);
border-radius: 9px;
padding: 0 6px;
}

.turn-indicator {
font-size: clamp(0.68rem, 1.5vw, 0.78rem);
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

/* Dice */
.dice-container { height: clamp(32px, 5.5vh, 44px); gap: 5px; }
.stick-dice {
width: clamp(22px, 3.5vw, 30px);
height: clamp(32px, 5.5vh, 44px);
padding: 3px 0;
border-radius: 6px;
}
.dot { width: 4px; height: 4px; }
.dice-total { font-size: clamp(0.7rem, 1.5vw, 0.82rem); }

/* Finished tokens */
.finished-container { padding: 5px; }
.finished-container h3 { font-size: 0.72rem; margin-bottom: 3px; }
.finished-zone { width: clamp(28px, 4.5vw, 40px); min-height: 24px; }
.base-container .token { width: 18px; height: 18px; }
.base-title { font-size: 0.65rem; }
}

/* ---------- Very short landscape (e.g. iPhone SE) ---------- */
@media (max-width: 768px) and (orientation: landscape) and (max-height: 360px) {
:root {
--action-h: 34px;
--controls-w: clamp(130px, 22vw, 180px);
}
header h1 { font-size: 0.78rem; }
.controls { padding: 4px 6px; gap: 3px; }
#roll-btn { font-size: 0.74rem; }
.action-buttons .btn-primary,
.action-buttons .btn-secondary { font-size: 0.7rem; }
.dice-container { height: 28px; }
.stick-dice { height: 28px; width: 20px; }
.turn-indicator { font-size: 0.64rem; }
.dice-total { font-size: 0.65rem; }
}

/* ---------- Very small portrait phones (≤390px) ---------- */
@media (max-width: 390px) and (orientation: portrait) {
#board { --board-size: min(93vw, 50vh); }
.controls { padding: 6px 8px; gap: 4px; }
.dice-container { height: 40px; }
.stick-dice { height: 40px; width: 28px; }
}

/* ============================================================
ACCESSIBILITY
============================================================ */
@media (prefers-reduced-motion: reduce) {
.stick-dice.rolling,
.token-selectable,
.chain-highlight,
.token { animation: none !important; transition: none !important; }
}

/* ============================================================
TUTORIAL OVERLAY
============================================================ */
.tutorial-overlay {
position: fixed;
inset: 0;
z-index: 650;
background: rgba(8,10,18,0.76);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
padding: 16px;
}
.tutorial-overlay.is-hidden { display: none; }

.tutorial-card {
width: min(92vw, 760px);
max-height: min(84vh, 760px);
overflow-y: auto;
background: rgba(18,20,36,0.96);
border: 1px solid rgba(255,255,255,0.2);
border-radius: 16px;
box-shadow: 0 18px 48px rgba(0,0,0,0.45);
padding: 16px 16px 14px;
position: relative;
}
.tutorial-card h2 {
margin-right: 40px;
margin-bottom: 10px;
font-size: clamp(1.1rem, 2.6vw, 1.45rem);
}
.tutorial-step h3 { margin: 0 0 8px; font-size: 1.05rem; }
.tutorial-step p { color: var(--text-secondary); margin-bottom: 8px; }
.tutorial-step ul { padding-left: 20px; margin-bottom: 10px; }
.tutorial-step li { margin-bottom: 6px; }
.tutorial-step pre {
background: rgba(255,255,255,0.06);
border: 1px solid rgba(255,255,255,0.14);
border-radius: 10px;
padding: 10px;
font-size: 0.88rem;
white-space: pre-wrap;
}
.tutorial-nav {
display: flex;
flex-wrap: wrap;
gap: 8px;
justify-content: flex-end;
margin-top: 12px;
}
.tutorial-close {
position: absolute;
top: 10px;
right: 12px;
background: transparent;
border: none;
color: #f8fbff;
font-size: 1.9rem;
line-height: 1;
cursor: pointer;
padding: 2px 4px;
}
.tutorial-highlight { position: relative; }
.tutorial-highlight::after {
content: "";
position: absolute;
inset: 3px;
border-radius: 8px;
border: 1px solid rgba(255,210,80,0.7);
box-shadow: 0 0 8px rgba(255,210,80,0.6);
animation: tutorialPulse 1.9s ease-in-out infinite;
pointer-events: none;
}
@keyframes tutorialPulse {
0%, 100% { opacity: 0.35; transform: scale(1); }
50% { opacity: 0.9; transform: scale(1.02); }
}
@media (prefers-reduced-motion: reduce) {
.tutorial-highlight::after { animation: none; opacity: 0.7; }
}
/* ── Action buttons centered on each player base ── */
.pasa-action-p1 {
top: calc((4.5 / 18) * 100%);
left: calc((15.5 / 18) * 100%);
transform: translate(-50%, -50%);
flex-direction: column;
gap: 8px;
}
.pasa-action-p2 {
top: calc((15.5 / 18) * 100%);
left: calc((15.5 / 18) * 100%);
transform: translate(-50%, -50%);
flex-direction: column;
gap: 8px;
}
.pasa-action .btn-primary,
.pasa-action .btn-secondary {
width: 110px;
height: 36px;
min-height: 36px;
font-size: 0.78rem;
border-radius: 20px;
padding: 0 10px;
}
/* ── Action buttons inside player bases ── */
.action-buttons {
position: absolute;
display: flex;
flex-direction: column;
gap: 8px;
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: opacity 0.18s ease;
z-index: 50;
width: auto;
min-height: unset;
}
.action-buttons.is-visible {
opacity: 1;
visibility: visible;
pointer-events: auto;
}
/* P1 buttons — centered in base-p1 */
#action-container {
top: calc((4.5 / 18) * 100%);
left: calc((15.5 / 18) * 100%);
width: 120px;
transform: translate(-50%, -50%);
right: auto;
bottom: auto;
}
/* P2 buttons — centered in base-p2 */
#action-container-p2 {
top: calc((15.5 / 18) * 100%);
left: calc((15.5 / 18) * 100%);
width: 120px;
transform: translate(-50%, -100%);
right: auto;
bottom: auto;
}
.action-buttons .btn-primary,
.action-buttons .btn-secondary {
width: 120px;
height: 36px;
min-height: 36px;
flex: none;
font-size: 0.8rem;
border-radius: 20px;
padding: 0 10px;
}
/* ============================================================
DICE OVERLAY ANIMATION (used by dice-anim.js)
============================================================ */

/* Wrapper sits on top of the board, pointer-events off */
.dice-overlay-wrap {
position: absolute;
inset: 0;
pointer-events: none;
z-index: 40;
overflow: hidden;
border-radius: inherit;
}

/* Trail stripe that grows along the left arm as dice travel */
.dice-trail {
position: absolute;
border-radius: 6px;
background: transparent;
border: 0;
opacity: 0;
transition: opacity 0.3s ease;
pointer-events: none;
}

/* Direction arrows floating ahead of the stack */
.dice-arrows {
position: absolute;
text-align: center;
font-size: 13px;
font-weight: 700;
letter-spacing: 4px;
opacity: 0;
pointer-events: none;
transition: opacity 0.18s ease;
display: none;
}

/* The three-dice stack */
.dice-stack {
position: absolute;
display: flex;
flex-direction: column;
gap: 3px;
pointer-events: none;
}

/* Each individual overlay stick — horizontal */
.overlay-stick {
border-radius: 7px;
border: 1px solid #7d603a;
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
box-shadow: 1px 3px 8px rgba(0, 0, 0, 0.6);
overflow: hidden;
}
.overlay-stick.os-light {
background: linear-gradient(to bottom, #cfb489, #fdeca1, #b5905d);
}
.overlay-stick.os-dark {
background: linear-gradient(to bottom, #2e2e2e, #1a1a1a, #282828);
border-color: #555;
}

/* Dot columns inside each stick */
.os-dot-col {
display: flex;
flex-direction: column;
gap: 2px;
align-items: center;
justify-content: center;
height: 100%;
padding: 3px 0;
}
.os-dot {
border-radius: 50%;
flex-shrink: 0;
}
.overlay-stick.os-light .os-dot { background: #111; }
.overlay-stick.os-dark .os-dot { background: #f8312f; }

/* Dim the board slightly while dice are rolling */
.board-wrapper.dice-rolling #board {
opacity: 0.72;
transition: opacity 0.2s ease;
}
.board-wrapper #board {
transition: opacity 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
.overlay-stick { animation: none !important; }
}


/* Counter-rotate text content inside the rotated board so labels and
   button text read right-side up even though the board is rotated 180°. */
.board-wrapper.rotate-for-p1-online .base-title,
.board-wrapper.rotate-for-p1-online .pasa-action button {
  transform: rotate(180deg);
}