/* Linkup — a 4×4 word board on the Arcade kit's warm paper. Groups lock in as coloured bands
   (colour + level label + shape, never colour alone). Phone first: the board fits 360px. */

.lk-card { padding: 14px 12px 16px; overflow-x: clip; min-width: 0; }

/* ---- top line: puzzle number + mistakes left ---- */
.lk-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; margin: 0 2px 12px; min-width: 0; }
.lk-pill { display: inline-flex; align-items: center; min-height: 30px; padding: 4px 12px; border-radius: 999px; background: var(--cbx-soft); font: 900 13px var(--cbx-body); color: var(--cbx-ink-2); white-space: nowrap; }
.lk-lives { display: inline-flex; align-items: center; gap: 6px; font: 800 12px var(--cbx-body); color: var(--cbx-muted); }
.lk-lives-l { margin-right: 2px; white-space: nowrap; }
.lk-lives i { width: 13px; height: 13px; border-radius: 50%; background: var(--cbx-accent); box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); transition: transform .25s, background .25s, box-shadow .25s; }
.lk-lives i.used { background: transparent; box-shadow: inset 0 0 0 2px var(--cbx-line); transform: scale(.82); }
.lk-lives i.lost { animation: lk-lose .5s ease; }
@keyframes lk-lose { 0% { transform: scale(1); } 30% { transform: scale(1.5); background: var(--cbx-bad); } 100% { transform: scale(.82); } }

/* ---- the board ---- */
.lk-board { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; perspective: 900px; }
.lk-tile {
  --h: 66px;
  position: relative; min-width: 0; height: var(--h); padding: 4px 2px; border: 0; border-radius: 12px; cursor: pointer;
  display: grid; place-items: center; text-align: center; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  background: #f1e7d8; color: var(--cbx-ink); box-shadow: 0 3px 0 #ddcdb7;
  transition: transform .14s cubic-bezier(.2,1.4,.4,1), background .14s, color .14s, box-shadow .14s;
}
.lk-w { display: block; width: 100%; max-height: 100%; overflow: hidden; font: 900 15px/1.08 var(--cbx-body); letter-spacing: .01em; text-transform: uppercase; overflow-wrap: normal; word-break: keep-all; hyphens: none; }
@media (hover: hover) { .lk-tile:hover:not(.on):not(:disabled) { background: #eadcc8; } }
.lk-tile.on { background: #3a2c24; color: #fff; transform: translateY(-4px) scale(1.04); box-shadow: 0 7px 0 #1d1511, 0 12px 18px rgba(42,29,23,.25); }
.lk-tile.pick { animation: lk-pick .22s cubic-bezier(.2,1.6,.4,1); }
@keyframes lk-pick { 0% { transform: translateY(0) scale(.94); } 100% { transform: translateY(-4px) scale(1.04); } }
.lk-tile:disabled { cursor: default; }
.lk-tile.shake { animation: lk-shake .42s ease; }
@keyframes lk-shake { 0%,100% { transform: translateY(-4px) scale(1.04); } 20% { transform: translate(-7px,-4px) scale(1.04); } 40% { transform: translate(6px,-4px) scale(1.04); } 60% { transform: translate(-4px,-4px) scale(1.04); } 80% { transform: translate(3px,-4px) scale(1.04); } }
.lk-tile.flipout { transition: transform .2s ease-in, opacity .2s; transform: rotateX(90deg); }
.lk-tile.hop { animation: lk-hop .3s ease; }
@keyframes lk-hop { 50% { transform: translateY(-8px) scale(1.06); } }

/* ---- solved bands ---- */
.lk-band {
  grid-column: 1 / -1; position: relative; min-height: 66px; padding: 8px 12px 8px; border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: var(--c); color: var(--k); box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 62%, #000);
}
.lk-band .lk-lv { position: absolute; top: 6px; left: 8px; font: 900 10px/1 var(--cbx-body); letter-spacing: .08em; text-transform: uppercase; opacity: .78; }
.lk-band .lk-cat { font: 900 15px/1.15 var(--cbx-body); text-transform: uppercase; letter-spacing: .03em; padding: 0 30px; }
.lk-band .lk-ws { font: 800 13px/1.25 var(--cbx-body); margin-top: 2px; }
.lk-band.missed { opacity: .9; }
.lk-band.missed::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(255,255,255,.18) 0 6px, transparent 6px 14px); pointer-events: none; }
.lk-band.missed .lk-lv::after { content: ' · missed'; }
.lk-band.fresh { animation: lk-flipin .5s cubic-bezier(.2,1.25,.35,1) both; transform-origin: 50% 50%; }
@keyframes lk-flipin { from { transform: rotateX(-90deg); } to { transform: none; } }
.lk-spark { position: absolute; width: 8px; height: 8px; border-radius: 2px; pointer-events: none; z-index: 2; }

/* ---- toast ("One away!") ---- */
.lk-toast {
  position: absolute; left: 50%; top: 52px; z-index: 5; margin: 0; padding: 9px 16px; border-radius: 12px;
  background: var(--cbx-ink); color: #fff; font: 900 15px var(--cbx-body); white-space: nowrap;
  transform: translate(-50%, -6px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.lk-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---- controls ---- */
.lk-controls { display: flex; gap: 8px; margin-top: 14px; }
.lk-ctl { flex: 1; min-width: 0; min-height: 48px; padding: 8px 6px; font-size: 15px; border-radius: 14px; }
.lk-ctl svg { flex: none; }
.lk-submit { flex: 1.15; }
.lk-submit:not(:disabled) { animation: lk-ready .3s ease; }
@keyframes lk-ready { 50% { transform: scale(1.05); } }

/* ---- results ---- */
.lk-result { margin-top: 16px; padding-top: 14px; border-top: 2px dashed var(--cbx-line); }
.lk-result .cbx-big small { font-size: .42em; }
.lk-grid { display: grid; justify-content: center; gap: 4px; margin: 4px 0 14px; }
.lk-grid .row { display: flex; gap: 4px; }
.lk-grid i { width: 24px; height: 24px; border-radius: 6px; background: var(--c); color: var(--k); display: grid; place-items: center; font: 900 11px/1 system-ui, sans-serif; font-style: normal; }
.lk-key { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 12px; margin: 4px 0 0; font: 800 12px var(--cbx-body); color: var(--cbx-muted); }
.lk-key span { display: inline-flex; align-items: center; gap: 5px; }
.lk-key i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.lk-result .cb-beat-result { margin: 0 auto 12px; }
.lk-result .cbx-chips { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lk-result .cbx-chips > * { padding: 10px 4px; }

@media (min-width: 560px) {
  .lk-card { padding: 18px 18px 20px; }
  .lk-board { gap: 9px; }
  .lk-tile { --h: 78px; }
  .lk-band { min-height: 78px; }
  .lk-w { font-size: 18px; }
  .lk-band .lk-cat { font-size: 17px; }
  .lk-band .lk-ws { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .lk-tile, .lk-lives i, .lk-toast { transition: none; }
  .lk-tile.pick, .lk-tile.shake, .lk-tile.hop, .lk-band.fresh, .lk-lives i.lost, .lk-submit:not(:disabled) { animation: none; }
  .lk-tile.flipout { transition: none; }
}
