#tee-rows tr:has(.tee-info) { cursor: pointer; }
#tee-rows tr:focus-within > * { background: var(--soft); }
@media (hover: hover) {
  #tee-rows tr:has(.tee-info):hover > * { background: var(--soft); }
}

/* Keep the numbers aligned with the header and reserve space for the cue. */
.results-panel thead th:last-child,
#tee-rows td:last-child {
  position: relative;
  padding-inline-end: 24px;
}
.tee-info {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  display: grid;
  place-items: center;
  inline-size: 24px;
  padding: 0;
  background: transparent;
  color: var(--muted);
}
.tee-info::before {
  content: "";
  inline-size: 6px;
  block-size: 6px;
  border-block-start: 1.5px solid currentColor;
  border-inline-end: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.tee-info:focus-visible {
  outline-offset: -3px;
  border-radius: 8px;
}

#tee-detail {
  border: 1px solid var(--line);
  --hole-row-height: clamp(23px, calc((80dvh - 288px - var(--safe-bottom)) / 9), 52px);
}
#tee-detail[open] {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 80dvh;
  overflow: hidden;
}
#tee-detail .sheet-heading h2 { font-size: 24px; overflow-wrap: anywhere; }
.tee-detail-subtitle { margin-top: 3px; color: var(--ink); font-size: 15px; }
#tee-detail .tee-detail-table {
  height: auto;
  font-size: 16px;
  border-collapse: collapse;
}
#tee-detail .tee-detail-table :is(th, td) {
  text-align: center;
  padding: 0 4px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 0;
}
#tee-detail .tee-detail-table th:first-child { text-align: left; padding-left: 8px; }
.tee-ratings { margin: 9px 0 11px; background: var(--surface); border-radius: 12px; }
.tee-detail-table thead, .tee-detail-table tbody tr { height: 29px; }
#tee-detail .tee-detail-table thead th { font-size: 13px; font-weight: 700; }
.tee-detail-table tbody th { font-weight: 600; }
.tee-detail-table td { font-weight: 600; font-variant-numeric: tabular-nums; }
#tee-hole-section:not([hidden]) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  container: tee-holes / inline-size;
}
.tee-hole-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding-block-start: 32px;
}
.tee-hole-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tee-hole-table thead th { position: sticky; top: 0; }
#tee-detail .tee-hole-table thead th {
  background: var(--bg);
  overflow-wrap: anywhere;
}
@container tee-holes (max-width: 250px) {
  #tee-detail .tee-hole-table :is(th, td) { padding-inline: 2px; }
  #tee-detail .tee-hole-table thead th { font-size: 11px; }
  #tee-detail .tee-hole-table #tee-hole-unit { width: 27%; }
  #tee-detail .tee-hole-table #tee-hole-index { width: 19%; }
  #tee-detail .tee-hole-table #tee-strokes-heading { width: 24%; }
}
.tee-hole-table tbody tr { height: var(--hole-row-height); }
.tee-hole-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: none;
  margin-bottom: 7px;
}
.tee-nine-picker, .tee-rating-picker {
  flex: 1 1 94px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  padding: 2px;
  background: var(--surface);
  border-radius: 12px;
}
.tee-hole-toolbar [hidden] { display: none; }
.tee-hole-toolbar button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 2px;
  background: transparent;
  color: var(--ink);
  border-radius: 9px;
  font: 700 12px Manrope, sans-serif;
}
.tee-hole-toolbar button[aria-pressed=true] {
  background: var(--soft);
  color: var(--accent);
}
.tee-hole-table th:first-child { width: 17%; }
.tee-hole-table #tee-hole-unit { width: 28%; }
.tee-hole-table #tee-hole-index { width: 20%; }
.tee-hole-table #tee-strokes-heading { width: 21%; }
#tee-detail .tee-hole-table .tee-strokes { color: var(--muted); }
.tee-stroke-marks {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
  color: var(--accent);
}
.tee-stroke-marks > span {
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: currentColor;
}
.tee-hole-table tbody tr:nth-child(odd) { background: var(--surface); }
.tee-no-holes { color: var(--muted); font-size: 13px; margin-top: 10px; }

@media (orientation: portrait) and (max-height: 560px) {
  #tee-detail {
    --hole-row-height: 25px;
    padding-block-start: 8px;
    padding-block-end: calc(8px + var(--safe-bottom));
  }
  #tee-detail[open] { height: calc(100dvh - var(--safe-top) - 12px); }
  #tee-detail .sheet-heading h2 { font-size: 22px; }
  .tee-ratings { margin: 5px 0 7px; }
  .tee-ratings thead, .tee-ratings tbody tr, .tee-hole-table thead { height: 23px; }
  .tee-hole-toolbar { margin-bottom: 4px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  #tee-detail { --hole-row-height: 27px; }
  #tee-detail[open] {
    height: 88dvh;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px 15px;
    align-items: start;
  }
  #tee-detail > .sheet-heading { grid-column: 1 / -1; margin: 0; }
  .tee-ratings { margin: 0; }
  #tee-hole-section { align-self: stretch; }
}
@media (orientation: landscape) and (max-height: 340px) {
  #tee-detail[open] { grid-template-columns: minmax(0, .9fr) minmax(0, 1.2fr); }
  #tee-detail > .sheet-heading { grid-area: 1 / 1; }
  .tee-ratings { grid-area: 2 / 1; align-self: start; }
  #tee-hole-section { grid-area: 1 / 2 / span 2; }
  #tee-detail .tee-ratings { font-size: 14px; }
  #tee-detail .tee-ratings thead th { font-size: 12px; }
  #tee-detail .tee-detail-table th:first-child { padding-left: 4px; }
  .tee-ratings th:first-child { width: 31%; }
}
