/* ============================================================
   HoppouStatus — Etopirika Coast theme
   Based on the tufted-puffin character "Erika-chan"
   ============================================================ */

:root {
  /* ---- Etopirika Coast palette ---- */
  --c-ink:        #2b2435;
  --c-ink-soft:   #6b6279;
  --c-ink-faint:  #a59ab4;

  --c-paper:      #fffaf2;
  --c-cream:      #fff4e0;
  --c-cream-deep: #ffe9c2;

  /* Etopirika beak / feet — coral orange */
  --c-coral:      #f47a5a;
  --c-coral-deep: #d9573a;
  --c-coral-soft: #ffd5c4;
  --c-coral-tint: #fff0e8;

  /* Ocean / sky */
  --c-ocean:      #5aa7d1;
  --c-ocean-deep: #2f7fab;
  --c-ocean-soft: #dbeffa;
  --c-sky-tint:   #eaf6ff;

  /* Accents */
  --c-cherry:     #ff87a9;
  --c-cherry-soft:#ffe1ea;
  --c-mint:       #6fd1a4;
  --c-mint-soft:  #daf4e7;
  --c-gold:       #f6b93b;
  --c-gold-soft:  #ffe8aa;
  --c-plum:       #544668;

  /* Rank colors */
  --c-silver: #c7d0dc;
  --c-gold-rank: #f6b93b;
  --c-crab:   #f47a5a;
  --c-clione: #b9a6ff;
  --c-prime:  #ff6fa4;

  /* Shadows */
  --sh-xs:   0 2px 6px rgba(43, 36, 53, 0.06);
  --sh-sm:   0 4px 12px rgba(43, 36, 53, 0.08);
  --sh-md:   0 10px 24px rgba(43, 36, 53, 0.10);
  --sh-lg:   0 20px 40px rgba(43, 36, 53, 0.14);
  --sh-pop:  0 14px 32px rgba(244, 122, 90, 0.35);
  --sh-pop-blue: 0 14px 32px rgba(90, 167, 209, 0.35);

  /* Radius */
  --r-xs: 8px;
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-xl: 36px;
  --r-2xl: 44px;

  /* Layout */
  --nav-h: 76px;
  --top-h: 64px;
  --max-w: 520px;

  /* Motion */
  --ease-pop:  cubic-bezier(.2,.9,.3,1.25);
  --ease-soft: cubic-bezier(.33,.1,.25,1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* The built-in `hidden` attribute must win against our display: flex/grid. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Zen Maru Gothic', 'M PLUS Rounded 1c', 'Kosugi Maru', system-ui, -apple-system, sans-serif;
  color: var(--c-ink);
  background: var(--c-paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  letter-spacing: 0.01em;
}

body {
  min-height: 100svh;
  background:
    radial-gradient(720px 380px at 10% -5%,  rgba(244, 122, 90, 0.12) 0%, transparent 55%),
    radial-gradient(680px 420px at 110% 8%,  rgba(90, 167, 209, 0.18) 0%, transparent 55%),
    radial-gradient(800px 500px at 50% 115%, rgba(255, 207, 87, 0.18) 0%, transparent 60%),
    var(--c-paper);
  background-attachment: fixed;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h2, h3 { margin: 0; font-weight: 900; letter-spacing: 0.01em; }
code { font-family: 'SFMono-Regular', ui-monospace, 'Kosugi Maru', monospace; }

/* ============================================================
   Loader
   ============================================================ */
.loader {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: linear-gradient(180deg, var(--c-ocean-soft) 0%, var(--c-cream) 70%, var(--c-coral-soft) 100%);
  transition: opacity 0.6s var(--ease-soft), visibility 0.6s var(--ease-soft);
  overflow: hidden;
}
.loader.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-scene { position: relative; width: 280px; height: 320px; text-align: center; }
.loader-sun {
  position: absolute;
  top: 30px; left: 50%; transform: translateX(-50%);
  width: 140px; height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fff2d1, var(--c-gold) 70%, transparent 72%);
  opacity: 0.7;
  filter: blur(2px);
  animation: loader-sun 3s ease-in-out infinite alternate;
}
@keyframes loader-sun {
  from { transform: translate(-50%, 0) scale(1); }
  to   { transform: translate(-50%, -6px) scale(1.05); }
}
.loader-wave {
  position: absolute;
  bottom: 60px; left: -10%; right: -10%;
  height: 70px;
  background:
    radial-gradient(40px 20px at 20% 100%, var(--c-ocean), transparent 70%) repeat-x,
    linear-gradient(180deg, transparent, var(--c-ocean));
  opacity: 0.5;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.loader-char-img {
  position: relative;
  width: 180px; height: auto;
  margin: 40px auto 0;
  animation: bob 1.8s ease-in-out infinite;
  filter: drop-shadow(0 14px 18px rgba(43, 36, 53, 0.20));
  z-index: 2;
}
.loader-title {
  position: absolute;
  bottom: 4px; left: 0; right: 0;
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  color: var(--c-ink);
}
.loader-dots {
  position: absolute;
  bottom: -20px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px;
}
.loader-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-coral);
  animation: loader-dot 1.1s ease-in-out infinite;
}
.loader-dots span:nth-child(2) { animation-delay: 0.15s; background: var(--c-ocean); }
.loader-dots span:nth-child(3) { animation-delay: 0.30s; background: var(--c-gold); }
@keyframes loader-dot {
  0%,100% { transform: translateY(0); opacity: 0.4; }
  50%     { transform: translateY(-6px); opacity: 1; }
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-10px) rotate(2deg); }
}

/* ============================================================
   App shell
   ============================================================ */
.app {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-bottom: calc(var(--nav-h) + 28px);
  min-height: 100svh;
  position: relative;
}

/* Decorative background inside the app */
.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  max-width: var(--max-w);
  margin: 0 auto;
  overflow: hidden;
}
.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
}
.bg-blob-1 {
  width: 260px; height: 260px;
  top: -60px; right: -80px;
  background: var(--c-coral-soft);
}
.bg-blob-2 {
  width: 300px; height: 300px;
  top: 40vh; left: -120px;
  background: var(--c-ocean-soft);
}
.bg-blob-3 {
  width: 220px; height: 220px;
  bottom: 8vh; right: -60px;
  background: var(--c-gold-soft);
}
.bg-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(43, 36, 53, 0.05) 1px, transparent 1.5px);
  background-size: 22px 22px;
  opacity: 0.5;
}

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--top-h);
  padding: 10px 18px;
  background: rgba(255, 250, 242, 0.85);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(43, 36, 53, 0.06);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-ocean-soft), var(--c-coral-soft));
  border: 2.5px solid #fff;
  box-shadow: var(--sh-sm), inset 0 0 0 1px rgba(255,255,255,0.4);
  overflow: hidden;
  position: relative;
}
.avatar-img {
  width: 110%; height: 110%;
  object-fit: cover;
  object-position: 50% 28%;
  transform: scale(1.25) translateY(6%);
}
.topbar-meta { line-height: 1.2; }
.topbar-name {
  font-size: 0.72rem;
  color: var(--c-ink-soft);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.topbar-rank { font-size: 0.98rem; font-weight: 900; display: flex; align-items: center; gap: 4px; }
.rank-pip { font-size: 1rem; }

.points-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background:
    linear-gradient(135deg, #ffe387 0%, #f6b93b 100%);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 900;
  box-shadow:
    var(--sh-sm),
    inset 0 -2px 0 rgba(154, 108, 0, 0.18),
    inset 0 1px 0 rgba(255,255,255,0.6);
  border: 2px solid #fff;
  color: #5a3b00;
  font-variant-numeric: tabular-nums;
}
.points-icon { filter: drop-shadow(0 1px 0 rgba(0,0,0,0.12)); }
.points-value { font-size: 1.1rem; }
.points-label { font-size: 0.72rem; opacity: 0.75; }

.points-chip.pulse { animation: popIn 0.6s var(--ease-pop); }
@keyframes popIn {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ============================================================
   Pages
   ============================================================ */
.pages { padding: 18px 16px 0; position: relative; z-index: 1; }
.page { animation: pageIn 0.45s var(--ease-soft); }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-head {
  margin: 10px 2px 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(43, 36, 53, 0.08);
  position: relative;
}
.page-head::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 56px; height: 3px;
  background: linear-gradient(90deg, var(--c-coral-deep), var(--c-gold));
  border-radius: 2px;
}
.page-head-kicker {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  color: var(--c-coral-deep);
  text-transform: uppercase;
  margin-bottom: 4px;
  font-family: 'Yuji Syuku', 'Zen Maru Gothic', serif;
}
.page-head h2 {
  font-size: 1.55rem;
  line-height: 1.25;
  margin: 0;
  letter-spacing: 0.04em;
}
.page-desc { margin: 6px 0 0; color: var(--c-ink-soft); font-size: 0.9rem; }
.page-desc b { color: var(--c-coral-deep); }

.section-title {
  margin: 30px 4px 14px;
  font-size: 1rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--c-ink);
  position: relative;
  letter-spacing: 0.02em;
}
.section-title::after {
  content: "";
  flex-grow: 1;
  height: 1px;
  margin-left: 8px;
  background: linear-gradient(90deg, rgba(43, 36, 53, 0.18), rgba(43, 36, 53, 0));
}
.section-title-center {
  justify-content: center;
  text-align: center;
}
.section-title-center::after { display: none; }
.section-title span:first-child {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff, #fff5e8);
  border: 1.5px solid rgba(244, 122, 90, 0.25);
  color: var(--c-coral-deep);
  font-size: 1rem;
}
.section-counter {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--c-coral-deep);
  background: var(--c-coral-tint);
  border-radius: 99px;
  padding: 2px 10px;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   HOME — hero scene
   ============================================================ */
.hero-scene {
  position: relative;
  height: 300px;
  border-radius: var(--r-xl);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--sh-md);
  border: 3px solid #fff;
  isolation: isolate;
  background: linear-gradient(180deg, #ffd5ad 0%, #ffe7c3 18%, #c9e2ee 50%, #6fa8c9 100%);
}
/* Real-photo backdrop blended with illustrated overlay */
.hero-scene-photo {
  position: absolute;
  inset: 0;
  background-image: url('../assets/images/hoppou/kunashir-view.jpg');
  background-size: cover;
  background-position: 50% 55%;
  filter: saturate(0.85) brightness(1.02);
  opacity: 0.4;
  mix-blend-mode: soft-light;
}
.hero-scene-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(180% 90% at 90% 0%, rgba(255, 174, 110, 0.65) 0%, rgba(255, 174, 110, 0) 40%),
    linear-gradient(180deg,
      rgba(255, 213, 173, 0.85) 0%,
      rgba(255, 231, 195, 0.45) 18%,
      rgba(201, 226, 238, 0.05) 50%,
      rgba(111, 168, 201, 0.0) 75%,
      rgba(64, 117, 156, 0.18) 100%);
  pointer-events: none;
}

/* Hero scene badge — round stamp in corner */
.hero-stamp {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  border: 2px solid #fff;
  box-shadow: 0 6px 18px rgba(43, 36, 53, 0.22);
  backdrop-filter: blur(6px);
  z-index: 8;
  display: grid;
  place-items: center;
  transform: rotate(-6deg);
  animation: hero-stamp-bob 5s ease-in-out infinite alternate;
}
@keyframes hero-stamp-bob {
  from { transform: rotate(-7deg) translateY(0); }
  to   { transform: rotate(-4deg) translateY(-2px); }
}
.hero-stamp::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1.5px dashed var(--c-coral-deep);
  border-radius: 50%;
}
.hero-stamp-ring {
  display: grid;
  gap: 0;
  text-align: center;
  font-weight: 900;
  color: var(--c-coral-deep);
  line-height: 1;
  letter-spacing: 0.06em;
}
.hero-stamp-ring span:nth-child(1) { font-size: 0.56rem; letter-spacing: 0.22em; }
.hero-stamp-ring span:nth-child(2) { font-size: 0.78rem; margin: 3px 0; letter-spacing: 0.12em; }
.hero-stamp-ring span:nth-child(3) { font-size: 0.5rem;  letter-spacing: 0.2em; opacity: 0.8; }
/* ----- Sun + rays ----- */
.hero-sun {
  position: absolute;
  top: 22px; right: 30px;
  width: 78px; height: 78px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 38%, #fffaf0 0%, #ffd06b 55%, rgba(255, 169, 86, 0) 78%);
  filter: blur(0.2px);
  box-shadow:
    0 0 30px rgba(255, 196, 102, 0.55),
    0 0 60px rgba(255, 169, 86, 0.32);
  animation: hero-sun-glow 4.5s ease-in-out infinite alternate;
  z-index: 1;
}
@keyframes hero-sun-glow {
  from { box-shadow: 0 0 30px rgba(255,196,102,0.45), 0 0 50px rgba(255,169,86,0.25); }
  to   { box-shadow: 0 0 38px rgba(255,196,102,0.7),  0 0 70px rgba(255,169,86,0.4); }
}
.hero-sun-rays {
  position: absolute;
  top: 0; right: 0;
  width: 220px; height: 220px;
  background:
    conic-gradient(from 0deg at 100% 0%,
      rgba(255, 220, 160, 0) 0deg,
      rgba(255, 220, 160, 0.18) 18deg,
      rgba(255, 220, 160, 0) 28deg,
      rgba(255, 220, 160, 0) 50deg,
      rgba(255, 220, 160, 0.14) 60deg,
      rgba(255, 220, 160, 0) 70deg,
      rgba(255, 220, 160, 0) 100deg,
      rgba(255, 220, 160, 0.16) 112deg,
      rgba(255, 220, 160, 0) 122deg,
      rgba(255, 220, 160, 0) 360deg);
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.85;
  animation: hero-rays-rotate 38s linear infinite;
  transform-origin: 100% 0;
  z-index: 1;
}
@keyframes hero-rays-rotate {
  to { transform: rotate(360deg); }
}

/* ----- Clouds (fluffy, multi-puff) ----- */
.hero-cloud {
  position: absolute;
  background: #fff;
  border-radius: 30px;
  opacity: 0.92;
  z-index: 2;
}
.hero-cloud::before, .hero-cloud::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
}
.hero-cloud-1 {
  top: 32px; left: 24px;
  width: 60px; height: 18px;
  box-shadow:
    14px -10px 0 -2px rgba(255,255,255,0.95),
    32px -4px 0 -2px rgba(255,255,255,0.95),
    50px -8px 0 -3px rgba(255,255,255,0.92);
  animation: hero-cloud-drift 22s ease-in-out infinite alternate;
}
.hero-cloud-2 {
  top: 76px; left: 38%;
  width: 50px; height: 14px;
  opacity: 0.85;
  box-shadow:
    12px -6px 0 -2px rgba(255,255,255,0.85),
    26px -10px 0 -3px rgba(255,255,255,0.82);
  animation: hero-cloud-drift 28s ease-in-out -8s infinite alternate-reverse;
}
.hero-cloud-3 {
  top: 14px; right: 35%;
  width: 36px; height: 11px;
  opacity: 0.75;
  box-shadow:
    8px -4px 0 -2px rgba(255,255,255,0.78),
    18px -6px 0 -3px rgba(255,255,255,0.72);
  animation: hero-cloud-drift 32s ease-in-out -4s infinite alternate;
}
@keyframes hero-cloud-drift {
  from { transform: translateX(-8px); }
  to   { transform: translateX(14px); }
}

