:root { --cell: 40px; --ink: #f3e9dc; --dim: #a8968a; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; color: var(--ink); background: radial-gradient(ellipse at 50% 0%, #3a2416, #120c08 70%); }
body { font: 15px/1.3 ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; user-select: none; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
#app { height: 100dvh; display: flex; flex-direction: column; padding-top: var(--safe-t); }
#hud { display: flex; gap: 12px; align-items: center; padding: 10px 12px 4px; font-weight: 700; }
#hud .sp, #bar .sp { flex: 1; }
#hud .ico { width: 20px; height: 20px; vertical-align: -5px; margin-right: 3px; }
#hud i { display: inline-block; width: 9px; height: 14px; border-radius: 3px; margin-right: 2px; vertical-align: -2px; }
#hud i.hp { background: #ff7a59; } #hud i.col { background: #5ee0ff; } #hud i.gone { background: #4a3a30; }
.free { background: #6dff9e; color: #062010; border-radius: 99px; padding: 2px 10px; font-size: 12px; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
#wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#board { display: grid; grid-template-columns: repeat(8, var(--cell)); gap: 3px; padding: 8px; border-radius: 14px; background: #1c130d; box-shadow: 0 0 0 1px #4a3424, 0 12px 40px #000a; }
#board.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translate(-5px, 2px); } 50% { transform: translate(5px, -2px); } 75% { transform: translate(-3px, 0); } }
.c { width: var(--cell); height: var(--cell); border: 0; border-radius: 6px; padding: 0; position: relative; display: grid; place-items: center;
  background: linear-gradient(160deg, #6b4a32, #4e3422); box-shadow: inset 0 2px 0 #ffffff1a, inset 0 -3px 0 #0005; }
.c svg { width: 72%; height: 72%; pointer-events: none; }
.c.colony { background: #0e2430; box-shadow: inset 0 0 0 1px #5ee0ff44; }
.c.wall { background: linear-gradient(160deg, #9aa7b8, #6c7788); box-shadow: inset 0 2px 0 #fff5, inset 0 -3px 0 #0006; }
.c.wall.old { opacity: .6; }
.c.wall.crack { background: repeating-linear-gradient(45deg, #6c7788 0 6px, #3e4552 6px 8px); }
.c .rd { font-size: calc(var(--cell) * .5); color: #10161f; }
.c .rd.a1 { opacity: .75; } .c .rd.a2 { opacity: .55; } .c .rd.a3 { opacity: .4; }
.c small { position: absolute; right: 3px; bottom: 1px; font-size: 10px; color: #10161fcc; font-weight: 700; }
.c.lure small { color: #ffd166; }
.c.tremor { animation: trem .25s infinite; box-shadow: 0 0 0 2px #ff9f43, 0 0 12px #ff9f43; z-index: 1; }
@keyframes trem { 25% { transform: translate(-1px, 1px); } 75% { transform: translate(1px, -1px); } }
.c.worm { background: radial-gradient(circle, #ff7a5955, #4e3422); }
.c.pv { outline: 3px solid #6dff9e; outline-offset: -3px; background: #6dff9e44; }
.c.pvbad { outline: 3px solid #ff4d6d; outline-offset: -3px; }
.c.flash { animation: flash .5s; }
@keyframes flash { from { background: #fff; } }
#hint { min-height: 36px; padding: 2px 12px; font-size: 13px; color: var(--dim); display: flex; align-items: center; gap: 8px; }
#hint b { color: var(--ink); }
#hint .x { margin-left: auto; flex: none; background: #3a2a1e; border: 0; border-radius: 99px; padding: 6px 12px; }
#hand, .pick { display: flex; gap: 8px; padding: 2px 10px 6px; justify-content: center; }
.card { flex: 1 1 0; max-width: 130px; min-width: 0; height: 112px; border-radius: 12px; border: 1px solid #ffffff1f; background: linear-gradient(170deg, #3a4a66, #232d42);
  padding: 7px; text-align: left; display: flex; flex-direction: column; gap: 3px; transition: transform .15s; }
.card.sel { transform: translateY(-10px); box-shadow: 0 0 0 2px #6dff9e, 0 8px 24px #000a; }
.card.k-lure { background: linear-gradient(170deg, #6b5216, #2f230a); }
.card.k-spike { background: linear-gradient(170deg, #6b2a1c, #2f120a); }
.card.k-echo, .card.k-quake { background: linear-gradient(170deg, #45306e, #211638); }
.card .nm { font-weight: 800; font-size: 14px; }
.card .shape { flex: 1; display: grid; place-items: center; min-height: 0; }
.card .shape svg { width: auto; max-width: 100%; }
.card .tx { font-size: 10.5px; line-height: 1.15; color: #e6dccfcc; max-height: 3.5em; overflow: hidden; }
#bar { display: flex; gap: 8px; align-items: center; padding: 4px 10px calc(10px + var(--safe-b)); }
#bar button, .btn { border: 0; border-radius: 12px; padding: 10px 16px; min-height: 44px; background: #3a2a1e; font-weight: 700; }
.btn.go { background: #6dff9e; color: #062010; }
.pile { font-size: 12px; color: var(--dim); }
#toasts { position: fixed; left: 0; right: 0; bottom: calc(200px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 20; }
.toast { background: #1c130dee; border: 1px solid #6b4a32; border-radius: 99px; padding: 7px 16px; font-weight: 600; font-size: 14px; animation: toast 2.3s forwards; }
.toast.good { border-color: #6dff9e; color: #b9ffd0; } .toast.bad { border-color: #ff4d6d; color: #ffb3c1; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
#overlay { position: fixed; inset: 0; z-index: 30; background: #0c0805ee; display: flex; align-items: center; justify-content: center; }
#overlay[hidden] { display: none; }
.screen { max-width: 440px; width: 100%; padding: 20px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.screen h2 { margin: 0; font-size: 30px; }
.screen p { margin: 0; color: #d9cbbd; }
.pick .card { height: 124px; }
