/* Desktop layout (Midnight Board on a PC). The breakpoint matches DESKTOP_QUERY in js/desktop.js.
   Below it nothing here applies except the keyboard bits at the top, which only style elements
   that phones never render, so the phone layout stays exactly as it was.
   - the tab bar becomes a left sidebar (brand, tabs, account, shortcuts);
   - the Játék tab shows the round entry as a panel beside the standings (tab-game.js deskGameHtml);
   - sheets are centred dialogs, pages fill the area beside the sidebar;
   - layout wrappers (.dk-pair, .dk-split*, .lbr-list) are display: contents on phones. */

.dk-pair, .dk-split, .dk-split-a, .dk-split-b, .lbr-list { display: contents; }

/* ---------- keyboard hints (desktop panel, shortcuts sheet, sidebar) ---------- */
kbd {
  display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 6px; text-align: center;
  font: 600 11px/1.5 var(--font-mono); color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); box-shadow: 0 1px 0 var(--border);
}
.kb-sec { display: flex; flex-direction: column; gap: 2px; }
.kb-sec .sec-title { margin: 0 2px 6px; }
.kb-row { display: flex; align-items: center; gap: 14px; padding: 9px 2px; border-bottom: 1px solid var(--border); font-size: 14px; }
.kb-row:last-child { border-bottom: 0; }
.kb-keys { display: inline-flex; align-items: center; gap: 4px; width: 132px; flex-shrink: 0; }
/* The row the keyboard edits in the round entry (only after a key was used). */
.er.kb { margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 14px; background: var(--accent-soft); border-bottom-color: transparent; }