/* ----- Birds (silhouette flock drifting) ----- */
.hero-birds {
  position: absolute;
  top: 56px;
  left: -60px;
  width: 120px;
  height: 28px;
  z-index: 2;
  opacity: 0.8;
  animation: hero-birds-fly 28s linear infinite;
}
@keyframes hero-birds-fly {
  0%   { transform: translateX(0)     translateY(0); }
  35%  { transform: translateX(180px) translateY(-6px); }
  60%  { transform: translateX(320px) translateY(2px); }
  100% { transform: translateX(560px) translateY(-4px); }
}

/* ----- Mountains (3 layered SVG silhouettes for depth) ----- */
.hero-mountains {
  position: absolute;
  left: 0; right: 0;
  bottom: 70px;
  width: 100%;
  height: 110px;
  z-index: 3;
  pointer-events: none;
}

/* ----- Lighthouse ----- */
.hero-lighthouse {
  position: absolute;
  left: 26px;
  bottom: 96px;
  width: 14px;
  height: 38px;
  z-index: 4;
  pointer-events: none;
}
.hero-lighthouse-body {
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 28px;
  background: linear-gradient(180deg, #fff 0%, #fff 50%, #d6473d 50%, #d6473d 65%, #fff 65%, #fff 80%, #d6473d 80%, #d6473d 100%);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}
.hero-lighthouse-cap {
  position: absolute;
  left: -3px;
  bottom: 28px;
  width: 20px;
  height: 8px;
  background: #2a3a4d;
  border-radius: 8px 8px 2px 2px;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.3);
}
.hero-lighthouse-cap::before {
  content: "";
  position: absolute;
  left: 7px;
  top: -4px;
  width: 6px; height: 4px;
  background: #d6473d;
  border-radius: 1px 1px 0 0;
}
.hero-lighthouse-beam {
  position: absolute;
  left: 50%; top: 30%;
  width: 70px;
  height: 16px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(255, 230, 150, 0.6) 0%, rgba(255, 230, 150, 0) 100%);
  filter: blur(2px);
  border-radius: 0 50% 50% 0 / 0 50% 50% 0;
  transform-origin: 0 50%;
  animation: hero-lighthouse-sweep 5s ease-in-out infinite alternate;
  opacity: 0.85;
}
@keyframes hero-lighthouse-sweep {
  from { transform: translateY(-50%) rotate(-12deg); opacity: 0.5; }
  to   { transform: translateY(-50%) rotate(18deg);  opacity: 0.95; }
}

/* ----- Sea ----- */
.hero-sea {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 90px;
  background:
    linear-gradient(180deg,
      rgba(140, 197, 220, 0.0) 0%,
      rgba(95, 156, 188, 0.92) 22%,
      rgba(58, 116, 152, 0.98) 70%,
      rgba(38, 92, 128, 1) 100%);
  z-index: 4;
}
.hero-sea::before {
  /* Horizon highlight */
  content: "";
  position: absolute;
  top: 6px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 220, 180, 0.55) 30%, rgba(255, 220, 180, 0.55) 70%, transparent);
}
.hero-shimmer {
  position: absolute;
  bottom: 0;
  right: 24%;
  width: 90px;
  height: 84px;
  background: radial-gradient(ellipse 60% 90% at 50% 0%, rgba(255, 209, 130, 0.55) 0%, rgba(255, 169, 86, 0) 70%);
  filter: blur(1px);
  z-index: 5;
  pointer-events: none;
}
.hero-waves {
  position: absolute;
  bottom: 18px;
  left: 0; right: 0;
  width: 100%;
  height: 26px;
  z-index: 5;
  pointer-events: none;
  opacity: 0.8;
  animation: hero-waves-shift 8s ease-in-out infinite alternate;
}
@keyframes hero-waves-shift {
  from { transform: translateX(-2px); }
  to   { transform: translateX(2px); }
}

/* ----- Drifting particles ----- */
.hero-particle {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, rgba(255,255,255,0));
  filter: blur(0.3px);
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  animation: hero-particle-float 14s linear infinite;
}
.hero-particle-1 { left: 14%;  top: 0; animation-delay: 0s;  }
.hero-particle-2 { left: 30%;  top: 0; animation-delay: 3s; width: 4px; height: 4px; }
.hero-particle-3 { left: 58%;  top: 0; animation-delay: 6s; width: 5px; height: 5px; }
.hero-particle-4 { left: 76%;  top: 0; animation-delay: 9s; width: 4px; height: 4px; }
.hero-particle-5 { left: 88%;  top: 0; animation-delay: 12s; width: 6px; height: 6px; }
@keyframes hero-particle-float {
  0%   { opacity: 0; transform: translateY(-12px) translateX(0); }
  10%  { opacity: 0.85; }
  50%  { transform: translateY(150px) translateX(20px); opacity: 0.7; }
  90%  { opacity: 0.4; }
  100% { opacity: 0; transform: translateY(280px) translateX(-10px); }
}

.hero-char-wrap {
  position: absolute;
  bottom: 8px;
  left: 60%;
  transform: translateX(-50%);
  width: 48%;
  max-width: 200px;
  z-index: 7;
  animation: bob 3.2s ease-in-out infinite;
}
.hero-char-wrap::after {
  /* Subtle ground reflection / shadow */
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -2px;
  height: 8px;
  background: radial-gradient(ellipse 50% 100% at 50% 0%, rgba(20, 30, 50, 0.32), rgba(20, 30, 50, 0));
  filter: blur(1px);
  pointer-events: none;
}
.hero-char {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 12px 16px rgba(43, 36, 53, 0.28));
}

.hero-bubble {
  position: absolute;
  top: 16px;
  left: 16px;
  max-width: 52%;
  background: #fff;
  padding: 12px 16px;
  border-radius: 18px 18px 18px 4px;
  font-weight: 700;
  line-height: 1.4;
  font-size: 0.9rem;
  box-shadow: 0 8px 22px rgba(43, 36, 53, 0.18);
  border: 2px solid rgba(43, 36, 53, 0.06);
  cursor: pointer;
  z-index: 8;
  animation: bubble-in 0.6s var(--ease-pop) 0.2s backwards;
  transition: transform 0.18s var(--ease-pop), box-shadow 0.18s ease;
}
.hero-bubble:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(43, 36, 53, 0.16);
}
.hero-bubble:active {
  transform: scale(0.98);
}
.hero-bubble::after {
  content: "";
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff8b6c, #f47a5a);
  box-shadow:
    0 3px 8px rgba(244, 122, 90, 0.45),
    inset 0 0 0 2px #fff;
  animation: bubble-pulse 2.4s ease-in-out infinite;
}
@keyframes bubble-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.hero-bubble::before {
  content: "";
  position: absolute;
  left: 14px; bottom: -10px;
  width: 14px; height: 14px;
  background: #fff;
  border-right: 2px solid rgba(43, 36, 53, 0.06);
  border-bottom: 2px solid rgba(43, 36, 53, 0.06);
  transform: rotate(45deg);
}

/* Rank progress card */
.rank-card {
  margin-bottom: 16px;
  border-radius: var(--r-lg);
  padding: 3px;
  background: linear-gradient(135deg, var(--c-coral) 0%, var(--c-gold) 50%, var(--c-ocean) 100%);
  box-shadow: var(--sh-md);
}
.rank-card-inner {
  background: #fff;
  border-radius: calc(var(--r-lg) - 4px);
  padding: 16px 18px;
}
.rank-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.rank-badge-ring {
  position: relative;
  width: 70px; height: 70px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-coral) 0%, var(--c-gold) 50%, var(--c-ocean) 100%);
  padding: 3px;
  box-shadow: 0 4px 10px rgba(244, 122, 90, 0.18);
}
.rank-badge {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-size: 2rem;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff 0%, #fff8ec 80%);
  border: 2px solid #fff;
}
.rank-kicker {
  font-size: 0.7rem;
  color: var(--c-ink-faint);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.rank-meta .rank-name { font-size: 1.2rem; font-weight: 900; line-height: 1.1; margin-top: 2px; }
.rank-meta .rank-sub { font-size: 0.72rem; color: var(--c-coral-deep); font-weight: 900; letter-spacing: 0.12em; margin-top: 2px; }

.rank-progress { display: flex; flex-direction: column; gap: 8px; }
.rank-progress-bar {
  height: 14px;
  background: var(--c-ocean-soft);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(43, 36, 53, 0.08);
}
.rank-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--c-coral) 0%, var(--c-gold) 100%);
  border-radius: 99px;
  transition: width 0.9s var(--ease-pop);
  position: relative;
  overflow: hidden;
}
.rank-progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 30%, rgba(255,255,255,0.5) 50%, transparent 70%);
  animation: shine 2.5s linear infinite;
}
@keyframes shine {
  from { transform: translateX(-100%); }
  to   { transform: translateX(200%); }
}
.rank-progress-text { font-size: 0.82rem; color: var(--c-ink-soft); font-weight: 700; text-align: right; }

