* {
    box-sizing: border-box;
}

html {
    height: 100%;
    width: 100%;
    padding: 0;
    margin: 0;
    font-size: 16px;
    font-family: Helvetica, sans-serif;
    background-color:rgba(100, 149, 237, 0.25);
}

body {
    height: 100%;
    width: 100%;
    margin: 0;
}

/* Responsive knobs */
:root {
    /* Tap target: min ~44px, scales with vw, caps at ~52px */
    --home-tap: clamp(4rem, 10vw, 6rem);
    /* Icon size inside */
    --home-icon: calc(var(--home-tap) * 0.80);

    /* Responsive knobs (rem-based, viewport aware) */
    --close-tap:  clamp(2.75rem, 8vw, 6rem);      /* button size */
    --close-icon: calc(var(--close-tap) * 0.9);     /* svg size */
}

/* Position in a corner (change left/right as you like) */
/* #site-home-button {
    position: fixed;
    top: 1.25rem;
    left: 1.25rem;
} */
    /* or right: 0.75rem; */
    /* z-index: 1000; */

/* Button styling (transparent, accessible) */
.home-btn {
    display: inline-grid;
    place-items: center;
    inline-size: var(--home-tap);
    block-size: var(--home-tap);
    padding: calc((var(--home-tap) - var(--home-icon)) / 2);
    border: 0;
    border-radius: 999px;
    /* round hit area */
    background: transparent;
    color: inherit;
    /* icon follows surrounding text color */
    text-decoration: none;
    cursor: pointer;
    opacity: .9;
    transition: opacity .15s ease, transform .08s ease;
    -webkit-tap-highlight-color: transparent;
}

.home-btn:hover {
    opacity: 1;
}

.home-btn:active {
    transform: scale(.96);
}

.home-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

.home-btn svg {
    width: var(--home-icon);
    height: var(--home-icon);
    pointer-events: none;
}



.headline {
    position: sticky;
    top: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: auto auto auto;
    grid-template-rows: 100%;
    width: 100%;
    grid-template-areas: "head-lt head-mid head-rt";
    /* justify-content: space-around; */
    align-items: center;
    background-color: dodgerblue;
    border-bottom-style: solid;
    padding: 1rem;
}

.headline-left {
    grid-area: head-lt;
    text-align: left;
    font-size: 3rem;
    font-variant: small-caps;
}

.headline-middle {
    grid-area: head-mid;
    text-align: center;
}
.headline-right {
    grid-area: head-rt;
    text-align: right;
    font-size: 3rem;
    font-variant: small-caps;
}
.headline-right a {
    text-decoration: none;
}

.site-name {
    font-size: 4rem;
    font-style:italic;
    font-weight: 800;
    font-family:'Times New Roman', Times, serif;
    text-align: center;
}
.site-name a:link,
.site-name a:visited {
    /* color:rgb(80, 79, 79); */
    color: black;
    text-decoration: none;
}


#match-detail {
    grid-area: match-detail;
    font-size: 2rem;
    font-weight: 400;
    text-align: right;
}

#event-headline {
    grid-area: event-headline;
}

#event-name {
    font-size: 4rem;
    font-style:italic;
    font-weight: 600;
    padding: 2rem 1rem 0.5rem 1rem;
    justify-self: center;
    flex-shrink: 1;
    text-overflow: ellipsis;
}


.event-info h2 {
    font-size: 3rem;
}

.event-info h3 {
    font-size: 2.5rem;
    font-weight: 400;
}


#scores-subtitle {
    display: none;    
}



.info-profile-team>* {
    text-align: center;
}


.pp-item {
    /* margin: .5rem; */
    align-self: last baseline;   /* modern browsers */
}



/* 1) Define the shared row tracks on the parent grid */
.info-profile-team {
    background-color:rgba(26, 115, 116, 0.3);
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    grid-template-rows: repeat(6, auto);   /* name, pic, pti, city, club, attire */
    gap: .5rem 1rem;
    justify-items: center;
    padding: 2rem 0;
    align-items: start;
    justify-items: stretch;
    margin: 1rem 1rem;
}


/* 2) Make each player a subgrid that spans those rows */
.info-profile {
    display: grid;
    grid-template-rows: subgrid;  /* adopt the 6 rows above */
    grid-row: 1 / -1;             /* span all parent rows */
    align-content: start;
}

