/* ===========================================================================
   NMS Pins Prototype — styles
   Two easy knobs to tweak the whole look:
     --brand : the NMS amber/gold accent
     --font  : swap in "Area" here once the brand font is installed
   =========================================================================== */
:root {
  --brand: #ffb600;
  --brand-deep: #f59000;
  /* --accent is set per-tree at runtime (defaults to the brand amber). */
  --accent: #ffb600;
  --font: 'Area', 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --ink: #1f2440;
  --ink-soft: #5b6285;
  --sky-top: #fff7e6;
  --sky-bottom: #ffe9c2;
  --locked: #b9bccc;
  --card: #ffffff;
}

* { box-sizing: border-box; }

html, body, #root {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(160deg, var(--sky-top), var(--sky-bottom));
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  background: #fff;
  box-shadow: 0 2px 14px rgba(31, 36, 64, 0.08);
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-star {
  font-size: 34px;
  color: var(--brand);
  filter: drop-shadow(0 2px 0 var(--brand-deep));
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 900; letter-spacing: -0.2px; }
.brand-sub { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); font-weight: 700; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.tally {
  font-size: 14px;
  color: var(--ink-soft);
  background: #fff6e0;
  border: 2px solid #ffe2a3;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
}
.tally strong { color: var(--brand-deep); }
.reset-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink-soft);
  background: #f1f2f7;
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.reset-btn:hover { background: #e6e7ef; color: var(--ink); }

.intro-strip {
  padding: 9px 22px;
  font-size: 13.5px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid rgba(31, 36, 64, 0.06);
  z-index: 4;
}
.intro-strip strong { color: var(--ink); }

/* ---------- Viewport / pannable world ---------- */
.viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.viewport.grabbing { cursor: grabbing; }
.world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}
.edges {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
}

/* ---------- Edges ---------- */
.edge {
  fill: none;
  stroke: #d7d2c4;
  stroke-width: 5;
  stroke-linecap: round;
}
.edge-dashed { stroke-dasharray: 4 12; stroke-width: 4; }
.edge-lit {
  stroke: var(--accent);
  stroke-width: 6;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 60%, transparent));
}

/* ---------- Pin nodes ---------- */
.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 132px;
  padding: 0;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  user-select: none;
}
.pin-disc {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 30px;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.pin:hover .pin-disc { transform: scale(1.09); }
.pin-label {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  max-width: 130px;
}
.pin-bonus-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--brand-deep);
  background: #fff3d4;
  padding: 1px 7px;
  border-radius: 999px;
}

/* Locked: dimmed, look-but-don't-touch */
.pin-locked { opacity: 0.85; }
.pin-locked .pin-disc {
  background: #eceef4;
  border: 3px solid var(--locked);
  color: #9aa0b8;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.05);
}
.pin-locked .pin-label { color: #9298b3; }

/* Available: bright and inviting */
.pin-available .pin-disc {
  background: #fff;
  border: 4px solid var(--accent);
  color: color-mix(in srgb, var(--accent) 78%, black);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent);
  animation: pulse 2.2s ease-in-out infinite;
}
.pin-available .pin-label { color: var(--ink); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
  50% { box-shadow: 0 6px 26px color-mix(in srgb, var(--accent) 70%, transparent); }
}

/* Earned: lit up and celebratory */
.pin-earned .pin-disc {
  background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 65%, black));
  border: 4px solid #fff;
  color: #fff;
  box-shadow: 0 0 0 4px var(--accent), 0 8px 22px color-mix(in srgb, var(--accent) 55%, transparent);
}
.pin-earned .pin-label { color: color-mix(in srgb, var(--accent) 72%, black); }

/* Bonus / side-quest pins read as side content */
.pin-bonus .pin-disc { border-style: dashed; }

