/* Finn para: woven cards on the linen. */
.stage.par { display: flex; flex-direction: column; padding: 10px 12px 10px; overflow: hidden }
.par [hidden] { display: none !important }

/* ── The menu ── */
.menu { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 540px; margin: 0 auto; padding-bottom: 4vh }
.menu h2 { margin: 0; font: 600 26px/1.15 Barlow, sans-serif; text-align: center }
.menu-lead { margin: 4px 0 18px; text-align: center; color: var(--ink-2) }
.modes { display: grid; gap: 10px }
.mode { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; min-height: 80px; padding: 12px 14px; border: 1px solid transparent; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); color: var(--ink); text-align: left; font: inherit; cursor: pointer; touch-action: manipulation; transition: transform .18s ease, box-shadow .18s ease }
.mode:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(22, 32, 43, .08), 0 10px 24px rgba(22, 32, 43, .1) }
.mode:active { transform: none }
.mode-art { display: flex; gap: 5px; height: 52px }
.mode-art canvas { height: 52px; width: 52px; image-rendering: pixelated; border-radius: 2px; box-shadow: 0 1px 2px rgba(42, 35, 31, .25) }
.mode-text { display: flex; flex-direction: column; min-width: 0 }
.mode-name { font: 700 18px/1.2 Barlow, sans-serif }
.mode-line { font-size: 14px; line-height: 1.35; color: var(--ink-2) }
.mode-best { display: none }
.mode.has-best .mode-best { display: block }
.mode-best canvas { image-rendering: pixelated }
@media (max-width: 420px) {
  .mode { grid-template-columns: auto 1fr; gap: 12px; padding: 10px 12px }
  .mode-art, .mode-art canvas { height: 44px }
  .mode-art canvas { width: 44px }
  .mode-best { grid-column: 2; margin-top: -4px }
  .mode-name { font-size: 17px }
}

/* ── Playing ── */
.play { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 8px }
.hud, .strip { width: min(100%, var(--bw, 640px)) }
.hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px }
.hud-back { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; min-width: 0; padding: 0 14px 0 10px; border: 1px solid var(--pill-border); border-radius: 999px; background: var(--card); color: var(--ink); font: 600 15px Barlow, sans-serif; cursor: pointer; touch-action: manipulation }
.hud-back > span:first-child { font-size: 22px; line-height: 1; margin-top: -2px; color: var(--ink-3) }
.hud-back:hover { border-color: var(--ink-3) }
.hud-mode { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.hud-stats { display: flex; gap: 16px; margin: 0; flex: none }
.hud-stats div { display: flex; flex-direction: column-reverse; align-items: flex-end }
.hud-stats dt { font: 700 11px/1 'Barlow Condensed', sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3) }
.hud-stats dd { margin: 0; font: 700 20px/1.1 Barlow, sans-serif; font-variant-numeric: tabular-nums }
@media (max-width: 420px) { .hud-stats { gap: 12px } .hud-back { font-size: 14px } }

.board-wrap { flex: 1; min-height: 0; width: 100%; display: grid; place-items: center }
.board { display: grid; gap: var(--gap, 10px); justify-content: center; touch-action: manipulation }

/* A card: a woven square that turns over */
.card { position: relative; width: var(--card, 100px); height: var(--card, 100px); padding: 0; border: 0; border-radius: 3px; background: none; perspective: 800px; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; container-type: size }
.card .inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .42s cubic-bezier(.35, .1, .25, 1) }
.card.up .inner { transform: rotateY(180deg) }
.card:not(.up):hover .inner { transform: translateY(-2px) }
.face { position: absolute; inset: 0; display: block; overflow: hidden; border-radius: 3px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 1px 2px rgba(42, 35, 31, .28), 0 5px 12px rgba(42, 35, 31, .12); transition: box-shadow .4s }
.face canvas { width: 100%; height: 100%; image-rendering: pixelated }
.front { transform: rotateY(180deg) }
.card:focus-visible { outline: 3px solid var(--sign-blue); outline-offset: 3px }
.card.matched { cursor: default }
.card.matched .face { box-shadow: 0 1px 1px rgba(42, 35, 31, .22) }
.card.found { animation: found .5s cubic-bezier(.3, .6, .3, 1) }
@keyframes found { 0% { transform: scale(1) } 35% { transform: scale(1.045) } 100% { transform: scale(1) } }

/* The name on its woven band */
.name { position: absolute; left: 0; right: 0; top: calc(100% / 3); height: calc(100% / 3); display: flex; align-items: center; justify-content: center; pointer-events: none }
.name span { font: 700 13cqw/1 'Barlow Condensed', sans-serif; letter-spacing: .03em; text-transform: uppercase; color: var(--w-svart); white-space: nowrap }

/* Dealing: the cards come in one after another, quietly */
.board .card { opacity: 0 }
.board.dealt .card { opacity: 1; transition: opacity .35s ease; transition-delay: calc(var(--k, 0) * 22ms) }

/* What the motif is called */
.strip { display: flex; align-items: center; gap: 12px; height: 76px; flex: none; padding: 8px 14px 8px 10px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow) }
.strip-art { flex: none; image-rendering: pixelated; border-radius: 2px }
.strip-text { margin: 0; font-size: 14px; line-height: 1.35; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden }
.strip-text b { margin-right: .3em; font: 700 1.08em/1 'Barlow Condensed', sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--w-raud) }
.strip-hint { color: var(--ink-3) }
.strip.shown { animation: strip .45s ease-out }
@keyframes strip { from { opacity: .2; transform: translateY(4px) } to { opacity: 1; transform: none } }
@media (max-width: 420px) { .strip { height: 86px; gap: 10px; padding: 6px 10px 6px 8px } .strip-text { font-size: 13px; line-height: 1.28; -webkit-line-clamp: 5 } }
@media (min-width: 900px) and (min-height: 700px) { .strip { height: 84px } .strip-text { font-size: 15px } }

/* ── The end ── */
#done .sheet-body { text-align: center }
#done h2 { margin-top: 4px }
.done-roser { display: flex; justify-content: center; margin: 6px 0 4px }
.done-roser canvas { image-rendering: pixelated }
.done-result { margin: 4px 0 0; font-size: 17px; font-variant-numeric: tabular-nums }
.new-best { color: var(--w-raud); font-weight: 700 }
.done-akle { margin: 14px 0 12px; display: flex; flex-direction: column; align-items: center }
.done-akle canvas { image-rendering: pixelated; border-radius: 2px; box-shadow: 0 2px 3px rgba(42, 35, 31, .18), 0 10px 24px rgba(42, 35, 31, .16) }
.done-akle figcaption { margin-top: 8px; font-size: 13px; line-height: 1.4 }
#done .fact { text-align: left; padding: 12px; border-radius: 10px; background: var(--linen) }
#done .fact p { font-size: 14px }
@media (max-height: 700px) { #done .sheet-body { padding: 16px 16px 14px } #done h2 { font-size: 22px } .done-akle { margin: 10px 0 8px } #done .btn-row { margin-top: 12px } }
.keys { color: var(--ink-2) }

@media (prefers-reduced-motion: reduce) {
  .card .inner, .face, .board.dealt .card, .mode { transition: none }
  .card.found, .strip.shown { animation: none }
}