/* 3) Place each field into the correct shared row */
.info-profile .pp-name   { grid-row: 1; font-size: 3rem; font-weight: 600; }
.info-profile .pp-pic    { grid-row: 2; }
.info-profile .pp-pti    {
    grid-row: 3;
    font-size: 2.5rem;
    font-weight: 600;
}

.info-profile .pp-city   { grid-row: 4; font-size: 2rem; }
.info-profile .pp-club   { grid-row: 5; font-size: 2rem; }
.info-profile .pp-attire { grid-row: 6; font-size: 2rem; }

/* Optional niceties */
.pp-pic { display: grid; place-items: center; }
.pp-pic-img { max-width: 100%; height: auto; }


@supports not (grid-template-rows: subgrid) {
    .info-profile { grid-template-rows: repeat(6, auto); } /* independent grids */
}




#info-whoswho {
  margin-top: 2rem;
  margin-bottom: 2rem;
  font-size: 2rem;
  text-align: center;
}
#player-hints-tbl {
    margin: auto;
}
#player-hints-tbl td:nth-child(2) {
    text-align: left;
}
#player-hints-tbl td:first-child {
    text-align: right;
    font-weight: 600;
}
  


#score-bracket-return,
#score-link-apta-results {
    display: none;
}





#transition-box {
  text-align: center;
  background-color: rgba(190, 214, 55, 0.5);
}

#transition-box h2 {
  font-size: 5rem;
  font-weight: 800;
  margin: 0;
  padding: 2rem;
}

#transition-box p {
  font-size: 2.5rem;
  margin: 2rem;
}



.transition-box,
.game-box {
    grid-area: game-box;
    min-height: 20vh;
}

#game-score {
    background-color:bisque;
    /* display: flex; */
    min-height: 20vh;
    /* max-height: 20vh; */
    height: 100%;
    place-items: center;
    place-content: center;
    /* align-content: space-around; */
    justify-content: center;
}

.point_box {
    display: flex;
    width:50%;
    height: 100%;
    flex-direction: column;
    justify-items: center;
    align-items: center;
    padding-top: 1rem;
}

.point_box h1 {
    padding: 1rem 1rem;
    margin: 0px;
    color:coral;
    font-size: 10rem;
    text-align: center;
    text-justify: center;
}

.point-box-name {
    padding: .2rem .1rem .1rem .1rem;
    margin: 0px;
    font-size: 3rem;
}

#pt-t1-name,
#pt-t2-name {
    overflow:hidden;
}




.match-scoreboard-box {
    height: 100%;
    /* border-left-style: solid;
    border-right-style: solid; */
}

.player-profiles {
    height: 100%;
    /* border-left-style: solid;
    border-right-style: solid; */
}


.score-tbl tr:first-child {
    background-color:rgba(100, 149, 237, 0.5);
}

.score-tbl {
    width: 90%;
    margin: 3rem auto;
    max-height: 100%;
    border-collapse: collapse;
    overflow-y:hidden;
    
}

.score-tbl-extras {
    display: none;
}


.score-row-winner {
    /* background-color: rgba(46, 139, 87, 0.5); */
    background-color: rgba(190, 214, 55, 0.5);
}

.score-name, .score-matchname {
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    padding: .3rem .5rem .3rem .3rem !important;
}

.score-court {
    text-align: right;
    font-size: 1rem;
    font-weight: 600;
    padding: .3rem .5rem .3rem .3rem !important;
}

.score-item-tb {
    padding: 0px 0px 2px 0px;
    vertical-align: top;
    margin-left: 0px;
    width: 1rem;
    height: 1.5rem;
    text-align: left;
    font-size: 1rem;
}

.score-item-set, .score-item-game {
    width: 2.5rem;
    height: 1.5rem;
    text-align: center;
    font-size: 1.5rem;
}

.score-item-game {
    background-color: bisque;
}

.score th {
    padding: 0rem 0.5rem;
    font-size: 1.5rem;
}

#scoreboard-tbl {
    width: 100%;
    max-height: 100%;
    border-collapse: collapse;
    overflow-y:hidden;
}
#scoreboard-tbl td {
    text-align: center;
}

#scoreboard-tbl tr {
    height: 20%;
}

#scoreboard-tbl tr:first-child {
    background-color:rgba(100, 149, 237, 0.5);
}

.scoreboard-name {
    text-align: left;
    font-size: 3rem;
    font-weight: 600;
    padding: .3rem .3rem .3rem 0rem !important;
}

.scoreboard th {
    padding: 0rem 0.5rem;
    font-size: 3rem;
}

