/* Trekk et kort på spillbordet (1.19.0). Felles utseende i assets/spillbord.css. */
:root { --display: "Spilleland Baloo", system-ui, sans-serif; }
#print-deck, template { display: none; }
.game { width: min(1080px, 100%); margin: 0 auto; padding: clamp(14px, 3.5vw, 36px); }
.in-frame .tk-top { display: none; }
.in-frame .game { padding-top: 10px; }
.tk-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(250px, 1fr); gap: clamp(18px, 3vw, 34px); align-items: start; }

/* Kortet */
.tk-deck { position: relative; }
.tk-deck::before, .tk-deck::after { content: ""; position: absolute; inset: 14px -8px auto 10px; height: calc(100% - 120px); border: 3px solid var(--sb-ink); border-radius: 22px; background: var(--sb-card); transform: rotate(2.4deg); z-index: 0; }
.tk-deck::after { transform: rotate(-3.2deg); inset: 22px 6px auto -6px; background: #f3e7cf; }
.playing-card { --card: var(--sb-mint); position: relative; z-index: 1; min-height: clamp(320px, 52vw, 440px); display: flex; flex-direction: column; background: var(--card); margin: 0 0 22px; }
.playing-card[data-tone="family"] { --card: #cfeedd; }
.playing-card[data-tone="friends"] { --card: #fbe08a; }
.playing-card[data-tone="work"] { --card: #c6e2f8; }
.playing-card[data-tone="barn"] { --card: #f9d2dc; }
.playing-card[data-tone="ungdom"] { --card: #e3d6fb; }
.playing-card[data-tone="generasjoner"] { --card: #f9c592; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: auto; font-weight: 800; }
.card-top p { margin: 0; }
#card-progress { padding: 2px 12px; background: var(--sb-card); border: 2px solid var(--sb-ink); border-radius: 999px; font-size: .95rem; }
.deck-heading { display: inline-flex; align-items: center; gap: .5rem; }
.deck-heading p { margin: 0; }
.deck-mark { width: 48px; height: 48px; object-fit: contain; }
#card-prompt { margin: 22px 0 12px; font: 800 clamp(1.7rem, 4.6vw, 2.7rem)/1.1 var(--sb-body); letter-spacing: -.015em; text-wrap: balance; }
.card-detail { margin: 0 0 auto; font-size: clamp(1.05rem, 2.6vw, 1.25rem); font-weight: 600; color: #2f3a33; }
.playing-card.flip { animation: tk-draw .42s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes tk-draw { from { transform: translate(40px, -18px) rotate(6deg); opacity: .2; } }
.deck-actions { display: flex; gap: 12px; flex-wrap: wrap; position: relative; z-index: 1; }
.deck-actions .action-primary { flex: 1 1 220px; }

/* Sidepanelet */
.tk-side { display: grid; gap: 18px; }
.game-filters { border: 3px solid var(--sb-ink); border-radius: 22px; background: var(--sb-card); padding: 16px; margin: 0; box-shadow: 4px 4px 0 var(--sb-ink); }
.game-filters legend { font: 800 1.2rem/1.2 var(--sb-body); padding: 0 6px; }
.tk-decks-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.game-filters label { margin: 0; display: block; }
.game-filters input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.game-filters label span { display: inline-flex; align-items: center; gap: .4rem; padding: 4px 12px 4px 6px; min-height: 44px; border: 2.5px solid var(--sb-ink); border-radius: 999px; background: #fff; font-weight: 700; cursor: pointer; }
.game-filters label span:not(:has(img)) { padding-left: 12px; }
.game-filters img { width: 30px; height: 30px; object-fit: contain; }
.game-filters input:checked + span { background: var(--sb-yellow); box-shadow: 2px 2px 0 var(--sb-ink); }
.game-filters input:focus-visible + span { outline: 4px solid var(--sb-red); outline-offset: 2px; }
.tk-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tk-tools p { margin: 0; flex-basis: 100%; color: var(--sb-muted); font-size: .98rem; }
.noscript { padding: 1em; border: 3px solid var(--sb-ink); border-radius: 16px; background: #ffe6a8; }

@media (max-width: 760px) {
  .tk-layout { grid-template-columns: 1fr; }
  .tk-deck::before, .tk-deck::after { display: none; }
}
@media (prefers-reduced-motion: reduce) { .playing-card.flip { animation: none; } }

@media print {
  body { background: white; color: #151515; }
  .game { display: none; }
  #print-deck { display: block; }
  .print-page:not(:last-child) { break-after: page; }
  .print-page { width: 100%; }
  .print-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 4mm;
    border-bottom: .25mm solid currentColor;
    padding-bottom: 1.6mm;
  }
  .print-head h1 { font: 800 18pt/1.1 var(--display); }
  .print-head p { font-size: 10pt; font-weight: 700; }
  .print-instructions { margin: 1.5mm 0 4mm; font-size: 9pt; }
  .print-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, 119mm);
    width: 100%;
    border: .3mm dashed #737373;
  }
  .print-card {
    display: flex;
    padding: 5mm;
    break-inside: avoid;
  }
  .print-card:nth-child(odd) { border-right: .3mm dashed #737373; }
  .print-card:nth-child(-n+2) { border-bottom: .3mm dashed #737373; }
  .print-card-content {
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    align-items: end;
    gap: 5mm;
    width: 100%;
    padding: 6mm;
    border: .3mm solid currentColor;
    border-radius: 2mm;
  }
  .print-card-content h2 { font: 800 21pt/1.1 var(--display); letter-spacing: -.035em; align-self: center; }
  .print-card-content p { font-size: 11.5pt; line-height: 1.28; }
  .print-card-content .print-tag { font-weight: 700; border-bottom: .25mm solid currentColor; padding-bottom: 2mm; }
  .print-card-content .print-foot { font-size: 8.5pt; font-weight: 700; padding-top: 3mm; }
}

.print-card .deck-heading { display: inline-flex; align-items: center; gap: .45rem; }
.print-mark { object-fit: contain; flex: none; }
@media print { body.sb-table { background: #fff; } .print-mark { width: 10mm; height: 10mm; } #print-deck { display: block; } .game { display: none; } }