/* Quick tiles */
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.quick-tile {
  text-align: left;
  padding: 0;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--sh-md);
  border: 2.5px solid #fff;
  transition: transform 0.2s var(--ease-pop), box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.quick-tile::before {
  content: "";
  position: absolute;
  right: -28px; bottom: -28px;
  width: 130px; height: 130px;
  border-radius: 50%;
  opacity: 0.32;
  transition: transform 0.4s var(--ease-pop);
  z-index: 0;
}
.quick-tile:hover::before { transform: scale(1.15); opacity: 0.42; }
.quick-tile::after {
  content: "›";
  position: absolute;
  top: 10px; right: 14px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--c-ink-soft);
  transition: transform 0.2s, background 0.2s, color 0.2s;
  z-index: 2;
  line-height: 1;
}
.quick-tile:hover::after { transform: translateX(3px); background: var(--c-coral); color: #fff; }
.quick-quiz::before    { background: var(--c-cherry-soft); }
.quick-qr::before      { background: var(--c-ocean-soft); }
.quick-shop::before    { background: var(--c-gold-soft); }
.quick-license::before { background: #e5dbff; }

.quick-tile-strip {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: var(--r-lg) 0 0 var(--r-lg);
  z-index: 1;
}
.quick-quiz    .quick-tile-strip { background: linear-gradient(180deg, #ff87a9, #ff5a85); }
.quick-qr      .quick-tile-strip { background: linear-gradient(180deg, #5aa7d1, #4f8fb8); }
.quick-shop    .quick-tile-strip { background: linear-gradient(180deg, #ffcf57, #f6b93b); }
.quick-license .quick-tile-strip { background: linear-gradient(180deg, #9b87d8, #6f5db5); }

.quick-tile:active {
  transform: scale(0.97) translateY(2px);
  box-shadow: var(--sh-sm);
}
.quick-tile-inner {
  padding: 16px 16px 14px 18px;
  position: relative;
  z-index: 2;
}
.quick-icon-wrap {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(43, 36, 53, 0.08);
  margin-bottom: 8px;
}
.quick-quiz    .quick-icon-wrap { background: linear-gradient(135deg, #fff, #ffeaf0); }
.quick-qr      .quick-icon-wrap { background: linear-gradient(135deg, #fff, #e6f0f7); }
.quick-shop    .quick-icon-wrap { background: linear-gradient(135deg, #fff, #fff1d0); }
.quick-license .quick-icon-wrap { background: linear-gradient(135deg, #fff, #ece6fb); }
.quick-icon {
  font-size: 1.55rem;
  display: inline-block;
  transform-origin: bottom center;
  transition: transform 0.3s var(--ease-pop);
}
.quick-tile:hover .quick-icon { transform: translateY(-2px) scale(1.12) rotate(-4deg); }
.quick-label { font-weight: 900; font-size: 1rem; letter-spacing: 0.01em; }
.quick-sub { font-size: 0.74rem; color: var(--c-ink-soft); font-weight: 700; margin-top: 3px; line-height: 1.3; }

/* Stats strip */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 16px;
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  border: 2px solid #fff;
  overflow: hidden;
}
.stat-streak .stat-value {
  background: linear-gradient(135deg, #ff5a36, #ffcf57);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-unit {
  font-size: 0.7rem;
  color: var(--c-ink-soft);
  margin-left: 1px;
  font-weight: 800;
  -webkit-text-fill-color: var(--c-ink-soft);
}
@media (max-width: 380px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .stat + .stat::before { display: none; }
  .stat { border-top: 1px solid rgba(43, 36, 53, 0.05); }
  .stat:nth-child(-n + 2) { border-top: none; }
}
.stat {
  padding: 14px 8px 12px;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: none;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.stat:hover { background: rgba(255, 246, 234, 0.55); }
.stat:active { transform: scale(0.97); }
.stat + .stat::before {
  content: "";
  position: absolute;
  left: 0; top: 18%; bottom: 18%;
  width: 1px;
  background: rgba(43, 36, 53, 0.08);
}
.stat-icon {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--c-coral-soft);
  font-size: 0.85rem;
  margin-bottom: 2px;
}
.stat[data-tone="coral"] .stat-icon { background: var(--c-coral-soft); }
.stat[data-tone="ocean"] .stat-icon { background: var(--c-ocean-soft); }
.stat[data-tone="gold"]  .stat-icon { background: var(--c-gold-soft); }
.stat[data-tone="fire"]  .stat-icon { background: linear-gradient(135deg, #ffd9bf, #ffb59a); }
.stat-value {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--c-coral-deep);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}
.stat[data-tone="ocean"] .stat-value { color: #4584b0; }
.stat[data-tone="gold"]  .stat-value { color: #c98a14; }
.stat-label {
  font-size: 0.72rem;
  color: var(--c-ink-soft);
  font-weight: 700;
  margin-top: 2px;
}

/* Place strip — horizontal scroll of 4 islands */
.place-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 62%;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 4px 12px;
  margin: 0 -16px 16px;
  padding-left: 16px;
  padding-right: 16px;
  -webkit-overflow-scrolling: touch;
}
.place-strip::-webkit-scrollbar { height: 0; }
.place-card {
  scroll-snap-align: start;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-lg);
  background-size: cover;
  background-position: center;
  box-shadow: var(--sh-sm);
  border: 2.5px solid #fff;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s var(--ease-pop);
}
.place-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.place-card-inner {
  position: absolute;
  inset: 0;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #fff;
  background: linear-gradient(180deg, transparent 35%, rgba(20, 24, 40, 0.15) 50%, rgba(20, 24, 40, 0.78) 100%);
}
.place-card-kicker {
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.24em;
  opacity: 0.85;
}
.place-card-name {
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.15;
  margin-top: 2px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.45);
}
.place-card-desc {
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.92;
  margin-top: 2px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.35);
}

/* News card */
.news-card {
  background: linear-gradient(135deg, #fff, var(--c-cream));
  padding: 14px 18px;
  border-radius: var(--r-md);
  border: 2px dashed rgba(43, 36, 53, 0.12);
  margin-bottom: 12px;
}
.news-head {
  font-weight: 900;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.news-head-icon { font-size: 1.1rem; }
.news-list li {
  padding: 6px 0 6px 18px;
  position: relative;
  font-size: 0.88rem;
  font-weight: 500;
}
.news-list li b {
  color: var(--c-coral-deep);
  font-weight: 900;
}
.news-dot {
  position: absolute;
  left: 2px; top: 13px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c-coral);
  box-shadow: 0 0 0 3px var(--c-coral-tint);
}

/* ============================================================
   Buttons & inputs
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 0.04em;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
  border: 2.5px solid #fff;
  min-height: 48px;
  font-size: 0.95rem;
}
.btn-sm {
  padding: 9px 16px;
  min-height: 40px;
  font-size: 0.85rem;
}
.btn-primary {
  background: linear-gradient(135deg, var(--c-coral) 0%, var(--c-coral-deep) 100%);
  color: #fff;
  box-shadow: var(--sh-pop), inset 0 -3px 0 rgba(0,0,0,0.08);
}
.btn-primary:hover { filter: brightness(1.03); }
.btn-primary:active { transform: translateY(2px); box-shadow: var(--sh-sm); }
.btn-ghost {
  background: #fff;
  color: var(--c-ink-soft);
  border: 2px solid rgba(43, 36, 53, 0.1);
  box-shadow: var(--sh-xs);
}
.btn-ghost:active { transform: translateY(1px); }
.btn-full { width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.input {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  background: #fff;
  border: 2px solid rgba(43, 36, 53, 0.1);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  color: var(--c-ink);
}
.input:focus { border-color: var(--c-coral); box-shadow: 0 0 0 4px var(--c-coral-tint); }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-weight: 700; font-size: 0.78rem; margin-bottom: 6px; color: var(--c-ink-soft); letter-spacing: 0.08em; }

/* ============================================================
   Quiz
   ============================================================ */
.quiz-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.quiz-item {
  display: flex; align-items: center; gap: 14px;
  background: #fff;
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--sh-sm);
  border: 2.5px solid #fff;
  cursor: pointer;
  transition: transform 0.15s var(--ease-pop), box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.quiz-item:hover { box-shadow: var(--sh-md); }
.quiz-item:active { transform: scale(0.98); }
.quiz-item-icon {
  width: 58px; height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--c-cherry-soft), var(--c-ocean-soft));
  background-size: cover;
  background-position: center;
  display: grid; place-items: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  box-shadow: inset 0 -3px 0 rgba(43, 36, 53, 0.06), inset 0 0 0 2px rgba(255,255,255,0.5);
  position: relative;
}
.quiz-item-icon span {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 2px 4px rgba(255,255,255,0.65));
}
.quiz-item-meta { flex: 1; line-height: 1.3; min-width: 0; }
.quiz-item-title { font-weight: 900; font-size: 1rem; }
.quiz-item-desc { font-size: 0.78rem; color: var(--c-ink-soft); font-weight: 500; }
.quiz-item-score {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.7rem;
  font-weight: 900;
  color: var(--c-ocean-deep);
  background: var(--c-ocean-soft);
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.04em;
}
.quiz-item-arrow { color: var(--c-coral); font-weight: 900; font-size: 1.4rem; }
.quiz-item.cleared {
  border-color: var(--c-mint);
  background: linear-gradient(135deg, #fff, var(--c-mint-soft));
}
.quiz-item.cleared::before {
  content: "✓ クリア";
  position: absolute;
  top: 8px; right: 10px;
  font-size: 0.66rem;
  font-weight: 900;
  color: var(--c-mint);
  background: rgba(255,255,255,0.8);
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.08em;
}

.quiz-play { display: flex; flex-direction: column; gap: 14px; }
.quiz-progress { display: flex; align-items: center; gap: 12px; font-weight: 900; font-size: 0.9rem; }
.quiz-progress > span:first-child {
  color: var(--c-coral-deep);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
}
.quiz-progress-bar {
  flex: 1;
  height: 10px;
  background: var(--c-ocean-soft);
  border-radius: 99px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(43, 36, 53, 0.08);
}
.quiz-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--c-coral), var(--c-gold));
  transition: width 0.5s var(--ease-pop);
}
.quiz-card {
  background: #fff;
  padding: 22px 20px;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
  border: 3px solid #fff;
}
.quiz-q-wrap {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--c-ocean-soft);
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 2px dashed rgba(47, 127, 171, 0.3);
  margin-bottom: 16px;
}
.quiz-q-label {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--c-ocean-deep);
  line-height: 1;
}
.quiz-q {
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.5;
  color: var(--c-ink);
  flex: 1;
}
.quiz-choices { display: grid; gap: 10px; }
.quiz-choice {
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: #fff;
  border: 2px solid rgba(43, 36, 53, 0.08);
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s, transform 0.1s var(--ease-pop);
}
.quiz-choice:hover { border-color: var(--c-coral); background: var(--c-coral-tint); }
.quiz-choice:active { transform: scale(0.98); }
.quiz-choice.correct {
  background: var(--c-mint-soft) !important;
  border-color: var(--c-mint) !important;
  color: #1e6b45;
  box-shadow: 0 0 0 4px rgba(111, 209, 164, 0.2);
}
.quiz-choice.wrong {
  background: #fff0eb !important;
  border-color: var(--c-coral) !important;
  color: var(--c-coral-deep);
}
.quiz-choice[disabled] { cursor: default; }
.quiz-feedback {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--c-cream);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.5;
}
.quiz-feedback.good { background: var(--c-mint-soft); color: #1e6b45; }
.quiz-feedback.bad  { background: #fff0eb; color: var(--c-coral-deep); }
#quizNextBtn { margin-top: 14px; }

.quiz-result {
  text-align: center;
  padding: 30px 18px 24px;
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--sh-md);
  border: 3px solid #fff;
  position: relative;
  overflow: hidden;
}
.quiz-result-burst {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 160%;
  height: 160%;
  background: conic-gradient(from 0deg,
    var(--c-gold-soft) 0deg,
    var(--c-cream) 30deg,
    var(--c-gold-soft) 60deg,
    var(--c-cream) 90deg,
    var(--c-gold-soft) 120deg,
    var(--c-cream) 150deg,
    var(--c-gold-soft) 180deg,
    var(--c-cream) 210deg,
    var(--c-gold-soft) 240deg,
    var(--c-cream) 270deg,
    var(--c-gold-soft) 300deg,
    var(--c-cream) 330deg,
    var(--c-gold-soft) 360deg);
  opacity: 0.35;
  animation: spin 20s linear infinite;
  z-index: 0;
}
@keyframes spin { to { transform: translateX(-50%) rotate(360deg); } }
.quiz-result-char {
  position: relative;
  z-index: 1;
}
.quiz-result-char img { width: 140px; margin: 0 auto; animation: bob 2.4s ease-in-out infinite; filter: drop-shadow(0 10px 12px rgba(43, 36, 53, 0.15)); }
.quiz-result-title { font-size: 1.5rem; font-weight: 900; margin-top: 12px; position: relative; z-index: 1; }
.quiz-result-score { color: var(--c-ink-soft); font-weight: 700; margin-top: 4px; position: relative; z-index: 1; }
.quiz-result-bonus {
  margin-top: 10px;
  font-weight: 900;
  color: var(--c-coral-deep);
  font-size: 1.05rem;
  position: relative; z-index: 1;
}
#quizBackBtn { margin-top: 18px; position: relative; z-index: 1; }

/* ---- Quiz play banner ---- */
.quiz-play-banner {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  height: 96px;
  box-shadow: var(--sh-sm);
  border: 3px solid #fff;
  isolation: isolate;
}
.quiz-play-banner-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.05);
  filter: saturate(1.05);
  z-index: 0;
}
.quiz-play-banner-bg::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 30% 110%, rgba(255, 135, 82, 0.55), transparent 55%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(47, 127, 171, 0.55));
}
.quiz-play-banner-fade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(26, 25, 48, 0.05) 0%, rgba(26, 25, 48, 0.45) 100%);
  z-index: 1;
}
.quiz-play-exit {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 3;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #fff;
  box-shadow: 0 4px 10px rgba(26, 25, 48, 0.18);
  font-weight: 900;
  color: var(--c-ink);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform 0.15s var(--ease-pop), background 0.15s;
}
.quiz-play-exit:hover { background: #fff; transform: translateX(-1px); }
.quiz-play-exit:active { transform: scale(0.94); }
.quiz-play-banner-body {
  position: relative;
  z-index: 2;
  height: 100%;
  padding: 14px 16px 14px 52px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
}
.quiz-play-banner-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: grid; place-items: center;
  font-size: 1.8rem;
  box-shadow: 0 6px 12px rgba(26, 25, 48, 0.2);
  flex-shrink: 0;
}
.quiz-play-banner-meta { min-width: 0; }
.quiz-play-banner-kicker {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.quiz-play-banner-title {
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.2;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Progress stars (dots) ---- */
.quiz-progress-stars {
  display: flex;
  gap: 4px;
  align-items: center;
}
.quiz-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(47, 127, 171, 0.22);
  transition: transform 0.3s var(--ease-pop), background 0.3s;
}
.quiz-dot.done { background: var(--c-coral); transform: scale(1.15); }
.quiz-dot.current {
  background: var(--c-gold);
  box-shadow: 0 0 0 3px rgba(255, 207, 87, 0.35);
  animation: dotPulse 1.2s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.25); }
}

/* ---- Question card entrance ---- */
.quiz-card { position: relative; }
.quiz-card.q-enter { animation: qEnter 0.35s var(--ease-pop); }
@keyframes qEnter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Answer buttons (upgraded) ---- */
.quiz-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  box-shadow: 0 3px 0 rgba(43, 36, 53, 0.06);
}
.quiz-choice:hover { transform: translateY(-1px); box-shadow: 0 5px 0 rgba(43, 36, 53, 0.08); }
.quiz-choice:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(43, 36, 53, 0.06); }
.quiz-choice-letter {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--c-ocean-soft);
  color: var(--c-ocean-deep);
  display: grid; place-items: center;
  font-weight: 900;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.quiz-choice:hover .quiz-choice-letter {
  background: var(--c-coral-tint);
  color: var(--c-coral-deep);
}
.quiz-choice.correct .quiz-choice-letter {
  background: var(--c-mint);
  color: #fff;
}
.quiz-choice.wrong .quiz-choice-letter {
  background: var(--c-coral);
  color: #fff;
}
.quiz-choice-text { flex: 1; }

/* ---- Mascot cheer ---- */
.quiz-mascot {
  position: absolute;
  right: -6px;
  bottom: -12px;
  width: 88px;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(43, 36, 53, 0.18));
}
.quiz-mascot img {
  width: 100%;
  animation: bob 3.2s ease-in-out infinite;
}
.quiz-mascot-cheer {
  position: absolute;
  right: 68px;
  top: -2px;
  background: #fff;
  border: 2px solid var(--c-coral);
  border-radius: 14px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--c-coral-deep);
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(43, 36, 53, 0.12);
}
.quiz-mascot-cheer::after {
  content: '';
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 7px solid #fff;
  filter: drop-shadow(1px 0 0 var(--c-coral));
}
.quiz-mascot-cheer.pop {
  animation: cheerPop 0.5s var(--ease-pop);
}
@keyframes cheerPop {
  0%   { transform: scale(0.8); }
  60%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Small screens: tighten banner */
@media (max-width: 360px) {
  .quiz-play-banner { height: 80px; }
  .quiz-play-banner-icon { width: 46px; height: 46px; font-size: 1.4rem; }
  .quiz-play-banner-title { font-size: 1rem; }
  .quiz-mascot { width: 72px; }
  .quiz-mascot-cheer { right: 54px; font-size: 0.68rem; }
}

/* Give card bottom padding to accommodate mascot */
.quiz-card { padding-bottom: 60px; }

/* ============================================================
   QR
   ============================================================ */
.qr-scanner { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.qr-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-xl);
  background: #1a1930;
  position: relative;
  overflow: hidden;
  box-shadow: var(--sh-md);
  border: 4px solid #fff;
}
.qr-frame video, .qr-frame canvas {
  width: 100%; height: 100%; object-fit: cover;
}
.qr-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  pointer-events: none;
}
.qr-target {
  position: relative;
  width: 65%;
  aspect-ratio: 1 / 1;
  box-shadow: 0 0 0 9999px rgba(26, 25, 48, 0.55);
  border-radius: 16px;
  overflow: hidden;
}
.qr-corner {
  position: absolute;
  width: 28px; height: 28px;
  border: 4px solid var(--c-coral);
  border-radius: 4px;
}
.qr-corner-tl { top: -2px; left: -2px;    border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.qr-corner-tr { top: -2px; right: -2px;   border-left: 0;  border-bottom: 0; border-top-right-radius: 12px; }
.qr-corner-bl { bottom: -2px; left: -2px; border-right: 0; border-top: 0;    border-bottom-left-radius: 12px; }
.qr-corner-br { bottom: -2px; right: -2px;border-left: 0;  border-top: 0;    border-bottom-right-radius: 12px; }
.qr-scanline {
  position: absolute;
  left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--c-coral), transparent);
  box-shadow: 0 0 12px var(--c-coral);
  animation: scanline 2.4s ease-in-out infinite;
}
@keyframes scanline {
  0%,100% { top: 10%; opacity: 0.3; }
  50%     { top: 90%; opacity: 1; }
}
.qr-placeholder {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #fff;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, rgba(91, 143, 193, 0.6), transparent 55%),
    radial-gradient(circle at 80% 85%, rgba(217, 87, 58, 0.35), transparent 60%),
    linear-gradient(135deg, #2d2647, #1a1930 60%, #221c39);
}
.qr-placeholder-bg {
  position: absolute; inset: 0; pointer-events: none;
}
.qr-placeholder-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(22px);
  opacity: 0.55;
  animation: qrBlobFloat 6s ease-in-out infinite;
}
.qr-placeholder-blob-1 {
  width: 140px; height: 140px;
  top: -30px; left: -20px;
  background: radial-gradient(circle, var(--c-coral), transparent 70%);
}
.qr-placeholder-blob-2 {
  width: 180px; height: 180px;
  bottom: -40px; right: -30px;
  background: radial-gradient(circle, var(--c-ocean), transparent 70%);
  animation-delay: 1.6s;
}
.qr-placeholder-blob-3 {
  width: 100px; height: 100px;
  top: 38%; right: 12%;
  background: radial-gradient(circle, var(--c-gold), transparent 70%);
  animation-delay: 3.2s;
  opacity: 0.35;
}
@keyframes qrBlobFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(8px, -10px, 0) scale(1.08); }
}
.qr-placeholder-ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 80%; aspect-ratio: 1;
  max-width: 260px;
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: qrRingSpin 18s linear infinite;
}
.qr-placeholder-ring-2 {
  width: 60%;
  max-width: 200px;
  border-style: dotted;
  border-color: rgba(246, 185, 59, 0.22);
  animation-direction: reverse;
  animation-duration: 14s;
}
@keyframes qrRingSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}
.qr-placeholder-card {
  position: relative;
  z-index: 2;
  width: min(86%, 320px);
  padding: 18px 16px 22px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  display: grid;
  gap: 10px;
  place-items: center;
  text-align: center;
  overflow: hidden;
}
.qr-placeholder-sweep {
  position: absolute;
  top: 0; left: -40%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.12) 45%,
    rgba(255, 255, 255, 0.22) 50%,
    rgba(255, 255, 255, 0.12) 55%,
    transparent 100%
  );
  pointer-events: none;
  animation: qrSweep 3.4s ease-in-out infinite;
}
@keyframes qrSweep {
  0%   { transform: translateX(0);    opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateX(260%); opacity: 0; }
}
.qr-placeholder-mascot {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
}
.qr-placeholder-erika {
  width: 72px;
  height: auto;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
  animation: qrErikaBob 2.8s ease-in-out infinite;
}
@keyframes qrErikaBob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-4px) rotate(2deg); }
}
.qr-placeholder-bubble {
  position: relative;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: #fff;
  color: var(--c-ink);
  border-radius: 14px 14px 14px 4px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  animation: qrBubblePop 2.4s ease-in-out infinite;
}
.qr-placeholder-bubble::before {
  content: '';
  position: absolute;
  left: -6px; bottom: 4px;
  width: 10px; height: 10px;
  background: #fff;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
@keyframes qrBubblePop {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}
.qr-placeholder-text { display: grid; gap: 4px; }
.qr-placeholder-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: center;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(246, 185, 59, 0.18);
  border: 1px solid rgba(246, 185, 59, 0.4);
  color: #ffd66b;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}
.qr-placeholder-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #ffd66b;
  box-shadow: 0 0 8px #ffd66b;
  animation: qrDotBlink 1.2s ease-in-out infinite;
}
@keyframes qrDotBlink {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50%      { opacity: 1; transform: scale(1.15); }
}
.qr-placeholder-title {
  margin: 2px 0 0;
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.qr-placeholder-sub {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
}
.qr-actions { display: flex; gap: 10px; width: 100%; justify-content: center; flex-wrap: wrap; }
.qr-manual { width: 100%; background: #fff; border-radius: var(--r-md); padding: 12px 16px; border: 2px dashed rgba(43, 36, 53, 0.15); }
.qr-manual summary { font-weight: 700; cursor: pointer; color: var(--c-ink-soft); }
.qr-manual[open] summary { color: var(--c-ink); margin-bottom: 8px; }
.qr-manual-inner { display: flex; gap: 8px; margin-top: 6px; }
.qr-manual-inner .input { flex: 1; }
.qr-hint { width: 100%; background: var(--c-cream); border-radius: var(--r-sm); padding: 12px 14px; font-size: 0.85rem; }
.qr-hint-title { font-weight: 900; margin-bottom: 6px; }
.qr-hint-codes { display: flex; flex-wrap: wrap; gap: 6px; }
.qr-hint code {
  background: #fff;
  padding: 4px 10px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--c-coral-deep);
  border: 1px solid rgba(217, 87, 58, 0.2);
  letter-spacing: 0.05em;
}

/* ============================================================
   Shop
   ============================================================ */
.shop-balance-card {
  margin-bottom: 18px;
  padding: 16px 20px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(circle at 90% 20%, rgba(246, 185, 59, 0.4), transparent 60%),
    linear-gradient(135deg, #fff, var(--c-gold-soft));
  border: 2.5px solid #fff;
  box-shadow: var(--sh-md);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.shop-balance-card::before {
  content: "";
  position: absolute;
  top: -20px; right: -10px;
  width: 70px; height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--c-gold), transparent 70%);
  opacity: 0.4;
}
.shop-balance-label {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--c-ink-soft);
}
.shop-balance-value {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--c-coral-deep);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin: 4px 0 2px;
}
.shop-balance-value small { font-size: 0.9rem; margin-left: 4px; font-weight: 700; color: var(--c-ink-soft); }
.shop-balance-hint { font-size: 0.78rem; color: var(--c-ink-soft); font-weight: 500; }

