/* Mobile-first layer (owner's principles, 2026-12-04). Loaded last.
   Base rules are for phones (320-767px); min-width steps add tablet (768px+) and desktop (1024px+).
   :where() keeps defaults at zero specificity, so component rules can still be precise. Slides (.qs) are fixed-size
   images and are not touched. */

/* ── Type: 16px body minimum; fluid headings with clamp() ── */
html, body { font-size: 16px; }
.lp-h1 { font-size: clamp(1.75rem, 4.5vw + .6rem, 2.75rem); }
.lp-h2 { font-size: clamp(1.375rem, 2.4vw + .8rem, 2rem); }
.staff-h1, .auth-title { font-size: clamp(1.5rem, 1.8vw + 1rem, 2rem); }
.lp-sub, .lp-lead { font-size: clamp(1rem, .5vw + .9rem, 1.125rem); }

/* ── Media never wider than its box ── */
:where(img, video, svg, canvas, iframe) { max-width: 100%; }
:where(img, video) { height: auto; }

/* ── Forms: 16px text (no iPhone zoom), 48px tall fields, labels above, full-width fields on phones ── */
:where(input:not([type=checkbox], [type=radio], [type=range], [type=hidden], [type=file], [type=submit], [type=button]),
       select, textarea) { font-size: 16px; }
:where(input:not([type=checkbox], [type=radio], [type=range], [type=hidden], [type=file], [type=submit], [type=button]),
       select) { min-height: 48px; }
.field-input { font-size: 16px; min-height: 48px; }
.auth-form input:not([type=checkbox], [type=radio]), .auth-form select, .auth-form textarea { width: 100%; }

/* ── Touch targets: 44 x 44 on touch screens; 32 is enough with a mouse ── */
@media (pointer: coarse) {
  :where(.auth-btn, .btn-primary, .btn-secondary, .lp-cta, .lp-cta2, .pp-cta, .tb-links a, .tb-link-btn, .tb-menu,
         .qk-back, .qk-rot, .pdf-btn, .pdf-mail-btn, .staff-nav a, .lp-car-btn, .lp-car-play, .lp-car-tab, .lpp-cmp-arrow,
         .sample-pop-x, .sample-pop-back, .terms-pop-x, .fb-x, .fb-shrink, .fb-open, .theme-toggle, .btt, .pp-sample-btn,
         .qk-sample-cta, button[type=submit]) { min-height: 44px; min-width: 44px; }
  .lpp-cmp-dot { position: relative; }
  .lpp-cmp-dot::after { content: ""; position: absolute; inset: -17px; }          /* small dot, 44px tap area */
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
}
@media (pointer: fine) {
  :where(.fb-shrink, .fb-x, .terms-pop-x, .sample-pop-x, .lp-car-play) { min-height: 32px; min-width: 32px; }
}

/* ── Page margins on an 8px scale: 16 phone, 24 tablet, 32 desktop ── */
.form-container { padding-left: 16px; padding-right: 16px; }
@media (min-width: 768px) { .form-container { padding-left: 24px; padding-right: 24px; } }
@media (min-width: 1024px) { .form-container { padding-left: 32px; padding-right: 32px; } }

/* ── Calls to action: full width on phones, natural width from tablet up ── */
.lp-cta-row > .lp-cta, .lp-cta-row > .lp-cta2 { width: 100%; justify-content: center; text-align: center; }
@media (min-width: 768px) { .lp-cta-row > .lp-cta, .lp-cta-row > .lp-cta2 { width: auto; } }

/* ── Tables: scroll sideways inside their own box on phones and tablets ── */
.staff table, .bl-body table, .legal-body table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (min-width: 1024px) { .staff table, .bl-body table, .legal-body table { display: table; } }
.sc-table-wrap .sc-table { display: table; }                      /* already in a scrolling box */

