* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; background: #1b1f27; color: #eef; }
header { display: flex; gap: 8px; padding: 10px; background: #12151b; }
.stat { flex: 1; text-align: center; background: #262c38; border-radius: 8px; padding: 6px; }
.stat span { display: block; font-size: 12px; opacity: .7; }
.stat b { font-size: 24px; }
.bar { height: 10px; background: #333; }
#fill { height: 100%; width: 0; background: #4ade80; transition: width .2s; }
#fill.low { background: #f87171; }
main { display: flex; gap: 12px; padding: 12px; flex-wrap: wrap; }
#factory { flex: 1 1 320px; text-align: center; }
#shop { flex: 1 1 320px; display: grid; gap: 8px; align-content: start; }
#belt { position: relative; overflow: hidden; height: 44px; margin: 10px 0; border-radius: 6px; background: repeating-linear-gradient(90deg, #444 0 20px, #555 20px 40px); background-size: 40px 100%; animation: belt 1s linear infinite; }
@keyframes belt { to { background-position: 40px 0; } }
#machines { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 120px; align-content: flex-start; }
.m { width: 38px; height: 38px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: bold; color: #111; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.1); } }
button { font: inherit; cursor: pointer; border: 0; border-radius: 8px; padding: 10px 14px; background: #3b82f6; color: #fff; }
button:disabled { background: #3a4050; color: #889; cursor: not-allowed; }
#make { font-size: 20px; padding: 18px 24px; background: #f59e0b; margin-top: 12px; }
#make:active { transform: scale(.96); }
.item { text-align: left; display: flex; justify-content: space-between; align-items: center; }
.item small { display: block; opacity: .8; }
#overlay { position: fixed; inset: 0; background: #000b; display: grid; place-items: center; }
#overlay[hidden] { display: none; }
#box { background: #262c38; padding: 28px; border-radius: 12px; text-align: center; max-width: 360px; }
#box h2 { margin-top: 0; }
#help { width: 44px; border-radius: 50%; font-weight: bold; background: #4b5563; }
#tuto { position: fixed; inset: 0; background: #000c; display: grid; place-items: center; z-index: 5; }
#tuto[hidden] { display: none; }
#tbox { background: #262c38; padding: 28px; border-radius: 12px; text-align: center; max-width: 380px; }
#tbox h2 { margin-top: 0; }
#tbox .dots { opacity: .6; font-size: 13px; margin-bottom: 14px; }
#tbox button + button { margin-left: 8px; background: #4b5563; }
#menu { position: fixed; inset: 0; background: #1b1f27; display: grid; place-items: center; z-index: 4; }
#menu[hidden] { display: none; }
#mbox { text-align: center; }
#mbox h1 { font-size: 48px; margin: 0 0 6px; }
#mbox p { opacity: .8; margin: 6px 0; }
#mbox button { display: block; width: 220px; margin: 12px auto 0; font-size: 18px; }
#mbox #mplay { background: #f59e0b; font-size: 22px; padding: 16px; }
.piece { position: absolute; top: 50%; left: -30px; border-radius: 4px; box-shadow: 0 2px 4px #0008; animation: slide 3s linear forwards; }
.piece.round { border-radius: 50%; }
@keyframes slide { to { left: 100%; } }
#box { min-width: 320px; animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.badge { display: inline-block; padding: 3px 12px; border-radius: 99px; font-size: 13px; font-weight: bold; background: #3a4050; }
.badge.ok { background: #166534; } .badge.bad { background: #991b1b; }
#box h2 { margin: 10px 0 14px; font-size: 28px; }
.rows { text-align: left; background: #1b1f27; border-radius: 8px; padding: 6px 14px; }
.rows div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #333a48; }
.rows div:last-child { border: 0; }
.ok { color: #4ade80; } .bad { color: #f87171; } .warn { color: #fbbf24; }
.hint { font-size: 13px; opacity: .85; margin: 12px 0; }
#box button { margin-top: 6px; }
#box button.sec { background: #4b5563; }