/* ============================================================
   Shop Tabs (ポイント / ふるさと納税)
   ============================================================ */
.shop-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(255, 255, 255, 0.6);
  padding: 6px;
  border-radius: 16px;
  margin: 0 0 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--sh-sm);
}
.shop-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 11px 6px;
  border: none;
  background: transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--c-ink-soft);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s var(--ease-pop);
  position: relative;
  white-space: nowrap;
  min-width: 0;
}
.shop-tab:hover { color: var(--c-ink); transform: translateY(-1px); }
.shop-tab.active {
  background: linear-gradient(135deg, #fff, #fff8ec);
  color: var(--c-coral-deep);
  box-shadow: 0 4px 10px rgba(244, 122, 90, 0.2);
}
.shop-tab-emoji { font-size: 1.05rem; line-height: 1; }
.shop-tab-label { line-height: 1.1; }

@media (max-width: 360px) {
  .shop-tab { font-size: 0.86rem; gap: 3px; padding: 10px 4px; }
  .shop-tab-emoji { font-size: 0.95rem; }
}

/* Panels */
.shop-panel { display: none; }
.shop-panel.active { display: block; animation: shopPanelIn 0.32s ease; }
@keyframes shopPanelIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Furusato (ふるさと納税) panel
   ============================================================ */
.furusato-intro {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  background:
    linear-gradient(135deg, rgba(90, 167, 209, 0.16), rgba(255, 207, 87, 0.18)),
    #fff;
  border: 2px solid #fff;
  box-shadow: var(--sh-sm);
  margin-bottom: 18px;
}
.furusato-intro-icon {
  font-size: 2.4rem;
  flex-shrink: 0;
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 2px rgba(90, 167, 209, 0.35);
}
.furusato-intro-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--c-ink);
}
.furusato-intro-desc {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--c-ink-soft);
  font-weight: 600;
}

.furusato-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.furusato-item {
  background: #fff;
  border-radius: var(--r-lg);
  padding: 12px;
  border: 2.5px solid #fff;
  box-shadow: var(--sh-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--ease-pop), box-shadow 0.2s;
}
.furusato-item:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.furusato-item-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  font-size: 3.6rem;
  margin-bottom: 10px;
  position: relative;
  background: linear-gradient(135deg, var(--c-coral-soft), var(--c-gold-soft));
}
.furusato-item[data-accent="ocean"]  .furusato-item-img { background: linear-gradient(135deg, var(--c-ocean-soft), #fff8ec); }
.furusato-item[data-accent="cherry"] .furusato-item-img { background: linear-gradient(135deg, var(--c-cherry-soft), #fff7ec); }
.furusato-item[data-accent="gold"]   .furusato-item-img { background: linear-gradient(135deg, var(--c-gold-soft),  #fff5ea); }
.furusato-item[data-accent="mint"]   .furusato-item-img { background: linear-gradient(135deg, #d3f0e0, #fff7ec); }
.furusato-item[data-accent="plum"]   .furusato-item-img { background: linear-gradient(135deg, #ddd2ff, #fff7ec); }
.furusato-item-emoji {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
  transition: transform 0.3s var(--ease-pop);
}
.furusato-item:hover .furusato-item-emoji { transform: scale(1.05) rotate(-3deg); }
.furusato-item-cat {
  position: absolute;
  top: 8px; right: 8px;
  background: #fff;
  color: var(--c-coral-deep);
  font-size: 0.62rem;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.furusato-item-name {
  font-size: 0.95rem;
  font-weight: 900;
  margin-bottom: 4px;
  color: var(--c-ink);
  line-height: 1.3;
}
.furusato-item-desc {
  font-size: 0.78rem;
  color: var(--c-ink-soft);
  line-height: 1.45;
  margin-bottom: 10px;
  flex-grow: 1;
}
.furusato-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.furusato-item-amount {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--c-coral-deep);
}
.furusato-item-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(180deg, #ff8b6c, #f47a5a);
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s var(--ease-pop), box-shadow 0.15s ease;
  box-shadow: 0 4px 10px rgba(244, 122, 90, 0.3);
}
.furusato-item-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(244, 122, 90, 0.4); }
.furusato-item-btn:active { transform: scale(0.96); }

.furusato-cta {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(255, 246, 234, 0.92));
  border-radius: var(--r-lg);
  border: 2px solid #fff;
  box-shadow: var(--sh-sm);
}
.furusato-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #5aa7d1, #4f8fb8);
  color: #fff;
  font-weight: 900;
  font-size: 0.98rem;
  border-radius: 14px;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(90, 167, 209, 0.35);
  transition: transform 0.18s var(--ease-pop), box-shadow 0.18s ease;
}
.furusato-cta-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(90, 167, 209, 0.45); }
.furusato-cta-btn:active { transform: scale(0.98); }
.furusato-disclaimer {
  margin: 0;
  font-size: 0.72rem;
  color: var(--c-ink-soft);
  text-align: center;
  line-height: 1.45;
  font-weight: 600;
}

@media (min-width: 768px) {
  .furusato-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1100px) {
  .furusato-grid { grid-template-columns: repeat(4, 1fr); }
  .furusato-intro { padding: 20px 24px; }
}

.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.shop-item {
  background: #fff;
  border-radius: var(--r-lg);
  padding: 12px;
  border: 2.5px solid #fff;
  box-shadow: var(--sh-sm);
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--ease-pop), box-shadow 0.2s;
}
.shop-item:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.shop-item-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--c-cherry-soft), var(--c-ocean-soft));
  display: grid; place-items: center;
  font-size: 3.6rem;
  margin-bottom: 10px;
  line-height: 1;
  position: relative;
  box-shadow: inset 0 -4px 0 rgba(43, 36, 53, 0.06);
  overflow: hidden;
}
.shop-item-emoji {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 8px rgba(26, 25, 48, 0.16));
  transition: transform 0.3s var(--ease-pop);
}
.shop-item:hover .shop-item-emoji { transform: scale(1.08) rotate(-3deg); }
.shop-item-sticker {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 2;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--c-ink);
  border-radius: 99px;
  box-shadow: 0 2px 4px rgba(26, 25, 48, 0.12);
}
/* Decorative background rings per item */
.shop-item-img::before {
  content: "";
  position: absolute;
  width: 180%; height: 180%;
  left: -40%; top: -40%;
  background: radial-gradient(closest-side, rgba(255,255,255,0.8), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.shop-item-img::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  z-index: 0;
  opacity: 0.6;
}

/* Per-accent color palettes */
.shop-item[data-accent="cherry"] .shop-item-img {
  background: linear-gradient(135deg, #ffb4c8 0%, #ffd8e2 60%, #fff 100%);
}
.shop-item[data-accent="cherry"] { border-top: 5px solid #ff87a9; }

.shop-item[data-accent="silver"] .shop-item-img {
  background: linear-gradient(135deg, #d5dde9 0%, #ecf0f7 60%, #fff 100%);
}
.shop-item[data-accent="silver"] { border-top: 5px solid #9aa5b8; }

.shop-item[data-accent="coral"] .shop-item-img {
  background: linear-gradient(135deg, #ff9d7a 0%, #ffc9ad 60%, #fff 100%);
}
.shop-item[data-accent="coral"] { border-top: 5px solid var(--c-coral); }

.shop-item[data-accent="ocean"] .shop-item-img {
  background: linear-gradient(135deg, #7fb7d6 0%, #c1e3f2 60%, #fff 100%);
}
.shop-item[data-accent="ocean"] { border-top: 5px solid var(--c-ocean); }

.shop-item[data-accent="gold"] .shop-item-img {
  background: linear-gradient(135deg, #ffcf57 0%, #ffe8a8 60%, #fff 100%);
}
.shop-item[data-accent="gold"] { border-top: 5px solid var(--c-gold); }

.shop-item[data-accent="mint"] .shop-item-img {
  background: linear-gradient(135deg, #7ed7b2 0%, #cff0e3 60%, #fff 100%);
}
.shop-item[data-accent="mint"] { border-top: 5px solid var(--c-mint); }

.shop-item-owned-stamp {
  position: absolute;
  top: 18px; right: -20px;
  transform: rotate(12deg);
  padding: 4px 28px;
  background: var(--c-mint);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  box-shadow: 0 2px 4px rgba(26,25,48,0.15);
  z-index: 3;
}

/* Hide old ::before pseudo tag for owned now that we have a bigger stamp */
.shop-item.owned::before { content: none; }
/* Owned items fade slightly so the stamp reads as achievement */
.shop-item.owned .shop-item-img { filter: saturate(0.9) brightness(1.02); }
.shop-item-name { font-weight: 900; font-size: 0.95rem; line-height: 1.25; }
.shop-item-desc { font-size: 0.74rem; color: var(--c-ink-soft); margin: 2px 0 10px; line-height: 1.3; min-height: 2.2em; font-weight: 500; }
.shop-item-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; }
.shop-item-price {
  font-weight: 900;
  color: var(--c-coral-deep);
  font-size: 0.98rem;
  display: inline-flex; align-items: center; gap: 2px;
}
.shop-item-price::before {
  content: "🌟";
  font-size: 0.8rem;
}
.shop-item-btn {
  padding: 8px 14px;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--c-coral), var(--c-coral-deep));
  color: #fff;
  font-weight: 900;
  font-size: 0.78rem;
  transition: transform 0.12s ease, filter 0.2s;
  box-shadow: var(--sh-xs);
  white-space: nowrap;
}
.shop-item-btn:hover:not([disabled]) { filter: brightness(1.05); }
.shop-item-btn[disabled] { background: rgba(43, 36, 53, 0.15); color: rgba(43, 36, 53, 0.5); }
.shop-item-btn:active:not([disabled]) { transform: scale(0.95); }
.shop-item.locked {
  opacity: 0.7;
  filter: saturate(0.65);
}
.shop-item.locked .shop-item-img { filter: grayscale(0.4); }
.shop-item.owned {
  border-color: var(--c-mint);
  background: linear-gradient(135deg, #fff, var(--c-mint-soft));
}
.shop-item.owned::before {
  content: "GET!";
  position: absolute;
  top: 10px; right: 10px;
  background: var(--c-mint);
  color: #fff;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  z-index: 2;
  box-shadow: var(--sh-xs);
}

.shop-history { margin-top: 26px; }
.shop-history-list {
  background: #fff;
  border-radius: var(--r-md);
  border: 2px solid rgba(43, 36, 53, 0.06);
  overflow: hidden;
}
.shop-history-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  border-bottom: 1px dashed rgba(43, 36, 53, 0.08);
  font-size: 0.88rem;
}
.shop-history-list li:last-child { border-bottom: 0; }
.shop-history-list li strong { color: var(--c-coral-deep); font-weight: 900; }
.shop-history-empty {
  color: var(--c-ink-soft);
  font-size: 0.85rem;
  padding: 16px !important;
  text-align: center;
  font-weight: 500;
}

/* ============================================================
   License card — premium (flippable)
   ============================================================ */
.license-card-flipper {
  position: relative;
  margin-bottom: 14px;
  perspective: 1600px;
  min-height: 480px;
}
.license-card-flipper > .license-card {
  backface-visibility: hidden;
  transition: transform 0.8s var(--ease-soft);
}
.license-card-flipper > .license-card:nth-child(2) {
  transform: rotateY(180deg);
  position: absolute;
  inset: 0;
}
.license-card-flipper.flipped > .license-card:nth-child(1) {
  transform: rotateY(-180deg);
}
.license-card-flipper.flipped > .license-card:nth-child(2) {
  transform: rotateY(0deg);
}

.license-card {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow:
    var(--sh-lg),
    0 0 0 1px rgba(43, 36, 53, 0.06),
    inset 0 0 0 1px rgba(255,255,255,0.5);
  background:
    linear-gradient(135deg, #fffaf2 0%, #fff 35%, #fff8ef 65%, #ffeede 100%);
  isolation: isolate;
  -webkit-backface-visibility: hidden;
}
/* Watermark: four-islands-map faintly behind everything */
.license-card-watermark {
  position: absolute;
  inset: 0;
  background-image: url('../assets/images/hoppou/four-islands-map.png');
  background-size: 150% auto;
  background-repeat: no-repeat;
  background-position: 55% 45%;
  opacity: 0.08;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
  filter: saturate(0.5);
}
.license-card-watermark-back {
  background-size: 130% auto;
  background-position: 50% 50%;
  opacity: 0.07;
}
/* Holographic sheen overlay */
.license-card-holo {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg,
      transparent 28%,
      rgba(255, 207, 130, 0.35) 42%,
      rgba(255, 135, 169, 0.3) 50%,
      rgba(90, 167, 209, 0.35) 58%,
      transparent 72%);
  opacity: 0.6;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 3;
  animation: holo 8s linear infinite;
}
@keyframes holo {
  0%,100% { transform: translateX(-10%); }
  50%     { transform: translateX(10%); }
}
/* Guilloche pattern overlay */
.license-card-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(47, 127, 171, 0.12) 0, rgba(47, 127, 171, 0.12) 1px, transparent 1.5px),
    radial-gradient(circle at 80% 70%, rgba(217, 87, 58, 0.12) 0, rgba(217, 87, 58, 0.12) 1px, transparent 1.5px);
  background-size: 14px 14px, 18px 18px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.7;
}
/* Decorative corner flourishes */
.license-card-corner {
  position: absolute;
  width: 70px;
  height: 70px;
  pointer-events: none;
  z-index: 2;
  opacity: 0.55;
}
.license-card-corner::before,
.license-card-corner::after {
  content: "";
  position: absolute;
  border: 1.5px solid var(--c-coral-deep);
}
.license-card-corner-tl { top: 6px; left: 6px; }
.license-card-corner-tl::before { top: 0; left: 0; width: 30px; height: 30px; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.license-card-corner-tl::after  { top: 4px; left: 4px; width: 22px; height: 22px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; opacity: 0.7; }
.license-card-corner-br { bottom: 6px; right: 6px; }
.license-card-corner-br::before { bottom: 0; right: 0; width: 30px; height: 30px; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.license-card-corner-br::after  { bottom: 4px; right: 4px; width: 22px; height: 22px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; opacity: 0.7; }

/* Micro-text band on front */
.license-card-micro {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: 0.5rem;
  letter-spacing: 0.25em;
  color: rgba(43, 36, 53, 0.35);
  padding: 3px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-align: center;
  background: rgba(255,255,255,0.3);
  border-top: 1px solid rgba(43, 36, 53, 0.06);
  z-index: 2;
  font-weight: 700;
}

.license-card-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  color: #fff;
  background:
    linear-gradient(135deg, var(--c-ocean-deep) 0%, var(--c-ocean) 40%, var(--c-coral) 100%);
  border-bottom: 3px solid #fff;
}
.license-card-header-left {
  display: flex; align-items: center; gap: 12px;
}
.license-emblem {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3);
}
.license-brand-jp { font-weight: 900; font-size: 0.98rem; line-height: 1.05; }
.license-brand-en { font-size: 0.62rem; opacity: 0.88; letter-spacing: 0.18em; margin-top: 2px; }
.license-serial {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  font-weight: 900;
  background: rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: 99px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-family: 'SFMono-Regular', ui-monospace, monospace;
}

.license-card-main {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  padding: 18px 20px 10px;
  align-items: center;
}
.license-portrait {
  position: relative;
  width: 120px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, #fff, var(--c-ocean-soft) 80%);
  border: 3px solid #fff;
  box-shadow: var(--sh-sm), inset 0 0 0 1px rgba(43, 36, 53, 0.05), 0 0 0 5px rgba(244, 122, 90, 0.12);
  overflow: visible;
}
.license-portrait::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  overflow: hidden;
  z-index: 0;
}
.license-portrait-img {
  position: relative;
  width: 140%; height: 140%;
  object-fit: cover;
  object-position: 50% 30%;
  transform: scale(1.05) translateY(6%);
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
  z-index: 1;
}
.license-portrait-ring {
  position: absolute;
  inset: -8px;
  border: 2px dashed var(--c-coral);
  border-radius: 50%;
  animation: spin 24s linear infinite;
  opacity: 0.65;
  pointer-events: none;
  z-index: 2;
}
.license-portrait-star {
  position: absolute;
  right: -6px; top: -4px;
  width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--c-gold), #e59b1a);
  color: #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.85rem;
  font-weight: 900;
  border: 2px solid #fff;
  box-shadow: var(--sh-sm);
  z-index: 3;
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}
.license-rank-zone {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-width: 0;
}
.license-rank-badge {
  font-size: 2.2rem;
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(43, 36, 53, 0.15));
}
.license-rank-name {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--c-ink);
  line-height: 1.1;
  word-break: keep-all;
}
.license-rank-en {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  font-weight: 900;
  color: var(--c-coral-deep);
  margin-top: 2px;
}
.license-rank-tier {
  margin-top: 6px;
  font-size: 0.66rem;
  letter-spacing: 0.15em;
  font-weight: 700;
  color: var(--c-ink-soft);
  background: rgba(43, 36, 53, 0.05);
  padding: 2px 8px;
  border-radius: 99px;
}