/* ---------- Branch header cards ---------- */
.header-card {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 16px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.header-card:hover { transform: translate(-50%, -50%) scale(1.04); }
.header-name { font-size: 15px; font-weight: 900; line-height: 1.1; }
.header-tagline { font-size: 11.5px; line-height: 1.25; opacity: 0.9; }
.header-status {
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.header-open {
  background: linear-gradient(150deg, #fff, color-mix(in srgb, var(--accent) 14%, #fff));
  border: 3px solid var(--accent);
  color: var(--ink);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent);
}
.header-open .header-status { color: color-mix(in srgb, var(--accent) 72%, black); }
.header-locked {
  background: #f4f5f9;
  border: 3px dashed var(--locked);
  color: #6c7290;
}
.header-soon {
  background: #eef0fb;
  border: 3px dashed #b9bff0;
  color: #5560a8;
}
.header-soon .header-status { color: #6f79c9; }

/* ---------- Zoom controls + hint ---------- */
.zoom-controls {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3;
}
.zoom-controls button {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: #fff;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(31, 36, 64, 0.18);
}
.zoom-controls button:hover { background: #fff6e0; }
.zoom-controls .fit-btn { font-size: 13px; height: 38px; }
.hint {
  position: absolute;
  left: 18px;
  bottom: 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
  padding: 6px 12px;
  border-radius: 999px;
  z-index: 3;
  pointer-events: none;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 36, 64, 0.5);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  z-index: 1000;
  animation: fade 0.15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative;
  width: min(520px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 22px;
  padding: 26px 26px 22px;
  box-shadow: 0 24px 60px rgba(31, 36, 64, 0.4);
  animation: pop 0.18s ease;
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-earned { box-shadow: 0 0 0 4px var(--accent), 0 24px 60px color-mix(in srgb, var(--accent) 45%, transparent); }
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #f1f2f7;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}
.modal-close:hover { background: #e6e7ef; }

.modal-head { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; padding-right: 30px; }
.modal-pin {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 30px;
}
.modal-pin-available { background: color-mix(in srgb, var(--accent) 14%, #fff); border: 4px solid var(--accent); color: color-mix(in srgb, var(--accent) 75%, black); }
.modal-pin-earned { background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 65%, black)); color: #fff; border: 4px solid #fff; box-shadow: 0 0 0 3px var(--accent); }
.modal-pin-locked { background: #eceef4; border: 4px solid var(--locked); color: #9aa0b8; }
.modal-pin-branch { background: #eef0fb; border: 4px solid #b9bff0; color: #5560a8; }
.modal-titles h2 { margin: 4px 0 2px; font-size: 22px; font-weight: 900; }
.modal-tagline { margin: 0; color: var(--brand-deep); font-weight: 800; font-size: 14px; }
.badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--brand-deep);
  background: #fff3d4;
  padding: 2px 9px;
  border-radius: 999px;
}
.modal-desc { color: var(--ink-soft); font-size: 14.5px; line-height: 1.5; margin: 0 0 16px; }

.progress-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.progress-bar { flex: 1; height: 12px; background: #eceef4; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 65%, black)); border-radius: 999px; transition: width 0.3s ease; }
.progress-count { font-size: 13px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.check {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  background: #f8f9fc;
  border: 2px solid #eceef4;
  border-radius: 14px;
  padding: 11px 13px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.check:hover:not(:disabled) { background: #fff6e0; border-color: #ffe2a3; }
.check:disabled { cursor: not-allowed; opacity: 0.7; }
.check-box {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid var(--locked);
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
}
.check:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 12%, #fff); border-color: color-mix(in srgb, var(--accent) 45%, #fff); }
.check.checked { background: color-mix(in srgb, var(--accent) 14%, #fff); border-color: var(--accent); }
.check.checked .check-box { background: var(--accent); border-color: color-mix(in srgb, var(--accent) 70%, black); }

.locked-note {
  background: #f4f5f9;
  border: 2px dashed var(--locked);
  border-radius: 14px;
  padding: 13px 15px;
  font-size: 14px;
  font-weight: 600;
  color: #6c7290;
  line-height: 1.45;
}
.locked-note strong { color: var(--ink); }

/* ---------- Topbar center (tree view) ---------- */
.topbar-center { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: center; }
.back-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink-soft);
  background: #f1f2f7;
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.back-btn:hover { background: #e6e7ef; color: var(--ink); }
.tree-name-chip {
  font-weight: 900;
  font-size: 15px;
  color: color-mix(in srgb, var(--accent) 72%, black);
  background: color-mix(in srgb, var(--accent) 14%, #fff);
  border: 2px solid var(--accent);
  padding: 5px 14px;
  border-radius: 999px;
}
#main { flex: 1; display: flex; min-height: 0; }
#main > .viewport, #main > .hub { flex: 1; }

/* ---------- Hub ("Choose your adventure") ---------- */
.hub {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 60px;
}
.hub-head { text-align: center; margin-bottom: 34px; }
.hub-head h2 { font-size: 34px; font-weight: 900; margin: 0 0 8px; }
.hub-head p { font-size: 16px; color: var(--ink-soft); margin: 0; font-weight: 600; }
/* ---------- Trophy case ---------- */
.trophy-case {
  width: 100%;
  max-width: 1120px;
  background: #fff;
  border: 2px solid #ffe2a3;
  border-radius: 20px;
  padding: 20px 24px;
  margin-bottom: 30px;
  box-shadow: 0 8px 24px rgba(31, 36, 64, 0.07);
}
.trophy-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.trophy-title { font-size: 20px; font-weight: 900; color: var(--ink); }
.trophy-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  background: #fff6e0;
  border: 2px solid #ffe2a3;
  padding: 4px 12px;
  border-radius: 999px;
}
.trophy-count strong { color: var(--brand-deep); font-size: 16px; }
.trophy-empty {
  margin-top: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  background: #fbfbfe;
  border: 2px dashed #e1e3ee;
  border-radius: 14px;
  padding: 18px;
  text-align: center;
}
.trophy-body { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.trophy-group { --accent: var(--brand); }
.trophy-group-name {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: color-mix(in srgb, var(--accent) 72%, black);
  margin-bottom: 7px;
}
.trophy-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.trophy-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: color-mix(in srgb, var(--accent) 74%, black);
  background: color-mix(in srgb, var(--accent) 13%, #fff);
  border: 2px solid color-mix(in srgb, var(--accent) 55%, #fff);
  border-radius: 999px;
  padding: 5px 12px 5px 9px;
}
.trophy-chip-star { color: var(--accent); font-size: 14px; }
.trophy-chip-x {
  font-size: 11px;
  background: color-mix(in srgb, var(--accent) 72%, black);
  color: #fff;
  border-radius: 999px;
  padding: 0 6px;
}
.trophy-next {
  margin-top: 16px;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  color: var(--brand-deep);
  background: #fff6e0;
  border: 2px solid var(--brand);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
}
.trophy-next:hover { background: #ffefc6; }

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 340px));
  gap: 24px;
  justify-content: center;
  width: 100%;
  max-width: 1120px;
}
.tree-card {
  --accent: var(--brand);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 8px;
  padding: 26px 24px 22px;
  border-radius: 22px;
  background: #fff;
  border: 3px solid color-mix(in srgb, var(--accent) 40%, #fff);
  box-shadow: 0 10px 30px rgba(31, 36, 64, 0.1);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.tree-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--accent) 30%, transparent);
}
.tree-card-glow {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.18;
}
.tree-card-name { font-size: 24px; font-weight: 900; color: var(--ink); }
.tree-card-tagline { font-size: 14px; font-weight: 800; color: color-mix(in srgb, var(--accent) 72%, black); }
.tree-card-desc { font-size: 14px; color: var(--ink-soft); line-height: 1.5; flex: 1; }
.tree-card-foot { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.tree-card-progress { display: flex; align-items: center; gap: 9px; flex: 1; }
.tree-card-bar { flex: 1; height: 9px; background: #eceef4; border-radius: 999px; overflow: hidden; }
.tree-card-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.tree-card-count { font-size: 12px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }
.tree-card-go {
  font-size: 13px;
  font-weight: 900;
  color: color-mix(in srgb, var(--accent) 72%, black);
  white-space: nowrap;
}
.tree-card-soon { cursor: default; opacity: 0.7; }
.tree-card-soon:hover { transform: none; }

/* ---------- Pin count (×N) + cross-tree link marker ---------- */
.pin-disc { position: relative; }
.pin-count {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: color-mix(in srgb, var(--accent) 72%, black);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 999px;
  border: 2px solid #fff;
}
.pin-link {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 14px;
  background: #fff;
  border-radius: 50%;
  line-height: 1;
  padding: 1px;
  filter: grayscale(0.2);
}

/* ---------- "What's next?" popup ---------- */
.whats-next { width: min(540px, 92vw); }
.whats-next-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-right: 30px; }
.whats-next-icon {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
  background: #fff6e0;
  border: 3px solid var(--brand);
}
.whats-next-head h2 { margin: 0; font-size: 22px; font-weight: 900; }
.whats-next-head p { margin: 2px 0 0; font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.whats-next-list { display: flex; flex-direction: column; gap: 12px; }
.wn-row {
  --accent: var(--brand);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 9%, #fff);
  border: 2px solid color-mix(in srgb, var(--accent) 35%, #fff);
}
.wn-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wn-tree {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: color-mix(in srgb, var(--accent) 72%, black);
}
.wn-pin { font-size: 17px; font-weight: 900; color: var(--ink); }
.wn-done { font-size: 15px; font-weight: 800; color: color-mix(in srgb, var(--accent) 70%, black); }
.wn-sub { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.wn-go {
  flex: none;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
}
.wn-go:hover { background: color-mix(in srgb, var(--accent) 80%, black); }

/* ---------- Login ("Enter your code") ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--sky-top), var(--sky-bottom));
}
.login-card {
  width: min(440px, 94vw);
  background: #fff;
  border-radius: 24px;
  padding: 36px 32px 28px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(31, 36, 64, 0.18);
}
.login-star {
  font-size: 46px;
  color: var(--brand);
  filter: drop-shadow(0 3px 0 var(--brand-deep));
  line-height: 1;
}
.login-card h1 { margin: 10px 0 4px; font-size: 24px; font-weight: 900; }
.login-sub { margin: 0 0 22px; color: var(--ink-soft); font-weight: 600; font-size: 15px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-input {
  font-family: inherit;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  text-align: center;
  text-transform: uppercase;
  color: var(--ink);
  padding: 14px 16px;
  border: 3px solid #eceef4;
  border-radius: 14px;
  outline: none;
}
.login-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px #fff1cf; }
.login-input::placeholder { color: #c2c6d6; letter-spacing: 1px; }
.login-go {
  font-family: inherit;
  font-size: 17px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(150deg, var(--brand), var(--brand-deep));
  border: none;
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
}
.login-go:hover { filter: brightness(1.04); }
.login-go:disabled { opacity: 0.6; cursor: default; }
.login-error {
  margin: 14px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: #c0364c;
  background: #fdeef0;
  border: 2px solid #f6c6cf;
  border-radius: 12px;
  padding: 11px 13px;
  line-height: 1.4;
}
.login-lost { margin: 18px 0 0; font-size: 13px; color: var(--ink-soft); font-weight: 600; }

/* ---------- Topbar: greeting / mode pill / switch ---------- */
.mode-pill {
  font-size: 12px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.mode-synced { color: #1f8a5b; background: #e6f7ee; border: 2px solid #b6e6cd; }
.mode-local { color: #6c7290; background: #f1f2f7; border: 2px solid #e1e3ee; }
.switch-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink-soft);
  background: #f1f2f7;
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.switch-btn:hover { background: #e6e7ef; color: var(--ink); }

/* ---------- Pending (skip-ahead) pin state ---------- */
.pin-pending .pin-disc {
  background: #fff8e8;
  border: 4px dashed var(--brand);
  color: var(--brand-deep);
  box-shadow: 0 4px 14px rgba(255, 182, 0, 0.3);
}
.pin-pending .pin-label { color: var(--brand-deep); }
.pin-pending-tag {
  display: none;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--brand-deep);
  background: #fff3d4;
  padding: 1px 7px;
  border-radius: 999px;
}
.pin-pending .pin-pending-tag { display: inline-block; }

.modal-pin-pending { background: #fff8e8; border: 4px dashed var(--brand); color: var(--brand-deep); }
.badge-pending { background: #fff3d4; color: var(--brand-deep); }
.pending-note {
  background: #fff8e8;
  border: 2px dashed var(--brand);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  color: #8a5a00;
  line-height: 1.45;
  margin-bottom: 12px;
}
.pending-bar { opacity: 0.65; }

/* ---------- Skip-ahead request form ---------- */
.skip-wrap { margin-top: 16px; }
.skip-open {
  width: 100%;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  color: var(--brand-deep);
  background: #fff6e0;
  border: 2px solid var(--brand);
  border-radius: 14px;
  padding: 11px;
  cursor: pointer;
}
.skip-open:hover { background: #ffefc6; }
.skip-form { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.skip-label { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.skip-text {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  border: 2px solid #eceef4;
  border-radius: 12px;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
}
.skip-text:focus { border-color: var(--brand); }
.skip-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.skip-count { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.skip-count-ok { color: #1f8a5b; }
.skip-submit {
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  background: var(--brand-deep);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
}
.skip-submit:disabled { opacity: 0.5; cursor: default; }

.refresh-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink-soft);
  background: #f1f2f7;
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.refresh-btn:hover { background: #e6e7ef; color: var(--ink); }

/* ---------- Sync note (toast) ---------- */
.sync-note {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 2000;
  max-width: min(560px, 92vw);
  font-size: 13.5px;
  font-weight: 700;
  color: #8a5a00;
  background: #fff6e0;
  border: 2px solid #ffd98a;
  border-radius: 12px;
  padding: 11px 16px;
  box-shadow: 0 8px 24px rgba(31, 36, 64, 0.18);
}

.load-error {
  max-width: 520px;
  margin: 12vh auto;
  padding: 28px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(31, 36, 64, 0.18);
  text-align: center;
  color: var(--ink-soft);
}
.load-error h2 { color: var(--ink); margin-top: 0; }

.earned-banner {
  margin-top: 16px;
  text-align: center;
  font-size: 16px;
  font-weight: 900;
  color: color-mix(in srgb, var(--accent) 72%, black);
  background: color-mix(in srgb, var(--accent) 14%, #fff);
  border: 2px solid var(--accent);
  border-radius: 14px;
  padding: 12px;
}

.earn-again {
  margin-top: 12px;
  width: 100%;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  color: color-mix(in srgb, var(--accent) 75%, black);
  background: #fff;
  border: 2px dashed var(--accent);
  border-radius: 14px;
  padding: 11px;
  cursor: pointer;
}
.earn-again:hover { background: color-mix(in srgb, var(--accent) 12%, #fff); }

.badge-repeat { background: #eef0fb; color: #5560a8; }
.badge-count { background: color-mix(in srgb, var(--accent) 18%, #fff); color: color-mix(in srgb, var(--accent) 72%, black); }

/* ===========================================================================
   V2 icon pins — SVG art + progress ring + dim-until-earned color flip.
   (These rules come last so they override the V1 emoji-disc styles above.)
   =========================================================================== */
.pin-disc {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: visible;
  border: 3px solid #e7e9f2;
  box-shadow: 0 4px 10px rgba(31, 36, 64, 0.08);
}
.pin-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 86px;
  height: 86px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.ring-bg { fill: none; stroke: #e7e9f2; stroke-width: 7; }
.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.35s ease;
}
.pin-art {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.92;
  transition: filter 0.25s ease, opacity 0.25s ease;
}
.pin-fallback { display: none; position: relative; z-index: 1; font-size: 30px; color: #b9bccc; }
.pin-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  z-index: 2;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
  border: 2px solid #fff;
}
/* reposition the (V1) ×N and cross-tree markers so they don't collide with the badge */
.pin-count { top: -4px; right: -4px; bottom: auto; }
.pin-link { top: -6px; left: -6px; right: auto; }

/* States */
.pin-locked .pin-disc { border-color: var(--locked); box-shadow: none; }
.pin-locked .pin-art { filter: grayscale(1); opacity: 0.4; }
.pin-locked .pin-ring { display: none; }
.pin-locked .pin-badge { background: #eceef4; font-size: 11px; }

.pin-available .pin-disc { animation: none; border-color: #e7e9f2; box-shadow: 0 4px 10px rgba(31, 36, 64, 0.08); }
.pin-available .pin-art,
.pin-pending .pin-art { filter: grayscale(1); opacity: 0.92; }

.pin-pending .pin-disc { border: 3px dashed var(--brand); }

.pin-earned .pin-disc {
  background: #fff;
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px var(--accent), 0 8px 20px color-mix(in srgb, var(--accent) 45%, transparent);
}
.pin-earned .pin-art { filter: none; opacity: 1; }
.pin-earned .pin-badge { background: var(--accent); color: #fff; }

/* Modal pin icon */
.modal-pin { position: relative; overflow: visible; background: #fff; }
.modal-pin-available,
.modal-pin-locked,
.modal-pin-pending,
.modal-pin-earned { background: #fff; }
.modal-pin-earned { border: 4px solid var(--accent); box-shadow: none; }
.modal-art { width: 40px; height: 40px; object-fit: contain; filter: grayscale(1); opacity: 0.9; }
.modal-pin-earned .modal-art { filter: none; opacity: 1; }
.modal-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  border: 2px solid #fff;
  background: #fff;
}
.modal-badge:empty { display: none; }
.modal-pin-earned .modal-badge { background: var(--accent); color: #fff; }

/* ===========================================================================
   v2_2: each icon SVG IS the whole pin badge (disc + ring + symbol baked in).
   So the app draws NO frame/disc/border of its own — it just holds the inlined
   SVG and layers state treatments (greyscale, progress ring, lock/check) on top.
   These rules come last, overriding the framed-disc styles above.
   =========================================================================== */
.pin-disc {
  position: relative;
  width: 74px;
  height: 74px;
  background: none;
  border: none;
  box-shadow: none;
  overflow: visible;
  display: grid;
  place-items: center;
}
.pin-art {
  position: relative;
  z-index: 1;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  filter: grayscale(1);
  opacity: 0.92;
  transition: filter 0.25s ease, opacity 0.25s ease;
}
.pin-art svg { width: 100%; height: 100%; display: block; }
.pin-art .pin-fallback { display: block; font-size: 42px; color: var(--accent); }
/* Progress ring sits just OUTSIDE the badge so it reads as a separate fill cue. */
.pin-ring { width: 88px; height: 88px; z-index: 2; }

/* State treatments (no frames) */
.pin-locked .pin-disc { border: none; box-shadow: none; }
.pin-locked .pin-art { filter: grayscale(1); opacity: 0.45; }
.pin-locked .pin-ring { display: none; }

.pin-available .pin-disc { border: none; box-shadow: none; animation: none; }
.pin-available .pin-art,
.pin-pending .pin-art { filter: grayscale(1); opacity: 0.95; }

/* Pending = dashed amber ring around the badge (a treatment, not a frame). */
.pin-pending .pin-disc { border: 3px dashed var(--brand); border-radius: 50%; }

.pin-earned .pin-disc { background: none; border: none; box-shadow: none; }
.pin-earned .pin-art { filter: drop-shadow(0 3px 8px color-mix(in srgb, var(--accent) 50%, transparent)); opacity: 1; }

/* Modal icon: inlined badge, no frame */
.modal-pin,
.modal-pin-available,
.modal-pin-locked,
.modal-pin-pending,
.modal-pin-earned { background: none; border: none; box-shadow: none; }
.modal-art {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  filter: grayscale(1);
  opacity: 0.95;
}
.modal-art svg { width: 100%; height: 100%; display: block; }
.modal-pin-earned .modal-art { filter: none; opacity: 1; }

/* ===========================================================================
   v2_3: exactly ONE ring. The progress arc overlays the icon's OWN border
   (radius 46 in the icon's -64..64 viewBox), so the ring SVG must be the SAME
   size and center as the inlined icon (74px). No background ring; no ring at
   all when earned (the icon's own colored border shows). Last block wins.
   =========================================================================== */
.pin-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 74px;
  height: 74px;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}
.ring-bg { display: none; } /* no separate background ring */
.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.35s ease;
}
.ring-pending-ring {
  fill: none;
  stroke: var(--brand);
  stroke-width: 5;
  stroke-dasharray: 5 6;
  display: none;
}
.pin-pending .ring-pending-ring { display: block; }
.pin-pending .ring-fill { stroke: var(--brand); }
.pin-earned .pin-ring { display: none; } /* earned: the icon's own border is the ring */
.pin-locked .pin-ring { display: none; }

/* Sit the corner badge on the icon's own edge, not the outer hit-area corner. */
.pin-badge { right: 6px; bottom: 6px; }

/* ===========================================================================
   7/7: open-text notes (in the pin modal) + "Request a new pin" (hub form)
   =========================================================================== */
.opentext-wrap { margin-top: 16px; border-top: 2px dashed #eceef4; padding-top: 14px; }
.opentext-label { font-size: 14px; font-weight: 800; color: var(--ink); margin-bottom: 8px; }
.opentext-rows { display: flex; flex-direction: column; gap: 8px; }
.ot-row { display: flex; gap: 8px; align-items: flex-start; }
.ot-input {
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #f8f9fc;
  border: 2px solid #eceef4;
  border-radius: 12px;
  padding: 9px 11px;
  resize: vertical;
}
.ot-input:focus { outline: none; border-color: var(--accent); background: #fff; }
.ot-remove {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: #f1f2f7;
  color: var(--ink-soft);
  font-size: 18px;
  cursor: pointer;
}
.ot-remove:hover { background: #ffe1e6; color: #c0364c; }
.ot-add {
  margin-top: 8px;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  color: color-mix(in srgb, var(--accent) 75%, black);
  background: #fff;
  border: 2px dashed var(--accent);
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
}
.ot-add:hover { background: color-mix(in srgb, var(--accent) 10%, #fff); }

/* Request-a-new-pin card on the hub */
.request-pin-card {
  width: 100%;
  max-width: 1120px;
  margin: 26px auto 0;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  font-family: inherit;
  background: #fff;
  border: 2px dashed #ffd98a;
  border-radius: 18px;
  padding: 18px 22px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.request-pin-card:hover { border-color: var(--brand); box-shadow: 0 8px 24px rgba(255, 182, 0, 0.2); }
.request-pin-icon { font-size: 30px; flex: none; }
.request-pin-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.request-pin-text strong { font-size: 16px; color: var(--ink); }
.request-pin-text span { font-size: 13.5px; color: var(--ink-soft); }
.request-pin-go { font-weight: 900; font-size: 14px; color: var(--brand-deep); white-space: nowrap; }

/* Request-a-new-pin form (modal) */
.request-modal { width: min(540px, 92vw); }
.request-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding-right: 30px; }
.request-head-icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  background: #fff6e0;
  border: 3px solid var(--brand);
}
.request-head h2 { margin: 0; font-size: 21px; font-weight: 900; }
.request-head p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-soft); font-weight: 600; }
.request-label { display: block; font-size: 14px; font-weight: 800; color: var(--ink); margin: 14px 0 7px; }
.request-desc,
.request-step {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #f8f9fc;
  border: 2px solid #eceef4;
  border-radius: 12px;
  padding: 10px 12px;
}
.request-desc { resize: vertical; }
.request-desc:focus,
.request-step:focus { outline: none; border-color: var(--brand); background: #fff; }
.request-steps { display: flex; flex-direction: column; gap: 8px; }
.request-add-step {
  margin-top: 10px;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  color: var(--brand-deep);
  background: #fff;
  border: 2px dashed var(--brand);
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
}
.request-add-step:disabled { opacity: 0.5; cursor: default; }
.request-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 18px; }
.request-status { font-size: 13px; font-weight: 700; color: #c0364c; }
.request-submit {
  font-family: inherit;
  font-weight: 900;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(150deg, var(--brand), var(--brand-deep));
  border: none;
  border-radius: 12px;
  padding: 11px 22px;
  cursor: pointer;
}
.request-submit:disabled { opacity: 0.5; cursor: default; }
.request-thanks { text-align: center; padding: 24px 10px 10px; }
.request-thanks h2 { margin: 10px 0 4px; font-size: 24px; font-weight: 900; }
.request-thanks p { margin: 0; color: var(--ink-soft); font-weight: 600; }

/* The icon IS the pin in every state — clear the leftover v1 disc backgrounds
   (white for available, grey for locked) so no frame shows behind the badge. */
.pin-locked .pin-disc,
.pin-available .pin-disc,
.pin-pending .pin-disc,
.pin-earned .pin-disc { background: none; box-shadow: none; }
