:root { --cy: #4ff6ff; --mg: #ff3df0; --yl: #fff27a; --bg: #03040b; --tx: #e8fbff; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; color: var(--tx);
  font-family: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; user-select: none; -webkit-user-select: none; }
canvas { display: block; position: fixed; inset: 0; cursor: crosshair; }
body.menu canvas { cursor: default; }
#dim { position: fixed; inset: 0; background: radial-gradient(ellipse at center, rgba(3,4,11,0.35), rgba(3,4,11,0.85)); opacity: 0; pointer-events: none; transition: opacity .3s; }
body.menu #dim { opacity: 1; }
.screen { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; overflow: auto; }
.screen.show { display: flex; animation: fadein .25s ease-out; }
@keyframes fadein { from { opacity: 0; transform: scale(1.02); } to { opacity: 1; transform: none; } }
h2 { margin: 0; font-size: clamp(30px, 5vw, 60px); font-weight: 900; letter-spacing: .12em; color: var(--cy);
  text-shadow: 0 0 18px rgba(79,246,255,.6), 3px 0 0 rgba(255,61,240,.55), -3px 0 0 rgba(79,246,255,.55); }
.sub { margin: 0; opacity: .85; font-size: clamp(14px, 1.4vw, 18px); max-width: 760px; }
kbd { font: 700 11px/1 system-ui, sans-serif; border: 1px solid rgba(255,255,255,.35); border-radius: 4px; padding: 2px 5px; margin-left: 6px; opacity: .8; vertical-align: middle; }
button { font: inherit; color: inherit; cursor: pointer; }
.big { background: linear-gradient(90deg, rgba(79,246,255,.18), rgba(255,61,240,.18)); border: 2px solid var(--cy); color: #fff;
  padding: 12px 38px; font-size: 20px; font-weight: 900; letter-spacing: .14em; border-radius: 4px; box-shadow: 0 0 22px rgba(79,246,255,.35), inset 0 0 18px rgba(79,246,255,.15);
  transition: transform .08s, box-shadow .15s; }
.big:hover, .big:focus-visible { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 34px rgba(79,246,255,.7), inset 0 0 22px rgba(79,246,255,.3); outline: none; }
.big.alt { border-color: var(--mg); box-shadow: 0 0 22px rgba(255,61,240,.35); }
.small { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.25); padding: 8px 16px; border-radius: 4px; font-weight: 700; letter-spacing: .06em; }
.small:hover:not(:disabled) { border-color: var(--cy); background: rgba(79,246,255,.12); }
.small:disabled { opacity: .35; cursor: not-allowed; }
.link { background: none; border: 0; text-decoration: underline; opacity: .7; padding: 4px; }
.link:hover { opacity: 1; }

