/* Live game scoring (include/livegame_ui.php): team scoring screen, admin review and the public live page.
   Mobile first: scorekeepers use phones at the rink. */

.lg-wrap { max-width: 1000px; margin: 0 auto; color: #222; }
.lg-wrap h3 { font-family: "Oswald", Arial, sans-serif; font-size: 1.4rem; margin: 0 0 .6rem; color: #222; }
.lg-wrap h4 { font-family: "Oswald", Arial, sans-serif; font-size: 1.1rem; margin: 1rem 0 .4rem; color: #333; }
.lg-wrap a { color: #2a5d9f; }

.lg-card { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 14px; margin: 0 0 14px; }
.lg-help { color: #666; font-size: .85rem; margin: .4rem 0; }
.lg-none { color: #888; font-size: .9rem; margin: 0 0 .4rem; }
.lg-tag { display: inline-block; background: #8f783b; color: #fff; font-size: .7rem; padding: 1px 5px; border-radius: 3px; vertical-align: middle; }
.lg-unofficial { background: #fff6d6; border: 1px solid #ecd27a; border-radius: 4px; padding: 6px 10px; font-size: .85rem; margin: 0 0 14px; }

/* Scoreboard */
.lg-scoreboard { background: #202124; color: #fff; border-radius: 6px; padding: 12px; margin: 0 0 10px; position: sticky; top: 0; z-index: 20; }
.lg-score { display: flex; align-items: center; justify-content: center; gap: 10px; }
.lg-score-team { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; text-align: center; font-weight: 600; font-size: .95rem; line-height: 1.2; }
.lg-score-team img { width: 48px; height: 48px; object-fit: contain; margin-bottom: 4px; }
.lg-score-num { font-family: "Oswald", Arial, sans-serif; font-size: 2.6rem; line-height: 1; min-width: 1.5em; text-align: center; }
.lg-score-sep { color: #aaa; }
.lg-status { text-align: center; color: #e6c766; font-weight: 600; margin-top: 6px; font-size: .95rem; }

/* Period buttons */
.lg-periodbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; }
.lg-periodbar span { font-size: .85rem; color: #555; margin-right: 4px; }

/* Section links */
.lg-sections { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.lg-sections a { background: #fff; border: 1px solid #ccc; border-radius: 20px; padding: 4px 12px; font-size: .9rem; text-decoration: none; }

/* Buttons */
.lg-btn { background: #f1f1f1; border: 1px solid #bbb; color: #222; padding: 6px 12px; border-radius: 4px; font-size: .95rem; cursor: pointer; }
.lg-btn:hover { background: #e4e4e4; color: #000; text-decoration: none; }
.lg-btn.active { background: #8f783b; border-color: #8f783b; color: #fff; }
.lg-btn-primary { background: #8f783b; border-color: #7b6630; color: #fff; }
.lg-btn-primary:hover { background: #7b6630; color: #fff; }
.lg-btn-primary[disabled] { opacity: .5; cursor: not-allowed; }
.lg-btn-sm { padding: 2px 8px; font-size: .85rem; }
.lg-btn-big { padding: 10px 24px; font-size: 1.1rem; margin-top: 10px; }
.lg-inline { display: inline; margin: 0; }

/* Tables */
.lg-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 0 0 10px; }
.lg-table th { background: #f3f3f3; text-align: left; padding: 6px; border-bottom: 2px solid #ddd; font-weight: 600; }
.lg-table td { padding: 6px; border-bottom: 1px solid #eee; vertical-align: middle; }
.lg-table td.lg-tools { white-space: nowrap; text-align: right; }
.lg-table input.lg-num { width: 3.2em; text-align: center; }
.lg-lineup tr.lg-inactive td { color: #999; }
.lg-lineup tr.lg-new td { background: #fffbe8; }

/* Forms */
.lg-form { background: #f8f8f8; border: 1px solid #e3e3e3; border-radius: 6px; padding: 10px; margin-top: 8px; }
.lg-form h4 { margin-top: 0; }
.lg-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 8px; align-items: flex-end; }
.lg-row label { display: flex; flex-direction: column; font-size: .8rem; color: #555; margin: 0; }
.lg-row label.lg-check { flex-direction: row; align-items: center; gap: 6px; font-size: .9rem; color: #222; }
.lg-row select, .lg-row input[type=text] { font-size: 1rem; padding: 5px 6px; border: 1px solid #bbb; border-radius: 4px; min-width: 5em; background: #fff; }
.lg-row select { max-width: 100%; }
.lg-time { width: 5.5em; }
.lg-teampick { display: flex; gap: 8px; margin: 0 0 8px; }
.lg-teampick label { flex: 1 1 0; border: 1px solid #bbb; border-radius: 4px; padding: 8px; background: #fff; text-align: center; font-weight: 600; margin: 0; cursor: pointer; }
.lg-teampick input { margin-right: 4px; }
.lg-block { display: block; font-size: .85rem; color: #555; }
.lg-block textarea { display: block; width: 100%; margin-top: 4px; border: 1px solid #bbb; border-radius: 4px; padding: 6px; }
.lg-team-lineup { margin-bottom: 18px; }
.lg-team-lineup small { color: #777; font-family: Arial, sans-serif; font-size: .8rem; }
.lg-addplayer { margin-top: 8px; }
.lg-addplayer summary { cursor: pointer; color: #2a5d9f; }
.lg-addplayer form { margin-top: 8px; }
.lg-newlist { margin: 6px 0 0; padding-left: 18px; }
.lg-issues { background: #fdecea; border: 1px solid #f5c2bd; border-radius: 4px; padding: 8px 12px; margin: 8px 0; }
.lg-issues p { margin: 0 0 4px; font-weight: 600; }
.lg-issues ul { margin: 0; padding-left: 18px; }
.lg-msg { padding: 8px 12px; border-radius: 4px; margin: 0 0 10px; background: #e8f4ea; border: 1px solid #b9dcbf; }
.lg-msg.lg-err { background: #fdecea; border-color: #f5c2bd; }

/* Event lists (public view) */
.lg-events { list-style: none; padding: 0; margin: 0 0 6px; }
.lg-events li { padding: 4px 0; border-bottom: 1px solid #f0f0f0; font-size: .92rem; }
.lg-ev-time { display: inline-block; min-width: 3.2em; color: #777; font-variant-numeric: tabular-nums; }

/* Live list on the home page / schedule */
.lg-live-badge { display: inline-block; background: #c62828; color: #fff; font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 3px; letter-spacing: .05em; }

@media (max-width: 575px) {
	.lg-card { padding: 10px; }
	.lg-score-num { font-size: 2.1rem; }
	.lg-score-team { font-size: .8rem; }
	.lg-score-team img { width: 36px; height: 36px; }
	.lg-table { font-size: .82rem; }
	.lg-table th, .lg-table td { padding: 4px; }
	.lg-row label { flex: 1 1 45%; }
	.lg-row select, .lg-row input[type=text] { width: 100%; }
}

/* Messages after saving: a toast at the bottom when the page jumped to a section (livegame.js) */
.lg-msg.lg-toast { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 100; max-width: 600px; margin: 0 auto; box-shadow: 0 4px 16px rgba(0,0,0,.25); cursor: pointer; }
/* Sections jumped to after saving stay clear of the sticky scoreboard */
.lg-card, .lg-wrap section { scroll-margin-top: 150px; }
/* Button links keep their colours inside pages that colour links */
a.lg-btn { color: #222 !important; text-decoration: none; }
a.lg-btn-primary, a.lg-btn.active { color: #fff !important; }
@media (max-width: 575px) {
	.lg-scoreboard { padding: 6px 8px; }
	.lg-score-team img { width: 26px; height: 26px; margin-bottom: 2px; }
	.lg-score-num { font-size: 1.8rem; }
	.lg-status { margin-top: 2px; font-size: .85rem; }
	.lg-card, .lg-wrap section { scroll-margin-top: 135px; }
}

/* Game clock in the scoreboard (livegame.js): the scorekeeper starts/stops it and taps the time to type it */
.lg-clock { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 6px; }
.lg-clock .lg-clock-time { font-family: "Oswald", Arial, sans-serif; font-size: 1.6rem; line-height: 1; color: #fff; background: #111214; border: 1px solid #44464c; border-radius: 6px; padding: 4px 12px; min-width: 4.2em; text-align: center; font-variant-numeric: tabular-nums; }
.lg-clock-edit .lg-clock-time { cursor: pointer; }
.lg-clock-edit .lg-clock-time:hover { border-color: #8f783b; }
.lg-clock .lg-clock-input { width: 4.2em; outline: 2px solid #8f783b; }
.lg-clock-running .lg-clock-time { color: #7dff9a; }
.lg-clock-toggle { background: #8f783b; color: #fff; border: 0; border-radius: 6px; padding: 6px 14px; font-weight: 600; font-size: .95rem; cursor: pointer; }
.lg-clock-running .lg-clock-toggle { background: #c62828; }
.lg-clock-view .lg-clock-time { font-size: 1.3rem; padding: 2px 10px; }
.lg-now { margin-top: 3px; white-space: nowrap; }
@media (max-width: 575px) {
	.lg-clock { margin-top: 4px; }
	.lg-clock .lg-clock-time { font-size: 1.3rem; padding: 3px 10px; }
	.lg-clock-toggle { padding: 5px 10px; font-size: .85rem; }
	.lg-card, .lg-wrap section { scroll-margin-top: 170px; }
}

/* Discard a game sheet (admin/stats_livegames.php) */
.lg-btn-danger { background: #c62828; border-color: #a51f1f; color: #fff; }
.lg-btn-danger:hover { background: #a51f1f; color: #fff; }
.lg-discard { margin-top: 24px; border-color: #f0c7c3; }
.lg-discard summary { cursor: pointer; color: #c62828; font-weight: 600; }
.lg-discard form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.lg-discard input[type=text] { font-size: 1rem; padding: 5px 8px; border: 1px solid #bbb; border-radius: 4px; text-transform: uppercase; }

/* Away team on the left, home team on the right; stacked on phones (include/livegame_ui.php $split) */
.lg-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.lg-side { min-width: 0; }
.lg-split > .lg-side { background: #f8f8f8; border: 1px solid #e3e3e3; border-radius: 6px; padding: 10px; }
.lg-split > .lg-side .lg-form { background: transparent; border: 0; padding: 0; margin: 0; }
.lg-side-head { display: flex; align-items: center; gap: 8px; margin: -2px 0 8px; padding-bottom: 6px; border-bottom: 2px solid #8f783b; font-weight: 700; }
.lg-side-head img { width: 28px; height: 28px; object-fit: contain; }
.lg-side-head small { margin-left: auto; color: #888; font-weight: 400; text-transform: uppercase; font-size: .7rem; letter-spacing: .05em; }
.lg-row label.lg-wide { flex: 1 1 100%; }
.lg-row label.lg-wide select { width: 100%; }
.lg-split .lg-row { gap: 8px; }

/* Lineups fold away once both are saved */
.lg-lineups > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.lg-lineups > summary::-webkit-details-marker { display: none; }
.lg-lineups > summary h3 { margin: 0; display: inline-block; }
.lg-lineups-sum { color: #666; font-size: .9rem; }
.lg-lineups-toggle { margin-left: auto; font-size: .85rem; color: #2a5d9f; border: 1px solid #c9d6ea; border-radius: 14px; padding: 2px 10px; }
.lg-lineups .lg-hide, .lg-lineups[open] .lg-show { display: none; }
.lg-lineups[open] .lg-hide { display: inline; }
.lg-lineups[open] > summary { margin-bottom: 8px; }
.lg-lineups .lg-split > .lg-side { background: #fff; }

@media (max-width: 767px) {
	.lg-split { grid-template-columns: 1fr; }
}
.lg-timewrap { display: flex; align-items: center; gap: 4px; }
.lg-timewrap .lg-now { margin-top: 0; padding: 5px 8px; }

/* ===== Scoring screen layout for phones / tablets (include/livegame_ui.php lg_ui_render) ===== */
/* Black bar: score, then the period picker and the clock on one line */
.lg-bar { padding: 8px 10px; }
.lg-bar .lg-score-team { flex-direction: row; justify-content: center; gap: 6px; font-size: .9rem; }
.lg-bar .lg-score-team img { width: 30px; height: 30px; margin: 0; flex: 0 0 30px; }
.lg-bar .lg-score-team span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-bar .lg-score-num { font-size: 2rem; }
.lg-bar-controls { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.lg-bar-controls .lg-clock { margin: 0; }
.lg-period-form { margin: 0; }
.lg-period-select { background: #111214; color: #e6c766; border: 1px solid #44464c; border-radius: 6px; padding: 6px 8px; font-size: 1rem; font-weight: 700; height: 38px; }
.lg-bar-help { margin: 0 0 12px; }

/* Before the game */
.lg-setup-first { border: 2px solid #8f783b; }
.lg-setup > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.lg-setup > summary::-webkit-details-marker { display: none; }
.lg-setup > summary h3 { margin: 0; display: inline-block; }
.lg-setup .lg-hide, .lg-setup[open] .lg-show { display: none; }
.lg-setup[open] .lg-hide { display: inline; }
.lg-setup[open] > summary { margin-bottom: 8px; }
.lg-setup .lg-split > .lg-side { background: #fff; }
.lg-starter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 0 0 10px; padding: 8px; background: #fff8e6; border: 1px solid #ecd27a; border-radius: 6px; }
.lg-starter label { display: flex; flex-direction: column; font-size: .8rem; color: #555; margin: 0; flex: 1 1 160px; }
.lg-starter select { font-size: 1rem; padding: 5px 6px; border: 1px solid #bbb; border-radius: 4px; background: #fff; width: 100%; }
.lg-starter-ok { flex: 1 1 100%; font-size: .85rem; color: #2e7d32; }
p.lg-starter { display: block; }

/* Team panels: away left, home right, side by side on phones too */
.lg-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 8px; }
.lg-team { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 8px; min-width: 0; }
.lg-team .lg-side-head { margin: 0 0 8px; font-size: .9rem; }
.lg-team .lg-side-head span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-side-head img { flex: 0 0 28px; }
.lg-shotctl { display: flex; align-items: stretch; gap: 6px; margin: 0 0 8px; }
.lg-shot-btn { flex: 0 0 48px; height: 52px; border: 0; border-radius: 8px; font-size: 1.8rem; font-weight: 700; line-height: 1; cursor: pointer; color: #fff; touch-action: manipulation; }
.lg-shot-minus { background: #6b6c71; }
.lg-shot-plus { background: #2e7d32; }
.lg-shot-btn.is-tap { transform: scale(.94); filter: brightness(1.15); }
.lg-shot-count { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #202124; color: #fff; border-radius: 8px; }
.lg-shot-total { font-family: "Oswald", Arial, sans-serif; font-size: 1.6rem; line-height: 1; }
.lg-shot-count small { font-size: .7rem; color: #c4c6ca; white-space: nowrap; }
.lg-shot-per { color: #e6c766; font-weight: 700; }
.lg-act-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lg-act-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; padding: 6px 4px; border-radius: 8px;
	background: #f1f1f1; border: 1px solid #ccc; color: #222 !important; font-weight: 700; font-size: .85rem; text-decoration: none !important; text-align: center; touch-action: manipulation; }
.lg-act-btn .fa { font-size: 1.1rem; }
.lg-act-btn:hover { background: #e4e4e4; }
.lg-act-goal { grid-column: 1 / -1; background: #8f783b; border-color: #7b6630; color: #fff !important; font-size: 1rem; }
.lg-act-goal:hover { background: #7b6630; }
.lg-act-wide { grid-column: 1 / -1; }
.lg-act-shootout.lg-act-wide { background: #8f783b; border-color: #7b6630; color: #fff !important; }

/* Pop-up forms */
.lg-modal { display: none; position: fixed; inset: 0; z-index: 1050; background: rgba(0,0,0,.55); padding: 12px; overflow-y: auto; }
.lg-modal.is-open { display: flex; align-items: flex-start; justify-content: center; }
.lg-modal-box { background: #fff; border-radius: 10px; width: 100%; max-width: 520px; margin: 4vh auto 20px; padding: 12px 14px 14px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.lg-modal-head { display: flex; align-items: center; gap: 8px; border-bottom: 2px solid #8f783b; padding-bottom: 8px; margin-bottom: 10px; }
.lg-modal-head img { width: 32px; height: 32px; object-fit: contain; flex: 0 0 32px; }
.lg-modal-head h3 { margin: 0 !important; font-size: 1.25rem !important; flex: 1 1 auto; min-width: 0; }
.lg-modal-close { background: none; border: 0; font-size: 2rem; line-height: 1; color: #666 !important; padding: 0 4px; cursor: pointer; text-decoration: none !important; }
.lg-modal .lg-form { background: transparent; border: 0; padding: 0; margin: 0; }
.lg-modal-foot { display: flex; gap: 8px; margin-top: 6px; }
.lg-modal-foot .lg-btn { padding: 10px 18px; font-size: 1rem; }
.lg-modal-foot .lg-btn-primary { flex: 1 1 auto; }
body.lg-modal-on { overflow: hidden; }

/* Game activity */
.lg-activity { list-style: none; margin: 0; padding: 0; }
.lg-act { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid #eee; }
.lg-act-when { flex: 0 0 52px; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; font-size: .85rem; color: #555; line-height: 1.2; }
.lg-act-when b { color: #222; }
.lg-act-logo { flex: 0 0 28px; width: 28px; height: 28px; }
.lg-act-logo img { width: 28px; height: 28px; object-fit: contain; display: block; }
.lg-act-what { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; font-size: .92rem; }
.lg-act-what small { color: #666; }
.lg-act-kind { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #8f783b; }
.lg-act-is-penalty .lg-act-kind { color: #c62828; }
.lg-act-is-goalie .lg-act-kind { color: #2a5d9f; }
.lg-act .lg-tools { flex: 0 0 auto; white-space: nowrap; }
.lg-act .lg-tools .lg-btn-sm { padding: 6px 10px; }
.lg-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 575px) {
	.lg-bar { padding: 6px 8px; }
	.lg-bar .lg-score-team { font-size: .78rem; flex-direction: column; gap: 2px; }
	.lg-bar .lg-score-team img { width: 24px; height: 24px; flex-basis: 24px; }
	.lg-bar .lg-score-num { font-size: 1.7rem; }
	.lg-bar-controls { margin-top: 4px; gap: 6px; }
	.lg-period-select { height: 34px; padding: 4px 6px; font-size: .95rem; }
	.lg-teams { gap: 6px; }
	.lg-team { padding: 6px; }
	.lg-team .lg-side-head small { display: none; }
	.lg-shot-btn { flex-basis: 40px; height: 48px; font-size: 1.5rem; }
	.lg-act-btn { min-height: 46px; font-size: .78rem; }
	.lg-modal { padding: 6px; }
	.lg-modal-box { margin-top: 2vh; padding: 10px; }
}
/* names in the bar and the shot counter fit narrow screens */
.lg-bar .lg-score-team { min-width: 0; }
.lg-bar .lg-score-team span { max-width: 100%; display: block; }
.lg-shot-count { line-height: 1.1; padding: 2px 0; }
.lg-shot-count small { font-size: .65rem; text-transform: uppercase; letter-spacing: .04em; }