#scoreboard-tbl th:nth-child(n+2) {
    text-align: center;
}


#scoreboard-tbl th:nth-child(2),
#scoreboard-tbl td:nth-child(2) {
    text-align: left;
}

.scoreboard-ball-td {
    width: 3rem;
}
  
.scoreboard-ball {
    border-radius: 2rem;
    height: 2rem;
    width: 2rem;
    margin: .2rem;
}
  
/* 
#ball-t1a,
#ball-t1b,
#ball-t2a,
#ball-t2b {
    border-radius: 3rem;
    font-size: 3rem;
    width: 4rem;
    text-align: center;
    font-weight: 600;
} */

.scoreboard-tb {
    padding: 0px 0px 2px 0px;
    vertical-align: top;
    margin-left: 0px;
    width: 20px;
    height: 20px;
    text-align: left;
    font-size: 2rem;
}

.scoreboard-s, .scoreboard-g {
    width: 30px;
    height: 30px;
    text-align: center;
    font-size: 3.5rem;
}

.scoreboard-g {
    background-color: bisque;
}


#sponsor {
    background-color:rgba(26, 116, 69, 0.5);
    font-family:'Times New Roman', Times, serif;
    font-variant-caps: petite-caps;
    font-size: 1rem;
    height: 100%;
    width: 100%;
}

#sponsor h1 {
    margin-top:0;
}

#sponsor p {
    text-align: center;
    font-size: 2rem;
    transform: rotate(-20deg);
}

#match-list-img {
    position: fixed;
    right: 3rem;
    width: 20%;
    max-width: 200px;
}

#match-list-tbl {
    font-size: 1.5rem;
    table-layout: auto;
    border-spacing: 0px 2px;
}

#match-list-tbl th {
    text-align: left;
    font-size: 1.5rem;
}

#match-list-tbl tr:nth-child(even) {
    background-color: bisque;
}

#match-list-tbl td:first-child {
    font-weight: 600;
    text-align: center;
    background-color: rgb(184, 247, 221);
    font-size: 2rem;
    border-style: solid;
    border-width: 2px;
    border-radius: 2.5rem;
    height: 5rem;
    width: 5rem;
}

#match-list-tbl td:nth-child(2),
#match-list-tbl td:nth-child(3) {
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
    background-color: rgb(240, 183, 177);
    border-style: solid;
    border-width: 2px;
    border-radius: 2.5rem;
}

#match-list-tbl td:nth-child(7) {
    text-align: center;
}

#admin-mode-toggle {
    font-size: 3rem;
    position:fixed;
    bottom: 3rem;
    right: 3rem;    
}


#event-selection {
    text-align: center;
}

#event-selection h2 {
    font-size: 4rem;
}

#event-selection h4 {
    font-size: 3rem;
}
  
#event-selection table {
    margin-left: auto;
    margin-right: auto;
    border-spacing: 2rem;
}
  
#event-selection-div table td {
    padding: 1rem;
    background-color: bisque;
    border-style: solid;
    border-radius: .5rem;
    font-size: 3rem;
}
  

#event-footer {
    grid-area: event-footer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0rem 1rem;
    font-size: 2rem;
    border-top-style: solid;
    /* background-color: dodgerblue; */
    /* background-color:rgba(100, 149, 237); */
}

#event-footer a:link,
#event-footer a:visited {
    font-weight: 600;
    color:rgb(80, 79, 79);
    text-decoration: none;
}



/* Overlay (scrim) */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    /* dim */
    backdrop-filter: blur(2px);
    /* optional soft blur */
    z-index: 999;
}


/* Your existing base styles (kept as fallbacks) */
.modal-close {
  appearance: none;
  border: 0;
  background: transparent;      /* stays transparent */
  color: inherit;               /* icon color follows surrounding text color */
  inline-size: 40px;            /* fallback hit area */
  block-size: 40px;             /* fallback hit area */
  padding: 8px;                 /* fallback padding */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: .85;
  transition: opacity .15s ease, transform .08s ease;
}
.modal-close:hover { opacity: 1; }
.modal-close:active { transform: scale(.96); }
.modal-close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Responsive overrides — place AFTER the block above */
.modal-close {
  inline-size: var(--close-tap);
  block-size:  var(--close-tap);
  padding: calc((var(--close-tap) - var(--close-icon)) / 2); /* keeps icon centered */
}

/* Scale the SVG to match */
.modal-close svg {
  width:  var(--close-icon);
  height: var(--close-icon);
}










