/* GymNoor Live results: phone-first layout without horizontal clipping.
   Mobile cards preserve every score; desktop tables and print pages are unchanged. */
html,body { max-width:100%; overflow-x:clip; }
.wrap,.comp-head,.card,.public-section,#public-results { min-width:0; }
.orientation-tip { display:none; }
@media screen and (max-width:850px) {
  html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
  .wrap { width:100%; max-width:100%; padding:12px max(10px,env(safe-area-inset-right)) 32px max(10px,env(safe-area-inset-left)); }
  .comp-head { padding:14px; margin-bottom:12px; gap:12px; }
  .comp-title { font-size:clamp(20px,5.5vw,28px); line-height:1.2; overflow-wrap:anywhere; }
  .meta { gap:6px; }
  .tag { font-size:12px; }
  .actions { width:100%; }
  .actions .btn { flex:1 1 120px; text-align:center; }
  .card { padding:12px; border-radius:12px; }
  .card h2, .public-heading { font-size:clamp(19px,4.8vw,24px); line-height:1.3; overflow-wrap:anywhere; }
  .public-heading { margin:20px 0 12px; }
  .public-section { margin-bottom:12px; }
  .public-filters { display:flex; flex-direction:column; gap:12px; align-items:stretch; }
  .public-filters label { display:flex; flex-direction:column; align-items:stretch; gap:5px; font-size:15px; }
  .public-filters select { font-size:16px; min-height:44px; width:100%; max-width:100%; }
  .public-filters .update-note { font-size:13px; }
  .public-apparatus-grid { gap:12px; }
  .public-event-title { gap:8px; }
  .public-event-title .app-photo { width:70px; height:52px; }
  /* Instead of a table bigger than a phone, show one complete gymnast card per row. */
  .table-wrap { width:100%; max-width:100%; overflow:visible; border:0; border-radius:0; }
  table.results { display:block; width:100%; min-width:0; border:0; }
  .results thead { display:none; }
  .results tbody { display:grid; width:100%; gap:11px; }
  .results tbody tr { display:grid; width:100%; min-width:0; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; padding:10px; border:1px solid #557caf; background:#102f66; border-radius:12px; }
  .results td { display:flex; min-width:0; align-items:center; flex-direction:column; justify-content:center; gap:4px; white-space:normal; overflow-wrap:anywhere; text-align:center; border:1px solid #355b91; border-radius:8px; background:#184078; padding:9px 5px; font-size:clamp(15px,3.8vw,18px); font-variant-numeric:tabular-nums; line-height:1.25; }
  .results td::before { content:attr(data-label); display:block; color:#c8e1ff; font-size:clamp(11px,2.9vw,13px); font-weight:750; line-height:1.25; max-width:100%; overflow-wrap:anywhere; }
  .results td.name { grid-column:1/-1; color:#fff; background:#15386f; text-align:center; font-size:clamp(17px,4.4vw,21px); font-weight:850; }
  .results td.name small { display:block; color:#d1e3f5; font-weight:550; margin-top:2px; }
  .results td.final { grid-column:1/-1; background:#214d8d; border-color:#81a8d2; color:#fff; font-size:clamp(21px,5vw,26px); }
  .results td.empty { grid-column:1/-1; min-height:70px; }
  .results td.empty::before { display:none; }
  .results tr:hover td { background:#184078; }
  .results tr:hover td.final { background:#214d8d; }
  .apparatus-table tbody tr { grid-template-columns:repeat(6,minmax(0,1fr)); }
  .apparatus-table tbody td:nth-child(1),.apparatus-table tbody td:nth-child(2) { grid-column:span 3; }
  .apparatus-table tbody td:nth-child(4),.apparatus-table tbody td:nth-child(5),.apparatus-table tbody td:nth-child(6) { grid-column:span 2; }
  .apparatus-table tbody td.name,.apparatus-table tbody td.final,.apparatus-table tbody td.empty { grid-column:1/-1; }
  .app-tools { padding:12px; }
  .app-tools .app-tools-row { flex-direction:column; align-items:stretch; }
  .app-tools .btn { min-height:43px; }
}
@media screen and (max-width:850px) and (orientation:landscape) and (min-width:630px) {
  .results tbody { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .results tbody tr { align-content:start; }
  .wrap { padding-top:8px; }
}
@media screen and (max-width:850px) and (orientation:portrait) {
  .orientation-tip:not([hidden]) { display:flex; align-items:center; gap:10px; padding:10px 12px; margin:0 0 12px; background:#153e7a; color:#fff; border:1px solid #6f99d2; border-radius:12px; line-height:1.45; font-size:14px; }
  .orientation-tip .orientation-message { flex:1; min-width:0; }
  .orientation-tip button { flex-shrink:0; border:1px solid #8cb3e0; color:#fff; background:#275797; border-radius:8px; width:34px; height:34px; font:700 21px/1 Arial; cursor:pointer; }
}
/* On phones, show competition scores first. Keep push setup reachable via Alerts. */
.mobile-alerts-jump { display:none; }
@media screen and (max-width:850px) {
  .wrap:has(#public-results) { display:flex; flex-direction:column; }
  .wrap:has(#public-results) .comp-head { order:1; }
  .wrap:has(#public-results) .public-filters { order:2; }
  .wrap:has(#public-results) .orientation-tip { order:3; }
  .wrap:has(#public-results) #public-results { order:4; }
  .wrap:has(#public-results) .app-tools { order:5; margin-top:14px; scroll-margin-top:12px; }
  .wrap:has(#public-results) .footer { order:6; }
  .wrap:has(#public-results) .mobile-alerts-jump { display:inline-flex; align-items:center; justify-content:center; flex:0 0 62px; }
  .wrap:has(#public-results) .actions .btn { padding:9px 7px; font-size:12px; }
  .wrap:has(#public-results) .public-filters { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .wrap:has(#public-results) .public-filters label { min-width:0; font-size:13px; }
  .wrap:has(#public-results) .public-filters select { width:100%; font-size:16px; }
  .wrap:has(#public-results) .public-filters .update-note { grid-column:1/-1; margin:0; }
  .wrap:has(#public-results) .public-section > .update-note { font-size:13px; line-height:1.45; margin:0 0 12px; }
}
@media screen and (max-width:850px) and (orientation:landscape) {
  .wrap:has(#public-results) .comp-head { flex-direction:row; align-items:center; }
  .wrap:has(#public-results) .comp-title { font-size:clamp(18px,2.8vw,25px); }
  .wrap:has(#public-results) .actions { width:auto; flex-shrink:0; }
  .wrap:has(#public-results) .public-filters { grid-template-columns:repeat(2,minmax(0,1fr)) auto; align-items:end; }
  .wrap:has(#public-results) .public-filters .update-note { grid-column:auto; max-width:175px; }
}
