/* =====================================================================
   app.css — v12 実ページ用レイアウト（tokens.css の後に読み込む）
   tokens の .rx は固定アートボード前提なので、ここでスクロール可能な
   実ページ用に上書きする。
   ===================================================================== */

html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  font-family: var(--ff);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* Override tokens' fixed-artboard rules for a real scrollable page. */
.rx {
  width: 100%;
  height: auto;
  min-height: 100vh;
  position: static;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

/* ---------- header ---------- */
.rx-navbar.site {
  position: sticky; top: 0; z-index: 50;
  height: 56px;
}
/* v13.3/v13.5: navbar logo is the wide "チャートで脳トレ！" banner (~7.9:1).
   Size by width (height auto) so it never overflows next to the auth controls. */
.rx-navbar.site .logo { width: min(380px, 62vw); height: auto; display: block; }
@media (min-width: 900px) { .rx-navbar.site .logo { width: 380px; } }
@media (max-width: 480px) { .rx-navbar { padding: 0 12px; } }
.rx-navbar .linkbtn {
  background: transparent; border: none; color: #cdd8ef;
  padding: 8px; min-height: 44px; display: inline-flex; align-items: center;
}
/* v13.5: keep avatar + logout on one line (was wrapping/breaking on mobile). */
#authSlot { display: inline-flex; align-items: center; gap: 8px; flex: none; white-space: nowrap; }
@media (max-width: 480px) { .rx-avatar { display: none; } }

/* ---------- page container ---------- */
.container {
  width: 100%; max-width: 1080px; margin: 0 auto;
  padding: 18px 18px 40px;
  flex: 1;
}

.greeting-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.greeting-sub { font-size: 13px; color: var(--muted); }
.greeting-title { font-size: 20px; font-weight: 800; margin-top: 2px; }
.greeting-text { flex: 1; min-width: 0; }
.rank-emblem { width: 52px; height: 52px; flex: none; object-fit: contain; }
.rank-name { font-size: 19px; font-weight: 800; margin-top: 1px; }

/* ---------- next-mission card ---------- */
.mission-card {
  background: linear-gradient(120deg, #fbf6e9, #fff);
  border: 1px solid #f0e4c4;
}
.mission-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 800; color: var(--gold); letter-spacing: .02em;
}
.mission-label { font-size: 16px; font-weight: 800; margin-top: 6px; line-height: 1.4; }
.mission-prog { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.mission-prog .rx-prog { flex: 1; }
.mission-num { font-size: 12px; font-weight: 700; color: var(--ink-2); flex: none; }
.mission-unlock { font-size: 12.5px; color: var(--ink-2); margin-top: 10px; line-height: 1.5; }
.mission-unlock strong { color: var(--ink); }
.mission-card--max { background: linear-gradient(120deg, #eaf1fe, #fff); border-color: #cfe0fb; }

/* ---------- rank-up overlay ---------- */
.rankup-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(7, 14, 30, .62);
  display: grid; place-items: center; padding: 20px;
}
.rankup-box {
  width: 100%; max-width: 340px; background: var(--navy-grad); color: #fff;
  border-radius: var(--r-lg); padding: 28px 24px 22px; text-align: center;
  box-shadow: var(--sh-3); border: 1px solid rgba(255,255,255,.12);
}
.ru-kicker {
  font-family: var(--ff-num); font-weight: 700; letter-spacing: .14em;
  font-size: 14px; color: var(--gold);
}
.ru-emblem { width: 116px; height: 116px; object-fit: contain; margin: 8px auto 4px; display: block; }
.ru-name { font-size: 20px; font-weight: 800; }
.ru-unlocked { font-size: 12px; color: var(--on-navy-dim); margin-top: 16px; }
.ru-list { list-style: none; margin: 8px 0 18px; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.ru-list li {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  font-size: 13.5px; font-weight: 700; color: #fff;
}
.ru-list li svg { color: var(--up); flex: none; }

/* ---------- responsive hub grid ---------- */
.hub-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.hub-side { display: flex; flex-direction: column; gap: 16px; }
.hub-main { display: flex; flex-direction: column; gap: 16px; }
.section-h { font-size: 13px; font-weight: 800; color: var(--ink-2); margin: 4px 0 0; }

/* ---------- journey ---------- */
.journey { display: flex; flex-direction: column; }
.jstep { display: flex; gap: 14px; align-items: flex-start; }
.jrail { display: flex; flex-direction: column; align-items: center; }
.jdot {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: #fff;
}
.jdot.done { background: var(--up); }
.jdot.now  { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-tint); }
.jdot.next { background: var(--gold); }
.jdot.lock { background: #eef1f5; color: #9aa4b4; }
.jline { width: 2px; height: 26px; background: var(--line); }
.jline.done { background: var(--up); }
.jbody { padding-top: 8px; flex: 1; }
.jbody .t { font-size: 14.5px; font-weight: 700; }
.jbody .t.lock { color: var(--muted); }
.jbody .hint { font-size: 11.5px; font-weight: 700; margin-top: 2px; }
.jbody .hint.now { color: var(--blue); }
.jbody .hint.next { color: var(--gold); }
/* Linkable journey steps jump straight to the feature. */
a.jstep--link { text-decoration: none; color: inherit; border-radius: 12px; transition: background .15s ease; }
a.jstep--link:hover { background: var(--blue-tint); }
a.jstep--link:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.jgo { align-self: center; color: var(--muted); flex: none; display: grid; place-items: center; }
a.jstep--link:hover .jgo { color: var(--blue); }
/* Mission card CTA — go do the mission. */
.mission-cta { margin-top: 12px; text-decoration: none; }

/* ---------- game card ---------- */
.gcard { padding: 16px; display: flex; gap: 14px; align-items: flex-start; }
.gicon {
  width: 48px; height: 48px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--blue-tint); color: var(--blue);
}
.gcard.lock .gicon { background: #eef1f5; color: #9aa4b4; }
.gbody { flex: 1; min-width: 0; }
.gbody .kick { color: var(--blue); }
.gbody .gtitle { font-size: 16px; font-weight: 800; margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.gcard.lock .gtitle { color: var(--ink-2); }
.gbody .gdesc { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.gmeta { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.gcta { align-self: center; flex: none; }

/* ---------- per-game stats merged into the card body ---------- */
.gstats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line, #e6e9ef);
}
.gstat { display: flex; flex-direction: column; min-width: 0; }
.gstat .gv {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 16px; font-weight: 800; line-height: 1.2; color: var(--ink, #0c1933);
}
.gstat .gv-ico { display: inline-flex; }
.gstat .gv-ico svg { width: 13px; height: 13px; }
.gstat .gl {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 700; color: var(--muted); margin-top: 2px;
}
.gl-help { display: inline-flex; color: var(--muted); opacity: 0.65; }
.gl-help:hover { opacity: 1; color: var(--blue); }
.gl-help svg { width: 11px; height: 11px; }

/* Tiered "achievement" styling — gets richer (bronze → silver → gold) as the
   value climbs (連勝 / 総資産). Adds color, a soft glow and a tinted chip. */
.gstat--t1, .gstat--t2, .gstat--t3 {
  padding: 2px 8px; margin: -2px -2px; border-radius: 9px;
}
.gv--t1 { color: #b06a23; }
.gstat--t1 { background: linear-gradient(180deg, rgba(214,158,79,0.14), rgba(214,158,79,0.06)); }
.gv--t1 .gv-ico { color: #c8862f; }

.gv--t2 { color: #5b6b86; }
.gstat--t2 { background: linear-gradient(180deg, rgba(120,140,170,0.16), rgba(120,140,170,0.06)); }
.gv--t2 .gv-ico { color: #7f93b3; }

.gv--t3 { color: #b8860b; } /* fallback for browsers without background-clip:text */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .gv--t3 {
    background: linear-gradient(92deg, #d4a017 0%, #f3c64b 45%, #b8860b 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  }
}
.gstat--t3 {
  background: linear-gradient(180deg, rgba(217,164,23,0.18), rgba(217,164,23,0.07));
  box-shadow: 0 0 0 1px rgba(217,164,23,0.28) inset;
}
.gv--t3 .gv-ico { color: #d9a417; -webkit-text-fill-color: #d9a417; filter: drop-shadow(0 0 4px rgba(217,164,23,0.5)); }

/* ---------- next-unlock banner ---------- */
.nextbanner {
  padding: 14px 16px;
  background: linear-gradient(120deg, #fbf6e9, #fff);
  border: 1px solid #f0e4c4;
  display: flex; align-items: center; gap: 12px;
}
.nextbanner .em {
  width: 50px; height: 50px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
  background: var(--gold-tint); color: var(--gold);
  border: 1px solid #ecdcb0;
}

/* ---------- daily strip ---------- */
.daily {
  padding: 12px 16px; display: flex; align-items: center; gap: 12px;
  background: #fff;
}

/* ---------- daily calendar ---------- */
.cal-card { background: #fff; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cal-title { font-size: 14px; font-weight: 800; color: var(--ink); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-wdrow { margin-bottom: 5px; }
.cal-wd { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.cal-wd.sun { color: #d6455b; }
.cal-wd.sat { color: var(--blue); }
.cal-cell {
  aspect-ratio: 1; border-radius: 8px; background: #f4f6f9;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.cal-cell.empty { background: transparent; }
.cal-cell .cal-num { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.cal-cell.done { background: var(--up-tint); }
.cal-cell.done .cal-num { color: var(--up); font-weight: 800; }
/* Stamp fills the whole date cell (the date number underneath may be hidden). */
.cal-cell .cal-stamp { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; line-height: 0; }
.cal-cell .cal-stamp-img { width: 100%; height: 100%; display: block; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(15, 25, 51, .28)); }
.cal-cell.done .cal-num { display: none; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--blue); }
.cal-foot { margin-top: 12px; font-size: 12.5px; color: var(--ink-2); text-align: center; }

/* ---------- guest hero ---------- */
.guest-hero {
  padding: 18px 16px; background: var(--navy-grad); border: none; color: #fff;
}
.guest-hero h2 { font-size: 17px; font-weight: 800; margin-top: 10px; }
.guest-hero p { font-size: 12.5px; color: var(--on-navy-dim); margin-top: 6px; line-height: 1.6; }
.guest-google { margin-top: 14px; }

/* ---------- footer ---------- */
.sitefoot {
  border-top: 1px solid var(--line); background: #fff;
  padding: 22px 18px; color: var(--muted); font-size: 12px;
}
.sitefoot .inner { max-width: 1080px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.sitefoot a { color: var(--ink-2); text-decoration: none; }
.sitefoot a:hover { color: var(--blue); text-decoration: underline; }
.sitefoot .spacer { flex: 1; }

/* ---------- stat pills (desktop) ---------- */
.statset { display: flex; gap: 10px; }
.statset .stat { padding: 10px 16px; text-align: center; }
.statset .stat .v { font-size: 18px; font-weight: 700; }
.statset .stat .l { font-size: 10.5px; color: var(--muted); font-weight: 700; }

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  .container { padding: 28px 32px 48px; }
  .greeting-title { font-size: 26px; }
  .hub-grid { grid-template-columns: 1fr 332px; align-items: start; }
  /* slightly larger text on desktop for readability */
  .section-h { font-size: 14.5px; }
  .gbody .gtitle { font-size: 18px; }
  .gbody .gdesc { font-size: 14px; }
  .gbody .kick { font-size: 12.5px; }
  .jbody .t { font-size: 16px; }
  .jbody .hint { font-size: 12.5px; }
  .trust-text { font-size: 17px; }
  .consent-note { font-size: 12.5px; }
}
@media (max-width: 899px) {
  .desktop-only { display: none !important; }
  /* a11y: keep important tap targets >= 44px on touch screens. */
  .rx-btn--sm { min-height: 44px; }
}
@media (min-width: 900px) {
  .mobile-only { display: none !important; }
}

/* utility */
.hidden { display: none !important; }
.center-load { padding: 60px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .rx *, .rx *::before, .rx *::after { animation: none !important; transition: none !important; }
}

/* ===== hub hero ===== */
.hub-hero {
  background: var(--navy-grad);
  position: relative;
  overflow: hidden;
  color: var(--on-navy);
}
.hub-hero__inner {
  position: relative;
  padding: 20px 26px 26px;
}
.hub-hero__candle-decor {
  position: absolute;
  right: -6px; top: 8px;
  opacity: .16;
  pointer-events: none;
}
.hub-hero__logo {
  max-width: min(240px, 60%);
  height: auto;
  display: block;
  position: relative;
}
.hub-hero__brand {
  position: relative;
  margin-bottom: 20px;
}
.hub-hero__title { margin: 0; line-height: 0; }
.hub-hero__titlelogo {
  width: min(380px, 92%);
  height: auto;
  display: block;
  position: relative;
}
.hub-hero__copy { position: relative; }
.hub-hero__heading {
  font-size: 25px;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
  margin: 0 0 10px;
}
.hub-hero__sub {
  font-size: 13.5px;
  color: var(--on-navy-dim);
  line-height: 1.6;
  margin: 0 0 20px;
}
.hub-hero__actions {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 16px;
}
.hub-hero__info {
  position: relative;
}
.hub-hero__info-text {
  font-size: 11.5px;
  color: var(--on-navy-dim);
  line-height: 1.5;
  margin: 0;
}
.hub-hero--compact {
  padding: 16px 26px;
  display: flex;
  align-items: center;
}
.hub-hero--compact .hub-hero__logo {
  max-width: min(200px, 50%);
}
@media (min-width: 900px) {
  .hub-hero__inner {
    max-width: 1080px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 400px;
    grid-template-rows: auto auto 1fr;
    column-gap: 48px;
    padding: 28px 40px 32px;
    align-items: start;
  }
  .hub-hero__candle-decor { right: 40px; top: 20px; opacity: .22; }
  .hub-hero__brand { grid-column: 1; grid-row: 1; }
  .hub-hero__copy { grid-column: 1; grid-row: 2; }
  .hub-hero__heading { font-size: 38px; }
  .hub-hero__sub { font-size: 17px; }
  .hub-hero__actions {
    grid-column: 2; grid-row: 1 / 3;
    align-self: center;
    background: rgba(255,255,255,.06);
    border-radius: var(--r-lg);
    padding: 24px;
    border: 1px solid rgba(255,255,255,.1);
  }
  .hub-hero__info { grid-column: 1 / 3; grid-row: 3; margin-top: 16px; }
  .hub-hero__logo { max-width: min(280px, 70%); }
  .hub-hero__titlelogo { width: min(480px, 100%); }
}

/* ===== login sheet (ゲストビュー hubRoot 内) ===== */
.login-sheet {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.trust-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.trust-item { align-items: flex-start; }
.trust-check {
  width: 22px; height: 22px; border-radius: 7px; flex: none;
  background: var(--up-tint); color: var(--up);
  display: grid; place-items: center;
}
.trust-check svg { width: 14px; height: 14px; }
.trust-text { font-size: 15.5px; font-weight: 600; color: var(--ink); line-height: 1.45; }
.consent-note {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
  margin: 0;
}
.consent-note a { color: var(--blue); }

/* ---------- v13.3: greeting-brand removed (navbar carries the banner now) ---------- */

/* ---------- v13.2: mission rank badge + intro hint ---------- */
.mission-rank-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .03em;
  margin-bottom: 6px;
}
.mission-intro {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 6px;
  line-height: 1.5;
}
