:root {
  --ink: #1d2340;
  --panel: rgba(20, 26, 48, 0.72);
  --accent: #ff5a5f;
  --gold: #ffc933;
  --gem: #44e8ff;
  --font: 'Fredoka', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe6f7; font-family: var(--font); color: #fff; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

.panel {
  background: var(--panel);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.75; }

/* Score */
#leftcol { position: fixed; top: 16px; left: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
#scorecard { min-width: 170px; }

/* Daily trip */
.daily { display: flex; align-items: center; gap: 12px; width: 100%; margin: 14px 0 4px; padding: 12px 16px; border: none; border-radius: 16px; background: linear-gradient(135deg, #ff5a5f, #ff9f1c); color: #fff; text-align: left; font-family: inherit; box-shadow: 0 6px 18px rgba(255, 90, 95, 0.35); cursor: pointer; transition: transform 0.1s; }
.daily:hover { transform: translateY(-2px); }
.daily .dEmoji { font-size: 32px; }
.daily .dText { flex: 1; display: flex; flex-direction: column; }
.daily b { font-size: 18px; }
.daily small { font-size: 13px; opacity: 0.95; }
.daily .dGo { font-size: 22px; }
#dailyHud { width: 230px; border: 2px solid #ff9f1c; }
.dhHead { display: flex; justify-content: space-between; font-weight: 600; }
#dhTime { color: var(--gold); font-variant-numeric: tabular-nums; }
#dailyHud .bar { height: 8px; background: rgba(255,255,255,0.15); border-radius: 6px; overflow: hidden; margin: 6px 0 4px; }
#dhFill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff5a5f, #ff9f1c); }
#dhScore { font-size: 13px; opacity: 0.9; }
#dailyHud.urgent { animation: pulse 0.6s ease-in-out infinite alternate; }
@keyframes pulse { to { box-shadow: 0 0 0 4px rgba(255,90,95,0.6); } }
#dailyEnd h2 { margin: 4px 0 0; color: var(--ink); }
#deScore { font-size: 54px; font-weight: 700; color: var(--accent); line-height: 1.1; }
#deBest { font-size: 14px; font-weight: 600; color: #2a9d8f; min-height: 1.2em; }
#deStats { margin-top: 10px; font-size: 18px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
#deStreak { margin-top: 8px; font-size: 15px; }

/* Photo quest */
#quest { width: 230px; font-size: 14px; }
.qHead { font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; }
#qCount { color: var(--gold); }
#qList { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
#qList li { display: flex; gap: 6px; white-space: nowrap; }
#qList .qName { overflow: hidden; text-overflow: ellipsis; flex: 1; }
#qList .qMeta { opacity: 0.75; font-variant-numeric: tabular-nums; }
#qList li.done .qName { text-decoration: line-through; opacity: 0.6; }
#qList li.done .qMeta { opacity: 1; }
#goals { width: 230px; font-size: 14px; }
#gList { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
#gList li { display: flex; gap: 6px; white-space: nowrap; }
#gList .qName { overflow: hidden; text-overflow: ellipsis; flex: 1; }
#gList .qMeta { opacity: 0.75; font-variant-numeric: tabular-nums; }
#gList li.done .qName { text-decoration: line-through; opacity: 0.6; }
#goals.all { box-shadow: 0 0 0 2px #06d6a0; }
#qHint { margin-top: 6px; font-size: 12px; opacity: 0.8; }
#quest.framed { box-shadow: 0 0 0 2px #ffd60a, 0 6px 20px rgba(255,214,10,0.35); }
#quest.framed #qHint { opacity: 1; color: #ffd60a; font-weight: 600; }

/* Viewfinder (only in photo mode; outside the HUD so it never ends up in pictures) */
#viewfinder { display: none; position: fixed; inset: 12.5%; pointer-events: none; z-index: 4; }
body.photo #viewfinder { display: block; }
#viewfinder i { position: absolute; width: 44px; height: 44px; border: 4px solid rgba(255,255,255,0.85); transition: border-color 0.15s; }
#viewfinder i:nth-child(1) { left: 0; top: 0; border-right: none; border-bottom: none; }
#viewfinder i:nth-child(2) { right: 0; top: 0; border-left: none; border-bottom: none; }
#viewfinder i:nth-child(3) { left: 0; bottom: 0; border-right: none; border-top: none; }
#viewfinder i:nth-child(4) { right: 0; bottom: 0; border-left: none; border-top: none; }
#viewfinder.locked i { border-color: #ffd60a; }
#vfLabel { position: absolute; left: 50%; bottom: -44px; transform: translateX(-50%); white-space: nowrap; background: var(--panel); padding: 4px 14px; border-radius: 999px; font-size: 15px; }
#vfLabel:empty { display: none; }
#viewfinder.locked #vfLabel { color: #ffd60a; font-weight: 600; }

/* Photo album in the passport */
#album { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
#album .albumHead { width: 100%; font-size: 13px; font-weight: 600; }
#album figure { margin: 0; width: 96px; background: #fff; padding: 4px 4px 2px; border-radius: 4px; box-shadow: 0 2px 6px rgba(0,0,0,0.15); transform: rotate(-2deg); }
#album figure:nth-child(2n) { transform: rotate(2deg); }
#album img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 2px; }
#album figcaption { font-size: 10px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.toast.photo { background: linear-gradient(135deg, #1d2340ee, #3a2f6bee); border: 2px solid #ffd60a; }
#score { font-size: 38px; font-weight: 700; line-height: 1.05; color: var(--gold); text-shadow: 0 2px 0 rgba(0,0,0,0.25); }
#score.bump { animation: bump 0.25s ease-out; }
@keyframes bump { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
.stats { display: flex; gap: 12px; font-size: 16px; margin-top: 4px; }
.best { font-size: 12px; opacity: 0.65; margin-top: 4px; }
#level { margin-top: 6px; font-size: 12px; font-weight: 600; }
#level .bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.2); margin-top: 3px; overflow: hidden; }
#level .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffd23f, #ff8c42); transition: width 0.3s; }
#level.up { animation: levelUp 1.2s ease; }
@keyframes levelUp { 0%, 100% { transform: none; } 20% { transform: scale(1.15); color: #ffd23f; } }
.flame { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #efe3cf; padding: 0; cursor: pointer; }
.flame.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.flame.locked { filter: grayscale(1); opacity: 0.35; }
#flameMsg { font-size: 12px; opacity: 0.7; margin: -2px 0 6px 52px; min-height: 1em; }
.explored { font-size: 13px; margin-top: 4px; cursor: help; }
.explored b { color: #ff8c5a; }

/* Top center */
#topcenter { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: min(560px, 60vw); }
.pill { background: var(--panel); backdrop-filter: blur(6px); border-radius: 999px; padding: 6px 16px; font-weight: 500; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#guide { display: flex; align-items: center; gap: 8px; font-size: 14px; background: rgba(120, 60, 200, 0.75); }
#guideArrow { display: inline-block; font-size: 18px; color: #ffe066; transform-origin: 50% 50%; transition: transform 0.1s linear; }
#guideArrow { rotate: -90deg; }
#guideDist { opacity: 0.85; font-weight: 600; }
#combo { font-weight: 700; font-size: 20px; color: var(--gold); text-shadow: 0 2px 6px rgba(0,0,0,0.4); opacity: 0; transform: scale(0.8); transition: all 0.15s; }
#combo.show { opacity: 1; transform: scale(1); }
#combo b { color: #fff; background: var(--accent); border-radius: 8px; padding: 0 6px; }
#power { display: flex; flex-direction: column; align-items: stretch; gap: 3px; background: linear-gradient(135deg, #ff8c42ee, #ffd23fee); color: #3a2200; font-weight: 700; min-width: 190px; text-align: center; }
#power .bar { height: 4px; border-radius: 2px; background: rgba(58, 34, 0, 0.25); overflow: hidden; }
#power .bar i { display: block; height: 100%; background: #3a2200; }
#stuntCombo { font-weight: 700; font-size: 17px; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,0.5); opacity: 0; transform: scale(0.8); transition: opacity 0.15s, transform 0.15s; text-align: center; }
#stuntCombo.show { opacity: 1; transform: scale(1); }
#stuntCombo b { background: linear-gradient(135deg, #7b2ff7, #f107a3); border-radius: 8px; padding: 0 7px; margin-left: 4px; }
#stuntCombo .bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.25); margin-top: 3px; overflow: hidden; }
#stuntCombo .bar i { display: block; height: 100%; background: #f107a3; }

#guide.ufo { background: linear-gradient(135deg, #1b7a43ee, #2fbf71ee); }
#toasts { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#hint { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(10px); max-width: min(560px, 86vw); background: #fffaf2; color: var(--ink); border-radius: 14px; padding: 9px 16px; font-size: 15px; box-shadow: 0 6px 20px rgba(0,0,0,0.25); opacity: 0; transition: opacity 0.35s, transform 0.35s; pointer-events: none; text-align: center; }
#hint.show { opacity: 1; transform: translateX(-50%); }
#hint b { color: var(--accent); }
#hint::before { content: '💡 '; }
#sideToasts { position: fixed; right: 16px; bottom: 40px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; width: min(340px, 60vw); }
#sideToasts .toast { text-align: left; font-size: 15px; animation-name: sideToast; }
@keyframes sideToast { 0% { opacity: 0; transform: translateX(24px) scale(0.95); } 8% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateX(12px); } }
.toast { background: var(--panel); padding: 8px 18px; border-radius: 14px; font-size: 17px; animation: toast 3.2s ease forwards; text-align: center; }
.toast.big { background: linear-gradient(135deg, #7b2ff7cc, #f107a3cc); font-size: 20px; }
.toast.gem { background: linear-gradient(135deg, #0ea5e9cc, #22d3eecc); }
.toast .pts { color: var(--gold); font-weight: 700; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-10px) scale(0.9); } 8% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(-6px); } }

#guide.race { background: linear-gradient(135deg, #e85d04ee, #faa307ee); }
#challenge { width: 100%; max-width: 440px; padding: 8px 14px; }
.chHead { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 15px; }
#chTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#chTime { color: var(--gold); font-variant-numeric: tabular-nums; }
#challenge .bar { height: 8px; background: rgba(255,255,255,0.15); border-radius: 6px; overflow: hidden; margin-top: 6px; }
#chFill { height: 100%; background: linear-gradient(90deg, #ffd23f, #ff9f1c); transition: width 0.1s linear; }
#chInfo { font-size: 12px; opacity: 0.8; margin-top: 3px; }
#chInfo:empty { display: none; }
#challenge.urgent { animation: urgent 0.5s ease-in-out infinite alternate; }
#challenge.urgent #chFill { background: #e63946; }
@keyframes urgent { to { box-shadow: 0 0 0 3px #e63946; } }
.toast.challenge { background: linear-gradient(135deg, #e85d04dd, #faa307dd); }
.toast.fail { background: #6c757ddd; }
.toast small { opacity: 0.8; font-size: 12px; }

/* Score popups */
#pops { position: fixed; inset: 0; pointer-events: none; }
.pop { position: absolute; transform: translate(-50%, -50%); font-weight: 700; font-size: 22px; color: var(--gold); text-shadow: 0 2px 0 #7a5200, 0 0 8px rgba(0,0,0,0.3); animation: pop 0.9s ease-out forwards; }
.pop.hot { color: #ff7b54; font-size: 26px; }
.pop.bonk { color: #fff; font-size: 30px; text-shadow: 0 2px 0 #c1121f, 0 0 10px #c1121f; }
.pop.boing { color: #ff006e; font-size: 30px; text-shadow: 0 2px 0 #fff, 0 0 10px rgba(255,255,255,0.8); }
.pop.splash { color: #48cae4; font-size: 26px; text-shadow: 0 2px 0 #023e8a; }
.pop.speech { color: var(--ink); font-size: 15px; background: #fff; padding: 3px 10px; border-radius: 12px; text-shadow: none; animation-duration: 1.4s; }
.pop.gem { color: var(--gem); font-size: 32px; text-shadow: 0 2px 0 #075b6e; }
@keyframes pop { 0% { opacity: 0; margin-top: 0; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -60px; } }

/* Minimap */
#mapwrap { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
#bigmap { background: rgba(10, 14, 30, 0.55); z-index: 30; }
#bigmap .bmCard { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; justify-content: center; }
#bigmapCanvas { width: min(78vh, 88vw, 640px); height: min(78vh, 88vw, 640px); border-radius: 50%; border: 6px solid rgba(255,255,255,0.95); box-shadow: 0 10px 40px rgba(0,0,0,0.4); }
.bmLegend { display: flex; flex-direction: column; gap: 5px; background: var(--panel); color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 13px; }
.bmLegend b { font-size: 16px; margin-bottom: 2px; }
.bmItems { display: grid; grid-template-columns: auto auto; gap: 5px 14px; }
@media (max-width: 420px) { .bmItems { grid-template-columns: auto; } }
.bmLegend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid transparent; margin-right: 8px; vertical-align: -1px; }
.bmLegend small { opacity: 0.7; margin-top: 4px; }
#tourBtn { margin-top: 8px; padding: 8px 12px; font-size: 14px; }
#minimap { cursor: pointer; }
#minimap { width: 190px; height: 190px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.9); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }
#coords, #tiles, #weather { font-size: 11px; background: var(--panel); border-radius: 8px; padding: 2px 8px; }
#tiles:empty { display: none; }

/* Fuel */
#fuel { position: fixed; left: 16px; bottom: 40px; width: 210px; }
#fuel .bar { height: 12px; background: rgba(255,255,255,0.15); border-radius: 8px; overflow: hidden; margin-top: 6px; }
#fuelFill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff9f1c, #ffbf69); border-radius: 8px; transition: width 0.08s linear; }
#fuel.low #fuelFill { background: linear-gradient(90deg, #e63946, #ff6b6b); }
#fuel.active { box-shadow: 0 0 0 2px #ff9f1c, 0 6px 20px rgba(255,159,28,0.4); }

#controls { position: fixed; right: 16px; bottom: 40px; font-size: 13px; line-height: 1.6; transition: opacity 0.8s; max-width: 420px; }
#controls.faded { opacity: 0; pointer-events: none; }
#controls b { color: var(--gold); }

#buttons { position: fixed; left: 240px; bottom: 40px; display: flex; gap: 8px; }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--panel); font-size: 20px; }
.iconbtn.on { background: #ff006e; }
.iconbtn:hover { background: rgba(40, 50, 90, 0.85); }

#attribution { position: fixed; right: 8px; bottom: 6px; font-size: 11px; color: var(--ink); opacity: 0.8; background: rgba(255,255,255,0.6); padding: 1px 6px; border-radius: 6px; }
#attribution a { color: inherit; }

/* Overlays / menu */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 30% 20%, rgba(255, 220, 160, 0.35), rgba(30, 40, 90, 0.55)); padding: 16px; z-index: 10; }
.card { position: relative; background: #fffaf2; color: var(--ink); border-radius: 26px; padding: 28px 30px; width: min(760px, 100%); max-height: 100%; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,0.35); }
.card.small { width: min(440px, 100%); text-align: center; }
h1 { margin: 0; font-size: 46px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
h1 span { color: var(--accent); }
.tag { margin: 6px 0 18px; font-size: 17px; opacity: 0.8; }
#cities { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.city { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid #efe3cf; background: #fff; border-radius: 14px; text-align: left; color: var(--ink); font-size: 15px; transition: transform 0.1s, border-color 0.1s; }
.city:hover { transform: translateY(-2px); border-color: var(--accent); }
.city .emoji { font-size: 28px; }
.city small { display: block; opacity: 0.6; font-size: 12px; }
#searchForm { display: flex; gap: 8px; margin-top: 18px; }
#searchBox { flex: 1; padding: 12px 16px; border-radius: 14px; border: 2px solid #efe3cf; font-family: inherit; font-size: 16px; outline: none; }
#searchBox:focus { border-color: var(--accent); }
#searchForm button, .primary { padding: 12px 22px; border-radius: 14px; border: none; background: var(--accent); color: #fff; font-size: 16px; font-weight: 600; }
#results { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.result { text-align: left; padding: 8px 12px; border-radius: 10px; border: 1px solid #efe3cf; background: #fff; color: var(--ink); font-size: 14px; }
.result:hover { border-color: var(--accent); }
#searchMsg { font-size: 14px; margin-top: 6px; opacity: 0.7; min-height: 1em; }
.row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.ghost { padding: 10px 18px; border-radius: 14px; border: 2px solid #efe3cf; background: transparent; color: var(--ink); font-size: 15px; }
.ghost:hover { border-color: var(--accent); }
.close { position: absolute; top: 14px; right: 14px; border: none; background: #f2e9da; width: 34px; height: 34px; border-radius: 50%; color: var(--ink); font-size: 15px; }
.globe { font-size: 64px; animation: spin 2.4s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { font-size: 14px; opacity: 0.7; min-height: 1em; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 20px; border-top: 2px dashed #efe3cf; padding-top: 14px; }
.split h3 { margin: 0 0 8px; font-size: 17px; }
#moves { margin-top: 16px; font-size: 13px; }
#moves summary { cursor: pointer; font-weight: 600; font-size: 17px; }
#moves dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; margin: 8px 0 0; }
#moves dt { font-weight: 600; white-space: nowrap; }
#moves dd { margin: 0; opacity: 0.85; }
#moves b { color: var(--accent); }
.swatchRow { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 14px; }
.swatchRow > span { width: 44px; opacity: 0.7; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #d8cbb5; padding: 0; }
.sw.on { box-shadow: 0 0 0 3px var(--ink); }
#passStats { font-size: 14px; line-height: 1.6; }
#passStats b { color: var(--accent); }
#records { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 8px; font-size: 12px; }
#records .recHead { width: 100%; font-size: 13px; font-weight: 600; }
#records span { background: #fff3dc; border-radius: 999px; padding: 2px 8px; }
#records b { color: var(--accent); }
#stamps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.stamp { font-size: 12px; border: 2px dashed var(--accent); color: var(--accent); border-radius: 10px; padding: 2px 8px; transform: rotate(-3deg); background: #fff; }
.stamp:nth-child(2n) { transform: rotate(2deg); border-color: #2a9d8f; color: #2a9d8f; }
.stamp:nth-child(3n) { transform: rotate(-1deg); border-color: #8338ec; color: #8338ec; }
#food { margin-top: 10px; font-size: 13px; }
.foodHead { font-weight: 600; margin-bottom: 4px; }
.foodNone { opacity: 0.7; }
.foodCity { margin: 6px 0; }
.foodCity small { opacity: 0.6; }
.foodDone { color: #2a9d8f; font-weight: 600; font-size: 12px; }
.dish { display: inline-block; margin: 3px 4px 0 0; padding: 2px 9px; border-radius: 999px; border: 1.5px dashed rgba(29,35,64,0.25); color: rgba(29,35,64,0.45); font-size: 12px; }
.dish.on { border: 1.5px solid #f4a261; background: #fff1dc; color: var(--ink); }
#badges { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px; }
.badgeHead { width: 100%; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.badge { font-size: 20px; filter: grayscale(1); opacity: 0.25; cursor: help; }
.badge.on { filter: none; opacity: 1; }
.toast.ach { background: linear-gradient(135deg, #f9c74fee, #f8961eee); color: #3a2200; }
.achIcon { font-size: 22px; vertical-align: middle; }
body.photo #hud > *:not(#pops) { display: none !important; }
body.photo #attribution { opacity: 0.4; }
.petToggle { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; cursor: pointer; }
.petToggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.pop.bark { color: #7a4a21; font-size: 18px; background: #fff; padding: 2px 10px; border-radius: 12px; text-shadow: none; }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity 0.4s; z-index: 5; }
#flash.on { opacity: 0.85; transition: none; }
/* Speed lines at the screen edges when moving fast (wingsuit, hook pulls, car surfing). */
#speedlines { position: fixed; inset: -10%; pointer-events: none; opacity: 0;
  background: repeating-conic-gradient(from 0deg at 50% 50%, transparent 0deg 3.2deg, rgba(255, 255, 255, 0.55) 3.2deg 3.6deg);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 38%, #000 75%);
  mask-image: radial-gradient(circle at 50% 50%, transparent 38%, #000 75%); }
body.photo #speedlines { display: none; }
.tip { font-size: 15px; background: #fff3dc; border-radius: 12px; padding: 8px 12px; min-height: 2.6em; }

/* Touch controls */
#stick, #jumpBtn { display: none; }
body.touch #stick { display: block; position: fixed; left: 28px; bottom: 110px; width: 130px; height: 130px; border-radius: 50%; background: rgba(20,26,48,0.35); border: 3px solid rgba(255,255,255,0.5); touch-action: none; }
body.touch #knob { position: absolute; left: 40px; top: 40px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,0.85); pointer-events: none; }
body.touch #jumpBtn { display: block; position: fixed; right: 32px; bottom: 120px; width: 90px; height: 90px; border-radius: 50%; border: none; background: rgba(255,90,95,0.85); color: #fff; font-size: 38px; touch-action: none; }
body.touch #controls { display: none; }
body.touch #game { touch-action: none; }

@media (max-width: 700px) {
  .split { grid-template-columns: 1fr; }
  #minimap { width: 120px; height: 120px; }
  #controls { display: none; }
  /* Phone layout: icon buttons stack down the left edge, panels stay compact. */
  #buttons { left: 16px; bottom: auto; top: 158px; gap: 6px; flex-direction: column; }
  #scorecard .best, .explLabel { display: none; }
  .iconbtn { width: 36px; height: 36px; font-size: 16px; }
  #fuel { width: 150px; }
  #scorecard { min-width: 0; }
  #dailyHud { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); width: auto; padding: 4px 12px; border-radius: 999px; }
  #dailyHud .bar, #dhScore, .dhLabel { display: none; }
  .dhHead { gap: 8px; }
  #quest { position: fixed; top: 172px; right: 16px; width: auto; max-width: 46vw; padding: 6px 12px; }
  #qList, #qHint, .qLabel, #gList { display: none; }
  #goals { position: fixed; top: 210px; right: 16px; width: auto; padding: 6px 12px; }
  .qHead { gap: 8px; white-space: nowrap; }
  #quest.framed #qHint { display: block; }
  #score { font-size: 28px; }
  #topcenter { width: calc(100vw - 120px); top: 214px; }
  .pill, .toast { font-size: 14px; }
  #mapwrap #coords { display: none; }
  /* Keep the button column clear of the jetpack panel (and the joystick on touch screens):
     wrap into a second column when the screen is short. */
  #buttons { flex-wrap: wrap; align-content: flex-start; max-height: max(130px, calc(100dvh - 260px)); }
  body.touch #buttons { max-height: max(130px, calc(100dvh - 420px)); }
}
.deFlag { font-size: 56px; }

/* Hats */
.hat { width: 34px; height: 34px; border-radius: 10px; border: 2px solid #efe3cf; background: #fff; font-size: 18px; padding: 0; cursor: pointer; }
.hat.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.hat.locked { filter: grayscale(1); opacity: 0.35; }
#hatMsg { font-size: 12px; opacity: 0.7; margin: -2px 0 6px 52px; min-height: 1em; }

/* Workshop */
#workshop { margin-top: 16px; }
#workshop h3 { display: flex; justify-content: space-between; align-items: center; }
#workshop .wallet { font-size: 14px; color: #b07a00; background: #fff3d0; border-radius: 999px; padding: 2px 10px; }
.upg { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px dashed #efe3cf; }
.upg .uIcon { font-size: 24px; }
.upg .uText { flex: 1; display: flex; flex-direction: column; font-size: 13px; }
.upg small { opacity: 0.7; }
.upg .pips { display: flex; gap: 3px; margin-top: 3px; }
.upg .pips i { width: 16px; height: 5px; border-radius: 3px; background: #efe3cf; }
.upg .pips i.on { background: var(--accent); }
.upg button { padding: 6px 10px; border-radius: 10px; border: none; background: var(--gold); color: var(--ink); font-weight: 600; font-family: inherit; cursor: pointer; min-width: 70px; }
.upg button:disabled { background: #eee; color: #999; cursor: default; }

/* Postcards */
#postcard { z-index: 12; }
.pcCard { width: min(860px, 100%); text-align: center; }
#pcImg { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); margin-top: 18px; }
#album figure { cursor: pointer; transition: transform 0.12s; }
#album figure:hover { transform: rotate(0deg) scale(1.06); }

/* First steps checklist (replaces the controls box until it's done) */
#firstSteps { position: fixed; right: 16px; bottom: 40px; font-size: 14px; min-width: 240px; }
.fsHead { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
#fsList { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
#fsList li { display: flex; gap: 8px; }
#fsList b { color: var(--gold); font-weight: 600; }
#fsList li.done { opacity: 0.55; text-decoration: line-through; }
body.tutorial #controls { display: none; }
@media (max-width: 700px) { #firstSteps { display: none; } }
body.touch #firstSteps { display: none; }

#vfFilter { position: absolute; left: 50%; top: -40px; transform: translateX(-50%); white-space: nowrap; background: var(--panel); padding: 3px 12px; border-radius: 999px; font-size: 13px; }

/* "Did you know?" card */
#fact { position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%); width: min(460px, calc(100vw - 32px)); font-size: 14px; line-height: 1.45; animation: factIn 0.35s ease; }
@keyframes factIn { from { opacity: 0; transform: translate(-50%, 12px); } }
.factHead { font-weight: 600; padding-right: 24px; }
.factHead b { color: var(--gold); }
#fact p { margin: 6px 0; opacity: 0.92; }
#fact a { color: #9fd3ff; font-size: 13px; }
#factClose { position: absolute; top: 8px; right: 8px; border: none; background: transparent; color: #fff; opacity: 0.7; font-size: 14px; cursor: pointer; }
@media (max-width: 700px) { #fact { bottom: 260px; font-size: 13px; } }

/* Graphics preset */
.gfxRow { display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 10px 0 2px; font-size: 13px; }
.gfxRow > span { opacity: 0.7; margin-right: 4px; }
.gfxBtn { padding: 5px 12px; border-radius: 999px; border: 2px solid #efe3cf; background: #fff; color: var(--ink); font-family: inherit; font-size: 13px; cursor: pointer; }
.gfxBtn.on { border-color: var(--ink); background: var(--ink); color: #fff; }
#settings label { display: inline-flex; align-items: center; gap: 4px; }
#settings input[type=range] { width: 90px; accent-color: var(--accent); }
#padStatus { opacity: 1 !important; font-weight: 600; }

/* Trip recap in the menu */
#recap { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; background: #fff3dc; border-radius: 14px; padding: 10px 14px; margin: 10px 0 0; font-size: 14px; }
#recap b { width: 100%; font-size: 15px; }
#journalBtn { margin-left: auto; padding: 5px 12px; font-size: 13px; }

/* ---------- Mystery City ---------- */
.daily.mystery { background: linear-gradient(135deg, #5f4bd8, #2a9d8f); box-shadow: 0 6px 18px rgba(95, 75, 216, 0.35); margin-top: 8px; }
#mysteryHud { width: 240px; border: 2px solid #8f7cf2; }
#mhTime { color: var(--gold); font-variant-numeric: tabular-nums; }
#mhSub { font-size: 12px; opacity: 0.85; margin: 4px 0; }
#mhClues { list-style: none; margin: 4px 0 8px; padding: 0; font-size: 13px; max-height: min(140px, 22vh); overflow: auto; }
#mhClues li { padding: 2px 0; animation: clueIn 0.5s ease-out; }
#mhClues li.none { opacity: 0.6; font-style: italic; }
@keyframes clueIn { from { background: rgba(143, 124, 242, 0.6); } to { background: transparent; } }
#mhGuess { width: 100%; padding: 7px 10px; font-size: 14px; }
#mhHint { width: 100%; margin-top: 6px; padding: 5px 10px; font-size: 13px; background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.3); }
#mhHint small { opacity: 0.75; font-size: 11px; }
#mhHint:disabled { opacity: 0.45; cursor: default; }
#mhGuess kbd { font: inherit; font-size: 11px; opacity: 0.8; border: 1px solid rgba(255,255,255,0.6); border-radius: 4px; padding: 0 4px; margin-left: 4px; }
body.mystery #coords, body.mystery #quest, body.mystery #goals { display: none !important; } /* names are hidden anyway; keep the column clear */
#grPlace small { font-size: 13px; font-weight: 500; opacity: 0.7; }
#guessMap { background: rgba(10, 14, 30, 0.6); z-index: 32; }
.gmCard { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 32px); display: flex; flex-direction: column; gap: 10px; background: #fffaf2; color: var(--ink); border-radius: 20px; padding: 14px; box-shadow: 0 16px 50px rgba(0,0,0,0.4); overflow: auto; }
.gmHead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.gmHead b { font-size: 20px; }
#gmMsg { font-size: 13px; opacity: 0.75; }
.gmWrap { position: relative; }
#gmCanvas { display: block; width: 100%; height: min(58vh, 520px); border-radius: 14px; cursor: crosshair; touch-action: none; background: #9fd3ef; }
.gmZoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.gmZoom button { width: 34px; height: 34px; border-radius: 10px; border: none; background: #fff; font-size: 20px; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,0.2); cursor: pointer; }
#gmPick { justify-content: flex-end; }
#guessMap.done #gmCanvas { height: min(34vh, 300px); }
#gmGo:disabled { opacity: 0.45; cursor: default; }
#gmResult { text-align: center; }
#grPlace { font-size: 20px; font-weight: 600; }
#grScore { font-size: 48px; font-weight: 700; color: var(--accent); line-height: 1.1; }
#grLine { font-size: 16px; font-weight: 600; color: #2a9d8f; }
#grBreak { font-size: 13px; opacity: 0.8; margin-top: 4px; }
#grClues { font-size: 13px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
#grClues span { background: #efe9ff; border-radius: 999px; padding: 2px 9px; }
#grMsg { font-size: 13px; min-height: 1.2em; margin-top: 4px; }
#gmResult .row { justify-content: center; margin-top: 8px; }
@media (max-width: 520px) { #mysteryHud { width: 200px; } #gmCanvas { height: 50vh; } }