/* ── Dialogs: full width on phones, 60-75% on tablets, 480-600px on desktop ── */
dialog.terms-pop { width: calc(100vw - 24px); }
@media (min-width: 768px) { dialog.terms-pop { width: 75vw; } }
@media (min-width: 1024px) { dialog.terms-pop { width: 600px; } }
/* The sample pop-up is a report viewer, not a dialog: it stays large on every screen. */

/* ── Cards: one full-width column on phones, two on tablets, three or more on desktop ── */
.lp-grid, .lp-steps, .lpp-goals { grid-template-columns: 1fr; }
@media (min-width: 768px) { .lp-grid, .lp-steps, .lpp-goals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .lp-grid, .lp-steps, .lpp-goals { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ── Theme switch: a clear icon in both modes (moon in light mode, sun in dark mode) ── */
.topbar .theme-toggle { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 40px; }
.theme-toggle #themeIcon { font-size: 18px; line-height: 1; }
.theme-toggle .bi-sun-fill { color: #fff; }
body.light .theme-toggle .bi-moon-stars-fill { color: var(--teal-700); }

/* ── Legal pages: close button (top right) and a back button at the end ── */
.legal-close-row { display: flex; justify-content: flex-end; margin: -6px -6px 0 0; }
.legal-close { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--teal-300); color: inherit; text-decoration: none; font-size: 18px; }
.legal-close:hover, .legal-close:focus-visible { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
body.light .legal-close { border-color: var(--teal-700); color: var(--teal-700); }
body.light .legal-close:hover { color: #fff; }
.legal-back-row { margin: 18px 0 6px; }
.legal-back { width: 100%; }
@media (min-width: 768px) { .legal-back { width: auto; } }

/* ══ Full report on phones (owner, 2026-12-04). Base = phone; desktop layout comes back at min-width steps.
   The PDF (body.pdf-render) always keeps the desktop layout. ══ */

/* Social name (minor elements): number card above its reading, not side by side */
.minor-table, .minor-table tbody, .minor-row, .minor-label-cell, .minor-interp-cell { display: block; width: 100%; }
.minor-label-cell { min-width: 0; border-right: none; border-bottom: 1px solid var(--teal-200); }
@media (min-width: 768px) {
  .minor-table { display: table; } .minor-table tbody { display: table-row-group; } .minor-row { display: table-row; }
  .minor-label-cell, .minor-interp-cell { display: table-cell; width: auto; }
  .minor-label-cell { width: 220px; min-width: 200px; border-bottom: none; }
}
body.pdf-render .minor-table { display: table; } body.pdf-render .minor-table tbody { display: table-row-group; }
body.pdf-render .minor-row { display: table-row; } body.pdf-render .minor-label-cell, body.pdf-render .minor-interp-cell { display: table-cell; }

/* Periods: the same, number card above its reading */
.period-table, .period-table tbody, .period-row, .period-label-cell, .period-interp-cell { display: block; width: 100%; }
.period-label-cell { min-width: 0; border-right: none; border-bottom: 1px solid var(--teal-200); }
@media (min-width: 768px) {
  .period-table { display: table; } .period-table tbody { display: table-row-group; } .period-row { display: table-row; }
  .period-label-cell, .period-interp-cell { display: table-cell; width: auto; }
  .period-label-cell { width: 220px; min-width: 200px; border-bottom: none; }
}
body.pdf-render .period-table { display: table; } body.pdf-render .period-table tbody { display: table-row-group; }
body.pdf-render .period-row { display: table-row; } body.pdf-render .period-label-cell, body.pdf-render .period-interp-cell { display: table-cell; }

/* Unexpected situations: one card per number on phones; the four-column table from tablet up */
.sp-cards { display: grid; gap: 12px; padding: 12px; }
.sp-card { background: #fff; color: var(--black); border: 1px solid var(--teal-200); border-radius: 12px; overflow: hidden; }
.sp-card-title { margin: 0; padding: 10px 14px; background: var(--teal-700); color: #fff; font-size: 16px; }
.sp-card-calc { margin: 0; padding: 8px 14px; background: var(--teal-50); font-weight: 700; font-size: 15px; }
.sp-card-desc { margin: 0; padding: 8px 14px; font-style: italic; font-size: 14px; color: var(--muted-light); border-bottom: 1px solid var(--teal-200); }
.sp-card-body { padding: 10px 14px 14px; font-size: 15px; line-height: 1.6; }
.sp-table { display: none; }
@media (min-width: 768px) { .sp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }      /* tablets: 2 cards a row */
@media (min-width: 1024px) { .sp-cards { display: none; } .sp-table { display: table; } }
body.pdf-render .sp-cards { display: none; } body.pdf-render .sp-table { display: table; }

/* Transits & Essences: on phones and tablets the years slide sideways in readable cells; the row names stay put */
body:not(.pdf-render) .te-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; margin-bottom: 10px; }
body:not(.pdf-render) .te-table { table-layout: auto; width: max-content; min-width: 100%; }
body:not(.pdf-render) .te-cell { min-width: 38px; font-size: 13px; padding: 6px 4px; }
body:not(.pdf-render) .te-cell-year { writing-mode: horizontal-tb; transform: none; height: auto; font-size: 12px; }
body:not(.pdf-render) .te-cell-age { font-size: 13px; }
body:not(.pdf-render) .te-row-label { position: sticky; left: 0; z-index: 2; width: 110px; min-width: 110px; font-size: 12px; padding: 6px 8px;
  box-shadow: 2px 0 4px rgba(0,0,0,.18); }
body:not(.pdf-render) .te-small, body:not(.pdf-render) .te-ky-lp, body:not(.pdf-render) .te-ky-bd, body:not(.pdf-render) .te-ky-both { font-size: 11px; }
@media (min-width: 1024px) {
  body:not(.pdf-render) .te-table-wrap { overflow: hidden; margin-bottom: 2px; }
  body:not(.pdf-render) .te-table { table-layout: fixed; width: 100%; }
  body:not(.pdf-render) .te-cell { min-width: 0; font-size: 8px; padding: 1px 0; }
  body:not(.pdf-render) .te-cell-year { writing-mode: vertical-rl; transform: rotate(180deg); height: 30px; font-size: 7px; }
  body:not(.pdf-render) .te-cell-age { font-size: 7px; }
  body:not(.pdf-render) .te-row-label { position: static; width: 72px; min-width: 72px; font-size: 7px; padding: 2px 5px; box-shadow: none; }
  body:not(.pdf-render) .te-small, body:not(.pdf-render) .te-ky-lp, body:not(.pdf-render) .te-ky-bd, body:not(.pdf-render) .te-ky-both { font-size: 7px; }
}

/* # Meanings: one column on phones, two on tablets, three on desktop; readable text */
.py-meanings-grid { grid-template-columns: 1fr; gap: 10px; }
.py-meaning-text { font-size: 14px; line-height: 1.5; }
.py-meaning-num { min-width: 30px; width: 30px; height: 30px; font-size: 15px; }
@media (min-width: 768px) { .py-meanings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .py-meaning-text { font-size: 12px; } }
@media (min-width: 1024px) {
  .py-meanings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .py-meaning-text { font-size: 9px; line-height: 1.4; }
  .py-meaning-num { min-width: 24px; width: 24px; height: 24px; font-size: 11px; }
}
body.pdf-render .py-meanings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
body.pdf-render .py-meaning-text { font-size: 9px; line-height: 1.4; }
body.pdf-render .py-meaning-num { min-width: 24px; width: 24px; height: 24px; font-size: 11px; }

/* Feedback arrow on phones: tucks the button away to the edge (only the arrow stays); wider screens hide the label */
.fb.is-small .fb-open { display: none; }
.fb.is-small .fb-shrink { opacity: .9; }
@media (min-width: 768px) { .fb.is-small .fb-open { display: inline-flex; } }
.py-meanings-grid .py-meaning-row { margin-bottom: 0; }

/* Personal Days calendar (full report): on phones and tablets the days slide sideways in readable cells, like
   Transits & Essences, while the Month column stays put (no shadow). Desktop and the PDF keep the full-width grid. */
body:not(.pdf-render) .pyx-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
body:not(.pdf-render) .pyx-days { table-layout: auto; width: max-content; min-width: 100%; }
body:not(.pdf-render) .pyx-days td, body:not(.pdf-render) .pyx-days .pyx-head { min-width: 38px; height: 38px; font-size: 15px; }
body:not(.pdf-render) .pyx-days .pyx-corner, body:not(.pdf-render) .pyx-days .pyx-month-label { min-width: 96px; width: 96px; }
body:not(.pdf-render) .pyx-table .pyx-corner, body:not(.pdf-render) .pyx-table .pyx-label { position: sticky; left: 0; z-index: 2; }
body:not(.pdf-render) .pyx-table .pyx-corner { z-index: 3; }
@media (min-width: 1024px) {
  body:not(.pdf-render) .pyx-days { table-layout: fixed; width: 100%; }
  body:not(.pdf-render) .pyx-days td, body:not(.pdf-render) .pyx-days .pyx-head { min-width: 0; height: 30px; font-size: 14px; }
  body:not(.pdf-render) .pyx-days .pyx-head { font-size: 12px; }
  body:not(.pdf-render) .pyx-days .pyx-corner, body:not(.pdf-render) .pyx-days .pyx-month-label { min-width: 0; width: 70px; }
}

/* ── Top bar tools on phones: one row that fits; the guide and light/dark buttons always stay visible ── */
.topbar .tb-tools { flex: 1 1 100%; flex-wrap: nowrap; gap: 6px; min-width: 0; }
.topbar .tb-jump { flex: 1 1 auto; min-width: 0; max-width: none; min-height: 44px; }
.topbar .lang-wrap { flex: 0 1 132px; min-width: 0; max-width: 132px; overflow: hidden; }
.topbar .lang-wrap select, .topbar .goog-te-combo { width: 100%; max-width: 100%; min-height: 40px; }
.topbar .tb-tool { flex: none; }
@media (min-width: 768px) {
  .topbar .tb-tools { flex: 0 1 auto; }
  .topbar .tb-jump { flex: none; max-width: 190px; }
  .topbar .lang-wrap { flex: none; max-width: 230px; }
}

/* ── Main menu: the Menu button on phones and tablets (up to 1023px, portrait and landscape); links in the bar on desktop ── */
.tb-menu { display: inline-flex; }
.tb-links { display: none; order: 10; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: 6px 0; }
.tb-links.is-open { display: flex; }
.tb-links a, .tb-link-btn { padding: 10px 12px; font-size: 15px; }
@media (min-width: 1024px) {
  .tb-menu { display: none; }
  .tb-links, .tb-links.is-open { display: flex; order: 0; flex-basis: auto; flex-direction: row; align-items: center; padding: 0; }
  .tb-links a, .tb-link-btn { padding: 7px 10px; font-size: 13px; }
}
.pl-meaning-empty { font-style: italic; }

/* ── Site language menu (replaces the Google widget) and Japanese text ── */
.site-lang { border: 0; background: transparent; color: inherit; font: 600 14px 'Inter', sans-serif; min-height: 36px; padding: 0 4px; cursor: pointer; }
.topbar .lang-wrap .site-lang { min-height: 36px; width: auto; max-width: 100%; }
.site-lang option { color: #111; }
html[lang="ja"] body, html[lang="ja"] input, html[lang="ja"] select, html[lang="ja"] textarea, html[lang="ja"] button {
  font-family: 'Inter', 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', sans-serif; }
html[lang="ja"] h1, html[lang="ja"] h2, html[lang="ja"] h3, html[lang="ja"] .lp-h1, html[lang="ja"] .lp-h2 {
  font-family: 'Cinzel', 'Noto Sans JP', 'Hiragino Sans', serif; letter-spacing: 0; }

.st-row { display: flex; gap: 8px; align-items: flex-start; } .st-row textarea { flex: 1; min-height: 48px; font-size: 15px; }

/* ── Account menu ("Hi, name"): My account, Admin, Sign out. Inside the Menu on phones/tablets, a dropdown on desktop ── */
.tb-acct { position: relative; }
.tb-acct > summary { list-style: none; display: flex; align-items: center; gap: 6px; padding: 10px 12px; min-height: 44px;
  border-radius: 12px; cursor: pointer; font: 600 15px 'Inter', sans-serif; }
.tb-acct > summary::-webkit-details-marker { display: none; }
.tb-acct > summary:hover { background: var(--teal-900); }
body.light .tb-acct > summary:hover { background: var(--teal-50); }
.tb-acct > summary:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.tb-acct[open] .tb-caret { transform: rotate(180deg); }
.tb-caret { font-size: 11px; transition: transform .15s ease; }
.tb-acct-menu { display: flex; flex-direction: column; padding: 2px 0 4px 18px; }
.tb-acct-menu .tb-form { display: block; }
.tb-acct-menu .tb-link-btn { width: 100%; text-align: left; }
@media (min-width: 1024px) {
  .tb-acct { margin-left: auto; }
  .tb-acct > summary { padding: 7px 10px; min-height: 36px; font-size: 13px; }
  .tb-acct-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px; z-index: 960;
    border-radius: 14px; background: #10252B; border: 1px solid var(--teal-800); box-shadow: 0 14px 36px rgba(0,0,0,.35); }
  body.light .tb-acct-menu { background: #fff; border-color: var(--teal-200); box-shadow: 0 14px 36px rgba(20,49,58,.14); }
  .tb-acct-menu a, .tb-acct-menu .tb-link-btn { padding: 10px 12px; font-size: 14px; min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .tb-caret { transition: none; } }

/* ── Phones and tablets (up to 1023px): one header row, logo left and Menu right. Language, Guide, theme (and
   "Jump to section" on reports) live inside the open menu, under the links, at full width. ── */
.topbar { flex-wrap: wrap; row-gap: 0; }
.topbar .tb-menu { margin-left: auto; }
.topbar .tb-tools { display: none; }
.topbar .tb-links.is-open ~ .tb-tools { display: flex; order: 11; flex: 1 1 100%; flex-wrap: wrap; gap: 8px;
  padding: 10px 0 12px; border-top: 1px solid rgba(127,179,192,.25); }
.topbar .tb-links.is-open ~ .tb-tools .tb-jump { flex: 1 1 100%; max-width: none; }
.topbar .tb-links.is-open ~ .tb-tools .lang-wrap { flex: 1 1 auto; max-width: none; overflow: visible; padding: 0 12px; min-height: 44px; }
.topbar .tb-links.is-open ~ .tb-tools .lang-wrap .site-lang { width: 100%; min-height: 44px; font-size: 16px; }
.topbar .tb-links.is-open ~ .tb-tools .tb-tool { min-height: 44px; min-width: 44px; justify-content: center; }
.topbar .tb-links.is-open ~ .tb-tools .tb-tool span { display: inline; }
@media (min-width: 1024px) {

  .topbar .tb-menu { margin-left: 0; }
  .topbar .tb-tools, .topbar .tb-links.is-open ~ .tb-tools { display: flex; order: 0; flex: 0 1 auto; flex-wrap: nowrap;
    padding: 0; border-top: 0; margin-left: auto; }
  .topbar .tb-links.is-open ~ .tb-tools .lang-wrap { flex: none; max-width: 230px; padding: 0 4px; }
  .topbar .tb-links.is-open ~ .tb-tools .tb-jump { flex: none; max-width: 190px; }
}
