/* =====================================================================
 * styles.css: Treasure Map (game palette, not Westpac brand colours)
 * ===================================================================== */
:root {
  --bg: #070d1f;
  --night: #0d1630;
  --panel: #16224b;
  --panel-2: #1c2a5e;
  --line: #2a3a72;
  --text: #f2f5ff;
  --muted: #9aa7d1;
  --gold: #ffc93c;
  --gold-2: #f59e0b;
  --mint: #34e3b0;
  --coral: #ff6b6b;
  --sky: #5cc8ff;
  --violet: #a78bfa;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 700px at 30% 10%, #172a63 0%, var(--bg) 60%) fixed;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }

/* ---------- stage + phone ---------- */
.stage {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 16px;
}
.phone {
  position: relative;
  width: 390px;
  height: min(844px, calc(100vh - 32px));
  background: var(--night);
  border: 8px solid #04060d;
  border-radius: 44px;
  overflow: hidden;
  overflow: clip; /* can never be scrolled by focus/scrollIntoView */
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px #2a3a72;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; font-size: 20px;
  background: linear-gradient(135deg, #2a3f86, #1a2758);
  box-shadow: inset 0 0 0 1px #3a4f96;
}
.brand-title { font-weight: 900; font-size: 18px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--muted); }

.coin-counter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 201, 60, .55);
  background: linear-gradient(180deg, #2b2108, #1a1405);
  color: var(--gold);
  font-weight: 900; font-size: 16px;
  box-shadow: 0 0 18px rgba(255, 201, 60, .18);
}
.coin-ico { width: 26px; height: 26px; display: inline-flex; }
.coin-ico svg { width: 100%; height: 100%; }
.coin-counter.bump { animation: bump .5s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* ---------- power-up switcher ---------- */
.powerup {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 16px 12px;
}
.pu {
  display: flex; align-items: center; gap: 8px;
  padding: 8px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--panel);
  text-align: left;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.pu-card { flex: none; width: 28px; height: 19px; border-radius: 4px; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.pu-black .pu-card { background: linear-gradient(135deg, #3a3a44, #0b0b10); box-shadow: inset 0 0 0 1px #ffc93c88, 0 2px 6px rgba(0, 0, 0, .4); }
.pu-platinum .pu-card { background: linear-gradient(135deg, #f1f3f8, #8d96ab); }
.pu-debit .pu-card { background: linear-gradient(135deg, #5df0c4, #149a75); }
.pu-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.pu-text b { font-size: 13px; }
.pu-text small { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pu.is-active {
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(255, 201, 60, .18), 0 8px 18px rgba(0, 0, 0, .35);
}
.pu.is-active small { color: var(--gold); }

/* ---------- screens ---------- */
.screens { position: relative; flex: 1; overflow: hidden; overflow: clip; }
.screen {
  position: absolute; inset: 0;
  overflow-y: auto;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen.is-active { opacity: 1; pointer-events: auto; }
#screen-map { overflow: hidden; }
.screen-pad { padding: 6px 16px 28px; }

/* ---------- chips (shared) ---------- */
.chip {
  flex: none;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(22, 34, 75, .92);
  font-size: 12.5px; font-weight: 800;
  white-space: nowrap;
  backdrop-filter: blur(6px);
}
.chip.is-active { background: var(--gold); border-color: var(--gold); color: #2a1a00; }

/* ---------- map ---------- */
.map {
  position: absolute; inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  border-top: 1px solid var(--line);
}
.map.is-dragging { cursor: grabbing; }
#map-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map-labels, .map-markers { position: absolute; inset: 0; pointer-events: none; }

.place {
  position: absolute; left: 0; top: 0;
  translate: -50% -50%;
  font-size: 10px; font-weight: 900;
  letter-spacing: .1em; text-transform: uppercase;
  color: rgba(196, 210, 255, .42);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.place.sea { font-style: italic; text-transform: none; letter-spacing: .04em; font-size: 12.5px; color: rgba(150, 215, 255, .5); }

.you { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 1; }
.you-dot {
  position: absolute; left: -8px; top: -8px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--sky); border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}
.you-ring {
  position: absolute; left: -22px; top: -22px; width: 44px; height: 44px;
  border-radius: 50%; background: rgba(92, 200, 255, .25);
  animation: you 2.4s ease-out infinite;
}
.you-label {
  position: absolute; top: 11px; left: 50%; translate: -50% 0;
  font-size: 10px; font-weight: 900; color: #fff;
  background: #1f6fb0; padding: 1px 6px; border-radius: 6px;
}
@keyframes you { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }

.map-chips {
  position: absolute; top: 10px; left: 0; right: 0;
  display: flex; gap: 6px;
  overflow-x: auto; padding: 0 12px 4px;
  scrollbar-width: none; z-index: 4;
}
.map-chips::-webkit-scrollbar { display: none; }
.map-zoom {
  position: absolute; right: 12px; bottom: 64px; z-index: 4;
  display: flex; flex-direction: column; gap: 6px;
}
.map-zoom button {
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(22, 34, 75, .92);
  font-size: 20px; font-weight: 900; line-height: 1;
}
.map-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 4;
  display: flex; gap: 10px;
  padding: 6px 10px; border-radius: 12px;
  background: rgba(13, 22, 48, .88); border: 1px solid var(--line);
  font-size: 11px; font-weight: 800; color: #cdd6f6;
}
.map-legend span { display: inline-flex; align-items: center; gap: 4px; }
.map-legend i { width: 16px; height: 16px; display: inline-flex; }
.map-legend svg { width: 100%; height: 100%; }

.map.flash::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(255, 201, 60, .35), transparent 65%);
  animation: flash .7s ease-out forwards;
}
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

/* ---------- markers ---------- */
.src-extras   { --src: #ffb23c; --src-glow: rgba(255, 178, 60, .5); }
.src-shopback { --src: #ff6b6b; --src-glow: rgba(255, 107, 107, .5); }
.src-altitude { --src: #5cc8ff; --src-glow: rgba(92, 200, 255, .5); }

.marker {
  position: absolute; left: 0; top: 0;
  width: 38px; height: 38px; margin: -19px 0 0 -19px; padding: 0;
  border: 0; background: none;
  pointer-events: auto; z-index: 2;
}
.marker-body {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  transition: transform .4s cubic-bezier(.3, 1.6, .5, 1), opacity .3s;
}
.marker-icon {
  position: relative;
  width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #22346e, #0d1630);
  border: 2.5px solid var(--src);
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .5), 0 0 16px var(--src-glow);
  animation: bob 2.6s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.marker-icon svg { width: 22px; height: 22px; }
.marker-pulse {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--src);
  animation: pulse 1.9s ease-out infinite;
  animation-delay: var(--d, 0s);
}
.marker-coins {
  position: absolute; top: 33px; left: 50%;
  transform: translateX(-50%);
  padding: 1px 6px; border-radius: 999px;
  background: var(--gold); color: #3b2600;
  font-size: 10.5px; font-weight: 900; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
}
.marker-coins.pop { animation: pop .55s cubic-bezier(.3, 1.9, .5, 1); }
.marker:focus-visible .marker-icon { outline: 3px solid #fff; outline-offset: 2px; }

.marker.is-hidden { pointer-events: none; }
.marker.is-hidden .marker-body { transform: scale(0); opacity: 0; }
.marker.is-used .marker-icon { filter: grayscale(.85); opacity: .6; animation: none; }
.marker.is-used .marker-pulse { display: none; }
.marker.is-used .marker-coins { background: var(--mint); color: #04261c; }
.marker.is-selected { z-index: 3; }
.marker.is-selected .marker-body { transform: scale(1.25); }
.marker.is-glow { z-index: 3; }
.marker.is-glow .marker-icon { box-shadow: 0 0 0 4px rgba(255, 201, 60, .45), 0 0 26px var(--gold); }

@keyframes pulse { 0% { transform: scale(.9); opacity: .85; } 100% { transform: scale(1.9); opacity: 0; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes pop { 0% { transform: translateX(-50%) scale(.3); } 100% { transform: translateX(-50%) scale(1); } }

/* ---------- tab bar ---------- */
.tabbar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 6px 14px;
  background: #0a1128;
  border-top: 1px solid var(--line);
  z-index: 5;
}
.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0;
  border: 0; background: none;
  color: var(--muted);
  font-size: 11px; font-weight: 800;
}
.tab span { font-size: 20px; filter: grayscale(.6); transition: transform .2s, filter .2s; }
.tab.is-active { color: var(--gold); }
.tab.is-active span { filter: none; transform: translateY(-2px) scale(1.1); }
.tab-dot {
  position: absolute; top: 4px; right: calc(50% - 18px);
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--coral); border: 2px solid #0a1128;
  transform: scale(0); transition: transform .3s cubic-bezier(.3, 1.8, .5, 1);
}
.tab-dot.is-on { transform: scale(1); }

/* ---------- sheet ---------- */
.sheet-backdrop {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(3, 6, 16, .55);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 21;
  padding: 10px 18px 20px;
  border-radius: 28px 28px 0 0;
  border-top: 1px solid #33468a;
  background: linear-gradient(180deg, #1b2959, #111a3e);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .5);
  transform: translateY(105%);
  transition: transform .38s cubic-bezier(.2, .9, .3, 1.08);
}
.sheet.is-open { transform: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: #3a4a85; margin: 0 auto 14px; }
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-icon {
  flex: none; width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #22346e, #0d1630);
  border: 3px solid var(--src);
  box-shadow: 0 0 20px var(--src-glow);
}
.sheet-icon svg { width: 32px; height: 32px; }
.sheet-title-wrap { min-width: 0; }
.sheet-title-wrap h3 { margin: 0 0 2px; font-size: 19px; }
.sheet-title-wrap .muted { font-size: 12.5px; }
.sheet-close {
  margin-left: auto; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel);
}
.offer-big { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.badge {
  font-size: 11px; font-weight: 900;
  padding: 3px 9px; border-radius: 999px;
  background: var(--src); color: #0d1630;
}
.offer-text { font-size: 26px; font-weight: 900; letter-spacing: -.01em; }
.coin-math {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: 14px; padding: 10px 14px;
  border-radius: 16px; border: 1px solid var(--line);
  background: #0f1838;
}
.coin-math div { display: flex; flex-direction: column; align-items: center; text-align: center; }
.coin-math small { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.coin-math b { font-size: 20px; display: inline-flex; align-items: center; }
.coin-math .op { color: var(--muted); font-weight: 900; font-size: 18px; }
.coin-total b { color: var(--gold); }
.coin-total .ci svg { width: 20px; height: 20px; }
.coin-note { text-align: center; color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.why {
  margin-top: 12px; padding: 10px 12px;
  font-size: 13px; line-height: 1.4; color: #d9e0fb;
  border-radius: 14px;
  background: rgba(167, 139, 250, .12);
  border: 1px solid rgba(167, 139, 250, .35);
}
.why span { font-weight: 900; color: var(--violet); margin-right: 2px; }
.btn-use {
  width: 100%; margin-top: 16px; padding: 15px;
  border: 0; border-radius: 16px;
  background: linear-gradient(180deg, #ffd45c, #f5a30b);
  color: #2a1a00; font-size: 15.5px; font-weight: 900;
  box-shadow: 0 6px 0 #b46f00, 0 12px 26px rgba(245, 158, 11, .35);
  transition: transform .08s, box-shadow .08s;
}
.btn-use:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #b46f00, 0 6px 14px rgba(245, 158, 11, .3); }
.btn-use.is-used {
  background: linear-gradient(180deg, #5df0c4, #22c995);
  color: #04261c; box-shadow: 0 6px 0 #128a66; cursor: default;
}
.demo-hint { text-align: center; font-size: 11.5px; color: var(--muted); margin: 12px 0 0; }

.ci { display: inline-flex; vertical-align: -3px; margin-right: 3px; }
.ci svg { width: 15px; height: 15px; }

/* ---------- toast + coin fx ---------- */
.toast {
  position: absolute; top: 178px; left: 50%; z-index: 30;
  transform: translate(-50%, -12px);
  max-width: 90%;
  padding: 9px 16px; border-radius: 999px;
  background: linear-gradient(180deg, #fff6d6, #ffe08a);
  color: #2a1a00; font-size: 13px; font-weight: 900;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .4);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .3s cubic-bezier(.3, 1.6, .5, 1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
.fx-coin {
  position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px;
  transform: scale(.3);
  transition: transform .28s ease-out, opacity .6s;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4));
}
.fx-coin svg { width: 100%; height: 100%; }
.fx-coin.fly { transition: transform .62s cubic-bezier(.55, -.25, .7, 1), opacity .62s ease-in; }

/* ---------- Discover ---------- */
.goal-search {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; margin-top: 4px;
  border-radius: 16px;
  border: 1.5px solid #3a4f96;
  background: linear-gradient(180deg, #1d2b62, #16224b);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, .08);
}
.goal-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none;
  color: var(--text); font: inherit; font-size: 14px;
}
.goal-search input::placeholder { color: #8f9cc8; }
.chips { display: flex; gap: 6px; overflow-x: auto; margin: 12px -16px 0; padding: 0 16px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

.row { margin-top: 20px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; }
.row-head h3 { margin: 0; font-size: 16.5px; }
.row-head span { font-size: 12px; color: var(--muted); }
.row-scroll {
  display: flex; gap: 10px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 10px -16px 0; padding: 0 16px 6px;
  scrollbar-width: none;
}
.row-scroll::-webkit-scrollbar { display: none; }
.row-empty { margin-top: 10px; padding: 14px; border-radius: 14px; border: 1px dashed var(--line); color: var(--muted); font-size: 13px; text-align: center; }

.shop-card {
  flex: none; width: 152px;
  scroll-snap-align: start;
  padding: 0; text-align: left;
  border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  transition: transform .15s;
}
.shop-card:active { transform: scale(.97); }
.shop-card.is-used { opacity: .65; }
.shop-art { position: relative; height: 80px; display: grid; place-items: center; background: linear-gradient(135deg, #3b2f7a, #1f2a66); }
.shop-emoji { font-size: 36px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); }
.shop-src {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(13, 22, 48, .82);
}
.shop-src svg { width: 18px; height: 18px; }
.shop-new {
  position: absolute; top: 9px; left: 8px;
  padding: 2px 6px; border-radius: 6px;
  background: var(--mint); color: #04261c;
  font-size: 9.5px; font-weight: 900; letter-spacing: .04em;
}
.cat-coffee      { background: linear-gradient(135deg, #8a5a3c, #4a2e22); }
.cat-meals       { background: linear-gradient(135deg, #ff8a6b, #b5412f); }
.cat-groceries   { background: linear-gradient(135deg, #48c78e, #1d7a55); }
.cat-baked       { background: linear-gradient(135deg, #f2b45b, #a8641f); }
.cat-treats      { background: linear-gradient(135deg, #ff9ed2, #b2477f); }
.cat-travel      { background: linear-gradient(135deg, #5cc8ff, #2a65b8); }
.cat-fuel        { background: linear-gradient(135deg, #8d99b8, #444e6e); }
.cat-fashion     { background: linear-gradient(135deg, #c39bff, #6a3fbf); }
.cat-department  { background: linear-gradient(135deg, #7d8cff, #3d48b0); }
.cat-fitness     { background: linear-gradient(135deg, #34e3b0, #138c69); }
.cat-transport   { background: linear-gradient(135deg, #6fe0ff, #1d8fb5); }
.cat-experiences { background: linear-gradient(135deg, #4fd1ff, #1f5fa3); }
.shop-body { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px 11px; }
.shop-body b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-body small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-offer { font-size: 12.5px; font-weight: 900; color: var(--mint); margin-top: 3px; }
.shop-coins { font-size: 12.5px; font-weight: 900; color: var(--gold); display: inline-flex; align-items: center; }

/* ---------- Pot ---------- */
.pot-hero {
  text-align: center;
  padding: 18px 14px 14px; margin-top: 4px;
  border-radius: 24px; border: 1px solid var(--line);
  background: radial-gradient(400px 220px at 50% 0%, #2a3c84, #16224b 70%);
}
.pot-hero h2 { margin: 8px 0 12px; font-size: 20px; }
.ring { position: relative; width: 180px; height: 180px; margin: 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #24346b; stroke-width: 14; }
.ring-fg {
  fill: none; stroke: url(#g-ring); stroke-width: 14; stroke-linecap: round;
  transition: stroke-dashoffset 1.1s cubic-bezier(.3, 1, .4, 1);
  filter: drop-shadow(0 0 6px rgba(255, 201, 60, .45));
}
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-emoji { font-size: 26px; }
.ring-amt { font-size: 23px; font-weight: 900; letter-spacing: -.02em; }
.ring-sub { font-size: 12px; color: var(--muted); }
.pot-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pot-stats div { padding: 9px 4px; border-radius: 14px; background: rgba(13, 22, 48, .55); display: flex; flex-direction: column; }
.pot-stats b { font-size: 17px; }
.pot-stats small { font-size: 11px; color: var(--muted); }

.pot-h { margin: 22px 0 10px; font-size: 15.5px; display: flex; justify-content: space-between; align-items: baseline; }
.pot-h span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: #24346b; gap: 2px; }
.stack-seg { min-width: 6px; height: 100%; transition: width .6s; }
.stack-legend { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 10px; font-size: 12.5px; }
.stack-legend span { display: flex; align-items: center; gap: 6px; }
.stack-legend b { margin-left: auto; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.t-coins   { background: var(--gold); }
.t-skip    { background: var(--mint); }
.t-mission { background: var(--violet); }
.t-auto    { background: var(--sky); }
.t-earlier { background: #56658f; }

.history { list-style: none; margin: 0; padding: 0; }
.history li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; margin: 0 -8px;
  border-bottom: 1px solid rgba(42, 58, 114, .6);
  border-radius: 12px;
}
.history li.is-fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { 0% { background: rgba(255, 201, 60, .35); transform: translateX(-6px); } 30% { transform: none; } 100% { background: transparent; } }
.h-ico {
  flex: none; width: 36px; height: 36px; border-radius: 12px;
  display: grid; place-items: center; font-size: 17px;
  background-color: transparent;
}
.h-ico.t-coins   { background: rgba(255, 201, 60, .16); }
.h-ico.t-skip    { background: rgba(52, 227, 176, .16); }
.h-ico.t-mission { background: rgba(167, 139, 250, .18); }
.h-ico.t-auto    { background: rgba(92, 200, 255, .16); }
.h-ico.t-earlier { background: rgba(86, 101, 143, .3); }
.h-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.h-main b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-main small { font-size: 11.5px; color: var(--muted); }
.h-amt { font-weight: 900; color: var(--mint); font-size: 14px; }

/* ---------- Missions: Me vs Me (Phase 4) ---------- */
.m-head { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.m-head h2 { margin: 0; font-size: 22px; }
.m-head p { margin: 2px 0 0; font-size: 13px; }
.m-level-badge {
  display: flex; flex-direction: column; align-items: center; line-height: 1;
  padding: 8px 12px; border-radius: 14px;
  background: linear-gradient(180deg, #2a1f63, #1b1745);
  border: 1.5px solid var(--violet);
  font-size: 10px; font-weight: 900; letter-spacing: .1em; color: var(--violet);
  box-shadow: 0 0 18px rgba(167, 139, 250, .25);
}
.m-level-badge b { font-size: 22px; color: var(--text); letter-spacing: 0; margin-top: 2px; }
.card {
  margin-top: 12px; padding: 14px;
  border-radius: 18px; border: 1px solid var(--line);
  background: var(--panel);
}
.card > b { font-size: 14.5px; }
.small { font-size: 12px; line-height: 1.45; }
.ai-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; margin-bottom: 8px;
  background: rgba(167, 139, 250, .16); color: var(--violet);
  font-size: 11px; font-weight: 900;
}
.ai-tag.demo { background: rgba(255, 201, 60, .14); color: var(--gold); }
.m-target { margin: 0 0 6px; font-size: 18px; line-height: 1.3; }
.m-target-num { color: var(--gold); display: inline-block; margin: 0 3px; transform-origin: center bottom; }
.m-target-num.flash { animation: targetFlash 1.1s ease-out; }
@keyframes targetFlash { 0% { transform: scale(1.6); color: #fff; text-shadow: 0 0 16px var(--gold); } 100% { transform: scale(1); } }
.bar { position: relative; height: 14px; margin-top: 12px; border-radius: 999px; background: #24346b; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--mint), #22c995); transition: width .6s; }
.bar-fill.over { background: linear-gradient(90deg, #ff8a6b, var(--coral)); }
.bar-caption { margin: 8px 0 0; font-size: 13px; }

.level-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pips { display: flex; align-items: center; margin: 14px 0 10px; }
.pip {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 900; color: var(--muted);
  background: #24346b; border: 2px solid #33468a;
}
.pip.done { background: var(--violet); border-color: var(--violet); color: #1b1745; }
.pip.now {
  background: var(--gold); border-color: #fff; color: #2a1a00;
  box-shadow: 0 0 0 4px rgba(255, 201, 60, .25), 0 0 16px rgba(255, 201, 60, .5);
  animation: pipPop .6s cubic-bezier(.3, 1.8, .5, 1);
}
@keyframes pipPop { from { transform: scale(.5); } to { transform: scale(1); } }
.pip-line { flex: 1; height: 3px; background: #33468a; }
.warn { color: var(--coral); }

.reward-line { margin: 6px 0; font-size: 14px; }
.reward-line b { color: var(--mint); }
.reward-line.is-silent { color: var(--muted); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.switch {
  position: relative; flex: none; width: 50px; height: 30px; border-radius: 999px;
  border: 0; background: #33468a; transition: background .2s;
}
.switch span {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; transition: transform .2s; box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
}
.switch[aria-checked="true"] { background: var(--mint); }
.switch[aria-checked="true"] span { transform: translateX(20px); }

.banner {
  margin-top: 12px; padding: 12px 14px; border-radius: 16px;
  font-size: 13.5px; line-height: 1.45;
  border: 1px solid; animation: bannerIn .45s cubic-bezier(.3, 1.4, .5, 1);
}
@keyframes bannerIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.banner.res-win, .banner.res-levelup { background: rgba(52, 227, 176, .12); border-color: rgba(52, 227, 176, .5); }
.banner.res-fail { background: rgba(255, 107, 107, .12); border-color: rgba(255, 107, 107, .5); }
.banner.res-eased { background: rgba(92, 200, 255, .12); border-color: rgba(92, 200, 255, .5); }
.banner.res-shifted, .banner.res-flagged { background: rgba(255, 201, 60, .1); border-color: rgba(255, 201, 60, .5); }

.prompt { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(167, 139, 250, .15); }
.prompt-q { margin: 0 0 12px; font-size: 15px; }
.prompt-btns { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.btn-yes, .btn-no { padding: 12px; border-radius: 14px; font-weight: 900; font-size: 14px; border: 0; }
.btn-yes { background: linear-gradient(180deg, #5df0c4, #22c995); color: #04261c; box-shadow: 0 4px 0 #128a66; }
.btn-no { background: #24346b; color: var(--text); }
.why-ai { margin-top: 10px; font-size: 12.5px; color: #cdd6f6; }
.why-ai summary { cursor: pointer; color: var(--violet); font-weight: 800; }
.why-ai p { margin: 6px 0 0; }

.week-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid rgba(42, 58, 114, .6); font-size: 13px; }
.week-row:last-child { border-bottom: 0; }
.res { font-weight: 900; font-size: 12.5px; white-space: nowrap; }
.res-win, .res-levelup { color: var(--mint); }
.res-fail { color: var(--coral); }
.res-eased { color: var(--sky); }
.res-shifted, .res-flagged { color: var(--gold); }
.fair { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.5; }
.fair li { margin-bottom: 4px; }
.week-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.tab.bump span { animation: bump .5s cubic-bezier(.3, 1.8, .5, 1); }

/* ---------- demo controls ---------- */
.demo {
  width: 230px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(13, 22, 48, .85);
}
.demo-title { font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.tm-scenarios { display: flex; flex-direction: column; gap: 8px; }
.tm-scenario-btn {
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel);
  text-align: left; font-weight: 800; font-size: 13.5px;
}
.tm-scenario-btn.is-active { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 201, 60, .15); }
.demo-note { font-size: 12.5px; color: var(--muted); line-height: 1.45; margin: 12px 0; }
.demo-note b { color: var(--text); }
.demo-reset {
  width: 100%; padding: 9px; border-radius: 12px;
  border: 1px dashed #4a5c9e; background: none;
  font-weight: 800; font-size: 13px; color: var(--muted);
}

/* ---------- small screens: full-screen app ---------- */
@media (max-width: 700px) {
  .stage { flex-direction: column; padding: 0; gap: 0; }
  .phone { width: 100vw; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  .demo { width: 100%; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .marker-icon, .marker-pulse, .you-ring { animation: none; }
}

/* ---------- AI: goal search + insight ---------- */
.goal-card { margin-bottom: 12px; }
.intent-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.intent { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: rgba(167, 139, 250, .16); color: var(--violet); }
.intent.when { background: rgba(255, 201, 60, .14); color: var(--gold); }
.goal-list { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; gap: 6px; }
.goal-list button { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.gl-main { flex: 1; display: grid; gap: 2px; min-width: 0; }
.gl-main small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.gl-match { font-weight: 900; color: var(--mint); font-size: 15px; }
.insight-h { margin: 6px 0 4px; font-size: 16px; }
.insight p { margin: 4px 0; }
.small { font-size: 13px; }
#sheet-why em { font-style: normal; }