/* title */
.logo { display: flex; gap: .25em; font-weight: 900; font-size: clamp(56px, 11vw, 150px); line-height: .9; letter-spacing: .06em; position: relative; }
.logo .l1 { color: #fff; text-shadow: 0 0 24px rgba(79,246,255,.9), 0 0 60px rgba(79,246,255,.5); }
.logo .l2 { color: transparent; -webkit-text-stroke: 2px var(--mg); text-shadow: 0 0 26px rgba(255,61,240,.7); animation: echoShift 3.2s ease-in-out infinite; }
@keyframes echoShift { 0%, 100% { transform: translateX(0); opacity: 1; } 50% { transform: translateX(10px); opacity: .75; } }
.logo::after { content: 'ECHO LOOP'; position: absolute; left: 14px; top: 10px; color: transparent; -webkit-text-stroke: 1px rgba(79,246,255,.25); pointer-events: none; animation: ghost 3.2s ease-in-out infinite; white-space: nowrap; word-spacing: .1em; }
@keyframes ghost { 0%, 100% { transform: translate(0,0); opacity: .2; } 50% { transform: translate(-16px, 8px); opacity: .5; } }
.tag { margin: 0; font-size: clamp(15px, 1.6vw, 20px); max-width: 720px; opacity: .9; }
.cores { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.core { width: 190px; padding: 12px 14px; text-align: left; background: rgba(8,12,30,.75); border: 1px solid rgba(255,255,255,.15); border-radius: 6px; transition: transform .1s, border-color .1s; }
.core:hover:not(.locked) { transform: translateY(-3px); }
.core.sel { border-color: var(--c); box-shadow: 0 0 22px color-mix(in srgb, var(--c) 45%, transparent); }
.core b { display: block; color: var(--c); letter-spacing: .14em; font-size: 16px; }
.core span { display: block; font-size: 12px; opacity: .8; margin-top: 4px; line-height: 1.35; }
.core.locked { opacity: .45; cursor: not-allowed; }
.core.locked b::after { content: ' 🔒'; font-size: 12px; }
.modes { display: flex; gap: 8px; }
.mode { background: transparent; border: 1px solid rgba(255,255,255,.2); padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 700; opacity: .7; }
.mode.sel { border-color: var(--yl); color: var(--yl); opacity: 1; }
.mode small { opacity: .7; font-weight: 400; }
.best { margin: 0; font-size: 14px; opacity: .8; min-height: 1em; }
.how { display: grid; gap: 4px; font-size: 13px; opacity: .78; max-width: 820px; background: rgba(0,0,0,.3); padding: 10px 16px; border-radius: 6px; }
.how em { color: var(--cy); font-style: normal; font-weight: 700; }
.foot { font-size: 13px; opacity: .8; }

/* upgrade cards */
.cards { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; margin: 10px 0; }
.card { width: 230px; min-height: 270px; padding: 18px 16px; background: rgba(6,10,26,.92); border: 2px solid var(--c); border-radius: 8px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: 0 0 24px color-mix(in srgb, var(--c) 35%, transparent), inset 0 0 30px color-mix(in srgb, var(--c) 12%, transparent);
  transition: transform .1s, box-shadow .1s; animation: dealin .35s cubic-bezier(.2,1.4,.4,1) both; position: relative; }
.card:nth-child(2) { animation-delay: .06s; } .card:nth-child(3) { animation-delay: .12s; }
@keyframes dealin { from { opacity: 0; transform: translateY(40px) rotate(-3deg) scale(.9); } to { opacity: 1; transform: none; } }
.card:hover, .card:focus-visible { transform: translateY(-8px) scale(1.04); box-shadow: 0 0 44px color-mix(in srgb, var(--c) 70%, transparent); outline: none; }
.card .rar { font-size: 11px; letter-spacing: .2em; font-weight: 800; color: var(--c); }
.card .nm { font-size: 20px; font-weight: 900; letter-spacing: .04em; }
.card .ds { font-size: 14px; opacity: .9; line-height: 1.35; }
.card .lv { margin-top: auto; font-size: 12px; opacity: .7; }
.card .key { position: absolute; top: 8px; left: 10px; font-size: 12px; font-weight: 800; opacity: .6; }
.card .tagc { position: absolute; top: 8px; right: 10px; font-size: 10px; font-weight: 800; letter-spacing: .14em; opacity: .7; }
.card svg { width: 64px; height: 64px; filter: drop-shadow(0 0 8px var(--c)); }
.upbar { display: flex; align-items: center; gap: 14px; }
.bank { color: #5dffc0; font-weight: 800; }
.buildlist { font-size: 12px; opacity: .7; max-width: 760px; }

/* game over */
.stats { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 10px; }
.stat { background: rgba(8,12,30,.8); border: 1px solid rgba(255,255,255,.12); border-radius: 6px; padding: 10px 14px; }
.stat b { display: block; font-size: 26px; color: #fff; }
.stat span { font-size: 12px; opacity: .7; letter-spacing: .08em; }
.stat.hl b { color: var(--yl); }
.unlock { color: var(--yl); font-weight: 800; min-height: 1em; margin: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; align-items: center; }
.col { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }

.settings-body { display: grid; gap: 12px; min-width: 300px; background: rgba(8,12,30,.85); padding: 18px 22px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12); }
.settings-body label { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-weight: 700; }
.settings-body label.chk { justify-content: flex-start; }
input[type=range] { accent-color: var(--cy); width: 170px; }
input[type=checkbox] { accent-color: var(--cy); width: 18px; height: 18px; }
.creditsBody { max-width: 640px; line-height: 1.5; opacity: .9; background: rgba(8,12,30,.85); padding: 14px 22px; border-radius: 8px; }

#hint { position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%); font-size: 15px; font-weight: 700; background: rgba(0,0,0,.45); padding: 8px 16px; border-radius: 20px; opacity: 0; transition: opacity .4s; pointer-events: none; white-space: nowrap; }
#hint.show { opacity: 1; }
#toast { position: fixed; left: 50%; top: 90px; transform: translateX(-50%); font-weight: 800; color: var(--yl); opacity: 0; transition: opacity .3s; pointer-events: none; }
#toast.show { opacity: 1; }
@media (max-height: 720px) { .how { display: none; } .card { min-height: 220px; } .cores .core span { display: none; } }