@media (min-width: 1024px) {
  :root { --side-w: 236px; --page-pad: 40px; }

  /* ---------- shell and sidebar ---------- */
  body:not(.logged-out) .app-shell { max-width: none; margin: 0 0 0 var(--side-w); padding: 30px var(--page-pad) 56px; }
  #banner, #main { width: 100%; max-width: 1200px; margin: 0 auto; }
  #main { gap: 16px; }
  /* Form-like tabs read better narrow; they keep the left edge of the wide column. */
  #main:has(> .tab-form), #main:has(> .menu-list) { max-width: 880px; margin-left: max(0px, (100% - 1200px) / 2); }
  .gx-seg, .gx-page .gx-seg { max-width: 420px; }
  .segscroll { max-width: 640px; }

  .tabbar {
    top: 0; right: auto; width: var(--side-w);
    background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none;
    border-top: 0; border-right: 1px solid var(--border); padding: 0;
  }
  .tabbar-in { max-width: none; height: 100%; margin: 0; flex-direction: column; justify-content: flex-start; padding: 24px 14px 16px; }
  .side-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 26px; }
  .side-brand .brand { font-size: 26px; }
  .side-brand .live { margin-left: auto; font-size: 10.5px; }
  .side-tabs { display: flex; flex-direction: column; gap: 4px; }
  .tab {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 11px 12px; border-radius: 14px; font: 600 14.5px var(--font-body);
  }
  .tab span { flex: 1; text-align: left; }
  .tab.on { background: var(--accent-soft); }
  .tab-key { opacity: 0; transition: opacity 0.15s; }
  .tab:hover .tab-key, .tab:focus-visible .tab-key { opacity: 1; }
  .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
  .side-me, .side-keys {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 14px;
    background: none; color: var(--ink); font: 600 13.5px var(--font-body); text-align: left; cursor: pointer;
  }
  .side-me .avatar { width: 34px; height: 34px; font-size: 15px; }
  .side-me-t { display: flex; flex-direction: column; min-width: 0; }
  .side-me-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-me-t small { font: 500 12px var(--font-body); color: var(--muted); }
  .side-keys { color: var(--muted); }
  .side-keys span { flex: 1; }

  /* The brand lives in the sidebar; the Játék header keeps only a watch tag. */
  .brandrow .brand, .brandrow .live { display: none; }
  .brandrow:not(:has(.watch-tag)) { display: none; }
  .brandrow .watch-tag { margin-left: 0; max-width: none; }

  .toast { bottom: 28px; left: calc(50% + var(--side-w) / 2); }

  /* ---------- Játék tab: standings | entry panel ---------- */
  .dk-game { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 430px); gap: 28px; align-items: start; }
  .dk-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .dk-side { position: sticky; top: 30px; }
  .dk-chart { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
  .dk-chart .sec-title { margin: 0 2px; }
  .hero { padding: 22px 24px; }

  .epanel { display: flex; flex-direction: column; gap: 16px; padding: 20px 22px; border-radius: 26px; }
  .ep-title { margin: 0; font: 700 22px var(--font-head); letter-spacing: -0.02em; }
  .epanel .er-list { margin: 0 -2px; }
  .kbd-hint { margin: -4px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 12px; color: var(--muted); }
  .kbd-hint span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
  button.link.kbd-more { padding: 0; font-size: 12px; display: inline-flex; align-items: center; gap: 5px; margin-left: auto; }

  /* Idle screen: last game and leaderboard side by side */
  .hero.idle { padding: 30px 32px 28px; }
  .hero.idle .hero-btn { width: auto; padding: 15px 28px; }
  .dk-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }

  /* ---------- other tabs ---------- */
  .gx-page { max-width: 1120px; }
  .dk-split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .dk-split-a, .dk-split-b { display: block; }
  .dk-split-b { padding-top: 48px; }
  .dk-split-b .gx-tiles { grid-template-columns: 1fr; margin-top: 0; }
  .rt-scroll, .tscroll { scrollbar-width: thin; }

  .stv { max-width: 1120px; }
  .tiles { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .lbr-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
  .stv .podium { width: 100%; max-width: 620px; margin-left: auto; margin-right: auto; }

  .arch { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
  .arch > .help { grid-column: 1 / -1; }

  .menu-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .run-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

  /* ---------- sheets: centred dialogs; pages beside the sidebar ---------- */
  .sheet {
    top: 0; bottom: 0; margin: auto; height: fit-content; max-height: 88vh; max-width: 600px;
    border-radius: 28px; box-shadow: 0 30px 90px var(--shadow), 0 0 0 1px var(--border);
  }
  .sheet::before { display: none; }
  .sheet-head { padding: 20px 22px 8px; }
  .sheet-body { padding: 6px 24px 26px; }
  .sheet.page {
    --page-w: 760px;
    left: var(--side-w); right: 0; margin: 0; height: auto; max-width: none; max-height: none;
    border-radius: 0; box-shadow: none;
  }
  .sheet.page[data-type="game-detail"], .sheet.page[data-type="archive"], .sheet.page[data-type="stats-hub"] { --page-w: 1120px; }
  .sheet.page .sheet-head, .sheet.page .sheet-body { padding-left: max(var(--page-pad), calc((100% - var(--page-w)) / 2)); padding-right: max(var(--page-pad), calc((100% - var(--page-w)) / 2)); }
  .sheet.page .sheet-head { padding-top: 30px; }
  .sheet.page .sheet-body { padding-bottom: 56px; }
  .sheet.page[data-type="game-detail"] .podium, .sheet.page[data-type="game-detail"] .gd-rest { width: 100%; max-width: 620px; margin-left: auto; margin-right: auto; }

  /* ---------- roomier screens ---------- */
  @media (min-width: 1280px) {
    .hero-title { font-size: 24px; }
    /* The round card of a full-width chart sits beside it. */
    .gx-page .gx-chart.wide, .sheet.page .gx-chart.wide { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 6px 18px; align-items: start; }
    .gx-page .gx-chart.wide .gx-legend, .sheet.page .gx-chart.wide .gx-legend { grid-column: 1; grid-row: 2; }
    .gx-page .gx-chart.wide .gx-tip, .sheet.page .gx-chart.wide .gx-tip { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
  }
  @media (max-width: 1279px) {
    :root { --side-w: 204px; --page-pad: 28px; }
    .dk-game { grid-template-columns: minmax(0, 1fr) 350px; gap: 22px; }
    .epanel { padding: 18px; }
  }

  /* ---------- pointer affordances ---------- */
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .sheet:focus-visible { outline: none; }
  .hero :focus-visible { outline-color: #FFFFFF; }
  .side-me, .side-keys, .tab { transition: background-color 0.15s, color 0.15s; }
}

@media (min-width: 1024px) and (hover: hover) {
  .tab:not(.on):hover, .side-me:hover, .side-keys:hover { background: var(--surface-alt); color: var(--ink); }
  button.primary:not(:disabled):hover, .fab:hover, button.sm:hover { filter: brightness(1.08); }
  button.ghost:not(:disabled):hover, .icon-btn:not(:disabled):hover, .num-stepper .icon-btn:not(:disabled):hover { background: var(--surface-alt); }
  .menu-item:not(:disabled):not(.static):hover, .gi:hover, .game-item:hover {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: color-mix(in srgb, var(--accent) 4%, var(--surface));
  }
  .stp button:not(:disabled):hover, .re-row .stepper button:not(:disabled):hover { background: var(--accent-soft); color: var(--accent); }
  .seg button:not(.on):hover, .gx-seg button:not(.on):hover, .segmented button:not(.on):not(:disabled):hover { color: var(--ink); }
  .pick:hover, .seat-row:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
  .dealer-btn:not(.on):hover { color: var(--ink); }
  .hero-btn:hover, .tm-btn:hover { filter: brightness(0.95); }
  .htrump button:not(:disabled):not(.on):hover { background: rgba(255, 255, 255, 0.24); }
  button.link:hover { text-decoration: underline; text-underline-offset: 3px; }
}
