:root {
  --purple: #46178f;
  --purple-dark: #2b0e5a;
  --red: #e21b3c;
  --blue: #1368ce;
  --yellow: #d89e00;
  --green: #26890c;
  --ok: #66bf39;
  --bad: #f35;
  --white: #fff;
  --ink: #333;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 700;
  color: var(--white);
  background: var(--purple);
  background-image: radial-gradient(circle at 20% 10%, rgba(255,255,255,.08) 0 18%, transparent 18.5%),
                    radial-gradient(circle at 90% 80%, rgba(255,255,255,.06) 0 22%, transparent 22.5%);
  overflow-x: hidden;
}
button { font: inherit; cursor: pointer; border: 0; }
.wrap { min-height: 100%; display: flex; flex-direction: column; }
.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 16px; gap: 18px; }
.logo { font-weight: 900; font-size: clamp(28px, 6vw, 64px); letter-spacing: -1px; text-shadow: 0 4px 0 rgba(0,0,0,.25); }
.logo span { color: #ffd23f; }
.card { background: var(--white); color: var(--ink); border-radius: 8px; padding: 18px 22px; box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.btn { background: var(--white); color: var(--ink); padding: 14px 28px; border-radius: 6px; font-weight: 800; font-size: 18px; box-shadow: 0 4px 0 rgba(0,0,0,.3); transition: transform .08s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.3); }
.btn.dark { background: #333; color: #fff; }
.muted { opacity: .75; font-weight: 600; }
.big { font-size: clamp(24px, 5vw, 48px); font-weight: 900; }
.huge { font-size: clamp(40px, 10vw, 120px); font-weight: 900; line-height: 1; }

/* topbar */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: rgba(0,0,0,.2); font-size: 15px; gap: 12px; }
.pill { background: rgba(255,255,255,.18); padding: 4px 12px; border-radius: 999px; }

/* tiles */
.c0 { background: var(--red); } .c1 { background: var(--blue); }
.c2 { background: var(--yellow); } .c3 { background: var(--green); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px; width: 100%; }
.tile { color: #fff; border-radius: 6px; padding: 18px 14px; min-height: 84px; display: flex; align-items: center; gap: 12px; font-size: clamp(18px, 4.5vw, 30px); font-weight: 800; text-align: left; box-shadow: 0 5px 0 rgba(0,0,0,.25); transition: transform .08s, opacity .2s; text-shadow: 0 2px 2px rgba(0,0,0,.2); word-break: break-word; }
.tile:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.tile .shape { font-size: 1.1em; flex: none; width: 1.2em; text-align: center; }
.tile.dim { opacity: .3; }

/* timer */
.timer { width: 88px; height: 88px; border-radius: 50%; background: var(--purple-dark); display: grid; place-items: center; font-size: 36px; font-weight: 900; box-shadow: 0 4px 0 rgba(0,0,0,.25); }

/* bars */
.bars { width: min(1100px, 100%); display: flex; flex-direction: column; gap: 10px; }
.bar { display: flex; align-items: center; gap: 14px; }
.bar .lbl { width: 32%; text-align: right; font-size: clamp(16px, 2.6vw, 30px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .fill { height: clamp(34px, 5vh, 56px); border-radius: 4px; width: 0; transition: width 1s cubic-bezier(.2,.9,.3,1); display: flex; align-items: center; justify-content: flex-end; padding-right: 12px; font-size: clamp(16px, 2.4vw, 26px); min-width: 0; box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.bar .place { width: 48px; font-size: clamp(16px, 2.6vw, 30px); opacity: .8; }

/* chips */
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; max-width: 1100px; }
.chip { background: rgba(0,0,0,.25); padding: 10px 18px; border-radius: 6px; font-size: 22px; animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
.chip.off { opacity: .4; }
.chip button { background: none; color: inherit; opacity: .5; margin-left: 8px; font-size: 18px; }

/* animations */
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse { 50% { transform: scale(1.06); } }
@keyframes shake { 10%,30%,50%,70%,90% { transform: translateX(-6px) rotate(-1deg); } 20%,40%,60%,80% { transform: translateX(6px) rotate(1deg); } }
.pop { animation: pop .5s cubic-bezier(.2,1.6,.4,1) both; }
.rise { animation: rise .6s ease-out both; }
.pulse { animation: pulse 1.2s ease-in-out infinite; }
.shake { animation: shake .9s ease-in-out both; }

.footer { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; gap: 12px; }
.ok-bg { background: var(--ok) !important; background-image: none !important; }
.bad-bg { background: var(--bad) !important; background-image: none !important; }