/* Modal */
.modal {
    position: fixed;
    inset: 0;
    display: grid;
    max-height: 90vh;
    /* height: 50vh; */
    overflow: hidden;
    overflow-y: scroll;
    width: 92vw;
    margin: auto;
    grid-template-columns: 100%;
    grid-template-rows: 100%;
    grid-template-areas: "focus-match";
    /* place-items: center; */
    /* align-items: center; */
    z-index: 1000;
    /* background-color: rgba(100, 149, 237, 0.5); */
    /* background-color: white; */
    border-radius: 12px;
    /* above overlay */
}

.modal>* {
    background: #fff;
    /* max-width: 480px; */
    width: min(92vw, 480px);
    /* width: 92vw; */
    border-radius: 12px;
    /* padding: 1rem 1.25rem; */
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}


#modal-close-div {
    grid-area: modal-close-div;
}

#modal-close {
    /* background-color: rgba(100, 149, 237, 0); */
    font-size: 4rem;
    font-weight: 600;
}

/* Nice fade */
.overlay[hidden], .modal[hidden] { display: none; }
.overlay, .modal { opacity: 1; transition: opacity .18s ease; }
body.is-open .overlay[hidden],
body.is-open .modal[hidden] { display: block; } /* unhide when open */
body.is-open .overlay, body.is-open .modal { opacity: 1; }





/* START PREVIOUS PORTRAIT ONLY SECTION */

#event-matches {
    display: grid;
    height: auto;
    width: 100%;
    margin: auto;
    grid-template-columns: 100%;
    grid-template-rows: auto;
    grid-template-areas: "event-headline"
                         "event-scores"
                         "sponsors-apta"
                         "event-qrcode"
                         "event-footer";
}

#info-scores {
    grid-area: event-scores;
}



#focus-match-box {
    grid-area: focus-match;
    /* margin-top: 2rem; */
    display: grid;
    height: auto;
    overflow-y: scroll;
    width: 100%;
    border-style: solid;
    grid-template-columns: 100%;
    grid-template-rows: auto;
    grid-template-areas: "match-headline"
                         "game-state"
                         /* "match-scoreboard-box" */
                         "match-profiles";
}

#match-headline {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: rgba(100, 149, 237);
    grid-area: match-headline;
    padding: 2rem 2rem;
    align-items: center;
    border-bottom-style: solid;
    /* border-top-left-radius: 12px;
    border-top-right-radius: 12px; */
    display: grid;
    height: auto;
    width: 100%;
    /* margin-bottom: 2rem; */
    grid-template-columns: auto auto;
    justify-content: space-between;
    grid-template-areas: "modal-close-div match-detail"
                         "modal-close-div match-detail";
}

#match-detail, #match-location {
    font-size: 3rem;
    font-weight: 600;
}

#game-state {
    grid-area: game-state;
    display: grid;
    grid-template-columns: 100%;
    grid-template-rows: auto;
    grid-template-areas: "score-box"
                         "match-scoreboard-box";
    border-style: none none solid none;
    /* below options allow box to be inset in the dialog instead */
    /* border-style: solid;
    margin: 2rem 1rem; */
}

#match-scoreboard-box {
    grid-area: match-scoreboard-box;
    background-color: rgba(100, 149, 237, 0.25);
    /* border-bottom-style: solid; */
    /* border-bottom-left-radius: 12px; */
    /* border-bottom-right-radius: 12px; */
    /* margin-bottom: 1rem; */
}

#match-profiles {
    grid-area: match-profiles;
    display: grid;
    height: auto;
    width: 100%;
    border-bottom-style: solid;
    grid-template-columns: 100%;
    grid-template-rows: auto;
    grid-template-areas: "profiles-headline"
                         "profiles-t1"
                         "profiles-t2"
}

#info-profile-headline {
    margin: 3rem 0rem 1rem 0rem;
    grid-area: profiles-headline;
    text-align: center;
    font-size: 3rem;
    font-weight: 600;
    /* justify-content: center; */
}

#info-profile-t1 {
    grid-area: profiles-t1;
}

#info-profile-t2 {
    grid-area: profiles-t2;
}

#event-qrcode {
    text-align: center;
    font-size: 2rem;
    grid-area: event-qrcode;
}

#event-qrcode-chartitem {
    display: flex;
    justify-content: space-around;
}

#info-sponsors-apta {
    grid-area: sponsors-apta;
}