.license-card-meta {
  position: relative;
  z-index: 2;
  padding: 6px 20px 14px;
  display: grid;
  gap: 8px;
}
.license-meta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.license-meta-cell {
  background: rgba(255, 255, 255, 0.7);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(43, 36, 53, 0.06);
  backdrop-filter: blur(6px);
}
.license-meta-k {
  display: block;
  font-size: 0.62rem;
  color: var(--c-ink-soft);
  font-weight: 900;
  letter-spacing: 0.18em;
}
.license-meta-v {
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--c-ink);
}
.license-meta-v.mono {
  font-family: 'SFMono-Regular', ui-monospace, monospace;
  font-size: 0.88rem;
  letter-spacing: 0.05em;
}

.license-card-foot {
  position: relative;
  z-index: 2;
  padding: 10px 20px 22px;
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 14px;
  align-items: end;
  border-top: 1px dashed rgba(43, 36, 53, 0.12);
  margin-top: 4px;
}
.license-sig-wrap { min-width: 0; }
.license-sig {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  font-weight: 900;
  color: var(--c-ink-soft);
}
.license-sig-line {
  font-family: 'Yuji Syuku', 'Zen Maru Gothic', serif;
  font-size: 1.2rem;
  color: var(--c-plum);
  border-bottom: 1.5px solid rgba(43, 36, 53, 0.2);
  padding: 4px 4px 2px;
  margin-top: 4px;
  font-style: italic;
  line-height: 1.1;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.license-stamp {
  position: relative;
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 3px double var(--c-coral-deep);
  display: grid; place-items: center;
  color: var(--c-coral-deep);
  font-weight: 900;
  font-size: 0.72rem;
  line-height: 1.1;
  text-align: center;
  transform: rotate(-10deg);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.7), rgba(255, 230, 220, 0.55) 80%);
  justify-self: end;
  box-shadow: inset 0 0 0 1px rgba(217, 87, 58, 0.2);
}
.license-stamp::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed var(--c-coral-deep);
  border-radius: 50%;
  opacity: 0.5;
}
.license-stamp-ring { letter-spacing: 0.08em; position: relative; z-index: 1; }

/* License back face */
.license-card-back {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 22px 16px;
  background:
    linear-gradient(135deg, #fffaf2 0%, #fff 40%, #f6eee2 100%);
}
.license-back-head {
  border-bottom: 1.5px solid var(--c-coral);
  padding-bottom: 8px;
  margin-bottom: 4px;
  position: relative;
  z-index: 2;
}
.license-back-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--c-ink);
}
.license-back-en {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  font-weight: 900;
  color: var(--c-coral-deep);
  margin-top: 2px;
}
.license-back-body {
  position: relative;
  z-index: 2;
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--c-ink);
  font-weight: 500;
}
.license-back-body p { margin: 0 0 6px; }
.license-back-body b { color: var(--c-coral-deep); font-weight: 900; }
.license-back-facts {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 6px 0 4px;
}
.license-back-facts li {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(43, 36, 53, 0.08);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}
.license-back-facts li span {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--c-ink-soft);
  font-weight: 900;
  margin-bottom: 2px;
}
.license-back-facts li b {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--c-coral-deep);
}
.license-back-foot {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed rgba(43, 36, 53, 0.15);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.license-back-barcode {
  height: 28px;
  background-image:
    repeating-linear-gradient(90deg,
      var(--c-ink) 0 2px,
      transparent 2px 4px,
      var(--c-ink) 4px 5px,
      transparent 5px 8px,
      var(--c-ink) 8px 10px,
      transparent 10px 13px);
  border-radius: 4px;
  opacity: 0.85;
}
.license-back-note {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--c-ink-soft);
  text-align: center;
  font-weight: 700;
}
.license-back-operator {
  display: block;
  margin-top: 4px;
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  font-weight: 600;
  color: rgba(43, 36, 53, 0.45);
}
.license-back-operator b {
  font-weight: 900;
  color: rgba(43, 36, 53, 0.7);
  letter-spacing: 0.1em;
}

/* App-wide credit (subtle footer line) */
.app-credit {
  margin: 28px auto 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  opacity: 0.55;
  user-select: none;
}
.app-credit-line {
  width: 36px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-ink-soft), transparent);
}
.app-credit-text {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--c-ink-soft);
  font-feature-settings: "palt";
}
.app-credit-text b {
  font-weight: 900;
  color: var(--c-ink);
  letter-spacing: 0.06em;
}

.license-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}
.license-actions .btn { min-width: 120px; }

/* Rank-tinted accents per rank */
.license-card-flipper[data-rank="silver"] .license-portrait { box-shadow: var(--sh-sm), inset 0 0 0 1px rgba(43, 36, 53, 0.05), 0 0 0 5px rgba(199, 208, 220, 0.3); }
.license-card-flipper[data-rank="gold"]   .license-portrait { box-shadow: var(--sh-sm), inset 0 0 0 1px rgba(43, 36, 53, 0.05), 0 0 0 5px rgba(246, 185, 59, 0.25); }
.license-card-flipper[data-rank="crab"]   .license-portrait { box-shadow: var(--sh-sm), inset 0 0 0 1px rgba(43, 36, 53, 0.05), 0 0 0 5px rgba(244, 122, 90, 0.28); }
.license-card-flipper[data-rank="clione"] .license-portrait { box-shadow: var(--sh-sm), inset 0 0 0 1px rgba(43, 36, 53, 0.05), 0 0 0 5px rgba(185, 166, 255, 0.3); }
.license-card-flipper[data-rank="prime"]  .license-portrait { box-shadow: var(--sh-sm), inset 0 0 0 1px rgba(43, 36, 53, 0.05), 0 0 0 5px rgba(255, 111, 164, 0.32); }

/* Rank journey */
.rank-journey {
  position: relative;
  padding: 10px 6px 0;
}
.rank-journey-line {
  position: absolute;
  left: 35px;
  top: 30px;
  bottom: 30px;
  width: 3px;
  background: linear-gradient(180deg,
    var(--c-silver) 0%,
    var(--c-gold-rank) 25%,
    var(--c-crab) 50%,
    var(--c-clione) 75%,
    var(--c-prime) 100%);
  border-radius: 99px;
  opacity: 0.35;
}
.rank-list { display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 1; }
.rank-item {
  display: flex; align-items: center; gap: 14px;
  background: #fff;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 2.5px solid #fff;
  box-shadow: var(--sh-xs);
  position: relative;
  transition: all 0.25s var(--ease-pop);
}
.rank-item.current {
  border-color: var(--c-coral);
  box-shadow: var(--sh-pop);
  transform: translateX(4px);
}
.rank-item.current::after {
  content: "NOW";
  position: absolute;
  right: 12px; top: -8px;
  background: linear-gradient(135deg, var(--c-coral), var(--c-coral-deep));
  color: #fff;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  box-shadow: var(--sh-xs);
}
.rank-item.locked { opacity: 0.6; filter: saturate(0.5); }
.rank-item.locked .rank-item-badge { background: rgba(43, 36, 53, 0.08); }
.rank-item-badge {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1.8rem;
  background: radial-gradient(circle at 30% 30%, #fff, var(--c-ocean-soft) 80%);
  background-size: cover !important;
  background-position: center !important;
  flex-shrink: 0;
  box-shadow: var(--sh-xs), inset 0 0 0 2px rgba(255, 255, 255, 0.7), 0 0 0 3px rgba(43, 36, 53, 0.04);
  position: relative;
  z-index: 2;
  border: 2px solid #fff;
}
.rank-item-badge .rank-item-emoji {
  font-size: 1.6rem;
  filter: drop-shadow(0 1px 2px rgba(255,255,255,0.6));
}
.rank-item.current .rank-item-badge {
  transform: scale(1.1);
  box-shadow: var(--sh-sm), 0 0 0 3px rgba(244, 122, 90, 0.4), inset 0 0 0 2px rgba(255, 255, 255, 0.7);
}
.rank-item-meta { flex: 1; line-height: 1.3; min-width: 0; }
.rank-item-name { font-weight: 900; font-size: 0.98rem; }
.rank-item-name small { font-weight: 700; color: var(--c-coral-deep); font-size: 0.68rem; letter-spacing: 0.12em; display: block; margin-top: 1px; }
.rank-item-range { font-size: 0.76rem; color: var(--c-ink-soft); font-weight: 500; margin-top: 2px; line-height: 1.4; }
.rank-item-range b { color: var(--c-ink); font-weight: 900; }
.rank-item-check {
  color: var(--c-mint);
  font-weight: 900;
  font-size: 1.3rem;
  background: var(--c-mint-soft);
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px var(--c-mint);
}
.rank-item.locked .rank-item-check { display: none; }
.rank-item.current .rank-item-check { display: none; }

/* Footer credits */
.footer-credits {
  margin-top: 20px;
  padding: 14px 8px 4px;
  text-align: center;
  font-size: 0.7rem;
  color: var(--c-ink-faint);
  font-weight: 500;
  line-height: 1.5;
}
.footer-credits code {
  background: rgba(43, 36, 53, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  color: var(--c-ink-soft);
}

.profile-card {
  background: #fff;
  border-radius: var(--r-md);
  padding: 14px 16px;
  box-shadow: var(--sh-xs);
  border: 2px solid #fff;
  margin-bottom: 20px;
}
.profile-form { display: flex; flex-direction: column; gap: 12px; }
.profile-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================================================
   Bottom navigation — refined hand-drawn feel
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(min(var(--max-w), 100%) - 18px);
  z-index: 40;
  padding: 0;
  pointer-events: none;
}
.bottom-nav-inner {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr 1fr 1fr;
  height: var(--nav-h);
  padding: 8px 10px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(255, 246, 234, 0.92));
  border-radius: 26px;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 -1px 0 rgba(43, 36, 53, 0.04) inset,
    0 18px 36px -14px rgba(43, 36, 53, 0.28),
    0 6px 14px -6px rgba(43, 36, 53, 0.18);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
}
/* subtle washi paper grain via tiny dots */
.bottom-nav-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image:
    radial-gradient(rgba(43, 36, 53, 0.045) 0.6px, transparent 0.6px);
  background-size: 8px 8px;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: multiply;
}
/* hairline divider */
.bottom-nav-inner::after {
  content: '';
  position: absolute;
  left: 12%; right: 12%;
  top: 6px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(43, 36, 53, 0.08), transparent);
  pointer-events: none;
}
.nav-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 3px;
  padding: 4px 0 6px;
  border-radius: 16px;
  color: var(--c-ink-soft);
  background: transparent;
  font-weight: 700;
  transition:
    color 0.22s ease,
    transform 0.18s var(--ease-pop);
}
.nav-btn:active { transform: scale(0.94); }
.nav-icon {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.28s var(--ease-pop), color 0.22s ease;
}
.nav-icon svg { width: 100%; height: 100%; display: block; }
.nav-label {
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  font-weight: 800;
  font-feature-settings: "palt";
  opacity: 0.78;
  transition: opacity 0.22s ease;
}
.nav-pill {
  position: absolute;
  bottom: 0px;
  left: 50%;
  width: 18px; height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--c-coral), var(--c-gold));
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  transition: transform 0.28s var(--ease-pop);
  box-shadow: 0 2px 6px rgba(244, 122, 90, 0.4);
}
.nav-btn.active {
  color: var(--c-coral-deep);
}
.nav-btn.active .nav-icon { transform: translateY(-3px) scale(1.06); }
.nav-btn.active .nav-label { opacity: 1; color: var(--c-ink); }
.nav-btn.active .nav-pill { transform: translateX(-50%) scaleX(1); }

