/* Mutation Mania */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1118; color: #e8f1f8; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; border-radius: 10px; background: #243344; padding: 8px 12px; }
button:hover { background: #2e4258; }
button:disabled { opacity: 0.45; cursor: default; }
button.go { background: #1f9d5b; font-weight: 700; }
button.go:hover { background: #25b96b; }
button.warn { background: #b13a4a; }
input { font: inherit; color: inherit; background: #0f1822; border: 1px solid #33485e; border-radius: 8px; padding: 8px 10px; user-select: text; -webkit-user-select: text; }
.hidden { display: none !important; }
#scene, #scene canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
#hud > * { pointer-events: auto; }
#wallet { position: absolute; top: 8px; left: 8px; display: flex; flex-wrap: wrap; gap: 6px; max-width: 60vw; pointer-events: none; }
.cur { background: rgba(10, 16, 24, 0.82); border-radius: 10px; padding: 5px 10px; display: flex; gap: 8px; align-items: baseline; font-variant-numeric: tabular-nums; border-left: 4px solid #888; }
.cur b { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.7; }
.cur span { font-weight: 700; font-size: 17px; }
.cur.cash { border-color: #4be38a; } .cur.cash span { color: #7dffb0; }
.cur.dna { border-color: #58b7ff; } .cur.dna span { color: #9fd6ff; }
.cur.rp { border-color: #c77dff; } .cur.rp span { color: #e0b8ff; }
.cur.tokens { border-color: #ffd23f; } .cur.tokens span { color: #ffe58a; }
#mats { flex-basis: 100%; font-size: 12px; opacity: 0.8; padding-left: 4px; text-shadow: 0 1px 2px #000; }
#menu { position: absolute; top: 8px; right: 8px; display: grid; grid-template-columns: repeat(2, auto); gap: 6px; }
#menu button { position: relative; background: rgba(20, 32, 46, 0.9); font-weight: 600; font-size: 14px; padding: 9px 12px; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ff4f7b; color: #fff; font-size: 11px; font-style: normal; line-height: 18px; text-align: center; }
#goal { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); max-width: 36vw; background: rgba(10, 16, 24, 0.75); border-radius: 10px; padding: 6px 12px; font-size: 14px; text-align: center; pointer-events: none; }
#goal:empty { display: none; }
#use { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); background: #1f9d5b; padding: 12px 22px; font-size: 18px; font-weight: 700; border-radius: 14px; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; align-items: center; max-width: 86vw; }
#use.no { background: #56636f; }
#use small { font-weight: 500; font-size: 12px; opacity: 0.9; }
#toasts { position: absolute; left: 8px; bottom: 26px; display: flex; flex-direction: column; gap: 6px; max-width: min(60vw, 360px); pointer-events: none; }
.toast { background: rgba(10, 16, 24, 0.88); border-left: 4px solid #58b7ff; border-radius: 8px; padding: 7px 11px; font-size: 14px; animation: toast 4s forwards; }
.toast.good { border-color: #4be38a; } .toast.bad { border-color: #ff4f7b; } .toast.gold { border-color: #ffd23f; }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px); } 6% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }
#stick { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); border: 2px solid rgba(255, 255, 255, 0.25); pointer-events: none; }
#knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 255, 255, 0.45); transform: translate(-50%, -50%); }

/* Panels */
#panel { position: fixed; inset: 4vh 4vw; max-width: 900px; margin: 0 auto; background: rgba(13, 21, 31, 0.97); border: 1px solid #2b3d50; border-radius: 16px; display: flex; flex-direction: column; box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7); }
#panel header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #22313f; }
#panel h2 { margin: 0; font-size: 20px; }
#panel-tabs { display: flex; gap: 6px; padding: 8px 16px 0; flex-wrap: wrap; }
#panel-tabs:empty { display: none; }
#panel-tabs button { background: #18232f; font-size: 14px; }
#panel-tabs button.on { background: #2f6fb1; font-weight: 700; }
#panel-body { flex: 1; overflow-y: auto; padding: 12px 16px 16px; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.note { opacity: 0.8; font-size: 14px; margin: 0 0 10px; line-height: 1.4; }
.bar { position: sticky; top: -12px; z-index: 2; background: #101a26; border: 1px solid #2b3d50; border-radius: 12px; padding: 10px; margin-bottom: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.card { background: #131e2a; border: 2px solid #22313f; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; font-size: 13px; position: relative; }
.card.pick { cursor: pointer; }
.card.on { border-color: #4be38a; background: #17301f; }
.card img { width: 72px; height: 72px; }
.card.unknown img { filter: brightness(0) opacity(0.5); }
.card .name { font-weight: 700; font-size: 14px; }
.card .sub { opacity: 0.75; font-size: 12px; }
.card .tank { position: absolute; top: 6px; left: 6px; font-size: 10px; background: #2f6fb1; border-radius: 6px; padding: 1px 6px; }
.chip { display: inline-block; background: #2a3a4c; border-radius: 6px; padding: 1px 6px; font-size: 11px; margin: 1px; }
.row { display: flex; align-items: center; gap: 10px; background: #131e2a; border: 1px solid #22313f; border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.row .grow { flex: 1; min-width: 0; }
.row h3 { margin: 0 0 2px; font-size: 15px; }
.row p { margin: 0; font-size: 13px; opacity: 0.8; }
.row .buttons { display: flex; flex-direction: column; gap: 5px; }
.row.done { border-color: #4be38a; }
.row.now { border-color: #ffd23f; background: #2a2613; }
.meter { height: 8px; background: #0b121a; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: #4be38a; }
.level { font-size: 11px; border-radius: 6px; padding: 1px 6px; background: #2a3a4c; margin-left: 6px; }
.chances { font-size: 11px; margin-top: 4px; }
.chances span { margin-right: 6px; white-space: nowrap; }
table.board { width: 100%; border-collapse: collapse; font-size: 14px; }
table.board td, table.board th { padding: 7px 8px; border-bottom: 1px solid #22313f; text-align: left; }
table.board td:last-child, table.board th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
table.board tr.me td { color: #7dffb0; font-weight: 700; }

/* A new creature */
#reveal { position: fixed; inset: 0; background: rgba(4, 8, 12, 0.8); display: flex; align-items: center; justify-content: center; z-index: 5; }
.reveal-card { background: #101a26; border: 3px solid #4be38a; border-radius: 20px; padding: 18px 26px; text-align: center; min-width: 260px; max-width: 90vw; animation: pop 0.35s; }
.reveal-card img { width: 160px; height: 160px; }
.reveal-card h2 { margin: 4px 0; font-size: 26px; }
.reveal-card p { margin: 3px 0; font-size: 14px; }
#reveal-kicker { text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; opacity: 0.8; }
#reveal-rarity { font-weight: 800; font-size: 16px; }
#reveal-ok { margin-top: 12px; background: #1f9d5b; font-weight: 700; padding: 10px 28px; font-size: 16px; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* Title */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 30%, rgba(31, 157, 91, 0.35), rgba(5, 9, 13, 0.94) 65%); z-index: 6; overflow-y: auto; touch-action: pan-y; }
.screen .panel { text-align: center; padding: 24px; max-width: 520px; }
.logo { font-size: clamp(44px, 11vw, 84px); line-height: 0.95; margin: 0 0 10px; font-weight: 900; letter-spacing: 0.02em; color: #7dffb0; text-shadow: 0 0 24px rgba(75, 227, 138, 0.7), 0 4px 0 #0c5a33; }
.tag { font-size: 17px; opacity: 0.9; }
#play-btn { background: #1f9d5b; font-size: 22px; font-weight: 800; padding: 14px 34px; border-radius: 16px; margin: 14px 0; }
.help { text-align: left; background: rgba(10, 16, 24, 0.7); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.help summary { cursor: pointer; font-weight: 700; }
.help ul { padding-left: 18px; margin: 8px 0 0; line-height: 1.45; }
.small { font-size: 12px; opacity: 0.6; }

@media (max-width: 720px) {
  #menu { grid-template-columns: repeat(2, auto); gap: 4px; }
  #menu button { font-size: 12px; padding: 7px 8px; }
  .cur { padding: 3px 7px; } .cur span { font-size: 14px; } .cur b { font-size: 9px; }
  #wallet { max-width: 52vw; }
  #goal { top: auto; bottom: 96px; max-width: 80vw; font-size: 13px; }
  #toasts { bottom: 140px; }
  #panel { inset: 2vh 2vw; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  #use { bottom: 30px; }
}
/* The small dot in the middle of the view: what you are looking at. */
#dot { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255, 255, 255, 0.75); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); pointer-events: none; }
