:root {
  --blue: #007B80;
  --white: #FFFAF1;
  --black: #10100E;
  --gold: #D2AF37;
  --bg: var(--white);
  --panel: var(--white);
  --panel-dark: var(--black);
  --text: var(--black);
  --text-on-dark: var(--white);
  --muted: rgba(16, 16, 14, .62);
  --muted-on-dark: rgba(255, 250, 241, .68);
  --line: rgba(16, 16, 14, .18);
  --line-on-dark: rgba(255, 250, 241, .2);
  --accent: var(--blue);
  --accent-soft: rgba(0, 123, 128, .12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "M PLUS 1p", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-user-select: none; user-select: none; }
a { color: inherit; text-decoration: none; }
.desktop-stage { min-height: 100vh; min-height: 100dvh; }
.desktop-guide { display: none; }
.app-shell { width: min(100%, 560px); min-height: 100vh; min-height: 100dvh; margin: 0 auto; position: relative; background: var(--bg); }
.topbar {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 10px; align-items: center; min-width: 0; }
.brand-logo { width: 136px; height: 43px; object-fit: contain; object-position: left center; }
.brand-members { color: var(--black); font-size: 9px; font-weight: 900; letter-spacing: .22em; padding-left: 10px; border-left: 1px solid var(--line); }
.icon-button {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--black);
  background: var(--white); color: var(--black); font-size: 23px; cursor: pointer;
}
main { padding: 14px 18px calc(116px + var(--safe-bottom)); }
.view { display: none; animation: fade .18s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: .55; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.panel { background: var(--panel); border: 1px solid var(--black); border-radius: 22px; }
.login-panel {
  min-height: calc(100dvh - 112px);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--text-on-dark);
  background: var(--black);
  border-color: var(--black);
}
.eyebrow { color: var(--blue); font-size: 10px; font-weight: 900; letter-spacing: .22em; }
h1, h2, p { margin-top: 0; }
.hero-actions { display: grid; gap: 10px; width: 100%; }
button { cursor: pointer; }
.primary-button, .secondary-button, .danger-button {
  min-height: 50px;
  border-radius: 14px;
  padding: 0 18px;
  font-weight: 900;
  border: 1px solid transparent;
  transition: transform .12s ease;
}
.primary-button { background: var(--blue); color: var(--white); border-color: var(--blue); }
.primary-button:active, .secondary-button:active, .danger-button:active { transform: scale(.985); }
.primary-button.small { min-height: 42px; font-size: 13px; white-space: nowrap; }
.secondary-button { background: var(--white); color: var(--black); border-color: var(--black); }
.login-panel .secondary-button { background: transparent; color: var(--white); border-color: var(--white); }
.danger-button { width: 100%; margin-top: 16px; background: var(--black); color: var(--white); border-color: var(--black); }
.microcopy { margin: 14px 0 0 !important; font-size: 11px !important; line-height: 1.5 !important; }
.section-block { margin-top: 34px; }
.home-first-section { margin-top: 0; }
body.logged-out main { padding-bottom: 18px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.section-heading h2 { margin: 5px 0 0; font-size: 22px; letter-spacing: -.04em; }
.text-button { border: 0; background: none; color: var(--blue); font-size: 12px; font-weight: 800; padding: 8px 0; }
.notice-list { display: grid; gap: 10px; }
.notice-card {
  background: var(--white);
  border: 1px solid var(--black);
  border-radius: 17px;
  padding: 16px;
  display: grid;
  gap: 9px;
}
.notice-card .meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.notice-card .badge { border-radius: 99px; padding: 4px 8px; background: var(--blue); color: var(--white); font-weight: 900; }
.notice-card h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.notice-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.notice-card a { color: var(--blue); font-size: 12px; font-weight: 900; }
.link-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.link-card {
  min-height: 130px;
  border-radius: 17px;
  padding: 14px;
  background: var(--blue);
  color: var(--white);
  border: 1px solid var(--blue);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.link-card:nth-child(2) { background: var(--black); border-color: var(--black); }
.link-card:nth-child(3) { background: var(--white); color: var(--black); border-color: var(--black); }
.link-card .link-number { margin-bottom: auto; color: var(--gold); font-size: 10px; font-weight: 900; }
.link-card strong { font-size: 14px; }
.link-card small { opacity: .72; font-size: 10px; margin-top: 4px; }
.section-title { padding: 12px 2px 18px; }
.section-title h1 { margin: 6px 0 0; font-size: 38px; letter-spacing: -.055em; }
.locked-card { padding: 42px 26px; text-align: center; }
.lock-icon { width: 54px; height: 54px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; background: var(--black); font-size: 24px; color: var(--white); }
.locked-card h2 { font-size: 20px; }
.locked-card p { color: var(--muted); font-size: 13px; line-height: 1.7; margin-bottom: 22px; }
.member-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1.6 / 1;
  border-radius: 22px;
  overflow: hidden;
  background-color: var(--white);
  background-image: url("./assets/member-card.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  border: 1px solid rgba(16, 16, 14, .12);
  box-shadow: 0 12px 28px rgba(16, 16, 14, .24);
}
.member-card {
  transform:
    perspective(900px)
    rotateX(var(--tilt-x, 0deg))
    rotateY(var(--tilt-y, 0deg));

  transform-style: preserve-3d;
  transform-origin: center;
  transition: transform 240ms cubic-bezier(.2, .8, .2, 1);

  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  will-change: transform;
}

.member-card.is-tilting {
  transition: none;
  cursor: grabbing;
}

/* カード上の文字を少しだけ手前に見せる */
.member-card .card-copy {
  transform: translateZ(16px);
}

@media (prefers-reduced-motion: reduce) {
  .member-card {
    transition: none;
  }
}
.card-copy {
  position: absolute;
  z-index: 2;
  top: 11.5%;
  right: 7.2%;
  width: 43%;
  color: var(--white);
  text-align: left;
}
.card-topline { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: clamp(5px, 1.4vw, 8px); font-weight: 900; letter-spacing: .12em; }
.card-active { color: var(--gold); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.card-name-block { margin-top: clamp(11px, 3.4vw, 26px); }
.card-name-block small, .card-meta-grid small { display: block; color: rgba(255,250,241,.64); font-size: clamp(5px, 1.35vw, 8px); font-weight: 800; letter-spacing: .13em; margin-bottom: 4px; }
.card-name-block strong { display: block; color: var(--white); font-size: clamp(14px, 4.5vw, 27px); line-height: 1.02; letter-spacing: -.03em; overflow-wrap: anywhere; }
.card-meta-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 10px; margin-top: clamp(9px, 2.8vw, 20px); }
.card-meta-grid strong { display: block; color: var(--gold); font-size: clamp(7px, 2.1vw, 12px); letter-spacing: .04em; white-space: nowrap; }
.card-since { margin-top: clamp(7px, 2vw, 14px); color: rgba(255,250,241,.74); font-size: clamp(5px, 1.5vw, 9px); font-weight: 800; letter-spacing: .13em; }
.member-details { margin-top: 18px; padding: 4px 18px; }
.detail-row { display: flex; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.detail-row:last-child { border: 0; }
.detail-row span { color: var(--muted); }
.settings-panel, .install-panel, .test-panel { padding: 20px; margin-bottom: 13px; }
.setting-intro { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.setting-intro h2, .install-panel h2, .test-panel h2 { margin: 0 0 6px; font-size: 18px; }
.setting-intro p, .install-panel p, .test-panel p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 12px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border: 0; padding-bottom: 0; }
.setting-row strong, .setting-row small { display: block; }
.setting-row strong { font-size: 13px; }
.setting-row small { color: var(--muted); margin-top: 4px; font-size: 10px; }
.switch { width: 46px; height: 27px; flex: 0 0 auto; position: relative; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; background: var(--black); border-radius: 99px; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 21px; height: 21px; left: 3px; top: 3px; border-radius: 50%; background: var(--white); transition: .2s; }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(19px); }
.install-panel .eyebrow, .test-panel .eyebrow { display: block; margin-bottom: 9px; }
.install-panel .secondary-button, .test-panel .secondary-button { width: 100%; margin-top: 16px; }
.admin-link { display: block; text-align: center; color: var(--blue); padding: 16px; font-size: 12px; font-weight: 800; }
.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(100%, 560px);
  min-height: calc(82px + var(--safe-bottom));
  height: auto;
  padding: 8px 16px calc(10px + var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--black);
  border-top: 1px solid var(--black);
}
.nav-item { min-height: 58px; padding: 4px 0; border: 0; background: transparent; color: rgba(255,250,241,.54); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; overflow: visible; }
.nav-item span { display: block; min-height: 22px; font-size: 18px; line-height: 1; }
.nav-item small { display: block; font-size: 9px; font-weight: 800; line-height: 1.35; }
.nav-item.active { color: var(--white); }
.nav-item.active span { color: var(--gold); }
.install-dialog { width: min(calc(100% - 28px), 480px); border: 1px solid var(--black); border-radius: 22px; background: var(--white); color: var(--black); padding: 0; }
.install-dialog::backdrop { background: rgba(16,16,14,.72); }
.install-dialog form { padding: 28px; position: relative; }
.install-dialog h2 { margin: 8px 0 18px; }
.install-dialog ol { padding-left: 21px; color: var(--muted); line-height: 1.8; font-size: 13px; }
.install-dialog p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.install-dialog .primary-button { width: 100%; }
.dialog-close { position: absolute; top: 14px; right: 14px; border: 0; background: transparent; color: var(--black); font-size: 24px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(92px + var(--safe-bottom)); transform: translate(-50%, 15px); width: min(calc(100% - 36px), 510px); background: var(--gold); color: var(--black); padding: 13px 16px; border: 1px solid var(--black); border-radius: 14px; font-size: 12px; font-weight: 900; opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.hidden { display: none !important; }
@media (min-width: 768px) {
  html { background: var(--black); }
  body { background: var(--black); }
  body:has(.desktop-stage) { overflow: hidden; }
  .desktop-stage {
    width: min(1180px, calc(100% - 48px));
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    padding: 32px 0;
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(390px, 560px);
    justify-content: center;
    align-items: stretch;
    gap: clamp(28px, 5vw, 76px);
  }
  .desktop-guide {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(28px, 4vw, 48px);
    border: 1px solid rgba(255, 250, 241, .28);
    border-radius: 24px;
    color: var(--white);
    background: var(--black);
  }
  .desktop-kicker {
    display: block;
    color: var(--gold);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .22em;
  }
  .desktop-guide h1 {
    margin: 14px 0 18px;
    color: var(--white);
    font-size: clamp(42px, 5vw, 68px);
    line-height: .98;
    letter-spacing: -.075em;
  }
  .desktop-guide-copy > p {
    max-width: 31em;
    margin: 0;
    color: var(--muted-on-dark);
    font-size: 13px;
    line-height: 1.9;
  }
  .desktop-qr-block {
    width: min(100%, 254px);
    margin: clamp(28px, 6vh, 56px) 0 20px;
  }
  .desktop-qr-frame {
    width: 100%;
    aspect-ratio: 1;
    padding: 14px;
    border: 1px solid var(--white);
    border-radius: 18px;
    background: var(--white);
  }
  .desktop-qr-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
  .desktop-qr-block a {
    display: block;
    margin-top: 12px;
    color: var(--white);
    font-size: 12px;
    font-weight: 800;
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-underline-offset: 4px;
  }
  .desktop-direct-note {
    margin: 0;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 250, 241, .2);
    color: var(--muted-on-dark);
    font-size: 11px;
    line-height: 1.7;
  }
  .app-shell {
    width: 100%;
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);
    min-height: 0;
    margin: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid rgba(255, 250, 241, .28);
    border-radius: 24px;
  }
  .app-shell main { overflow-y: auto; overscroll-behavior: contain; padding-bottom: 28px; }
  .app-shell .login-panel { min-height: 100%; }
  .bottom-nav {
    position: static;
    left: auto;
    bottom: auto;
    transform: none;
    width: 100%;
    min-height: 78px;
    padding-bottom: 10px;
    border-radius: 0 0 23px 23px;
  }
  .toast { bottom: 46px; width: min(calc(100% - 48px), 480px); }
  .legal-page {
    margin-top: 32px;
    margin-bottom: 32px;
    padding: 34px 28px 80px;
    border-radius: 24px;
    background: var(--white);
  }
}
@media (min-width: 768px) and (max-height: 720px) {
  .desktop-stage { padding: 18px 0; }
  .app-shell { height: calc(100dvh - 36px); }
  .desktop-guide { padding: 26px; }
  .desktop-guide h1 { font-size: 44px; }
  .desktop-qr-block { width: 190px; margin: 20px 0 14px; }
}
@media (min-width: 768px) and (max-width: 880px) {
  .desktop-stage { width: min(100% - 28px, 820px); grid-template-columns: 250px minmax(390px, 1fr); gap: 20px; }
  .desktop-guide { padding: 24px; }
  .desktop-guide h1 { font-size: 42px; }
  .desktop-qr-block { width: 190px; }
}
@media (max-width: 390px) {
  .brand-logo { width: 118px; }
  .brand-members { display: none; }
  .login-panel { min-height: calc(100dvh - 112px); }
}
.legal-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin: 24px 0 4px; }
.legal-links a { color: var(--muted); font-size: 11px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.legal-page { width: min(760px, calc(100% - 36px)); margin: 0 auto; padding: 34px 0 80px; }
.legal-page h1 { margin: 8px 0 4px; font-size: clamp(34px, 9vw, 58px); letter-spacing: -.06em; }
.legal-page section { border-top: 1px solid var(--line); padding: 22px 0; }
.legal-page section:first-of-type { margin-top: 28px; }
.legal-page h2 { margin: 0 0 10px; font-size: 17px; }
.legal-page p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.9; }
.legal-back { display: inline-block; color: var(--blue); font-size: 12px; font-weight: 800; margin-bottom: 26px; }
.legal-updated { color: var(--muted); font-size: 11px; }
.switch input:disabled + span { opacity: .35; cursor: not-allowed; }
.desktop-hero-title {
  display: none !important;
}

/* Notice visibility */
.notice-meta-right { display: inline-flex; align-items: center; gap: 7px; }
.notice-restricted-star { color: var(--gold); font-size: 15px; line-height: 1; font-weight: 900; }