/* Center QR button — refined floating action */
.nav-btn-center {
  position: relative;
  color: #fff;
  transform: translateY(-18px);
  width: 64px; height: 64px;
  align-self: center;
  justify-self: center;
  display: grid;
  grid-template: 1fr / 1fr;   /* single full-cell grid */
  place-items: center;        /* center icon within the cell */
  place-content: center;      /* center the grid tracks too */
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.45), transparent 55%),
    linear-gradient(160deg, var(--c-coral) 0%, var(--c-coral-deep) 60%, #b94527 100%);
  border: 3px solid #fff;
  box-shadow:
    0 0 0 1px rgba(43, 36, 53, 0.05),
    0 14px 28px -8px rgba(217, 87, 58, 0.55),
    0 4px 10px -2px rgba(43, 36, 53, 0.25),
    inset 0 -3px 6px rgba(0, 0, 0, 0.15),
    inset 0 2px 3px rgba(255, 255, 255, 0.45);
  padding: 0;
  gap: 0;
}
.nav-btn-center .nav-icon {
  grid-column: 1; grid-row: 1; /* same cell as the ring */
}
.nav-btn-center .nav-btn-center-ring {
  grid-column: 1; grid-row: 1;
}
.nav-btn-center .nav-icon {
  width: 30px; height: 30px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
}
.nav-icon-qr svg { transform: rotate(0deg); }
.nav-btn-center:active {
  transform: translateY(-15px) scale(0.95);
}
/* breathing ring around QR button */
.nav-btn-center-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(244, 122, 90, 0.45);
  pointer-events: none;
  animation: navCenterPulse 2.6s ease-in-out infinite;
}
.nav-btn-center-ring::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1.5px dashed rgba(246, 185, 59, 0.45);
  animation: navCenterSpin 12s linear infinite;
}
@keyframes navCenterPulse {
  0%, 100% { transform: scale(1);   opacity: 0.55; }
  50%      { transform: scale(1.12); opacity: 0;    }
}
@keyframes navCenterSpin {
  to { transform: rotate(360deg); }
}
.nav-btn-center.active {
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.55), transparent 55%),
    linear-gradient(160deg, var(--c-coral-deep), #a83a1d);
}
.nav-btn-center.active .nav-btn-center-ring {
  border-color: rgba(244, 122, 90, 0.7);
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 28px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--c-ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 99px;
  font-weight: 900;
  box-shadow: var(--sh-lg);
  z-index: 60;
  animation: toastIn 0.4s var(--ease-pop);
  max-width: calc(100% - 32px);
  text-align: center;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}
.toast.good { background: linear-gradient(135deg, var(--c-mint), #4ab085); }
.toast.bad  { background: linear-gradient(135deg, var(--c-coral), var(--c-coral-deep)); }
.toast.points {
  background: linear-gradient(135deg, var(--c-gold), #e59b1a);
  color: #5a3b00;
}
@keyframes toastIn {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to   { transform: translate(-50%, 0);    opacity: 1; }
}

/* ============================================================
   Confetti
   ============================================================ */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
}

/* ============================================================
   Small screens
   ============================================================ */
@media (max-width: 360px) {
  .quick-label { font-size: 0.95rem; }
  .hero-char-wrap { width: 54%; }
  .nav-label { font-size: 0.52rem; letter-spacing: 0.04em; }
  .nav-icon { width: 24px; height: 24px; }
  .license-card-main { grid-template-columns: 100px 1fr; }
  .license-portrait { width: 100px; }
  .license-rank-name { font-size: 1.15rem; }
  .hero-stamp { width: 64px; height: 64px; }
  .place-strip { grid-auto-columns: 76%; }
  .license-back-facts { grid-template-columns: 1fr; }
}

@media (min-width: 420px) {
  .pages { padding: 22px 18px 0; }
}

/* ============================================================
   Modal layer (daily welcome, future dialogs)
   ============================================================ */
.modal-layer {
  position: fixed; inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(26, 25, 48, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.26s ease;
}
.modal-card {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: 0 30px 80px rgba(26, 25, 48, 0.3), 0 6px 14px rgba(26, 25, 48, 0.12);
  padding: 24px 22px 22px;
  max-width: 360px;
  width: 100%;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  transition: transform 0.3s var(--ease-pop), opacity 0.3s ease;
}
.modal-layer.show .modal-backdrop { opacity: 1; }
.modal-layer.show .modal-card { transform: translateY(0) scale(1); opacity: 1; }

/* Welcome card specifics */
.welcome-card {
  text-align: center;
  overflow: hidden;
  isolation: isolate;
  border: 3px solid #fff;
}
.welcome-burst {
  position: absolute;
  top: -30%; left: 50%;
  transform: translateX(-50%);
  width: 180%;
  height: 120%;
  background: conic-gradient(from 0deg,
    rgba(255, 207, 87, 0.4) 0deg,
    rgba(255, 255, 255, 0) 25deg,
    rgba(255, 155, 122, 0.35) 60deg,
    rgba(255, 255, 255, 0) 95deg,
    rgba(255, 207, 87, 0.4) 130deg,
    rgba(255, 255, 255, 0) 165deg,
    rgba(255, 155, 122, 0.35) 200deg,
    rgba(255, 255, 255, 0) 235deg,
    rgba(255, 207, 87, 0.4) 270deg,
    rgba(255, 255, 255, 0) 305deg,
    rgba(255, 155, 122, 0.35) 340deg,
    rgba(255, 207, 87, 0.4) 360deg);
  animation: spin 18s linear infinite;
  z-index: -1;
  opacity: 0.8;
}
.welcome-char { margin: -6px auto 6px; }
.welcome-char img {
  width: 120px;
  animation: bob 2.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 12px rgba(26, 25, 48, 0.15));
}
.welcome-kicker {
  font-size: 0.8rem;
  color: var(--c-ink-soft);
  font-weight: 800;
  letter-spacing: 0.05em;
}
.welcome-title {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--c-ink);
  margin-top: 2px;
}
.welcome-streak {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--c-coral), var(--c-gold));
  color: #fff;
  font-weight: 900;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 14px rgba(255, 135, 82, 0.35);
}
.welcome-points {
  margin-top: 14px;
  font-size: 2rem;
  font-weight: 900;
  color: var(--c-coral-deep);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 rgba(255, 135, 82, 0.1);
}
.welcome-sub {
  margin-top: 2px;
  color: var(--c-ink-soft);
  font-weight: 700;
  font-size: 0.85rem;
}
#welcomeCloseBtn { margin-top: 18px; }

/* ============================================================
   Achievement popup (top-right slide-in)
   ============================================================ */
.achieve-pop {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 78;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 320px;
  padding: 12px 14px;
  background: #fff;
  border-radius: var(--r-md);
  box-shadow: 0 16px 40px rgba(26, 25, 48, 0.22);
  border: 3px solid var(--c-gold);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.4s var(--ease-pop), opacity 0.3s ease;
}
.achieve-pop.show {
  transform: translateX(0);
  opacity: 1;
}
.achieve-pop-icon {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-gold), var(--c-coral));
  display: grid; place-items: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(255, 207, 87, 0.4);
  animation: achieveBounce 1.4s ease-in-out infinite;
}
@keyframes achieveBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}
.achieve-pop-body { min-width: 0; flex: 1; }
.achieve-pop-kicker {
  font-size: 0.65rem;
  color: var(--c-gold);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.achieve-pop-title {
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--c-ink);
  margin-top: 1px;
}
.achieve-pop-desc {
  font-size: 0.78rem;
  color: var(--c-ink-soft);
  font-weight: 700;
  line-height: 1.35;
  margin-top: 2px;
}

/* ============================================================
   Achievement grid on license page
   ============================================================ */
.achieve-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 -2px 10px;
}
.achieve-tile {
  background: #fff;
  border-radius: var(--r-md);
  border: 2px solid #fff;
  box-shadow: var(--sh-sm);
  padding: 14px 10px 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--ease-pop);
}
.achieve-tile:hover { transform: translateY(-2px); }
.achieve-tile.earned {
  background:
    linear-gradient(135deg, rgba(255, 207, 87, 0.25), rgba(255, 255, 255, 0.8)),
    #fff;
  border-color: var(--c-gold);
  box-shadow: 0 6px 14px rgba(255, 207, 87, 0.24);
}
.achieve-tile.earned::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.6), transparent 40%);
  pointer-events: none;
}
.achieve-tile.locked .achieve-tile-icon { filter: grayscale(1); opacity: 0.5; }
.achieve-tile.locked .achieve-tile-name { color: var(--c-ink-soft); }
.achieve-tile-icon {
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 4px;
}
.achieve-tile.earned .achieve-tile-icon {
  filter: drop-shadow(0 3px 6px rgba(255, 135, 82, 0.3));
}
.achieve-tile-name {
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1.2;
  margin-top: 4px;
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}
.achieve-tile-desc {
  font-size: 0.65rem;
  color: var(--c-ink-soft);
  font-weight: 700;
  line-height: 1.35;
  margin-top: 4px;
  min-height: 2.7em;
}

/* Save button extra */
#licenseSaveBtn { min-width: 130px; }

@media (max-width: 380px) {
  .achieve-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Tappable topbar / interactive elements
   ============================================================ */
.topbar-profile-btn {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 0;
  text-align: left;
  border-radius: 16px;
  transition: background 0.18s ease, transform 0.18s ease;
}
.topbar-profile-btn:hover { background: rgba(244, 122, 90, 0.06); }
.topbar-profile-btn:active { transform: scale(0.98); }

.avatar { position: relative; }
.avatar-edit-pip {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 18px; height: 18px;
  background: var(--c-coral);
  color: #fff;
  font-size: 11px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(244, 122, 90, 0.4);
  pointer-events: none;
}

/* Avatar variants — color frame + decorative pattern background */
.avatar[data-frame="coral"]   { box-shadow: 0 0 0 3px var(--c-coral),   0 6px 14px rgba(244, 122, 90, 0.28); }
.avatar[data-frame="ocean"]   { box-shadow: 0 0 0 3px var(--c-ocean),   0 6px 14px rgba(90, 167, 209, 0.28); }
.avatar[data-frame="gold"]    { box-shadow: 0 0 0 3px var(--c-gold),    0 6px 14px rgba(246, 185, 59, 0.28); }
.avatar[data-frame="cherry"]  { box-shadow: 0 0 0 3px var(--c-cherry),  0 6px 14px rgba(255, 135, 169, 0.28); }
.avatar[data-frame="mint"]    { box-shadow: 0 0 0 3px var(--c-mint),    0 6px 14px rgba(111, 209, 164, 0.28); }
.avatar[data-frame="plum"]    { box-shadow: 0 0 0 3px var(--c-plum),    0 6px 14px rgba(84, 70, 104, 0.28); }

.avatar[data-pattern="wave"] {
  background: radial-gradient(circle at 20% 80%, rgba(90,167,209,0.25), transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(255,255,255,0.45), transparent 60%),
              #fff;
}
.avatar[data-pattern="dots"] {
  background-image: radial-gradient(rgba(43, 36, 53, 0.12) 1px, transparent 1.4px);
  background-size: 7px 7px;
  background-color: #fff;
}
.avatar[data-pattern="shine"] {
  background: conic-gradient(from 0deg, #fff7e0, #ffe9c2 25%, #fff 60%, #ffe1ea 90%, #fff7e0);
}
.avatar[data-pattern="plain"] { background: #fff; }

/* Points chip as button */
button.points-chip {
  border: 0;
  font: inherit;
  cursor: pointer;
}
button.points-chip:hover { transform: translateY(-1px); }

/* ============================================================
   Hero bubble as button
   ============================================================ */
button.hero-bubble {
  border: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: transform 0.18s var(--ease-pop);
}
button.hero-bubble:hover { transform: translate(0, -2px) rotate(-1deg); }
button.hero-bubble:active { transform: translate(0, 0) scale(0.98); }

/* ============================================================
   Stats strip — buttonized
   ============================================================ */
button.stat {
  border: 0;
  font: inherit;
  cursor: pointer;
  transition: transform 0.18s var(--ease-pop), box-shadow 0.18s ease;
  text-align: center;
}
button.stat:hover { transform: translateY(-2px); box-shadow: var(--sh-sm); }
button.stat:active { transform: translateY(0) scale(0.98); }

/* Place-card buttonized */
button.place-card { border: 0; cursor: pointer; font: inherit; padding: 0; }

/* Achievement tiles buttonized */
button.achieve-tile { border: 0; font: inherit; cursor: pointer; }
button.achieve-tile:hover { transform: translateY(-2px); box-shadow: var(--sh-sm); }
button.achieve-tile:active { transform: translateY(0) scale(0.98); }

/* ============================================================
   Home page settings CTA
   ============================================================ */
.home-settings-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 18px 0 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fff, #fff8ef);
  border: 2px solid #fff;
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: transform 0.2s var(--ease-pop), box-shadow 0.2s ease;
}
.home-settings-cta:hover { transform: translateY(-2px); box-shadow: var(--sh-sm); }
.home-settings-cta-icon {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--c-coral-soft), #fff5ec);
  display: grid; place-items: center;
  color: var(--c-coral-deep);
  flex-shrink: 0;
}
.home-settings-cta-meta { flex: 1; min-width: 0; }
.home-settings-cta-title { font-weight: 900; font-size: 0.95rem; }
.home-settings-cta-sub { font-size: 0.75rem; color: var(--c-ink-soft); margin-top: 2px; }
.home-settings-cta-arrow { font-size: 1.6rem; color: var(--c-ink-faint); font-weight: 900; line-height: 1; }

/* ============================================================
   Settings page
   ============================================================ */
.page-settings { padding-bottom: 100px; }

.settings-preview {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 18px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, #ffe8d6, #ffe1ea 60%, #d8eef9);
  overflow: hidden;
  isolation: isolate;
  margin-bottom: 18px;
  box-shadow: var(--sh-sm);
}
.settings-preview-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(220px 140px at 95% 10%, rgba(255, 255, 255, 0.55), transparent 60%),
    radial-gradient(180px 120px at 0% 100%, rgba(255, 207, 87, 0.4), transparent 60%);
  z-index: -1;
}
.settings-preview-avatar {
  flex-shrink: 0;
  width: 78px; height: 78px;
  border-radius: 50%;
  display: grid; place-items: center;
  overflow: hidden;
}
.settings-preview-avatar img { width: 100%; height: 100%; object-fit: cover; }
.settings-preview-meta { flex: 1; min-width: 0; }
.settings-preview-name {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--c-ink);
}
.settings-preview-rank {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  padding: 2px 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--c-ink-soft);
}
.settings-preview-bio {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--c-ink);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Section block */
.settings-section { margin-bottom: 20px; }
.settings-section-head {
  display: flex; align-items: center; gap: 8px;
  margin: 0 4px 8px;
}
.settings-section-icon { font-size: 1.2rem; }
.settings-section-title {
  font-weight: 900;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  color: var(--c-ink);
}

