/* Shared chrome. Page sections stay in their own stylesheets. */

:root {
  --paper: #f7fafc;
  --ink: #16324a;
  --muted: #5d6d7e;
  --line: rgba(22, 50, 74, 0.08);
  --accent: #1875f3;
  --price: #2a6fbf;
  --white: #ffffff;
  --card: #ffffff;
  --frame: 1080px;
  --pad: max(22px, calc((100vw - var(--frame)) / 2));
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  --shadow: 0 16px 40px rgba(22, 50, 74, 0.06);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(820px 460px at 0% 0%, rgba(186, 220, 255, 0.55), transparent 68%),
    radial-gradient(720px 420px at 100% 18%, rgba(176, 230, 214, 0.4), transparent 66%),
    radial-gradient(680px 380px at 80% 78%, rgba(255, 226, 186, 0.38), transparent 70%),
    #fbfcfd;
  background-attachment: fixed;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; margin: 0; }
p { margin: 0; }
button, input { font: inherit; color: inherit; }

.mast {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 16px var(--pad);
  background: rgba(244, 249, 253, 0.72);
  backdrop-filter: blur(16px);
}
.mast.is-scrolled { background: rgba(255, 255, 255, 0.92); border-bottom: 1px solid var(--line); }
.mark { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; text-decoration: none; }
.mark img { width: 28px; height: 28px; }
.colophon .mark { font-size: 16px; }
.colophon .mark img { width: 22px; height: 22px; }
.mast-nav { display: flex; gap: 22px; margin-left: auto; }
.mast-nav a { text-decoration: none; font-size: 13px; letter-spacing: 0.04em; color: var(--muted); }
.mast-nav a:hover { color: var(--ink); }
.mast-nav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.mast-tools { display: flex; align-items: center; gap: 10px; }
.nav-toggle { display: none; margin-left: auto; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.pick { position: relative; }
.pick-btn, .mast-login {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
}
.pick-list, .account-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 30;
}
.pick-list button, .account-list a, .account-list button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  text-decoration: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}
.pick-list button[aria-current="page"], .account-list a:hover, .account-list button:hover { background: #eef6fb; }
.account-menu { position: relative; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-solid {
  background: linear-gradient(180deg, #4c9af6 0%, #1875f3 55%, #1468dc 100%);
  color: #fff;
}
.btn-quiet { background: #fff; color: var(--accent); border-color: rgba(24, 117, 243, 0.45); }
.btn:disabled { opacity: 0.6; cursor: default; }

.colophon {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 32px var(--pad) 48px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.colophon-brand { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; }
.colophon nav { display: flex; flex-wrap: wrap; gap: 12px 28px; margin: 0; padding-top: 18px; border-top: 1px solid var(--line); }
.colophon a { text-decoration: none; }
.colophon a:hover { color: var(--ink); }

.page { padding: 48px var(--pad) 72px; }
.page h1 { font-size: clamp(40px, 5vw, 64px); max-width: 12em; }
.lede { margin-top: 16px; color: var(--muted); max-width: 36em; }
.panel {
  margin-top: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 8px; }
.toast { margin: 0; padding: 12px 16px; background: #16324a; color: #fff; border-radius: 12px; font-size: 14px; }
.toast-error { background: #8d3b32; }
.toast-success { background: #1d6b56; }

body.sheet-open { overflow: hidden; }
.auth-layer.sheet-dialog { z-index: 110; }

body.pay-open { overflow: hidden; }
.pay-return {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(16, 36, 54, 0.36);
  backdrop-filter: blur(10px);
}
.pay-return[hidden] { display: none !important; }
.pay-return.is-open { animation: auth-fade 0.32s var(--ease); }
.pay-return.is-open .auth-card { animation: auth-rise 0.46s var(--ease); }
@media (prefers-reduced-motion: reduce) {
  .pay-return.is-open,
  .pay-return.is-open .auth-card { animation: none; }
}

body.auth-open { overflow: hidden; }
.auth-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(16, 36, 54, 0.36);
  backdrop-filter: blur(10px);
}
.auth-layer.is-open { animation: auth-fade 0.32s var(--ease); }
.auth-card {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 26px 28px 28px;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(240px 140px at 100% 0%, rgba(215, 243, 236, 0.95), transparent 70%),
    radial-gradient(200px 120px at 0% 108%, rgba(246, 234, 211, 0.8), transparent 72%),
    linear-gradient(165deg, #dceef9 0%, #f4fafc 46%, #ffffff 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 28px 70px rgba(22, 50, 74, 0.2);
}
.auth-layer.is-open .auth-card { animation: auth-rise 0.46s var(--ease); }
.auth-card::before {
  content: "";
  position: absolute;
  top: 108px;
  right: 32px;
  width: 56px;
  height: 18px;
  pointer-events: none;
  background-image: radial-gradient(circle, #3cbea8 1.25px, transparent 1.45px);
  background-size: 11px 10px;
}
.auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.auth-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  letter-spacing: 0.01em;
}
.auth-mark img { width: 22px; height: 22px; }
.auth-close {
  flex: 0 0 auto;
  border: 1px solid rgba(22, 50, 74, 0.08);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.auth-close:hover { color: var(--ink); border-color: rgba(24, 117, 243, 0.4); background: #fff; }
.auth-copy { margin-top: 28px; padding-right: 72px; }
.auth-copy.is-in { animation: auth-step 0.4s var(--ease); }
.auth-card h2 {
  font-size: clamp(32px, 8vw, 40px);
  letter-spacing: -0.045em;
}
.auth-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}
.auth-msg {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.72);
}
.auth-msg-error { color: #8d3b32; background: rgba(141, 59, 50, 0.08); }
.auth-msg-success { color: #1d6b56; background: rgba(29, 107, 86, 0.1); }
.auth-card form { margin-top: 22px; }
.auth-card form.is-in { animation: auth-step 0.4s var(--ease); }
.auth-card label:not(.auth-agree) {
  display: block;
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.auth-card input:not([type="checkbox"]) + label { margin-top: 16px; }
.auth-card input:not([type="checkbox"]) {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(22, 50, 74, 0.12);
  border-radius: 16px;
  padding: 0 16px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.82);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
}
.auth-card input::placeholder { color: #8aa0b3; }
.auth-card input:not([type="checkbox"]):focus {
  outline: none;
  border-color: rgba(24, 117, 243, 0.55);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(24, 117, 243, 0.12);
}
.auth-card .btn-solid {
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  letter-spacing: 0.04em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 10px 22px rgba(24, 117, 243, 0.24);
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.auth-card .btn-solid:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #5aa3f8 0%, #1875f3 60%, #0f62d6 100%);
}
.auth-card .btn-solid:active { transform: translateY(0) scale(0.99); }
.auth-card .btn-solid:disabled { transform: none; }
.auth-email-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(22, 50, 74, 0.1);
  min-width: 0;
}
.auth-email-k {
  flex: 0 0 auto;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.auth-email-line span[id] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}
.auth-field {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border: 1px solid rgba(22, 50, 74, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  overflow: hidden;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
}
.auth-field:focus-within {
  border-color: rgba(24, 117, 243, 0.55);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(24, 117, 243, 0.12);
}
.auth-card .auth-field input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.auth-card .auth-field input:focus {
  border-color: transparent;
  box-shadow: none;
}
.auth-card .auth-field .btn {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-left: 1px solid rgba(22, 50, 74, 0.1);
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  box-shadow: none;
  white-space: nowrap;
}
.auth-card .auth-field .btn:hover {
  transform: none;
  background: rgba(24, 117, 243, 0.06);
  border-color: rgba(22, 50, 74, 0.1);
}
.auth-aside {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(22, 50, 74, 0.08);
}
.auth-link {
  border: 0;
  background: transparent;
  padding: 6px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.25s var(--ease);
}
.auth-link:hover { color: var(--ink); }
.auth-link + .auth-link::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 12px 1px;
  border-radius: 50%;
  background: rgba(22, 50, 74, 0.28);
  vertical-align: middle;
}
.auth-card label.auth-agree + label.auth-agree { margin-top: 8px; }
.auth-card label.auth-agree {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(22, 50, 74, 0.08);
  background: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--ink);
}
.auth-agree input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex: 0 0 auto;
  accent-color: #1875f3;
}
.auth-agree a {
  color: #0f62d6;
  text-decoration: none;
  box-shadow: inset 0 -1px 0 rgba(24, 117, 243, 0.45);
}
.auth-close:focus-visible,
.auth-link:focus-visible,
.auth-card .btn:focus-visible {
  outline: 2px solid rgba(24, 117, 243, 0.55);
  outline-offset: 2px;
}
@keyframes auth-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes auth-rise {
  from { opacity: 0; transform: translateY(12px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes auth-step {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .mast {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
  .mast .mark {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
    gap: 8px;
  }
  .mast .mark img { flex: 0 0 auto; }
  .mast .mark span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mast-tools {
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
    justify-content: flex-start;
    gap: 8px;
  }
  .mast-tools .pick,
  .mast-tools .account-menu { min-width: 0; max-width: 100%; }
  .mast-tools .pick-btn,
  .mast-tools .mast-login {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mast .pick-list,
  .mast .account-list {
    left: 0;
    right: auto;
    z-index: 40;
    width: max-content;
    min-width: max(100%, 168px);
    max-width: calc(100vw - 36px);
  }
  .mast .pick-list button,
  .mast .account-list a,
  .mast .account-list button {
    white-space: nowrap;
  }
  .nav-toggle {
    display: inline-flex;
    order: 2;
    margin-left: 0;
    flex: 0 0 auto;
  }
  .mast-nav {
    display: none;
    position: static;
    order: 4;
    flex: 1 1 100%;
    width: 100%;
    margin: 0;
    padding: 8px;
    flex-direction: column;
    gap: 4px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
  }
  .mast-nav.is-open { display: flex; }
  .mast-nav.is-open a { color: var(--ink); }
  .mast-nav a { padding: 10px 12px; }
}
@media (max-width: 520px) {
  .auth-card { padding: 22px 18px 24px; border-radius: 24px; }
  .auth-copy { margin-top: 22px; padding-right: 60px; }
  .auth-card::before { top: 96px; right: 20px; }
  .auth-field { flex-wrap: wrap; }
  .auth-card .auth-field .btn {
    width: 100%;
    border-left: 0;
    border-top: 1px solid rgba(22, 50, 74, 0.1);
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body { background-attachment: scroll; }
  .auth-layer.is-open,
  .auth-layer.is-open .auth-card,
  .auth-copy.is-in,
  .auth-card form.is-in,
  .sheet-dialog,
  .sheet-card { animation: none; }
  .auth-close,
  .auth-link,
  .auth-card input,
  .auth-field,
  .auth-card .btn-solid { transition: none; }
}