.event-info {
    font-size: 2.5rem;
    font-weight: 400;
    text-align: center;
}
.event-info a:link,
.event-info a:visited {
    font-weight: 600;
    /* color:rgb(80, 79, 79); */
    text-decoration: none;
}
.event-info img {
    max-width: 70%;
}

#info-scores,
#sponsors-apta,
#event-qrcode {
    border-bottom-style: solid;
}

.chart-set-1 {
    height: 100%;
    padding: 0.5rem;
}
    

#scores-subtitle {
    display: block;
}

#score-bracket-return,
#score-link-apta-results {
    display: block;
}

.score-box {
    grid-area: score-box;
    min-height: 20vh;
    border-bottom-style: solid;
}

.score-tbl {
    margin: 6rem auto;
    max-height: 100%;
    border-collapse: collapse;
    overflow-y:hidden;
}

.score-tbl-extras {
    display: table;
}

    
.score-name, .score-matchname {
    font-size: 3rem;
    padding: .3rem .5rem .3rem .3rem !important;
}

.score-court {
    font-size: 2rem;
    padding: .3rem .5rem .3rem .3rem !important;
    text-wrap: nowrap;
}

.score-item-tb {
    padding: 0px 0px 2px 0px;
    width: 2rem;
    height: 3rem;
    font-size: 2.5rem;
}

.score-item-set, .score-item-game {
    width: 5rem;
    height: 3rem;
    font-size: 4rem;
}

.score th {
    padding: 0rem 0.5rem;
    font-size: 3rem;
}


#event-footer {
    /* position: sticky;
    bottom: 0;
    z-index: 1; */
    min-height: 6vh;
    border-top-style: solid;
}

/* END PREVIOUS PORTRAIT ONLY SECTION */




@media screen and (orientation: landscape) {

    #event-matches {
        display: grid;
        height: 100%;
        width: 100%;
        margin: auto;
        grid-template-columns: 100%;
        grid-template-rows: auto;
        grid-template-areas: "event-headline"
                             "event-scores"
                             "event-footer";
    }
    #sponsors-apta,
    #event-qrcode {
        display: none;
    }

}




@media only screen and (max-width: 600px) {
    html {
        font-size: 6px;
    }
}

@media only screen and (min-width: 600px) {
    html {
        font-size: 7px;
    }
}

@media only screen and (min-width: 768px) {
    html {
        font-size: 9px;
    }
}

@media only screen and (min-width: 992px) {
    html {
        font-size: 12px;
    }
}

@media only screen and (min-width: 1200px) {
    html {
        font-size: 14px;
    }
}




/* ============ GAME SCORE GRID (two columns, shared rows) ============ */
#game-score {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  grid-template-rows: auto auto auto; /* name A, name B, score */
  gap: .25rem 1rem;
  align-items: start;                  /* vertical alignment handled per item */
  position: relative;                  /* for the divider pseudo-element */
}

/* Each point_box adopts the same 3 rows (subgrid) and centers its content */
#game-score > .point_box {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: 1 / -1;         /* span all rows */
  justify-items: center;    /* HORIZONTAL center within each cell */
  align-content: start;
  width: auto; height: auto;
}
#game-score > .point_box:first-of-type { grid-column: 1; }
#game-score > .point_box:last-of-type  { grid-column: 2; }

/* Map rows + BOTTOM/Baseline align the text so both sides line up */
#game-score .point_box .point-box-name:nth-of-type(1) { grid-row: 1; }
#game-score .point_box .point-box-name:nth-of-type(2) { grid-row: 2; }
#game-score .point_box > h1                          { grid-row: 3; }

#game-score .point_box .point-box-name,
#game-score .point_box > h1 {
  align-self: end;         /* bottom-align rows (fallback) */
  text-align: center;      /* keep text centered */
  margin: 0;
}

/* Crisper typography when supported: align last text baselines */
@supports (align-self: last baseline) {
  #game-score .point_box .point-box-name,
  #game-score .point_box > h1 {
    align-self: last baseline;
  }
}



/* part 2 */


/* Vertical divider between the two point boxes */
#game-score::after {
  content: "";
  position: absolute;
  top: .25rem;                 /* adjust to taste */
  bottom: .25rem;
  left: 50%;
  transform: translateX(-0.5px);   /* crisp 1px on retina */
  width: 0;
  border-left: 1px solid rgba(0,0,0,.35);     /* main line */
  box-shadow: 1px 0 0 rgba(255,255,255,.25);  /* subtle light edge (optional) */
  pointer-events: none;
}