.settings-card {
  background: #fff;
  border: 2px solid #fff;
  border-radius: var(--r-md);
  padding: 14px 16px;
  box-shadow: var(--sh-xs);
}
.settings-card .field { margin-bottom: 14px; }
.settings-card .field:last-child { margin-bottom: 0; }
.settings-card-desc {
  font-size: 0.78rem;
  color: var(--c-ink-soft);
  margin: 0 0 12px;
}
.settings-sub-label {
  font-weight: 900;
  font-size: 0.74rem;
  color: var(--c-ink-soft);
  letter-spacing: 0.08em;
  margin: 4px 2px 8px;
  text-transform: uppercase;
}
.field-counter {
  display: block;
  text-align: right;
  font-size: 0.7rem;
  color: var(--c-ink-faint);
  margin-top: 4px;
}
.input-textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
  line-height: 1.5;
}

/* Frame picker */
.frame-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.frame-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 14px;
  border: 2px solid #f3eee6;
  background: #fff;
  cursor: pointer;
  font: inherit;
  transition: transform 0.18s var(--ease-pop), border-color 0.18s ease, box-shadow 0.18s ease;
}
.frame-chip:hover { transform: translateY(-1px); }
.frame-chip.active {
  border-color: var(--c-coral);
  box-shadow: 0 6px 14px rgba(244, 122, 90, 0.18);
}
.frame-chip-color {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(43, 36, 53, 0.18);
}
.frame-chip-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--c-ink);
  text-align: center;
}

/* Pattern picker */
.pattern-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.pattern-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  border-radius: 14px;
  border: 2px solid #f3eee6;
  background: #fff;
  cursor: pointer;
  font: inherit;
  transition: transform 0.18s var(--ease-pop), border-color 0.18s ease;
}
.pattern-chip.active {
  border-color: var(--c-ocean);
  box-shadow: 0 6px 14px rgba(90, 167, 209, 0.18);
}
.pattern-chip-preview {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1rem;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(43, 36, 53, 0.12);
}
.pattern-chip-preview[data-pattern="wave"] {
  background: radial-gradient(circle at 20% 80%, rgba(90,167,209,0.4), transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(255,255,255,0.6), transparent 60%),
              #eaf6ff;
}
.pattern-chip-preview[data-pattern="dots"] {
  background-image: radial-gradient(rgba(43, 36, 53, 0.18) 1px, transparent 1.4px);
  background-size: 6px 6px;
  background-color: #fff;
}
.pattern-chip-preview[data-pattern="shine"] {
  background: conic-gradient(from 0deg, #fff7e0, #ffe9c2 25%, #fff 60%, #ffe1ea 90%, #fff7e0);
}
.pattern-chip-preview[data-pattern="plain"] { background: #fff; }
.pattern-chip-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--c-ink);
}

/* Island picker */
.island-picker { display: flex; flex-direction: column; gap: 10px; }
.island-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 8px;
  border-radius: var(--r-md);
  border: 2px solid #f3eee6;
  background: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
  position: relative;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s var(--ease-pop);
}
.island-chip:hover { transform: translateY(-1px); }
.island-chip.active {
  border-color: var(--c-coral);
  box-shadow: 0 6px 18px rgba(244, 122, 90, 0.2);
  background: linear-gradient(90deg, #fff7f1, #fff);
}
.island-chip-photo {
  width: 56px; height: 56px;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(43, 36, 53, 0.14);
}
.island-chip-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.island-chip-en {
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: var(--c-ocean-deep);
}
.island-chip-name {
  font-size: 1rem;
  font-weight: 900;
  color: var(--c-ink);
  margin-top: -2px;
}
.island-chip-desc {
  font-size: 0.74rem;
  color: var(--c-ink-soft);
  margin-top: 2px;
}
.island-chip-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--c-coral);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 0.85rem;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.18s ease, transform 0.18s var(--ease-pop);
}
.island-chip.active .island-chip-check { opacity: 1; transform: scale(1); }

/* Toggle row */
.settings-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed #efe6d6;
  cursor: pointer;
}
.settings-toggle:last-child { border-bottom: 0; }
.settings-toggle-meta { flex: 1; min-width: 0; }
.settings-toggle-meta strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 900;
  color: var(--c-ink);
}
.settings-toggle-meta small {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--c-ink-soft);
  font-weight: 600;
}
.settings-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.settings-toggle-track {
  flex-shrink: 0;
  width: 46px; height: 26px;
  border-radius: 99px;
  background: #e7ddc8;
  position: relative;
  transition: background 0.2s ease;
}
.settings-toggle-track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(43, 36, 53, 0.2);
  transition: transform 0.2s var(--ease-pop);
}
.settings-toggle input:checked + .settings-toggle-track {
  background: linear-gradient(135deg, var(--c-coral), var(--c-gold));
}
.settings-toggle input:checked + .settings-toggle-track::after {
  transform: translateX(20px);
}

/* Row buttons */
.settings-row-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 4px;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed #efe6d6;
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s ease;
}
.settings-row-btn:last-child { border-bottom: 0; }
.settings-row-btn:hover { background: rgba(255, 240, 232, 0.6); }
.settings-row-icon {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: var(--c-coral-tint);
  display: grid;
  place-items: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.settings-row-meta { flex: 1; min-width: 0; }
.settings-row-meta strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 900;
  color: var(--c-ink);
}
.settings-row-meta small {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--c-ink-soft);
  font-weight: 600;
}
.settings-row-arrow {
  font-size: 1.3rem;
  color: var(--c-ink-faint);
  font-weight: 900;
  line-height: 1;
}
.settings-row-btn-danger .settings-row-icon { background: #ffe1d8; }
.settings-row-btn-danger .settings-row-meta strong { color: var(--c-coral-deep); }

/* Info rows */
.settings-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 4px;
  border-bottom: 1px dashed #efe6d6;
  font-size: 0.85rem;
}
.settings-info-row span { color: var(--c-ink-soft); font-weight: 700; }
.settings-info-row strong { color: var(--c-ink); font-weight: 800; }
.settings-info-row .mono { font-family: 'SFMono-Regular', ui-monospace, monospace; font-size: 0.78rem; }

/* Profile shortcut on license page */
.profile-shortcut {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, #fff, #fff8ef);
  border: 2px solid #fff;
  box-shadow: var(--sh-xs);
  cursor: pointer;
  text-align: left;
  font: inherit;
  margin-bottom: 18px;
  transition: transform 0.18s var(--ease-pop), box-shadow 0.18s ease;
}
.profile-shortcut:hover { transform: translateY(-2px); box-shadow: var(--sh-sm); }
.profile-shortcut-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: grid; place-items: center;
}
.profile-shortcut-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-shortcut-meta { flex: 1; min-width: 0; }
.profile-shortcut-kicker {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--c-coral);
  text-transform: uppercase;
}
.profile-shortcut-name {
  font-size: 1rem;
  font-weight: 900;
  color: var(--c-ink);
  margin-top: 1px;
}
.profile-shortcut-sub {
  font-size: 0.74rem;
  color: var(--c-ink-soft);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.profile-shortcut-arrow {
  font-size: 1.6rem;
  color: var(--c-ink-faint);
  font-weight: 900;
  line-height: 1;
}

/* ============================================================
   Detail modal (island, achievement, history, credits)
   ============================================================ */
.detail-card {
  max-width: 380px;
  text-align: left;
  padding: 22px 22px 20px;
  max-height: calc(100svh - 48px);
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(43, 36, 53, 0.06);
  color: var(--c-ink);
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 2;
  transition: background 0.18s ease, transform 0.18s var(--ease-pop);
}
.modal-close:hover { background: rgba(43, 36, 53, 0.12); transform: rotate(90deg); }

.detail-photo {
  width: calc(100% + 44px);
  margin: -22px -22px 14px;
  height: 160px;
  background-size: cover;
  background-position: center;
  position: relative;
}
.detail-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 60%, #fff 100%);
}
.detail-kicker {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--c-coral);
  text-transform: uppercase;
}
.detail-title {
  font-size: 1.4rem;
  font-weight: 900;
  margin: 4px 0 4px;
  color: var(--c-ink);
}
.detail-sub {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--c-ink-soft);
  font-weight: 700;
}
.detail-facts {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.detail-facts li {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  background: var(--c-coral-tint);
  border-radius: 10px;
}
.detail-facts li span {
  font-size: 0.68rem;
  color: var(--c-ink-soft);
  font-weight: 800;
  letter-spacing: 0.04em;
}
.detail-facts li b {
  font-size: 0.85rem;
  color: var(--c-ink);
  font-weight: 900;
  margin-top: 2px;
}
.detail-body {
  margin: 0 0 16px;
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--c-ink);
}
.detail-body p { margin: 0 0 10px; }
.detail-body p:last-child { margin-bottom: 0; }
.detail-foot-note {
  margin-top: 12px;
  font-size: 0.7rem;
  color: var(--c-ink-faint);
  text-align: center;
}

/* Achievement detail */
.detail-card-achieve { text-align: center; }
.detail-card-achieve .detail-title,
.detail-card-achieve .detail-sub,
.detail-card-achieve .detail-kicker { text-align: center; }
.achieve-modal-medal {
  width: 110px; height: 110px;
  margin: 4px auto 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff7d6, #ffd07a 80%);
  display: grid;
  place-items: center;
  font-size: 3.4rem;
  box-shadow: 0 12px 28px rgba(246, 185, 59, 0.36);
  filter: drop-shadow(0 4px 8px rgba(255, 207, 87, 0.5));
}
.achieve-modal-meta { margin: 6px 0 14px; }
.achieve-modal-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--c-gold-soft);
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--c-coral-deep);
  letter-spacing: 0.04em;
}
.achieve-modal-pill-locked {
  background: rgba(43, 36, 53, 0.06);
  color: var(--c-ink-soft);
}

/* History modal list */
.history-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  max-height: 50svh;
  overflow-y: auto;
  border-radius: 14px;
  border: 1px solid #f0e6d4;
}
.history-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--c-ink-soft);
  font-size: 0.85rem;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px dashed #f0e6d4;
  font-size: 0.84rem;
}
.history-item:last-child { border-bottom: 0; }
.history-when {
  flex-shrink: 0;
  width: 56px;
  font-weight: 900;
  color: var(--c-ocean-deep);
  font-size: 0.78rem;
}
.history-when small {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--c-ink-soft);
}
.history-label {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  color: var(--c-ink);
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-points {
  flex-shrink: 0;
  font-weight: 900;
  font-size: 0.95rem;
}
.history-points small {
  font-weight: 700;
  margin-left: 2px;
  font-size: 0.7rem;
}
.history-pos { color: var(--c-coral); }
.history-neg { color: var(--c-ocean-deep); }

/* QR demo code copy buttons */
.qr-hint-code {
  font-family: 'SFMono-Regular', ui-monospace, monospace;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--c-ink);
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--c-cream);
  border: 1px dashed var(--c-cream-deep);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s var(--ease-pop);
}
.qr-hint-code:hover { background: var(--c-coral-tint); transform: translateY(-1px); }
.qr-hint-code:active { transform: translateY(0) scale(0.96); }
.qr-history-btn {
  margin-top: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--c-coral-tint);
  border: 1px dashed var(--c-coral-soft);
  color: var(--c-coral-deep);
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s var(--ease-pop);
}
.qr-history-btn:hover { background: var(--c-coral-soft); transform: translateY(-1px); }
.qr-history-btn:active { transform: translateY(0) scale(0.98); }

/* ============================================================
   Body lock for modals
   ============================================================ */
body.no-scroll { overflow: hidden; }

/* ============================================================
   User preferences (reduce-motion / high-contrast)
   ============================================================ */
html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  animation-duration: 0.001s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.05s !important;
}
html.high-contrast {
  --c-ink-soft: #4a4358;
  --c-ink-faint: #6c6280;
}
html.high-contrast body {
  text-shadow: none;
}
html.high-contrast .topbar-name,
html.high-contrast .rank-name,
html.high-contrast .quick-label,
html.high-contrast .stat-value {
  color: #1a1424;
}


/* ============================================================
   Apply avatar frame/pattern to all avatar surfaces
   ============================================================ */
.settings-preview-avatar,
.profile-shortcut-avatar {
  border: 2.5px solid #fff;
  box-shadow: var(--sh-sm);
}
.settings-preview-avatar[data-frame="coral"],
.profile-shortcut-avatar[data-frame="coral"]   { box-shadow: 0 0 0 3px var(--c-coral),  0 6px 14px rgba(244, 122, 90, 0.28); }
.settings-preview-avatar[data-frame="ocean"],
.profile-shortcut-avatar[data-frame="ocean"]   { box-shadow: 0 0 0 3px var(--c-ocean),  0 6px 14px rgba(90, 167, 209, 0.28); }
.settings-preview-avatar[data-frame="gold"],
.profile-shortcut-avatar[data-frame="gold"]    { box-shadow: 0 0 0 3px var(--c-gold),   0 6px 14px rgba(246, 185, 59, 0.28); }
.settings-preview-avatar[data-frame="cherry"],
.profile-shortcut-avatar[data-frame="cherry"]  { box-shadow: 0 0 0 3px var(--c-cherry), 0 6px 14px rgba(255, 135, 169, 0.28); }
.settings-preview-avatar[data-frame="mint"],
.profile-shortcut-avatar[data-frame="mint"]    { box-shadow: 0 0 0 3px var(--c-mint),   0 6px 14px rgba(111, 209, 164, 0.28); }
.settings-preview-avatar[data-frame="plum"],
.profile-shortcut-avatar[data-frame="plum"]    { box-shadow: 0 0 0 3px var(--c-plum),   0 6px 14px rgba(84, 70, 104, 0.28); }

