.anbi-hockey-board {
	--anbi-ph-text: #111827;
	--anbi-ph-muted: #667085;
	--anbi-ph-border: #d9dde5;
	--anbi-ph-card: #fff;
	--anbi-ph-surface: #f7f8fa;
	--anbi-ph-primary: #172554;
	box-sizing: border-box;
	width: 100%;
	color: var(--anbi-ph-text);
	font-family: inherit;
}

.anbi-hockey-board *,
.anbi-hockey-board *::before,
.anbi-hockey-board *::after { box-sizing: border-box; }

.anbi-ph-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

.anbi-ph-button,
.anbi-ph-saved-actions button,
.anbi-ph-saved-actions .anbi-ph-video-download {
	min-height: 40px;
	border: 1px solid var(--anbi-ph-border);
	border-radius: 9px;
	background: #fff;
	color: var(--anbi-ph-text);
	font: inherit;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.anbi-ph-button { padding: 10px 14px; }
.anbi-ph-button:hover:not(:disabled),
.anbi-ph-saved-actions button:hover { border-color: #8b95a7; transform: translateY(-1px); }
.anbi-ph-button:disabled { cursor: not-allowed; opacity: .42; }
.anbi-ph-button--record { border-color: #dc2626; background: #dc2626; color: #fff; }
.anbi-ph-button--primary { border-color: var(--anbi-ph-primary); background: var(--anbi-ph-primary); color: #fff; }
.anbi-ph-button--zones.is-active { border-color: #b45309; background: #fff7ed; color: #9a3412; }
.anbi-ph-button--wide { width: 100%; margin-top: 9px; }

.anbi-ph-speed { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: 14px; font-weight: 600; }
.anbi-ph-speed select,
.anbi-ph-card input[type="text"] {
	min-height: 40px;
	border: 1px solid var(--anbi-ph-border);
	border-radius: 9px;
	background: #fff;
	color: var(--anbi-ph-text);
	font: inherit;
}
.anbi-ph-speed select { padding: 7px 9px; }

.anbi-ph-drawing-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; padding: 10px; border: 1px solid var(--anbi-ph-border); border-radius: 12px; background: var(--anbi-ph-surface); }
.anbi-ph-drawing-tools .anbi-ph-button { font-size: 14px; }
.anbi-ph-team-icons { display: inline-flex; align-items: center; gap: 3px; margin-right: 5px; vertical-align: middle; }
.anbi-ph-team-icon { display: inline-block; width: 12px; height: 12px; border: 1.5px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #94a3b8; }
.anbi-ph-team-icon--attack { background: #dc2626; }
.anbi-ph-team-icon--defense { background: #2563eb; }
.anbi-ph-drawing-tools .anbi-ph-button.is-active { background: var(--anbi-ph-primary); border-color: var(--anbi-ph-primary); color: #fff; }
.anbi-ph-drawing-tools .anbi-ph-button--pieces.is-active { background: #111827; border-color: #111827; color: #fff; }
.anbi-ph-ink-setting { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--anbi-ph-text); font-size: 13px; font-weight: 650; }
.anbi-ph-ink-setting input[type="color"] { display: block; width: 38px; min-width: 38px; height: 36px; margin: 0; padding: 3px; border: 1px solid var(--anbi-ph-border); border-radius: 7px; background: #fff; cursor: pointer; }
.anbi-ph-ink-setting select { width: auto; min-height: 36px; margin: 0; padding: 5px 8px; border: 1px solid var(--anbi-ph-border); border-radius: 7px; background: #fff; color: var(--anbi-ph-text); font: inherit; }
.anbi-ph-drawing-hint { flex: 1 0 100%; color: var(--anbi-ph-muted); font-size: 12px; line-height: 1.4; }
.anbi-ph-drawing-tools button:focus-visible, .anbi-ph-ink-setting input:focus-visible, .anbi-ph-ink-setting select:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }

.anbi-ph-status {
	margin-bottom: 12px;
	padding: 10px 12px;
	border: 1px solid var(--anbi-ph-border);
	border-radius: 9px;
	background: var(--anbi-ph-surface);
	font-size: 14px;
	font-weight: 650;
}
.anbi-ph-status.is-recording { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; animation: anbi-ph-pulse 1s infinite; }
@keyframes anbi-ph-pulse { 50% { opacity: .62; } }

.anbi-ph-layout { display: grid; grid-template-columns: minmax(0, 1fr) 245px; gap: 16px; align-items: start; }
.anbi-ph-rink-wrap { min-width: 0; overflow: hidden; border: 1px solid var(--anbi-ph-border); border-radius: 14px; background: var(--anbi-ph-card); padding: 8px; }
.anbi-ph-scroll-rail { display: none; }
.anbi-ph-board-surface { position: relative; width: 100%; isolation: isolate; touch-action: none; overscroll-behavior: contain; -webkit-user-select: none; user-select: none; }
.anbi-ph-rink { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; touch-action: none; }
.anbi-ph-ink { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; pointer-events: none; touch-action: none; user-select: none; -webkit-user-select: none; }
.anbi-hockey-board[data-drawing-mode="pen"] .anbi-ph-ink { pointer-events: auto; cursor: crosshair; }
.anbi-hockey-board[data-drawing-mode="eraser"] .anbi-ph-ink { pointer-events: auto; cursor: crosshair; }
.anbi-ph-eraser-cursor { position: absolute; z-index: 2; transform: translate(-50%, -50%); border: 1px solid #111827; border-radius: 50%; box-shadow: 0 0 0 1px #fff; background: rgba(255,255,255,.18); pointer-events: none; }
.anbi-ph-eraser-cursor[hidden] { display: none !important; }
.anbi-ph-floor { fill: #f5efe3; stroke: #202632; stroke-width: 5; }
.anbi-ph-center-crest { opacity: .3; pointer-events: none; }
.anbi-ph-markings { stroke: #175a9c; stroke-width: 3; pointer-events: none; }
.anbi-ph-markings .anbi-ph-goal-line { stroke-width: 5; }
.anbi-ph-points { fill: #175a9c; pointer-events: none; }
.anbi-ph-goals { stroke: #f97316; stroke-width: 5; pointer-events: none; }
.anbi-ph-zones { display: none; pointer-events: none; }
.anbi-ph-zones.is-visible { display: block; }
.anbi-ph-zones .zone { stroke: rgba(255, 255, 255, .68); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.anbi-ph-zones .zone-0 { fill: #f7ed9a; fill-opacity: .48; }
.anbi-ph-zones .zone-1 { fill: #f9e7a7; fill-opacity: .48; }
.anbi-ph-zones .zone-2 { fill: #f4c48f; fill-opacity: .49; }
.anbi-ph-zones .zone-3 { fill: #f3a693; fill-opacity: .45; }
.anbi-ph-zones .zone-4 { fill: #bde68f; fill-opacity: .49; }
.anbi-ph-zones .zone-5 { fill: #c9b9e8; fill-opacity: .55; }
.anbi-ph-zones .zone-6 { fill: #9edce8; fill-opacity: .53; }
.anbi-ph-zones .zone-7 { fill: #a9e8cf; fill-opacity: .58; }
.anbi-ph-zones .zone-8 { fill: #bab6e4; fill-opacity: .55; }
.anbi-ph-zones .zone-9 { fill: #f1a6d3; fill-opacity: .55; }
.anbi-ph-zone-labels rect { fill: none; stroke: #111827; stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.anbi-ph-zone-labels text { fill: #111827; font-size: 13px; font-weight: 850; text-anchor: middle; }

.anbi-ph-rink [data-role="pieces"].is-hidden { display: none; }
.anbi-ph-piece, .anbi-ph-piece * { cursor: grab; touch-action: none !important; -webkit-user-select: none; user-select: none; }
.anbi-ph-piece:active { cursor: grabbing; }
.anbi-ph-ball-holder-ring { fill: none; stroke: #111827; stroke-width: 2.5; pointer-events: none; }

.anbi-ph-panel { display: grid; gap: 12px; }
.anbi-ph-card { border: 1px solid var(--anbi-ph-border); border-radius: 12px; background: var(--anbi-ph-card); padding: 13px; }
.anbi-ph-card h3 { margin: 0 0 9px; padding: 0; color: var(--anbi-ph-text); font-size: 15px; line-height: 1.2; }
.anbi-ph-session-card { border-left: 4px solid var(--anbi-ph-primary); }
.anbi-ph-session-card strong { display: block; margin-top: 4px; font-size: 15px; }
.anbi-ph-session-label { color: var(--anbi-ph-muted); font-size: 11px; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
.anbi-ph-card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.anbi-ph-card-title h3 { margin: 0; }
.anbi-ph-card-title span { color: var(--anbi-ph-muted); font-size: 12px; }
.anbi-ph-legend { display: flex; align-items: center; gap: 7px; margin: 6px 0; font-size: 14px; }
.anbi-ph-dot { width: 15px; height: 15px; flex: 0 0 15px; border-radius: 50%; }
.anbi-ph-dot--attack { background: #dc2626; }
.anbi-ph-dot--defense { background: #2563eb; }
.anbi-ph-muted { margin: 9px 0 0; color: var(--anbi-ph-muted); font-size: 13px; }
.anbi-ph-label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 750; }
.anbi-ph-card input[type="text"] { width: 100%; padding: 8px 10px; }
.anbi-ph-saved-list { display: grid; gap: 7px; margin-top: 10px; color: var(--anbi-ph-muted); font-size: 13px; }
.anbi-ph-saved-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; border: 1px solid var(--anbi-ph-border); border-radius: 9px; padding: 8px; }
.anbi-ph-saved-row.is-shared { border-color: #bfdbfe; background: #eff6ff; }
.anbi-ph-saved-info { min-width: 0; }
.anbi-ph-saved-name { display: block; width: 100%; min-width: 0; overflow-wrap: anywhere; border: 0; padding: 0; background: none; color: var(--anbi-ph-text); font: inherit; font-weight: 750; text-align: left; white-space: normal; cursor: pointer; }
.anbi-ph-saved-owner { display: block; margin-top: 3px; overflow: hidden; color: var(--anbi-ph-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.anbi-ph-saved-row.is-shared .anbi-ph-saved-owner { color: #1d4ed8; font-weight: 700; }
.anbi-ph-saved-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 4px; }
.anbi-ph-saved-actions button { min-width: 32px; min-height: 32px; padding: 5px; }
.anbi-ph-saved-actions .anbi-ph-video-button,
.anbi-ph-saved-actions .anbi-ph-video-download { min-height: 32px; padding: 7px 8px; font-size: 11px; white-space: nowrap; }
.anbi-ph-saved-actions .anbi-ph-video-download { display: inline-flex; align-items: center; text-decoration: none; background: #ecfdf5; border-color: #86efac; color: #166534; }
.anbi-ph-saved-actions .anbi-ph-video-button:disabled { cursor: wait; opacity: .6; }
.anbi-ph-saved-actions .anbi-ph-share-button { padding-inline: 8px; font-size: 11px; }
.anbi-ph-login-message { margin: 0; line-height: 1.45; }
.anbi-ph-login-message a { font-weight: 750; }

.anbi-ph-legacy-import { margin-top: 10px; padding: 9px; border: 1px solid #facc15; border-radius: 9px; background: #fffbeb; color: #713f12; font-size: 12px; line-height: 1.4; }
.anbi-ph-legacy-import[hidden] { display: none !important; }
.anbi-ph-legacy-import span { display: block; }
.anbi-ph-button--small { min-height: 34px; margin-top: 7px; padding: 7px 9px; font-size: 12px; }

.anbi-ph-share-panel { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--anbi-ph-border); }
.anbi-ph-share-panel[hidden] { display: none !important; }
.anbi-ph-share-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.anbi-ph-share-heading button { width: 30px; height: 30px; border: 1px solid var(--anbi-ph-border); border-radius: 8px; background: #fff; color: var(--anbi-ph-text); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.anbi-ph-share-name { margin: 4px 0 9px; color: var(--anbi-ph-muted); font-size: 12px; }
.anbi-ph-share-trainers { display: grid; gap: 5px; max-height: 210px; overflow: auto; }
.anbi-ph-share-option { display: flex; align-items: center; gap: 8px; margin: 0; padding: 7px 8px; border: 1px solid var(--anbi-ph-border); border-radius: 8px; background: var(--anbi-ph-surface); font-size: 13px; cursor: pointer; }
.anbi-ph-share-option input[type="checkbox"] { width: 17px; height: 17px; flex: 0 0 17px; margin: 0; accent-color: var(--anbi-ph-primary); }

@media (max-width: 900px) {
	.anbi-ph-layout { grid-template-columns: 1fr; }
	.anbi-ph-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* A landscape tablet gets the whole viewport for the rink; cards move below it. */
@media (orientation: landscape) and (pointer: coarse) and (max-width: 1366px) {
	.anbi-hockey-board { width: calc(100vw - 32px); max-width: none; margin: 0 0 0 var(--anbi-ph-tablet-offset, 0px); padding: 0; }
	.anbi-ph-layout { grid-template-columns: minmax(0, 1fr); }
	.anbi-ph-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.anbi-ph-rink-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 18px; align-items: stretch; gap: 1px; padding: 2px; }
	.anbi-ph-scroll-rail { display: flex; flex-direction: column; align-items: center; justify-content: space-between; min-height: 0; padding: 2px 0; border: 1px solid var(--anbi-ph-border); border-radius: 6px; background: #f7f8fa; color: #344054; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
	.anbi-ph-scroll-rail button { display: grid; place-items: center; width: 16px; height: 28px; padding: 0; border: 0; border-radius: 4px; background: #fff; color: #172554; font: inherit; font-size: 18px; cursor: pointer; touch-action: pan-y; }
	.anbi-ph-scroll-rail span { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 14px; pointer-events: none; }
	.anbi-ph-scroll-rail small { font-size: 6px; font-weight: 800; letter-spacing: .03em; writing-mode: vertical-rl; }
}

@media (max-width: 600px) {
	.anbi-ph-button { flex: 1 1 calc(50% - 8px); }
	.anbi-ph-speed { width: 100%; margin-left: 0; justify-content: flex-end; }
	.anbi-ph-rink-wrap { padding: 3px; border-radius: 10px; }
	.anbi-ph-panel { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
	.anbi-ph-status.is-recording { animation: none; }
	.anbi-ph-button,
	.anbi-ph-saved-actions button { transition: none; }
}

/* Android touch drag: cap descendent de la pista pot iniciar scroll/pan del navegador. */
.anbi-ph-board-surface,
.anbi-ph-board-surface svg,
.anbi-ph-board-surface svg *,
.anbi-ph-piece,
.anbi-ph-piece * {
	touch-action: none !important;
	-webkit-user-select: none !important;
	user-select: none !important;
	-webkit-touch-callout: none !important;
}
