/* Mobile-only presentation for the embedded Nova planner.
   The original theme.css and sky.js remain byte-for-byte unchanged.
   All six columns remain present, read in the original document order. */
@media (max-width:600px) {
  html { -webkit-text-size-adjust:100%; }
  body { min-width:0; overflow-x:hidden; }
  header {
    gap:10px;
    padding:16px 14px 14px;
    min-width:0;
  }
  header > div:first-child { min-width:0; width:100%; }
  .brand { font-size:10px; letter-spacing:.2em; margin-bottom:7px; }
  h1 { font-size:clamp(1.35rem,6.3vw,1.8rem); line-height:1.17; margin-bottom:6px; }
  #location { font-size:12px; line-height:1.45; overflow-wrap:anywhere; }
  .nova-actions { gap:7px; width:100%; }
  .nova-settings { width:100%; }
  .nova-settings > summary {
    width:100%;
    padding:11px 13px;
    font-size:14px;
    min-height:44px;
    text-align:center;
  }
  main { min-width:0; padding:15px 12px 35px; }
  .stats { grid-template-columns:minmax(0,1fr); gap:7px; margin-bottom:14px; }
  .stat {
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,auto);
    align-items:center;
    column-gap:10px;
    row-gap:4px;
    min-width:0;
    padding:11px 12px;
  }
  .stat .tag { grid-column:1; grid-row:1; font-size:10px; letter-spacing:.08em; }
  .stat strong {
    grid-column:2;
    grid-row:1 / span 2;
    margin:0;
    max-width:145px;
    font-size:clamp(16px,5.4vw,21px);
    text-align:right;
    line-height:1.25;
    overflow-wrap:anywhere;
  }
  .stat p {
    grid-column:1;
    grid-row:2;
    min-width:0;
    font-size:11px;
    line-height:1.35;
    margin:0;
  }
  .toolbar {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    margin:0 0 12px;
  }
  .toolbar #search {
    grid-column:1 / -1;
    width:100%;
    max-width:none;
    min-width:0;
    padding:11px 12px;
    font-size:16px; /* Avoid iOS input zoom. */
    min-height:45px;
  }
  .toolbar button,
  .toolbar select {
    min-width:0;
    width:100%;
    min-height:44px;
    padding:9px 7px;
    font-size:13px;
    line-height:1.35;
  }
  .toolbar button[onclick] { grid-column:1 / -1; }
  #count {
    margin:0 0 12px;
    font-size:11px;
    line-height:1.5;
    overflow-wrap:anywhere;
  }
  /* Preserve the original accessible table, but visually turn each <tr>
     into a labelled, touch-friendly mobile target card. */
  .table-wrap {
    width:100%;
    max-width:100%;
    min-width:0;
    overflow:visible;
    padding:0;
    border:0;
    background:transparent;
  }
  .table-wrap table,
  .table-wrap tbody {
    display:block;
    width:100%;
    max-width:100%;
  }
  .table-wrap thead {
    position:absolute;
    width:1px;
    height:1px;
    overflow:hidden;
    clip-path:inset(50%);
    white-space:nowrap;
  }
  .table-wrap tbody {
    display:grid;
    gap:10px;
  }
  .table-wrap tbody tr {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    column-gap:11px;
    row-gap:2px;
    min-width:0;
    padding:11px 13px 12px;
    background:linear-gradient(125deg,#122630,#0a161e);
    border:1px solid var(--line);
    border-radius:10px;
  }
  .table-wrap tbody td {
    display:block;
    min-width:0;
    margin:0;
    padding:7px 0 4px;
    border:0;
    font-size:13px;
    line-height:1.45;
    overflow-wrap:anywhere;
  }
  .table-wrap tbody td:first-child {
    grid-column:1 / -1;
    padding:4px 0 10px;
    margin:0 0 2px;
    border-bottom:1px solid var(--line);
    font-size:19px;
    line-height:1.3;
    color:var(--cyan);
  }
  .table-wrap tbody td:first-child .tag {
    display:inline-block;
    margin-left:6px;
    vertical-align:middle;
    padding:4px 6px;
    border-radius:5px;
    font-size:9px;
    line-height:1.2;
    letter-spacing:.04em;
    background:#1a3b43;
  }
  .table-wrap tbody td p.small { margin:3px 0 0; font-size:11px; line-height:1.5; }
  .table-wrap tbody td:not(:first-child)::before {
    display:block;
    margin-bottom:4px;
    font-size:10px;
    line-height:1.4;
    font-weight:700;
    letter-spacing:.10em;
    color:var(--muted);
  }
  .table-wrap tbody td:nth-child(2)::before { content:"TYPE"; }
  .table-wrap tbody td:nth-child(3)::before { content:"MAGNITUDE"; }
  .table-wrap tbody td:nth-child(4) { grid-column:1 / -1; }
  .table-wrap tbody td:nth-child(4)::before { content:"OBSERVING WINDOW"; }
  .table-wrap tbody td:nth-child(5)::before { content:"PEAK ALTITUDE"; }
  .table-wrap tbody td:nth-child(6)::before { content:"MOON DISTANCE"; }
  .table-wrap tbody td.empty {
    grid-column:1 / -1;
    padding:19px 8px;
    text-align:center;
  }
  .table-wrap tbody td.empty::before { display:none; }
  footer { margin-top:22px; padding-top:18px; font-size:11px; line-height:1.7; overflow-wrap:anywhere; }
  /* Settings remain in the iframe, with an independently scrollable form. */
  body .nova-settings .nova-settings-panel {
    position:fixed;
    inset:10px;
    top:10px;
    right:10px;
    bottom:10px;
    left:10px;
    width:auto;
    max-height:calc(100vh - 20px);
    max-height:calc(100dvh - 20px);
    overflow-y:auto;
    overscroll-behavior:contain;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
    padding:15px;
    z-index:100;
    box-shadow:0 0 0 999px rgba(0,0,0,.48),0 14px 30px #0009;
  }
  body .nova-settings .nova-settings-panel h2 { grid-column:1; grid-row:1; align-self:center; }
  body .nova-settings .nova-settings-close {
    display:block;
    grid-column:2;
    grid-row:1;
    min-height:42px;
    padding:8px 10px;
    font-size:13px;
    justify-self:end;
  }
  body .nova-settings .nova-settings-panel input {
    padding:10px;
    font-size:16px; /* No unwanted focus zoom on iOS Safari. */
    min-height:44px;
    min-width:0;
  }
  .nova-settings-actions { justify-content:stretch; }
  .nova-settings-actions .link-button,
  .nova-settings-actions button {
    flex:1 1 115px;
    min-height:44px;
    text-align:center;
    padding:10px 9px;
    font-size:13px;
  }
}