.settings-preview-avatar[data-pattern="wave"],
.profile-shortcut-avatar[data-pattern="wave"] {
  background: radial-gradient(circle at 20% 80%, rgba(90,167,209,0.25), transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(255,255,255,0.45), transparent 60%),
              #fff;
}
.settings-preview-avatar[data-pattern="dots"],
.profile-shortcut-avatar[data-pattern="dots"] {
  background-image: radial-gradient(rgba(43, 36, 53, 0.12) 1px, transparent 1.4px);
  background-size: 8px 8px;
  background-color: #fff;
}
.settings-preview-avatar[data-pattern="shine"],
.profile-shortcut-avatar[data-pattern="shine"] {
  background: conic-gradient(from 0deg, #fff7e0, #ffe9c2 25%, #fff 60%, #ffe1ea 90%, #fff7e0);
}
.settings-preview-avatar[data-pattern="plain"],
.profile-shortcut-avatar[data-pattern="plain"] { background: #fff; }

/* Make sure profile shortcut + preview images sit nicely */
.settings-preview-avatar img,
.profile-shortcut-avatar img {
  object-fit: cover;
  object-position: 50% 32%;
  transform: scale(1.15) translateY(4%);
}

/* ============================================================
   Responsive — tablet & desktop layouts
   ============================================================ */

/* ----- Tablet (≥ 768px) ----- */
@media (min-width: 768px) {
  :root { --max-w: 720px; }

  .topbar { padding: 12px 18px; }
  .main { padding: 18px 20px 36px; }

  /* Quick tiles 4 across */
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-tile-inner { padding: 18px 14px 14px; }

  /* Place strip becomes a 2x2 grid */
  .place-strip {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-columns: unset;
    overflow: visible;
    margin: 0 0 18px;
    padding: 0 0 4px;
    scroll-snap-type: none;
    gap: 12px;
  }
  .place-card { aspect-ratio: 16 / 9; }

  /* Achievements 4 across */
  .achieve-grid { grid-template-columns: repeat(4, 1fr); }

  /* Shop 3 across */
  .shop-grid { grid-template-columns: repeat(3, 1fr); }

  /* Frame picker 6 across */
  .frame-picker { grid-template-columns: repeat(6, 1fr); }

  /* Hero scene proportions */
  .hero-scene { aspect-ratio: 16 / 9; }

  /* Bottom nav slightly narrower than max-w to feel like a pill */
  .bottom-nav { width: min(640px, calc(100% - 32px)); }
}

/* ----- Desktop (≥ 1100px) ----- */
@media (min-width: 1100px) {
  :root {
    --max-w: 1080px;
    --nav-h: 72px;
  }

  body { font-size: 15.5px; }

  .app {
    padding-bottom: calc(var(--nav-h) + 40px);
  }

  /* Topbar */
  .topbar { padding: 16px 28px; gap: 24px; }
  .topbar-name { font-size: 1.05rem; }
  .topbar-rank { font-size: 1.05rem; }
  .points-chip { padding: 10px 16px; font-size: 1.05rem; }

  /* Main padding */
  .main { padding: 28px 28px 56px; }

  /* Page heads bigger */
  .page-head h2 { font-size: 1.7rem; }
  .page-head .page-desc { font-size: 1rem; }

  /* Bottom nav: keep as a centered pill, never wider than 720 */
  .bottom-nav { width: min(720px, calc(100% - 48px)); }
  .bottom-nav-inner { padding: 8px 16px; }

  /* Hero scene wide & limited height */
  .hero-scene {
    aspect-ratio: 21 / 9;
    max-height: 380px;
  }
  .hero-bubble { max-width: 360px; font-size: 1rem; }
  .hero-stamp { width: 110px; height: 110px; right: 18px; top: 18px; }

  /* Status / level card spacing */
  .status-card { padding: 22px 24px; }

  /* Place strip — 4 cards in a row */
  .place-strip {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }
  .place-card { aspect-ratio: 4 / 3; }

  /* Quick tiles padding more relaxed */
  .quick-tile-inner { padding: 22px 18px 18px; }
  .quick-icon { font-size: 2.4rem; }
  .quick-label { font-size: 1.1rem; }

  /* Achievements 4 across with more breathing room */
  .achieve-grid { gap: 14px; }

  /* Shop 3 across stays */
  .shop-grid { gap: 16px; }

  /* Settings page two-column flow */
  .page-settings {
    column-count: 2;
    column-gap: 28px;
  }
  .page-settings .page-head,
  .page-settings .settings-preview {
    column-span: all;
    -webkit-column-span: all;
  }
  .page-settings .settings-section {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 22px;
  }
  /* Section card body keep readable max width */
  .settings-card { padding: 18px 18px; }

  /* Frame picker tighter on desktop (6 cols already) */
  .frame-picker { gap: 10px; }
  .pattern-picker { gap: 10px; }

  /* Modal sizing */
  .modal-card { max-width: 540px; }
  .detail-card { max-width: 620px; }
  #historyModal .modal-card { max-width: 600px; }

  /* License page: rank list 2 columns */
  .rank-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .rank-list .rank-item { margin: 0; }

  /* License card centered, capped width */
  .license-card-flipper {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }

  /* QR scanner area: show camera + manual side-by-side */
  .qr-stage { max-width: 480px; margin-left: auto; margin-right: auto; }
  .qr-manual { max-width: 480px; margin-left: auto; margin-right: auto; }
  .qr-hint { max-width: 720px; margin-left: auto; margin-right: auto; }

  /* Quiz list cards: 2 cols */
  .quiz-list { grid-template-columns: repeat(2, 1fr); display: grid; gap: 14px; }

  /* Notice / shortcut centered */
  .notice-banner { max-width: 720px; margin-left: auto; margin-right: auto; }
  .home-settings-cta { max-width: 720px; margin-left: auto; margin-right: auto; }

  /* App credit centered */
  .app-credit { max-width: 720px; margin-left: auto; margin-right: auto; }
}

/* ----- Wide desktop (≥ 1440px) — keep content focused ----- */
@media (min-width: 1440px) {
  :root { --max-w: 1140px; }
}

/* ============================================================
   Desktop dashboard layout (≥ 1100px)
   Sidebar nav + grid content area
   ============================================================ */
.ds-sidebar {
  display: none;
}

@media (min-width: 1100px) {
  /* Hide mobile chrome — sidebar takes over */
  .topbar { display: none !important; }
  .bottom-nav { display: none !important; }

  /* Layout: shift content right */
  body { padding-left: 0; }
  .app {
    padding-left: 280px;
    max-width: 100%;
  }

  /* Sidebar */
  .ds-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 280px;
    padding: 22px 18px 20px;
    background:
      linear-gradient(180deg, rgba(255, 244, 230, 0.96) 0%, rgba(255, 250, 240, 0.96) 100%);
    border-right: 1.5px solid rgba(244, 122, 90, 0.16);
    box-shadow: 4px 0 20px rgba(43, 36, 53, 0.04);
    z-index: 50;
    overflow-y: auto;
  }
  .ds-sidebar::before {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    background: radial-gradient(circle at 100% 0%, rgba(244, 122, 90, 0.12), transparent 70%);
    pointer-events: none;
  }
  .ds-sidebar::after {
    content: "";
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 120px;
    background: radial-gradient(circle at 0% 100%, rgba(90, 167, 209, 0.1), transparent 60%);
    pointer-events: none;
  }

  /* Brand */
  .ds-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 6px 18px;
    border-bottom: 1px dashed rgba(244, 122, 90, 0.22);
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
  }
  .ds-brand-mark {
    position: relative;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffe5d2, #fff5e8);
    display: grid; place-items: center;
    box-shadow: 0 4px 10px rgba(244, 122, 90, 0.18);
    flex-shrink: 0;
  }
  .ds-brand-img {
    width: 36px; height: 36px;
    object-fit: contain;
  }
  .ds-brand-glow {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 207, 87, 0.25), transparent 70%);
    z-index: -1;
  }
  .ds-brand-text { line-height: 1.05; }
  .ds-brand-jp {
    font-weight: 900;
    font-size: 1.05rem;
    color: var(--c-ink);
    letter-spacing: 0.02em;
  }
  .ds-brand-en {
    font-size: 0.6rem;
    color: var(--c-coral-deep);
    font-weight: 800;
    letter-spacing: 0.18em;
    margin-top: 3px;
  }

  /* Profile card */
  .ds-profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #fff, #fffaf0);
    border: 1.5px solid #fff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(43, 36, 53, 0.06);
    text-align: left;
    cursor: pointer;
    width: 100%;
    transition: transform 0.18s var(--ease-pop), box-shadow 0.18s ease;
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
  }
  .ds-profile-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(43, 36, 53, 0.1);
  }
  .ds-profile-avatar {
    position: relative;
    width: 48px; height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .ds-profile-avatar .avatar-img {
    width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  }
  .ds-profile-pip {
    position: absolute;
    right: -2px; bottom: -2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff8b6c, #f47a5a);
    color: #fff;
    font-size: 0.62rem;
    display: grid; place-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
  }
  .ds-profile-meta { min-width: 0; flex-grow: 1; }
  .ds-profile-kicker {
    font-size: 0.65rem;
    color: var(--c-ink-faint);
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .ds-profile-name {
    font-size: 1rem;
    font-weight: 900;
    color: var(--c-ink);
    line-height: 1.2;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .ds-profile-rank {
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--c-coral-deep);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
  }

  /* Nav */
  .ds-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
    position: relative;
    z-index: 1;
  }
  .ds-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    border: none;
    background: transparent;
    font: inherit;
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--c-ink-soft);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s var(--ease-pop);
    position: relative;
    text-align: left;
  }
  .ds-nav-link:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--c-ink);
  }
  .ds-nav-link.active {
    background: linear-gradient(135deg, #fff, #fff5e6);
    color: var(--c-coral-deep);
    box-shadow:
      0 4px 14px rgba(244, 122, 90, 0.15),
      inset 0 0 0 1.5px #fff;
  }
  .ds-nav-link.active::before {
    content: "";
    position: absolute;
    left: 4px; top: 25%; bottom: 25%;
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--c-coral), var(--c-gold));
  }
  .ds-nav-icon {
    width: 28px; height: 28px;
    display: grid; place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    flex-shrink: 0;
  }
  .ds-nav-link.active .ds-nav-icon {
    background: linear-gradient(135deg, #ffe5d2, #ffd0aa);
  }
  .ds-nav-label { flex-grow: 1; }

  /* Points card */
  .ds-points-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #ffe9b5, #ffcd7a);
    border: 2.5px solid #fff;
    border-radius: 14px;
    box-shadow: 0 6px 14px rgba(246, 185, 59, 0.32);
    text-align: left;
    cursor: pointer;
    width: 100%;
    margin-top: 16px;
    margin-bottom: 12px;
    transition: transform 0.18s var(--ease-pop), box-shadow 0.18s ease;
    font: inherit;
    position: relative;
    z-index: 1;
  }
  .ds-points-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(246, 185, 59, 0.4);
  }
  .ds-points-icon {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    flex-shrink: 0;
  }
  .ds-points-meta { flex-grow: 1; min-width: 0; }
  .ds-points-kicker {
    font-size: 0.62rem;
    color: rgba(43, 36, 53, 0.6);
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .ds-points-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: rgba(43, 36, 53, 0.65);
    margin-top: 2px;
  }
  .ds-points-value strong {
    font-size: 1.45rem;
    font-weight: 900;
    color: var(--c-coral-deep);
    margin-right: 2px;
  }
  .ds-points-arrow {
    color: var(--c-coral-deep);
    font-weight: 900;
    font-size: 1.2rem;
  }

  /* Footer */
  .ds-foot {
    text-align: center;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    color: var(--c-ink-faint);
    padding: 8px 0 0;
    border-top: 1px dashed rgba(244, 122, 90, 0.2);
    position: relative;
    z-index: 1;
  }

  /* Pages: less padding since we have sidebar */
  .pages { padding: 16px 28px 100px; }

  /* HOME — dashboard grid */
  .page-home {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "hero hero"
      "rank stats"
      "quick quick"
      "places-title places-title"
      "places places"
      "news cta";
    gap: 18px;
    align-items: start;
  }
  .page-home > .hero-scene { grid-area: hero; margin-bottom: 0; height: 360px; }
  .page-home > .rank-card { grid-area: rank; margin-bottom: 0; }
  .page-home > .stats-strip { grid-area: stats; margin-bottom: 0; }
  .page-home > .quick-grid { grid-area: quick; margin-bottom: 0; grid-template-columns: repeat(4, 1fr); }
  .page-home > .section-title:has(span:nth-child(1):first-child)[data-island-section],
  .page-home > h3.section-title { grid-column: 1 / -1; margin: 6px 0 0; }
  .page-home > .place-strip { grid-column: 1 / -1; margin-bottom: 0; }
  .page-home > .notice-banner { grid-area: news; max-width: none; margin: 0; }
  .page-home > .home-settings-cta { grid-area: cta; max-width: none; margin: 0; }
  .page-home > .app-credit { grid-column: 1 / -1; max-width: none; margin: 0; padding-top: 12px; }

  /* Hero is wider — keep ratios reasonable */
  .hero-scene {
    height: 360px;
  }

  /* Stats strip 2x2 inside its grid cell */
  .stats-strip {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .stats-strip .stat:nth-child(-n+2) { border-bottom: 1px solid rgba(43, 36, 53, 0.05); }
  .stats-strip .stat + .stat::before { display: none; }
  .stats-strip .stat:nth-child(2n) { border-left: 1px solid rgba(43, 36, 53, 0.05); }

  /* Generic page heads centered max-width */
  .page-head { max-width: 920px; margin-left: auto; margin-right: auto; }

  /* Override the existing >=1100px max-width since sidebar shifts */
  :root { --max-w: 100%; }
  .pages { max-width: 1200px; margin: 0 auto; }
}

@media (min-width: 1440px) {
  .app { padding-left: 300px; }
  .ds-sidebar { width: 300px; padding: 26px 22px 22px; }
}

/* ============================================================
   Icon set — uniform line icons (used to replace emoji UI)
   ============================================================ */
.icon-sprite { position: absolute; width: 0; height: 0; pointer-events: none; }
.icon {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
  flex-shrink: 0;
}
.icon-lg { width: 1.6em; height: 1.6em; stroke-width: 1.6; }
.icon-xl { width: 2.2em; height: 2.2em; stroke-width: 1.5; }
.icon-sm { width: 0.95em; height: 0.95em; stroke-width: 1.8; }
