/*
 * Tang Luck Builder: page layout. The top bar, the page frame, the sign-in
 * screen and the wizard frame (step bar, step section, sticky footer).
 * Screen-specific styles live in each screen's own stylesheet.
 */

/* top bar: its sides line up with the page column; % (the body's width), not vw, so a docked phone preview narrows it too */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 10px max(16px, calc((100% - 1240px) / 2));
  background: rgba(11, 6, 32, .82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-size: 1.08rem; white-space: nowrap; }
.brand img { width: 30px; height: 30px; }
.brand b { color: var(--gold); }
.topnav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.topnav a, .topnav button {
  color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 9px; white-space: nowrap; font-weight: 600;
  background: none; border: 0; box-shadow: none;
}
.topnav a.on, .topnav button.on, .topnav a:hover, .topnav button:hover { color: var(--text); background: linear-gradient(180deg, rgba(138, 77, 255, .45), rgba(255, 63, 216, .18)); filter: none; }

/* page frame */
.page { max-width: 1240px; margin: 0 auto; padding: 22px 16px 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 10px; align-items: center; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.empty-state { text-align: center; padding: 50px 10px; color: var(--muted); }

/* full pages outside the shell: sign in, start-up error */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.gate-card {
  width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center; padding: 30px 26px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(60, 30, 130, .8), rgba(20, 10, 50, .85)); border: 1px solid var(--line2); box-shadow: 0 0 60px rgba(138, 77, 255, .35);
}
.gate-logo { width: 74px; height: 74px; margin: 0 auto; filter: drop-shadow(0 0 16px rgba(255, 213, 74, .5)); }
.gate-card h1 { font-size: 1.5rem; }
.gate-card h1 b { color: var(--gold); }
.login-card .field { text-align: left; }
.login-card .err:empty { display: none; }
.unavailable-detail { overflow-wrap: anywhere; }

/* wizard frame */
.wiz-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.wiz-steps { list-style: none; padding: 0; margin: 12px 0 20px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.wiz-steps li button { background: rgba(255, 255, 255, .04); border-color: var(--line); color: var(--muted); padding: 7px 12px; white-space: nowrap; }
.wiz-steps li button b {
  display: inline-flex; width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; background: rgba(255, 255, 255, .1); font-size: .8rem;
}
.wiz-steps li.on button { color: #2a1300; background: linear-gradient(180deg, #fff1a8, var(--gold)); border-color: var(--gold); }
.wiz-steps li.on button b { background: rgba(0, 0, 0, .15); }
.wiz-main section {
  background: linear-gradient(180deg, var(--card), rgba(24, 12, 56, .72)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
/* a title the keyboard starts from (wizard/core.mjs), not a control */
.wiz-main h3[tabindex='-1']:focus { outline: none; }
/* the footer stays over the step's content (a splash mock's layers have their own z-index), under the top bar */
.wiz-foot {
  position: sticky; z-index: 10; bottom: 0; display: flex; justify-content: space-between; gap: 10px; padding: 14px 0; margin-top: 16px;
  background: linear-gradient(180deg, transparent, var(--bg0) 40%);
}

@media (max-width: 860px) {
  .toasts { top: 106px; } /* under the bar's two rows */
  .top { gap: 10px; flex-wrap: wrap; }
  .topnav { order: 3; flex-basis: 100%; }
  .signout { margin-left: auto; }
  h2 { font-size: 1.3rem; }
}
@media (max-width: 520px) {
  .page { padding: 14px 12px 70px; }
  .wiz-main section { padding: 14px; }
  /* the phone nav and the step bar scroll sideways, with a visible hint at the edge */
  .topnav { gap: 2px; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .topnav a, .topnav button { padding: 6px 8px; font-size: .86rem; }
  .wiz-steps { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); scroll-snap-type: x proximity; }
  .wiz-steps::after { content: ''; flex: 0 0 15%; }
  .wiz-steps li { scroll-snap-align: start; }
}
/* a phone held sideways, a zoomed page: the bar stays one row, so there is room for the page */
@media (max-width: 860px) and (max-height: 520px) {
  .top { flex-wrap: nowrap; padding-top: 5px; padding-bottom: 5px; }
  .topnav { order: 0; flex-basis: auto; }
  .brand span { display: none; }
  .wiz-foot { padding: 6px 0; }
}
