:root {
  --gold: #ffd75e;
  --gold2: #f0a93a;
  --cream: #f7e2b6;
  --cream2: #d8af74;
  --chrome: #c9d5e3;
  --blue: #3a9bff;
  --orange: #ff8a2a;
  --ink: #0d1016;
  --carbon: repeating-linear-gradient(45deg, #15181d 0 2px, #1c1f25 2px 4px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0a09; color: #fff; }
body { font-family: 'Barlow Condensed', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }

#backdrop {
  position: fixed; inset: -40px;
  background: url(assets/bg.jpg) center / cover;
  filter: blur(26px) brightness(.55);
}

#stage {
  position: absolute; left: 50%; top: 50%;
  width: 1408px; height: 768px;
  background: url(assets/bg.jpg) 0 0 / 1408px 768px;
  transform-origin: 50% 50%;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(0,0,0,.6);
}
#dust { position: absolute; inset: 0; pointer-events: none; }

/* ---------- logo: covers the baked title ---------- */
#plate {
  position: absolute; left: 207px; top: 47px; width: 496px; height: 100px;
  border-radius: 22px;
  background: var(--carbon);
  box-shadow: inset 0 0 0 2px #2b2f36, inset 0 2px 0 3px rgba(255,255,255,.08), 0 0 0 2px #0a0b0d;
  display: grid; place-items: center;
}
.title {
  position: absolute; left: 50%; top: 50%; margin: 0;
  font: 400 92px/1 'Russo One', sans-serif; letter-spacing: 1px;
  transform: translate(-50%, -57%) skewX(-5deg) scale(.63, 1.05);
  color: transparent; white-space: nowrap;
  -webkit-text-stroke: 13px #2a0303;
  text-shadow: 0 5px 0 #2a0303, 0 7px 8px rgba(0,0,0,.6);
}
.title::before, .title::after {
  content: attr(data-text); position: absolute; left: 0; top: 0;
}
.title::before { -webkit-text-stroke: 7px #ffc53d; text-shadow: none; }
.title::after {
  -webkit-text-stroke: 0;
  background: linear-gradient(#ff8a5c 0%, #ff3a1f 30%, #d0140c 55%, #8e0806 100%);
  -webkit-background-clip: text; background-clip: text;
  text-shadow: none;
}
#emblem { position: absolute; left: 283px; top: 104px; width: 340px; height: 50px; pointer-events: none; }

/* ---------- main menu ---------- */
#menu {
  position: absolute; left: 224px; top: 211px; width: 452px; height: 392px;
  background: var(--carbon);
  box-shadow: inset 16px 0 22px -14px rgba(255,90,30,.75), inset -16px 0 22px -14px rgba(255,90,30,.75), inset 0 -10px 18px -12px rgba(255,60,20,.6);
  border-radius: 0 0 16px 16px;
  -webkit-mask-image: linear-gradient(transparent, #000 10px);
          mask-image: linear-gradient(transparent, #000 10px);
}
.mb {
  position: absolute; left: 27px; width: 398px;
  margin-top: -211px;
  display: flex; align-items: center; padding: 0 0 0 100px;
  border: 0; border-radius: 12px;
  background: linear-gradient(#262d39, #10141c 48%, #0b0e14 52%, #151b26);
  box-shadow:
    0 0 0 3px var(--chrome),
    inset 0 2px 0 rgba(255,255,255,.18),
    0 3px 0 0 #7cc4ff,
    0 9px 16px -6px var(--blue);
  transition: box-shadow .18s, transform .18s, filter .18s;
}
.mb span {
  font-weight: 700; font-size: 39px; line-height: 1; letter-spacing: .5px; text-transform: uppercase; white-space: nowrap;
  transform: scaleX(.9); transform-origin: 0 50%;
  background: linear-gradient(var(--cream) 30%, var(--cream2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,.6));
}
.ico {
  position: absolute;
  left: calc((var(--x) - 255) * 1px); top: calc((var(--y) - 4 - var(--bt)) * 1px);
  width: calc((var(--w) + 8) * 1px); height: calc((var(--h) + 8) * 1px);
  background: var(--img) 0 0 / 100% 100% no-repeat;
}
.mb.on {
  box-shadow:
    0 0 0 3px #ffc46b,
    0 0 0 5px rgba(255,120,30,.55),
    0 0 22px 6px rgba(255,130,40,.65),
    inset 0 0 22px rgba(255,120,30,.35),
    inset 0 2px 0 rgba(255,255,255,.2);
  transform: scale(1.015);
}
.mb[data-act=start] span { font-size: 44px; transform: none; }
.mb.on span { background-image: linear-gradient(#fff3a0 10%, var(--gold) 45%, var(--gold2)); }
.mb:active { transform: scale(.985); filter: brightness(1.2); }
.mb.on::after {
  content: ''; position: absolute; inset: 0; border-radius: 12px; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.16) 50%, transparent 65%) -200% 0 / 200% 100% no-repeat;
  animation: sheen 2.6s ease-in-out infinite;
}
@keyframes sheen { 0%, 40% { background-position: -200% 0; } 100% { background-position: 300% 0; } }

/* ---------- minimap + daily bar ---------- */
#map {
  position: absolute; left: 15px; top: 601px; width: 161px; height: 154px;
  border: 0; border-radius: 6px; background: transparent;
  transition: box-shadow .2s;
}
#map:hover, #daily:hover { box-shadow: 0 0 0 2px #ffd75e, 0 0 18px rgba(255,200,80,.6); }
.ping {
  position: absolute; left: 60px; top: 48px; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #7dff7a; animation: ping 1.6s ease-out infinite;
}
@keyframes ping { from { transform: scale(.5); opacity: 1; } to { transform: scale(2.6); opacity: 0; } }
#daily {
  position: absolute; left: 207px; top: 641px; width: 982px; height: 50px;
  border: 0; background: transparent; clip-path: polygon(3% 0, 97% 0, 100% 50%, 97% 100%, 3% 100%, 0 50%);
  transition: box-shadow .2s, background .2s;
}
#daily:hover { background: rgba(255,215,94,.08); }
#daily .bar { position: absolute; left: 60px; right: 60px; bottom: 5px; height: 3px; background: rgba(255,255,255,.12); border-radius: 2px; }
#daily .fill { display: block; height: 100%; width: 0; border-radius: 2px; background: linear-gradient(90deg, var(--orange), var(--gold)); box-shadow: 0 0 6px var(--gold); transition: width .6s; }
#daily .count { display: none;  position: absolute; right: 58px; top: -1px; font-size: 13px; font-weight: 700; color: var(--gold); letter-spacing: .5px; }
#daily.done .count { color: #7dff7a; }

/* ---------- player bar: covers the baked one ---------- */
#pbar {
  position: absolute; left: 812px; top: 715px; width: 596px; height: 42px;
  padding-right: 12px;
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  background: linear-gradient(90deg, rgba(23,25,29,0), #191b1f 18px), var(--carbon);
  background-blend-mode: normal;
  font-size: 25px; font-weight: 600; white-space: nowrap;
}
#pbar b { font-weight: 600; color: #e8c57d; }
#pbar em { font-style: normal; color: #b08a45; margin: 0 1px; }
#pbar span { color: #f4f4f4; }
#pbar span.bump { animation: bump .6s; }
@keyframes bump { 30% { color: var(--gold); text-shadow: 0 0 12px var(--gold); } }

/* ---------- windows ---------- */
#win {
  position: absolute; left: 726px; top: 128px; width: 650px; height: 498px;
  display: flex; flex-direction: column;
  border-radius: 18px;
  background: linear-gradient(rgba(14,17,23,.94), rgba(10,12,16,.96)), var(--carbon);
  box-shadow: 0 0 0 3px var(--chrome), 0 0 0 6px #1a1d22, 0 0 0 8px rgba(255,255,255,.18), 0 0 40px rgba(255,90,30,.35), 0 20px 50px rgba(0,0,0,.6);
  animation: win-in .28s cubic-bezier(.2,.9,.3,1.2);
}
#win[hidden] { display: none; }
@keyframes win-in { from { transform: translateX(30px) scale(.96); opacity: 0; } }
#win header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 10px 24px; border-bottom: 2px solid rgba(255,138,42,.5);
  box-shadow: 0 1px 0 rgba(255,255,255,.06);
}
#win h2 {
  margin: 0; font-size: 36px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  background: linear-gradient(#fff3a0, var(--gold) 45%, var(--gold2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#win-close {
  width: 40px; height: 40px; border-radius: 10px; border: 0; font-size: 20px;
  background: linear-gradient(#2a313d, #12161e); box-shadow: 0 0 0 2px var(--chrome);
}
#win-close:hover { box-shadow: 0 0 0 2px #ffc46b, 0 0 12px rgba(255,130,40,.7); }
#win-body { flex: 1; overflow: auto; padding: 18px 24px 22px; font-size: 21px; }
#win-body::-webkit-scrollbar { width: 8px; }
#win-body::-webkit-scrollbar-thumb { background: #3a404b; border-radius: 4px; }

.muted { color: #9aa3b2; font-weight: 500; }
.gold { color: var(--gold); }
.row { display: flex; align-items: center; gap: 14px; }
.grid { display: grid; gap: 12px; }
.card {
  position: relative; padding: 12px 16px; border-radius: 12px;
  background: linear-gradient(#1f2530, #11151c);
  box-shadow: 0 0 0 2px #39414e, inset 0 1px 0 rgba(255,255,255,.08);
}
.card.pick { cursor: pointer; transition: box-shadow .15s; }
.card.pick:hover, .card.sel { box-shadow: 0 0 0 2px #ffc46b, 0 0 14px rgba(255,130,40,.5); }
.card h3 { margin: 0; font-size: 25px; font-weight: 700; text-transform: uppercase; color: var(--cream); }
.card .meta { font-size: 18px; color: #aab3c2; font-weight: 500; }
.cta {
  border: 0; border-radius: 10px; padding: 8px 20px; font-size: 22px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: #1a0e00; background: linear-gradient(#ffe27a, #f5a623);
  box-shadow: 0 0 0 2px #ffcf6a, 0 4px 0 #a35a00, 0 6px 14px rgba(255,140,30,.45);
  transition: transform .1s, filter .15s;
}
.cta:hover { filter: brightness(1.08); }
.cta:active { transform: translateY(2px); box-shadow: 0 0 0 2px #ffcf6a, 0 2px 0 #a35a00; }
.cta:disabled { filter: grayscale(1) brightness(.6); cursor: not-allowed; }
.cta.blue { color: #fff; background: linear-gradient(#4aa8ff, #1662d6); box-shadow: 0 0 0 2px #9fd0ff, 0 4px 0 #0b3a85, 0 6px 14px rgba(40,140,255,.45); }
.cta.ghost { color: var(--cream); background: linear-gradient(#2a313d, #141920); box-shadow: 0 0 0 2px var(--chrome), 0 4px 0 #05070a; }
.cta.red { color: #fff; background: linear-gradient(#ff5a3c, #b40f0a); box-shadow: 0 0 0 2px #ff9a7a, 0 4px 0 #5e0503, 0 6px 14px rgba(255,60,30,.45); }

.meter { height: 12px; border-radius: 6px; background: #0a0c10; box-shadow: inset 0 0 0 1px #343b47; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--orange), var(--gold)); box-shadow: 0 0 8px rgba(255,200,80,.6); }
.meter.big { height: 22px; border-radius: 11px; }
.pips { display: flex; gap: 4px; }
.pips i { width: 22px; height: 8px; border-radius: 3px; background: #2b313b; }
.pips i.on { background: linear-gradient(90deg, var(--orange), var(--gold)); box-shadow: 0 0 6px rgba(255,180,60,.6); }

.server { display: grid; grid-template-columns: 1fr 90px 70px 96px; align-items: center; gap: 10px; }
.server .ms { font-weight: 700; }
.ms.good { color: #7dff7a; } .ms.mid { color: var(--gold); } .ms.bad { color: #ff6a50; }

label.set { display: grid; grid-template-columns: 190px 1fr 60px; align-items: center; gap: 14px; margin: 0 0 16px; color: var(--cream); font-weight: 600; }
input[type=range] { width: 100%; accent-color: var(--orange); }
input[type=text] {
  font: inherit; font-size: 21px; color: #fff; padding: 6px 12px; border-radius: 8px; border: 0;
  background: #0b0e13; box-shadow: inset 0 0 0 2px #3a4250; width: 100%;
}
input[type=text]:focus { outline: none; box-shadow: inset 0 0 0 2px #ffc46b; }
.toggle { justify-self: start; width: 64px; height: 32px; border-radius: 16px; border: 0; position: relative; background: #2b313b; box-shadow: inset 0 0 0 2px #3a4250; }
.toggle::after { content: ''; position: absolute; left: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%; background: #c9d5e3; transition: left .18s; }
.toggle.on { background: linear-gradient(90deg, var(--orange), var(--gold)); }
.toggle.on::after { left: 36px; background: #fff; }
.seg { display: flex; gap: 6px; }
.seg button { border: 0; border-radius: 8px; padding: 4px 14px; font-size: 19px; font-weight: 700; background: #1d222b; color: #aab3c2; box-shadow: inset 0 0 0 2px #343b47; }
.seg button.on { color: #1a0e00; background: linear-gradient(#ffe27a, #f5a623); box-shadow: none; }

.tilling { text-align: center; padding-top: 30px; }
.tilling .car { font-size: 64px; display: inline-block; animation: drift .5s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translateX(-14px) rotate(-4deg); } to { transform: translateX(14px) rotate(3deg); } }

#toast {
  position: absolute; left: 50%; top: 18px; transform: translate(-50%, -120%);
  padding: 10px 22px; border-radius: 12px; font-size: 22px; font-weight: 700; white-space: nowrap;
  background: linear-gradient(#232a36, #0d1118); box-shadow: 0 0 0 2px #ffc46b, 0 0 20px rgba(255,130,40,.5);
  color: var(--gold); transition: transform .3s cubic-bezier(.2,.9,.3,1.3); pointer-events: none; z-index: 5;
}
#toast.show { transform: translate(-50%, 0); }

#blackout {
  position: absolute; inset: 0; z-index: 9; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  animation: fade 1.2s;
}
#blackout[hidden] { display: none; }
#blackout p { margin: 0; text-align: center; font-size: 54px; font-weight: 700; color: var(--cream); text-transform: uppercase; letter-spacing: 2px; }
#blackout small { font-size: 26px; color: #8a919c; letter-spacing: 1px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- launch bar: the token on Pons, its CA and link (set in app.js LAUNCH) ---------- */
#launch {
  position: fixed; left: 0; right: 0; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center; gap: 22px; flex-wrap: wrap;
  min-height: 64px; padding: 10px 18px;
  color: #1a0400; font: 700 18px/1.2 'Barlow Condensed', sans-serif;
  background: #ff2a12; box-shadow: 0 4px 0 #6e0600, 0 8px 30px rgba(255,60,20,.55);
  animation: l-flash 1s ease-in-out infinite;
}
@keyframes l-flash { 0%, 100% { background: #ff2a12; } 50% { background: #ffc23a; } }
#launch .l-pulse { width: 14px; height: 14px; border-radius: 50%; background: #1a0400; animation: l-blink .5s steps(2, start) infinite; }
@keyframes l-blink { to { visibility: hidden; } }
#launch .l-head { font-size: 30px; letter-spacing: 1px; text-transform: uppercase; text-shadow: 0 2px 0 rgba(255,255,255,.35); }
#launch .l-ca { display: inline-flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; border-radius: 10px; background: rgba(14,6,2,.92); color: #ffe2b0; box-shadow: 0 0 0 2px #ffd75e; }
#launch .l-k { font-size: 16px; letter-spacing: 2px; color: var(--gold); }
#launch code { font: 600 16px ui-monospace, Menlo, monospace; color: #fff; word-break: break-all; }
#launch .l-tba { color: #ffe2b0; font-weight: 500; }
#launch .l-copy { border: 0; border-radius: 6px; padding: 5px 12px; font-size: 16px; font-weight: 700; color: #1a0e00; background: linear-gradient(#ffe27a, #f5a623); }
#launch .l-buy { padding: 10px 20px; border-radius: 10px; font-size: 22px; text-decoration: none; text-transform: uppercase; letter-spacing: 1px; color: var(--gold); background: #140600; box-shadow: 0 0 0 2px #ffd75e, 0 4px 0 #000; }
#launch a.l-buy:hover { color: #fff; }
#launch .l-off { opacity: .85; }
@media (prefers-reduced-motion: reduce) { #launch, #launch .l-pulse { animation: none; } }
@media (max-width: 700px) { #launch { gap: 8px; } #launch .l-head { font-size: 22px; width: 100%; text-align: center; } #launch code { font-size: 12px; } #launch .l-buy { font-size: 17px; } }

/* ---------- 3D farm ---------- */
#farm { position: fixed; left: 0; right: 0; bottom: 0; top: var(--bar, 64px); z-index: 15; background: #e9a35f; overflow: hidden; }
#farm[hidden] { display: none; }
#f-gl { width: 100%; height: 100%; display: block; }
.f-hud { position: absolute; inset: 0; pointer-events: none; font-size: 20px; }
.f-hud button, .f-hud .f-msg { pointer-events: auto; }
.f-panel { position: absolute; top: 14px; padding: 12px 16px; width: 260px; border-radius: 14px;
  background: linear-gradient(rgba(20,24,32,.88), rgba(10,12,16,.9)); box-shadow: 0 0 0 2px var(--chrome), 0 8px 24px rgba(0,0,0,.4); }
.f-left { left: 14px; } .f-right { right: 14px; width: 200px; }
.f-title { font-size: 26px; font-weight: 700; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.f-line { display: flex; justify-content: space-between; margin: 6px 0; color: var(--cream); font-weight: 600; }
.f-line b { color: #fff; }
.f-speed { text-align: center; line-height: 1; margin-bottom: 4px; }
.f-speed b { font-size: 52px; color: #fff; } .f-speed span { display: block; font-size: 16px; color: var(--cream2); }
.f-right .cta { width: 100%; margin-top: 10px; font-size: 18px; padding: 6px; }
#f-map { position: absolute; left: 14px; top: 176px; border-radius: 10px; box-shadow: 0 0 0 2px var(--chrome); background: #7f8a40; }
.f-help { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); padding: 6px 16px; border-radius: 10px;
  background: rgba(10,12,16,.75); color: var(--cream); font-weight: 600; white-space: nowrap; }
.f-msg { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); padding: 14px 28px; border-radius: 16px;
  background: linear-gradient(#232a36, #0d1118); box-shadow: 0 0 0 3px #ffc46b, 0 0 30px rgba(255,130,40,.5);
  font-size: 30px; font-weight: 700; color: var(--gold); text-transform: uppercase; text-align: center; }
.f-msg[hidden] { display: none; }
.f-sum h3 { margin: 0 0 8px; font-size: 34px; } .f-sum p { margin: 6px 0; font-size: 22px; color: var(--cream); text-transform: none; }
.f-sum .big { font-size: 40px; color: var(--gold); } .f-sum .cta { margin-top: 14px; }
.f-touch { display: none; }
@media (pointer: coarse) {
  .f-help { display: none; }
  .f-touch { display: flex; position: absolute; left: 12px; right: 12px; bottom: 14px; justify-content: space-between; align-items: flex-end; }
  .f-touch div { display: flex; gap: 10px; }
  .f-touch button { pointer-events: auto; width: 74px; height: 74px; border-radius: 50%; border: 0; font-size: 20px; font-weight: 700;
    color: #fff; background: rgba(20,24,32,.7); box-shadow: 0 0 0 2px var(--chrome); touch-action: none; user-select: none; -webkit-user-select: none; }
  .f-touch [data-k=gas] { background: rgba(255,60,20,.8); }
  .f-panel { transform: scale(.8); transform-origin: top left; } .f-right { transform-origin: top right; }
  #f-map { display: none; }
}
