:root{--bg:#111312;--panel:#2e302e;--panel-alt:#222522;--text:#fff;--accent:#f13737;--muted:#c9cdca;--line:rgba(255,255,255,.55);--scorebox:#f8f8f8;--scoretext:#101010;--flag-bg:#182126;--flag-bg:#182126;--font:Arial,sans-serif;--max-width:1760px;--radius:30px;--name-size:86px;--game-size:160px;--set-size:90px;--row-height:210px;--pad:28px;--title-size:72px;--meta-size:24px;--timer-size:72px;--timer-label-size:38px;--country-size:150px;--country-col:340px;--point-col:430px}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#000}body{color:var(--text);font-family:var(--font)}.viewport{position:fixed;inset:0;overflow:hidden;background:#000}.stage{position:absolute;left:0;top:0;width:1920px;height:1080px;transform-origin:top left;will-change:transform}.board{width:1920px;height:1080px;padding:24px 38px;background:var(--bg);display:grid;grid-template-rows:165px auto 1fr 80px;gap:16px;position:relative;overflow:hidden}.board.no-footer{grid-template-rows:165px auto 1fr}.topbar{max-width:var(--max-width);width:100%;height:165px;margin:0 auto;display:grid;grid-template-columns:180px minmax(0,1fr) 180px;align-items:center;gap:25px;border-bottom:3px solid var(--accent)}.board.no-branding .topbar{grid-template-columns:1fr}.board.no-branding .title-zone{text-align:left}.board.no-branding .tournament{font-size:var(--title-size)}.board.one-brand-left .topbar{grid-template-columns:180px 1fr}.board.one-brand-left .club-logo{display:none}.board.one-brand-right .topbar{grid-template-columns:1fr 180px}.board.one-brand-right .tournament-logo{display:none}.title-zone{text-align:center;min-width:0}.tournament{font-size:var(--title-size);font-weight:1000;font-style:italic;text-transform:uppercase;line-height:.9;letter-spacing:.02em;overflow:hidden;max-height:130px}.meta{margin-top:10px;color:var(--muted);font-size:var(--meta-size);font-weight:800;letter-spacing:.12em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.brand-slot{height:110px;display:grid;place-items:center;overflow:hidden}.brand-slot img{width:100%;height:100%;object-fit:contain}.brand-slot:empty{display:none}.hidden{display:none!important}.status-banner{max-width:var(--max-width);width:100%;margin:auto;background:var(--accent);color:#071115;border-radius:999px;padding:12px 30px;text-align:center;font-size:44px;font-weight:1000;letter-spacing:.08em;line-height:1.05}
.live-board{max-width:var(--max-width);width:100%;height:100%;margin:auto;display:grid;grid-template-columns:minmax(0,1fr) 360px;grid-template-rows:110px var(--row-height) var(--row-height) 110px;align-content:center;position:relative;min-height:0}.live-board.no-timer{grid-template-columns:minmax(0,1fr)}.name-strip{grid-column:1;padding:8px 55px;font-size:var(--name-size);line-height:94px;font-weight:1000;text-transform:uppercase;background:linear-gradient(90deg,var(--panel),transparent);border-radius:999px 0 0 999px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.name-strip.bottom{grid-row:4;align-self:end}.score-row{grid-column:1;display:grid;grid-template-columns:var(--country-col) var(--point-col) minmax(0,1fr);align-items:stretch;border-bottom:3px solid var(--line);min-width:0}.score-row:nth-of-type(3){border-bottom:0}.country-block{background:var(--scorebox);border-radius:70px 0 0 70px;display:flex;align-items:center;justify-content:center;gap:18px;overflow:hidden}.country-badge{width:var(--country-size);height:var(--country-size);flex:0 0 var(--country-size);border-radius:50%;display:grid;place-items:center;background:var(--flag-bg);border:4px solid rgba(255,255,255,.75);font-size:72px;font-weight:1000;letter-spacing:.05em;text-transform:lowercase}.serve{width:32px;height:32px;flex:0 0 32px;border-radius:50%;background:var(--serve-color,#b8db18);box-shadow:0 0 20px var(--serve-color,#b8db18);border:3px solid rgba(255,255,255,.75)}.serve:empty{visibility:hidden}.current-score{display:grid;place-items:center;background:var(--scorebox);color:var(--scoretext);font-size:var(--game-size);line-height:1;font-weight:1000;border-left:1px solid rgba(0,0,0,.1);overflow:hidden}.set-cells{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(110px,1fr);background:linear-gradient(90deg,var(--panel),var(--panel-alt));overflow:hidden;min-width:0}.set-cell{display:grid;place-items:center;border-left:3px solid var(--accent);font-size:max(var(--set-size),var(--game-size));font-weight:1000;min-width:0}.time-box{grid-column:2;grid-row:2/4;margin-left:24px;background:color-mix(in srgb,var(--panel) 80%,white 8%);border-radius:0 70px 70px 0;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;font-weight:1000;overflow:hidden;padding:20px}.time-box span{font-size:var(--timer-label-size)}.time-box strong{margin-top:26px;font-size:var(--timer-size);white-space:nowrap;max-width:100%;line-height:1}.footer{max-width:var(--max-width);width:100%;height:80px;margin:0 auto;display:flex;justify-content:space-between;align-items:center;overflow:hidden}.sponsors{display:flex;gap:18px;align-items:center;height:100%}.sponsor{min-width:150px;height:64px;padding:8px 18px;display:grid;place-items:center;background:rgba(255,255,255,.10);border-radius:16px;font-weight:900;overflow:hidden}.sponsor img{width:100%;height:100%;object-fit:contain}.source{font-size:14px;color:var(--muted);letter-spacing:.1em}.prematch{max-width:var(--max-width);width:100%;height:100%;margin:auto;display:flex;flex-direction:column;gap:64px;justify-content:center}.prematch-player{font-size:82px;line-height:1.1;font-weight:1000;background:linear-gradient(90deg,var(--panel),transparent);border-radius:999px;padding:24px 55px;display:flex;align-items:center;gap:30px;min-width:0}.prematch-player.right{justify-content:flex-end;background:linear-gradient(270deg,var(--panel-alt),transparent)}.versus{text-align:center;font-size:130px;line-height:1;font-weight:1000}.waiting{position:absolute;inset:0;background:var(--bg);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px}.waiting strong{font-size:130px}.waiting span{font-size:38px;color:var(--muted)}
.template-arena .title-zone{text-align:left}.template-arena .name-strip{border-radius:70px 0 0 70px}.template-arena .time-box{background:#4a4b45}.template-minimal .tournament{font-size:var(--title-size)}.template-minimal .live-board{grid-template-columns:minmax(0,1fr) 280px;grid-template-rows:90px 190px 190px 90px}.template-minimal .score-row{grid-template-columns:min(var(--country-col),250px) min(var(--point-col),330px) minmax(0,1fr)}.template-minimal .country-badge{width:85px;height:85px;flex-basis:85px;font-size:24px}
/* v0.3.5: optional elements can be repositioned/resized by Scoreboard Studio. */
.free-element{position:relative!important;transform-origin:center;overflow:visible!important}.footer{overflow:visible}.sponsors.free-element{align-self:center;justify-content:flex-start}.brand-slot.free-element img,.sponsors.free-element img{max-width:100%;max-height:100%;object-fit:contain}.time-box.free-element{align-self:center;justify-self:center}.status-banner.free-element{justify-self:center;align-self:center}
/* v0.4.0 direct visual layout editing inside Scoreboard Studio */
body.editor-mode [data-layout-key].editor-selected{outline:4px dashed #58f2b3;outline-offset:5px;cursor:move!important}
.layout-resize-handle{position:absolute;width:28px;height:28px;right:-14px;bottom:-14px;border-radius:7px;background:#58f2b3;border:3px solid #062016;z-index:999;cursor:nwse-resize;box-shadow:0 0 0 3px rgba(0,0,0,.35)}

/* v0.4.5: direct public links fill the complete viewport; clean layouts reuse empty branding space. */
.board.clean-layout{grid-template-rows:130px auto 1fr;padding:18px 30px;gap:10px}.board.clean-layout .topbar{height:130px;max-width:1840px}.board.clean-layout .tournament{font-size:var(--title-size)}.board.clean-layout .meta{font-size:var(--meta-size);margin-top:6px}.board.clean-layout .live-board{max-width:1840px;grid-template-columns:minmax(0,1fr) 390px;grid-template-rows:118px var(--row-height) var(--row-height) 118px}.board.clean-layout .name-strip{font-size:var(--name-size);line-height:1.05}.board.clean-layout .score-row{grid-template-columns:var(--country-col) var(--point-col) minmax(0,1fr)}.board.clean-layout .time-box{margin-left:20px}.board.clean-layout .prematch{max-width:1840px}.board.clean-layout.no-footer .live-board{align-content:center}.board.clean-layout .footer{display:none}

/* v0.4.6: keep a stable set grid even when future sets are still empty. */
.set-cells{grid-auto-flow:unset;grid-template-columns:repeat(var(--set-slots,3),minmax(0,1fr))}
.set-cell.empty-set{color:transparent}
.board.clean-layout .set-cells{min-width:0}

/* v0.4.7: service player is visible at a glance, not only by a tiny dot. */
.score-row.serving .current-score{position:relative}.score-row.serving .current-score:before{content:'';position:absolute;left:0;top:0;bottom:0;width:16px;background:var(--serve-color,#b8db18);box-shadow:0 0 24px var(--serve-color,#b8db18)}

/* v0.5.0: advanced theme background layers. */
.board{isolation:isolate;background:var(--bg);}
.board::before{content:'';position:absolute;inset:0;z-index:0;pointer-events:none;background-image:var(--bg-image,none);background-size:cover;background-position:center;background-repeat:no-repeat;opacity:var(--bg-image-opacity,0);filter:var(--bg-image-filter,none);transform:scale(1.01)}
.board::after{content:'';position:absolute;inset:0;z-index:0;pointer-events:none;background:var(--bg-overlay,transparent)}
.board>*{z-index:1}
.tournament.title-gradient{background-image:var(--title-gradient);background-clip:text;-webkit-background-clip:text;color:transparent;-webkit-text-fill-color:transparent}

.idle-screen{position:absolute;inset:0;z-index:100!important;background:#000;display:grid;place-items:center}.idle-screen img{width:100%;height:100%;object-fit:contain;background:#000}.idle-screen.black img{display:none}

/* v0.6.8: next-match presentation and URL-driven sponsor branding. */
.prematch{position:relative}.prematch-branding{position:absolute;left:0;right:0;top:8px;height:120px;display:flex;align-items:center;justify-content:space-between;gap:30px;color:var(--muted);font-size:42px;font-weight:900;text-transform:uppercase;letter-spacing:.04em}.prematch-branding img{max-width:300px;max-height:105px;object-fit:contain}.prematch-player{margin-top:30px}.prematch .country-badge:empty{visibility:hidden}

/* v0.7.0: production-oriented proportions inspired by real broadcast scoreboards.
   Public scoreboards default to this layout. Scoreboard Studio keeps theme layout
   unless layout=production is explicitly requested. */
.board.production-layout{
  padding:22px 30px;
  gap:10px;
  grid-template-rows:112px auto 1fr 58px;
}
.board.production-layout.no-footer{grid-template-rows:112px auto 1fr}
.board.production-layout .topbar{
  height:112px;
  max-width:1820px;
  grid-template-columns:130px minmax(0,1fr) 130px;
  gap:18px;
  border-bottom-width:2px;
}
.board.production-layout.no-branding .topbar{grid-template-columns:1fr}
.board.production-layout .brand-slot{height:82px}
.board.production-layout .title-zone{text-align:left}
.board.production-layout .tournament{
  font-size:min(var(--title-size),54px);
  line-height:.95;
  letter-spacing:.035em;
  max-height:58px;
  white-space:nowrap;
  text-overflow:ellipsis;
}
.board.production-layout .meta{
  margin-top:6px;
  font-size:min(var(--meta-size),22px);
  letter-spacing:.11em;
}
.board.production-layout .status-banner{font-size:30px;padding:8px 24px}
.board.production-layout .live-board{
  max-width:1780px;
  width:100%;
  height:720px;
  align-self:center;
  grid-template-columns:minmax(0,1fr) 300px;
  grid-template-rows:88px 205px 205px 88px;
  align-content:center;
}
.board.production-layout .live-board.no-timer{grid-template-columns:minmax(0,1fr)}
.board.production-layout .name-strip{
  padding:5px 38px;
  font-size:min(var(--name-size),64px);
  line-height:78px;
  border-radius:60px 0 0 60px;
}
.board.production-layout .score-row{
  grid-template-columns:210px 330px minmax(0,1fr);
  border-bottom-width:2px;
}
.board.production-layout .country-block{border-radius:58px 0 0 58px;gap:12px}
.board.production-layout .country-badge{
  width:min(var(--country-size),112px);
  height:min(var(--country-size),112px);
  flex-basis:min(var(--country-size),112px);
  border-width:3px;
  font-size:36px;
}
.board.production-layout .serve{width:24px;height:24px;flex-basis:24px;border-width:2px;box-shadow:0 0 14px var(--serve-color,#b8db18)}
.board.production-layout .current-score{font-size:min(var(--game-size),150px)}
.board.production-layout .set-cells{grid-template-columns:repeat(var(--set-slots,3),minmax(0,1fr))}
.board.production-layout .set-cell{
  font-size:min(max(var(--set-size),92px),118px);
  border-left-width:2px;
}
.board.production-layout .time-box{
  margin-left:18px;
  border-radius:0 58px 58px 0;
  padding:16px;
}
.board.production-layout .time-box span{font-size:min(var(--timer-label-size),32px);line-height:1.05}
.board.production-layout .time-box strong{margin-top:22px;font-size:min(var(--timer-size),64px)}
.board.production-layout .footer{height:58px;max-width:1780px}
.board.production-layout .prematch{max-width:1780px;gap:54px}
.board.production-layout .prematch-player{font-size:72px;padding:20px 48px}
.board.production-layout .versus{font-size:112px}
.board.production-layout .prematch-branding{height:90px;font-size:30px}
.board.production-layout .prematch-branding img{max-height:78px;max-width:250px}

/* header=0: full production canvas for the scoreboard itself. */
.board.hide-header{grid-template-rows:auto 1fr 58px;padding-top:18px}
.board.hide-header.no-footer{grid-template-rows:auto 1fr}
.board.hide-header .topbar{display:none}
.board.hide-header .status-banner{margin-top:4px}
.board.production-layout.hide-header .live-board{height:800px;max-width:1810px}
.board.production-layout.hide-header .prematch{max-width:1810px}

/* Prevent older clean-layout rules from undoing the production geometry. */
.board.production-layout.clean-layout{grid-template-rows:112px auto 1fr;padding:22px 30px;gap:10px}
.board.production-layout.clean-layout.no-footer{grid-template-rows:112px auto 1fr}
.board.production-layout.clean-layout.hide-header{grid-template-rows:auto 1fr;padding-top:18px}
.board.production-layout.clean-layout .topbar{height:112px;max-width:1820px}
.board.production-layout.clean-layout .live-board{max-width:1780px;grid-template-columns:minmax(0,1fr) 300px;grid-template-rows:88px 205px 205px 88px}
.board.production-layout.clean-layout.hide-header .live-board{max-width:1810px;height:800px}

/* v0.7.1: fixed production canvas. Never stretch the scoreboard to the browser ratio. */
.stage,.board{width:1800px;height:950px}
.country-badge{overflow:hidden;padding:0}
.country-badge img{width:100%;height:100%;display:block;object-fit:cover;border-radius:50%}
.country-badge.country-empty{visibility:hidden}
.board.production-layout{padding:18px 26px;grid-template-rows:92px auto 1fr 48px;gap:8px}
.board.production-layout.no-footer{grid-template-rows:92px auto 1fr}
.board.production-layout .topbar{height:92px;max-width:1735px;grid-template-columns:100px minmax(0,1fr) 100px}
.board.production-layout .brand-slot{height:68px}
.board.production-layout .tournament{font-size:min(var(--title-size),44px);max-height:48px}
.board.production-layout .meta{font-size:min(var(--meta-size),17px);margin-top:3px}
.board.production-layout .live-board{max-width:1710px;height:650px;grid-template-columns:minmax(0,1fr) 260px;grid-template-rows:72px 190px 190px 72px}
.board.production-layout .name-strip{padding:3px 30px;font-size:min(var(--name-size),56px);line-height:66px}
.board.production-layout .score-row{grid-template-columns:190px 310px minmax(0,1fr)}
.board.production-layout .country-badge{width:min(var(--country-size),104px);height:min(var(--country-size),104px);flex-basis:min(var(--country-size),104px);background:var(--flag-bg)}
.board.production-layout .current-score{font-size:min(var(--game-size),140px)}
.board.production-layout .set-cell{font-size:min(max(var(--set-size),84px),108px)}
.board.production-layout .time-box{margin-left:14px;border-radius:0 52px 52px 0;padding:12px}
.board.production-layout .time-box span{font-size:min(var(--timer-label-size),27px)}
.board.production-layout .time-box strong{font-size:min(var(--timer-size),55px);margin-top:18px}
.board.production-layout.hide-header .live-board{height:735px;max-width:1740px}
.board.production-layout.hide-header .prematch{max-width:1740px}
.board.production-layout.clean-layout .topbar{height:92px;max-width:1735px}
.board.production-layout.clean-layout .live-board{max-width:1710px;grid-template-columns:minmax(0,1fr) 260px;grid-template-rows:72px 190px 190px 72px}
.board.production-layout.clean-layout.hide-header .live-board{max-width:1740px;height:735px}


/* v0.8.0: compact broadcast geometry inspired by traditional court scoreboards. */
.stage,.board{width:1600px;height:1000px}
.country-block{gap:0}
.serve{display:none!important}
.country-badge.country-double{width:150px!important;height:170px!important;flex-basis:150px!important;border:0;background:transparent;display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center}
.country-badge.country-double img{width:72px;height:72px;flex:0 0 72px;border:3px solid rgba(255,255,255,.75);border-radius:50%;object-fit:cover}
.board.production-layout{padding:20px 24px;grid-template-rows:100px auto 1fr 44px;gap:8px}
.board.production-layout.no-footer{grid-template-rows:100px auto 1fr}
.board.production-layout .topbar{height:100px;max-width:1540px;grid-template-columns:92px minmax(0,1fr) 92px}
.board.production-layout .live-board{max-width:1520px;height:730px;grid-template-columns:minmax(0,1fr) 250px;grid-template-rows:86px 220px 220px 86px}
.board.production-layout .name-strip{padding:5px 28px;font-size:var(--name-size);line-height:76px;text-align:left}
.board.production-layout .score-row{grid-template-columns:210px 300px minmax(0,1fr)}
.board.production-layout .country-badge:not(.country-double){width:min(var(--country-size),112px);height:min(var(--country-size),112px);flex-basis:min(var(--country-size),112px)}
.board.production-layout .current-score{font-size:var(--game-size);text-align:center}
.board.production-layout .set-cell{font-size:var(--set-size);text-align:center}
.board.production-layout .time-box{margin-left:12px;border-radius:0 48px 48px 0;padding:10px}
.board.production-layout .time-box span{font-size:var(--timer-label-size)}
.board.production-layout .time-box strong{font-size:var(--timer-size);margin-top:14px}
.board.production-layout.hide-header .live-board{height:825px;max-width:1540px}
.board.production-layout.clean-layout .live-board{max-width:1520px;grid-template-columns:minmax(0,1fr) 250px;grid-template-rows:86px 220px 220px 86px}
.board.production-layout.clean-layout.hide-header .live-board{height:825px;max-width:1540px}
.score-row.serving .current-score:before{width:14px}


/* v0.8.1: broadcast-first geometry. The points column and every set are distinct
   score cells, matching conventional physical/broadcast tennis scoreboards. */
.stage,.board{width:1560px;height:1000px}
.board.production-layout{padding:18px 22px;grid-template-rows:92px auto 1fr 42px;gap:7px}
.board.production-layout.no-footer{grid-template-rows:92px auto 1fr}
.board.production-layout .topbar{height:92px;max-width:1516px;grid-template-columns:86px minmax(0,1fr) 86px}
.board.production-layout .tournament{font-size:min(var(--title-size),58px);max-height:62px}
.board.production-layout .meta{font-size:min(var(--meta-size),20px)}
.board.production-layout .live-board{max-width:1516px;height:748px;grid-template-columns:minmax(0,1fr) 210px;grid-template-rows:94px 224px 224px 94px}
.board.production-layout .name-strip{padding:4px 30px;font-size:var(--name-size);line-height:86px;display:flex;align-items:center}
.board.production-layout .score-row{grid-template-columns:190px 300px minmax(0,1fr)}
.board.production-layout .country-block{border-radius:54px 0 0 54px}
.board.production-layout .country-badge:not(.country-double){width:min(var(--country-size),118px);height:min(var(--country-size),118px);flex-basis:min(var(--country-size),118px)}
.board.production-layout .country-badge.country-double{width:176px!important;height:210px!important;flex-basis:176px!important;gap:9px}
.board.production-layout .country-badge.country-double img{width:88px;height:88px;flex-basis:88px}
.board.production-layout .current-score{font-size:var(--game-size);border-left:0;border-right:3px solid var(--accent);position:relative}
.board.production-layout .set-cells{grid-template-columns:repeat(var(--set-slots,3),minmax(0,1fr));grid-auto-columns:auto}
.board.production-layout .set-cell{font-size:var(--set-size);border-left:0;border-right:3px solid var(--accent);line-height:1}
.board.production-layout .set-cell:last-child{border-right:0}
.board.production-layout .time-box{margin-left:12px;border-radius:0 46px 46px 0;padding:9px}
.board.production-layout .time-box span{font-size:min(var(--timer-label-size),27px)}
.board.production-layout .time-box strong{font-size:min(var(--timer-size),52px);margin-top:13px}
.board.production-layout.hide-header .live-board{height:840px;max-width:1520px}
.board.production-layout.clean-layout .live-board{max-width:1516px;grid-template-columns:minmax(0,1fr) 210px;grid-template-rows:94px 224px 224px 94px}
.board.production-layout.clean-layout.hide-header .live-board{height:840px;max-width:1520px}
/* Font-size controls grow from the centre of their own fixed cells. */
.current-score,.set-cell,.country-block,.time-box{align-items:center;justify-content:center;text-align:center}

/* v0.9.4: compact doubles/prematch presentation */
.name-strip span,.prematch-player span:not(.country-badge){min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.prematch-player .country-badge.country-double{width:110px!important;height:150px!important;flex-basis:110px!important;gap:6px}
.prematch-player .country-badge.country-double img{width:62px;height:62px;flex-basis:62px}
