/* ฤกษ์ขั้นสูง 64 ข่วย — host-side layout for the synced app (views/xk64.js). Upstream rules come from
   xk64/styles.scoped.css (generated, scoped under .xk64); this file only adapts them to bazi's shell:
   bazi's .page (#view.xk64-page) holds  .xk64-head (switch + sub-menu + who)  and  .xk64 > .shell > .page > .view.v-*  */

/* ---------- switch + 64 sub-menu + who ---------- */
.xk64-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-width: 0; }
.xk64-tabs { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.xk64-tabs a { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap; }
.xk64-tabs a:hover { background: var(--soft); color: var(--ink); }
.xk64-tabs a[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.xk64-who { margin-left: auto; min-width: 0; font-size: 13px; color: var(--muted); text-align: right; }
.xk64-who small { display: block; font-size: 12px; color: var(--accent); }

/* ---------- map upstream's full-page shell onto the host element ---------- */
.xk64-page .xk64 { overflow-x: clip; background: none; min-width: 0; }   /* body overflow-x:hidden would break position:sticky */
.xk64-page .xk64 > .shell { min-height: 0; }
.xk64-page .xk64 .tag { gap: normal; }   /* bazi's global .tag adds gap; upstream's .tag has none (found by computed-style diff) */
.xk64-page .xk64 > .shell > .page { padding: 0; max-width: none; }

@media (min-width: 901px) {
  .page.xk64-page { gap: 12px; padding-top: 12px; }
  /* main page (≥ 1280px): bazi shell = one screen; calendar | panels fill what is left under the switch row */
  #app > .shell:has(> .page.xk64-main) { height: 100vh; height: 100dvh; min-height: 0; }
  .page.xk64-main { min-height: 0; overflow: hidden; padding-bottom: 16px; }
  .xk64-main > .xk64 { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .xk64-page .xk64 > .shell[data-view~="main"] { flex: 1 1 auto; height: auto; min-height: 0; }
  .xk64-page .xk64 > .shell[data-view~="main"] > .page { padding: 0; }
}
@media (min-width: 901px) and (max-width: 1279px) {
  /* upstream: main page scrolls as a whole here (calendar/day panels sized from --topbar-h, set by views/xk64.js) */
  #app > .shell:has(> .page.xk64-main) { height: auto; min-height: 100vh; }
  .page.xk64-main { overflow: visible; }
  .xk64-page .xk64 > .shell[data-view~="main"] { flex: none; }
}

@media (max-width: 900px) {
  .page.xk64-page { gap: 10px; padding-top: 8px; }
  .xk64-head { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "tabs" "who"; gap: 6px 10px; }
  .xk64-head > .luck-switch { grid-area: sw; }
  .xk64-tabs { grid-area: tabs; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .xk64-tabs a { min-height: 44px; padding: 0 2px; font-size: 13px; }
  .xk64-who { grid-area: who; margin-left: 0; font-size: 12px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
  .xk64-who small { display: inline; }
  .xk64-who small::before { content: " · "; color: var(--muted); }
}
