/* ============================================================
   Webbkryss / Minikryss — visual style (Ordgatan-aligned)
   Mobile-first, senior-friendly (16px+ body, 44px+ touch targets)
   ============================================================ */

:root {
  /* Spec §5 brand tokens */
  --c-orange:        #FF8800;
  --c-orange-2:      #FFBB66;
  --c-orange-soft:   #FFE8D0;
  --c-orange-softer: #FFF0E0;
  --c-orange-bg:     #FFFAF3;
  --c-orange-text:   #993C1D;

  --c-bg-page:     #F5F3EE;
  --c-surface:     #FFFFFF;
  --c-text:        #1F1F1D;
  --c-text-2:      #5F5E5A;
  --c-text-3:      #888780;
  --c-border:      #D3D1C7;
  --c-border-soft: #E8E6DE;
  --c-kb-bg:       #FAFAF7;
  --c-kb-action:   #F1EFE8;
  --c-timer:       #1D9E75;
  --c-error:       #E24B4A;

  --r-cell: 8px;
  --r-card: 12px;
  --r-pill: 20px;

  /* Legacy tokens (preserved for index/archive cards) */
  --wk-primary: #ff8d00;
  --wk-primary-dark: #e67e00;
  --wk-primary-light: #ffa033;
  --wk-primary-soft: #fff4e6;
  --wk-accent: #fdba74;
  --wk-success: #10b981;
  --wk-success-soft: #d1fae5;
  --wk-warning: #fde68a;
  --wk-error: #fca5a5;
  --wk-error-soft: #fee2e2;
  --wk-background: #f8fafc;
  --wk-surface: #ffffff;
  --wk-surface-soft: #fff8f2;
  --wk-text: #1f2937;
  --wk-text-muted: #6b7280;
  --wk-border: #ffe0c0;
  --wk-border-strong: #ffc48a;
  --wk-border-light: #f5e5d3;
  --wk-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
  --wk-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --wk-shadow-lg: 0 26px 64px rgba(15, 23, 42, 0.16);
  --wk-gradient: linear-gradient(180deg, #fff8f2 0%, #ffffff 100%);
  --wk-radius: 20px;
  --wk-radius-sm: 12px;
}

* { box-sizing: border-box; }

body.webbkryss-body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--c-bg-page);
  color: var(--c-text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

/* ============================================================
   MINIKRYSS PLAY SCREEN (namespace: .mk)
   Layout: fluid container + Ordgatan-style fixed bottom keyboard.
   Mobile-first, desktop expands with wider content + same keyboard.
   ============================================================ */
:root {
  --mk-keyboard-height: 180px;
  --mk-safe-bottom: env(safe-area-inset-bottom, 0px);
}

.mk {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 0 calc(var(--mk-keyboard-height) + var(--mk-safe-bottom) + 80px);
  font-family: inherit;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ───── Header (Ordgatan-style: minimal, flat, borderless) ───── */
.mk .header {
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}
.mk .logo-block { display: inline-flex; align-items: baseline; gap: 6px; }
.mk .logo-dots { display: none; } /* drop the 3x3 dot logo — Ordgatan uses wordmark only */
.mk .logo-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #ff8d00;
}
@media (min-width: 768px) {
  .mk .logo-name { font-size: 1.3rem; }
  .mk .header { height: 64px; padding: 0 24px; }
  .mk .progress-row { padding: 12px 24px; }
  .mk .timer { font-size: 0.95rem; }
  .mk .progress-text { font-size: 0.85rem; }
}

.mk .btn-tips {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff8f2;
  color: #c2410c;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #ffd9b3;
  cursor: pointer;
  height: 36px;
  font-family: inherit;
}
.mk .btn-tips:hover:not(:disabled) { background: #ffe9d0; }
.mk .btn-tips:disabled { opacity: 0.4; cursor: not-allowed; }
.mk .btn-tips svg { stroke: #c2410c !important; }
.mk .btn-tips .x {
  background: #ff8d00;
  color: white;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

/* ───── Progress row (Ordgatan-style: single line, flat) ───── */
.mk .progress-row {
  padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}
.mk .back {
  width: 32px; height: 32px;
  flex-shrink: 0;
  font-size: 1.05rem;
  color: #374151;
  background: none; border: none; box-shadow: none;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: background 0.15s;
}
.mk .back:hover { background: #f3f4f6; }

.mk .stars {
  display: inline-flex; align-items: center; gap: 4px;
  color: #ff8d00;
  font-size: 0.85rem;
  font-weight: 600;
}
.mk .progress {
  flex: 1; height: 8px;
  background: #f3f4f6;
  border-radius: 4px; overflow: hidden;
  min-width: 40px;
}
.mk .progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #ff8d00 0%, #ffa033 100%);
  transition: width 0.25s ease;
}
.mk .progress-text {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-width: 32px; text-align: right;
}
.mk .timer {
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #6b7280;
  white-space: nowrap;
  min-width: 36px;
}
.mk .help {
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: #f3f4f6;
  border: none;
  border-radius: 50%;
  color: #6b7280;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s;
}
.mk .help:hover { color: #374151; background: #e5e7eb; }

/* ───── Grid ───── */
.mk .grid-wrap {
  padding: 20px 16px 24px;
  background: var(--c-orange-bg);
  border-top: 0.5px solid var(--c-border-soft);
  border-bottom: 0.5px solid var(--c-border-soft);
}
.mk .grid {
  display: grid;
  grid-template-columns: repeat(var(--mk-cols, 5), 1fr);
  grid-template-rows: repeat(var(--mk-rows, 5), 1fr);
  aspect-ratio: var(--mk-cols, 5) / var(--mk-rows, 5);
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  gap: 6px;
  user-select: none;
}
@media (min-width: 600px) {
  .mk .grid { max-width: 420px; gap: 8px; }
}

/* ───── Cell base ───── */
.mk .cell {
  position: relative;
  border-radius: var(--r-cell);
  background: var(--c-surface);
  border: 0.5px solid var(--c-border);
  display: flex;
  align-items: center; justify-content: center;
  font-weight: 500;
  font-size: clamp(0.95rem, 3.5vw, 1.25rem);
  cursor: pointer;
  min-width: 0; min-height: 0;
  transition: background 0.1s, border-color 0.1s;
}
.mk .cell .num {
  position: absolute;
  top: 2px; left: 4px;
  font-size: 9px;
  font-weight: 500;
  color: var(--c-orange);
  pointer-events: none;
  line-height: 1;
}
.mk .cell input {
  width: 100%; height: 100%;
  border: none; background: transparent;
  text-align: center;
  font-size: inherit; font-weight: inherit;
  text-transform: uppercase;
  color: var(--c-text);
  font-family: inherit;
  padding: 0;
  outline: none;
  caret-color: transparent;
}

/* Cell states — spec §4 */
.mk .cell.in-word {
  background: var(--c-orange-softer);
  border-color: var(--c-orange-2);
}
.mk .cell.active {
  background: var(--c-orange-soft);
  border: 2px solid var(--c-orange);
}
.mk .cell.error {
  border: 2px solid var(--c-error);
}
.mk .cell.hinted input { color: var(--c-orange); font-style: italic; }

/* Clue-type cell (arrowword internal clue with text + arrow) */
.mk .cell.cell--clue {
  background: #EFEDE4;
  font-size: clamp(0.62rem, 1.9vw, 0.78rem);
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1.06;
  color: #2A2A26;
  padding: 3px 4px 10px;
  overflow: hidden;
  word-break: break-word;
  hyphens: auto;
}
.mk .cell.cell--clue:hover { background: #E6E4DB; }
.mk .cell.cell--clue .mk-clue-text {
  display: block;
  max-width: 100%;
  text-align: center;
}
.mk .cell.cell--clue .mk-arrow {
  position: absolute;
  right: 3px; bottom: 3px;
  width: 12px; height: 12px;
  color: #2A2A26;
  pointer-events: none;
}
.mk .cell.cell--clue .mk-arrow--left { right: auto; left: 3px; }
.mk .cell.cell--clue .mk-arrow--up { right: auto; bottom: auto; top: 3px; left: 3px; }
.mk .cell.cell--clue.cell--clue-split-h { flex-direction: column; padding: 0; }
.mk .cell.cell--clue.cell--clue-split-h .mk-clue-slot {
  height: 50%;
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  padding: 2px 2px 8px;
}
.mk .cell.cell--clue.cell--clue-split-h .mk-clue-slot--top {
  border-bottom: 1px solid #C4C2B8;
}
.mk .cell.cell--clue.cell--clue-split-v { flex-direction: row; padding: 0; }
.mk .cell.cell--clue.cell--clue-split-v .mk-clue-slot {
  width: 50%;
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  padding: 2px 2px 8px;
}
.mk .cell.cell--clue.cell--clue-split-v .mk-clue-slot--left {
  border-right: 1px solid #C4C2B8;
}
.mk .cell.cell--clue.cell--clue-arrow-only {
  padding: 0;
}
.mk .cell.cell--clue.cell--clue-arrow-only .mk-arrow {
  position: static;
  width: 60%; height: 60%;
}

/* Image cell (arrowword image clue) */
.mk .cell.cell--image {
  background: var(--c-surface);
  overflow: hidden;
  padding: 0;
}
.mk .cell.cell--image img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.mk .cell.cell--image.cell--image-clue .mk-arrow {
  position: absolute;
  right: 3px; bottom: 3px;
  width: 14px; height: 14px;
  color: white;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.8));
}

/* Block cell (dark) */
.mk .cell.cell--block {
  background: #2A2A26;
  border-color: #2A2A26;
  cursor: default;
}

/* Highlight the origin clue-cell of the current active slot */
.mk .cell.cell--clue.slot-origin {
  background: var(--c-orange-soft);
}
.mk .cell.cell--clue.slot-origin .mk-arrow { color: var(--c-orange-text); }

/* ───── Clue bar (Ordgatan clue-card style: white card, orange 32px pill + centered text) ───── */
.mk .clue-bar {
  padding: 16px 20px;
  background: white;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  border-top: 1px solid #f3f4f6;
}
.mk .clue-bar.empty {
  background: white;
  color: #9ca3af;
  justify-content: center;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
}
.mk .clue-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: #ff8d00;
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 700;
  flex-shrink: 0;
}
.mk .clue-dir {
  font-size: 1.1rem; font-weight: 700;
  color: #ff8d00;
  width: 18px; text-align: center;
  flex-shrink: 0;
}
.mk .clue-text {
  flex: 1;
  font-size: 1rem;
  font-weight: 500;
  color: #1f2937;
  line-height: 1.4;
}
.mk .clue-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #f3f4f6;
  border: none;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.05rem;
  color: #6b7280;
  flex-shrink: 0;
  font-family: inherit;
  transition: all 0.15s;
}
.mk .clue-toggle:hover:not(:disabled) { background: #ffe9d0; color: #ff8d00; }
.mk .clue-toggle:disabled { opacity: 0.3; cursor: not-allowed; }
.mk .clue-hint {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #fff8f2;
  border: none;
  color: #ff8d00;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.15s;
}
.mk .clue-hint:hover:not(:disabled) { background: #ffe9d0; }
.mk .clue-hint:disabled { opacity: 0.3; cursor: not-allowed; }

.mk .clue-check {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #dcfce7;
  border: none;
  color: #15803d;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.15s;
}
.mk .clue-check:hover:not(:disabled) { background: #bbf7d0; }
.mk .clue-check:active { transform: scale(0.95); }

/* Cell state: word fully solved (shown after manual validate) */
.mk .cell.slot-solved {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #15803d;
  cursor: not-allowed;
  animation: mk-solved-pop 0.35s ease-out;
}
.mk .cell.slot-solved input { color: #15803d; }
.mk .cell.slot-solved.active {
  background: #bbf7d0;
  border: 2px solid #22c55e;
}
@keyframes mk-solved-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* Tap-on-locked feedback: brief horizontal shake to signal the cell is locked */
.mk .cell.cell-locked-shake {
  animation: mk-locked-shake 0.28s ease-in-out;
}
@keyframes mk-locked-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-3px); }
  40%      { transform: translateX(3px); }
  60%      { transform: translateX(-2px); }
  80%      { transform: translateX(2px); }
}

@media (min-width: 768px) {
  .mk .clue-bar { padding: 18px 24px; min-height: 80px; }
  .mk .clue-text { font-size: 1.1rem; }
}

/* ───── On-screen keyboard (Ordgatan-style, fixed bottom) ───── */
.mk .keyboard {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--mk-keyboard-height) + var(--mk-safe-bottom));
  padding: 8px 4px;
  padding-bottom: calc(8px + var(--mk-safe-bottom));
  background: linear-gradient(180deg, #f5f0eb 0%, #e8e3de 100%);
  border-top: 1px solid var(--c-border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: none;
}
.mk .keyboard-inner {
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mk .kb-row {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex: 1;
}
.mk .key {
  flex: 1;
  min-width: 22px;
  max-width: 38px;
  border: none;
  border-radius: 6px;
  background: white;
  color: var(--c-text);
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: background 0.15s ease, transform 0.1s ease;
  padding: 0;
}
.mk .key:active,
.mk .key.pressed {
  background: #ffe0c0;
  transform: scale(0.95);
}
.mk .key.xtra {
  background: #fff8f2;
  border: 1px solid var(--c-orange-2);
  color: var(--c-orange-text);
}
.mk .key.xtra:active { background: #ffe0c0; }
.mk .key.act {
  min-width: 42px;
  max-width: 56px;
  flex: 1.3;
  font-size: 1.1rem;
  background: #fff8f2;
  border: 1px solid var(--c-border);
}
.mk .key.act:active { background: #ffe0c0; }

@media (min-width: 768px) {
  .mk .key { max-width: 44px; font-size: 1.1rem; }
  .mk .key.act { max-width: 64px; }
}

/* ───── Toast / feedback ───── */
.mk .mk-toast {
  position: fixed;
  left: 50%; top: 80px;
  transform: translateX(-50%);
  background: rgba(31, 31, 29, 0.92);
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  white-space: nowrap;
}
.mk .mk-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Clue-bar sits fixed above the keyboard so it stays visible while typing */
.mk .clue-bar {
  position: fixed;
  bottom: calc(var(--mk-keyboard-height) + var(--mk-safe-bottom));
  left: 0; right: 0;
  z-index: 99;
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================================
   LANDING PAGE STRUCTURE (index + archive)
   Unchanged from previous palette — uses legacy --wk-* tokens
   ============================================================ */
.wk-landing {
  max-width: 720px;
  margin: 24px auto;
  padding: 0 16px 48px;
  color: var(--wk-text);
}
.wk-landing-header { text-align: center; margin-bottom: 24px; }
.wk-landing-title {
  font-size: 1.75rem; font-weight: 700; margin: 0;
  color: var(--wk-text);
}
.wk-landing-title i { color: var(--wk-primary); margin-right: 8px; }
.wk-landing-subtitle {
  color: var(--wk-text-muted);
  font-size: 1rem;
  margin: 8px 0 0;
}
.wk-back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--wk-primary); text-decoration: none;
  font-weight: 600; font-size: 0.9rem;
  margin-bottom: 12px;
}
.wk-back-link:hover { color: var(--wk-primary-dark); }

.wk-hero-card {
  background: var(--wk-surface);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius);
  box-shadow: var(--wk-shadow);
  padding: 24px; margin-bottom: 20px; text-align: center;
}
.wk-hero-card__kicker {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--wk-primary-dark); font-weight: 700;
  font-size: 0.85rem; text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--wk-primary-soft);
  padding: 6px 14px; border-radius: 999px;
  margin-bottom: 14px;
}
.wk-hero-card__title-row {
  display: flex; justify-content: space-between;
  align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.wk-hero-card__title {
  font-size: 1.35rem; font-weight: 700; margin: 0;
  color: var(--wk-text);
}
.wk-hero-card__meta { color: var(--wk-text-muted); font-size: 0.9rem; }

.wk-cta-btn {
  display: inline-flex !important; align-items: center; gap: 10px;
  padding: 14px 28px !important;
  background: var(--wk-primary) !important; color: #fff !important;
  border: none !important;
  border-radius: var(--wk-radius-sm) !important;
  font-weight: 700 !important; font-size: 1.05rem !important;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(255, 141, 0, 0.3);
  margin-top: 8px; min-height: 52px;
}
.wk-cta-btn:hover { background: var(--wk-primary-dark) !important; }

.wk-in-progress-chip {
  background: var(--wk-primary-soft);
  border-radius: var(--wk-radius-sm);
  padding: 12px 16px; margin: 16px 0;
}
.wk-in-progress-chip__row {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; color: var(--wk-primary-dark);
}
.wk-state-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--wk-primary);
  animation: wk-pulse 1.5s infinite;
}
@keyframes wk-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.wk-completed-card { padding: 8px 0; }
.wk-completed-icon { font-size: 3.2rem; color: var(--wk-success); margin-bottom: 8px; }
.wk-completed-title {
  font-size: 1.2rem; margin: 0 0 18px;
  color: #047857; font-weight: 700;
}
.wk-completed-stats {
  display: flex; justify-content: center;
  gap: 24px; margin: 20px 0; flex-wrap: wrap;
}
.wk-completed-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wk-completed-stat__value {
  font-size: 1.6rem; font-weight: 700;
  color: var(--wk-primary);
}
.wk-completed-stat__value--success { color: var(--wk-success); }
.wk-completed-stat__label {
  font-size: 0.8rem; color: var(--wk-text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.wk-next-countdown {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 16px;
  background: var(--wk-primary-soft);
  border-radius: var(--wk-radius-sm);
  color: var(--wk-primary-dark);
  font-size: 0.95rem;
  margin: 16px auto; max-width: 320px;
}
.wk-completed-actions {
  display: flex; gap: 10px; justify-content: center;
  flex-wrap: wrap; margin-top: 16px;
}

.wk-how-to-play {
  background: var(--wk-surface);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius);
  box-shadow: var(--wk-shadow-sm);
  padding: 24px; margin-bottom: 20px;
}
.wk-section-title {
  font-size: 1.1rem; font-weight: 700; margin: 0 0 16px;
  color: var(--wk-text);
  display: flex; align-items: center; gap: 8px;
}
.wk-section-title i { color: var(--wk-primary); }
.wk-steps { display: flex; flex-direction: column; gap: 16px; }
.wk-step { display: flex; gap: 14px; align-items: flex-start; }
.wk-step-number {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--wk-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
}
.wk-step-content strong {
  display: block; font-weight: 700;
  margin-bottom: 4px; color: var(--wk-text);
}
.wk-step-content p {
  margin: 0; color: var(--wk-text-muted);
  font-size: 0.95rem; line-height: 1.5;
}

/* Difficulty badges (index hero card) */
.wk-difficulty {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600; font-size: 0.8rem;
}
.wk-difficulty--1 { background: var(--wk-success-soft); color: #047857; }
.wk-difficulty--2 { background: var(--wk-warning); color: #78350f; }
.wk-difficulty--3 { background: var(--wk-error-soft); color: #991b1b; }

/* Sidebar (recent puzzles on index) */
.wk-sidebar-card {
  background: var(--wk-surface);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius);
  box-shadow: var(--wk-shadow-sm);
  margin-bottom: 20px; overflow: hidden;
}
.wk-sidebar-header {
  background: var(--wk-surface-soft);
  padding: 14px 20px;
  font-weight: 700; color: var(--wk-text);
  border-bottom: 1px solid var(--wk-border);
  display: flex; align-items: center; gap: 8px;
}
.wk-sidebar-header i { color: var(--wk-primary); }
.wk-sidebar-body { padding: 12px 16px; }
.wk-sidebar-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--wk-border-light);
  background: var(--wk-surface-soft);
}
.wk-sidebar-footer a {
  color: var(--wk-primary-dark);
  text-decoration: none; font-weight: 600;
  font-size: 0.9rem;
}
.wk-puzzle-list { display: flex; flex-direction: column; }
.wk-puzzle-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px;
  text-decoration: none; color: var(--wk-text);
  border-bottom: 1px solid var(--wk-border-light);
}
.wk-puzzle-row:last-child { border-bottom: none; }
.wk-puzzle-row:hover { background: var(--wk-surface-soft); }
.wk-puzzle-date {
  font-weight: 700; color: var(--wk-primary-dark);
  min-width: 48px;
}
.wk-puzzle-theme { flex: 1; color: var(--wk-text); }
.wk-puzzle-status i { font-size: 1.1rem; }

/* Archive grid */
.wk-archive-grid {
  list-style: none;
  padding: 0; margin: 16px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.wk-archive-card a {
  display: block;
  padding: 16px;
  background: var(--wk-surface);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-sm);
  text-decoration: none; color: var(--wk-text);
  box-shadow: var(--wk-shadow-sm);
  min-height: 110px;
  transition: transform 0.15s, border-color 0.15s;
}
.wk-archive-card a:hover {
  transform: translateY(-2px);
  border-color: var(--wk-primary);
}
.wk-archive-card--done a { border-left: 4px solid var(--wk-success); }
.wk-archive-card--inprogress a { border-left: 4px solid var(--wk-primary); }
.wk-archive-card__date {
  display: block;
  font-size: 0.8rem;
  color: var(--wk-text-muted);
}
.wk-archive-card__title {
  display: block; font-weight: 700;
  margin-top: 4px; color: var(--wk-text);
}
.wk-archive-card__meta {
  display: block; margin-top: 4px;
  font-size: 0.8rem; color: var(--wk-text-muted);
}
.wk-archive-card__badge {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  background: var(--wk-success-soft);
  color: #047857;
  border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
}
.wk-archive-card__badge--inprogress {
  background: var(--wk-primary-soft);
  color: var(--wk-primary-dark);
}
.wk-pagination {
  margin: 20px 0;
  display: flex; justify-content: center;
  gap: 12px; align-items: center;
}
.wk-pagination a {
  padding: 10px 18px;
  background: var(--wk-surface);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-sm);
  color: var(--wk-primary);
  text-decoration: none; font-weight: 700;
}

/* Archive auth gate */
.wk-archive-locked {
  background: var(--wk-surface);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius);
  box-shadow: var(--wk-shadow-sm);
  padding: 40px 24px;
  text-align: center;
  margin: 20px 0;
}
.wk-archive-locked__icon {
  font-size: 2.8rem;
  color: var(--wk-primary);
  margin-bottom: 16px;
}
.wk-archive-locked h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--wk-text);
  margin: 0 0 10px;
}
.wk-archive-locked p {
  color: var(--wk-text-muted);
  margin: 0 0 20px;
  font-size: 0.95rem;
}
.wk-archive-locked .wk-cta-btn { margin-top: 4px; }

.wk-no-puzzle {
  text-align: center;
  padding: 48px 24px;
  background: var(--wk-surface);
  border: 2px dashed var(--wk-border);
  border-radius: var(--wk-radius);
  color: var(--wk-text-muted);
}
.wk-no-puzzle i {
  display: block;
  font-size: 2.5rem;
  color: var(--wk-primary);
  margin-bottom: 12px;
}

/* Bootstrap btn overrides inside landing */
.wk-landing .btn-primary,
.wk-landing .btn.btn-primary {
  background: var(--wk-primary);
  border-color: var(--wk-primary);
  color: #fff;
}
.wk-landing .btn-primary:hover,
.wk-landing .btn.btn-primary:hover {
  background: var(--wk-primary-dark);
  border-color: var(--wk-primary-dark);
}
.wk-landing .btn-outline-primary {
  color: var(--wk-primary);
  border: 2px solid var(--wk-primary);
  background: transparent;
  padding: 10px 20px;
  border-radius: var(--wk-radius-sm);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center; gap: 6px;
}
.wk-landing .btn-outline-primary:hover {
  background: var(--wk-primary-soft);
}

/* ============================================================
   "Already done" banner (shown on play page when revisiting)
   ============================================================ */
.wk-already-done {
  display: flex;
  gap: 14px; align-items: center;
  background: var(--wk-success-soft);
  border: 1px solid #6ee7b7;
  border-radius: var(--wk-radius);
  padding: 16px 20px;
  margin: 16px auto;
  max-width: 480px;
  box-shadow: var(--wk-shadow-sm);
}
.wk-already-done[hidden] { display: none; }
.wk-already-done__icon {
  font-size: 2rem;
  color: var(--wk-success);
}
.wk-already-done__body { flex: 1; }
.wk-already-done__body h2 {
  margin: 0 0 4px;
  font-size: 1.05rem; color: #047857;
}
.wk-already-done__body p {
  margin: 0 0 10px;
  color: var(--wk-text);
  font-size: 0.95rem;
}
.wk-btn--inline {
  display: inline-flex;
  align-items: center; gap: 8px;
  padding: 10px 20px; min-height: 44px;
  background: var(--wk-primary); color: white;
  border-radius: var(--wk-radius-sm);
  font-weight: 700; text-decoration: none;
  border: none; cursor: pointer;
}
.wk-btn--inline:hover { background: var(--wk-primary-dark); }
.wk-btn--primary { background: var(--wk-primary); color: white; }

/* ============================================================
   Completion overlay (trophy + rewards + CTA back to hub)
   ============================================================ */
.wk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  display: flex;
  align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.wk-overlay[hidden] { display: none; }
.wk-overlay__panel {
  background: var(--wk-surface);
  padding: 32px 24px;
  border-radius: var(--wk-radius);
  text-align: center;
  max-width: 92%; width: 380px;
  box-shadow: var(--wk-shadow-lg);
}
.wk-overlay__trophy {
  font-size: 3.2rem;
  color: var(--wk-primary);
  margin-bottom: 12px;
  animation: wk-trophy 0.6s ease-out;
}
@keyframes wk-trophy {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
.wk-overlay__panel h2 {
  margin: 0 0 12px;
  color: var(--wk-text);
  font-size: 1.4rem;
}
.wk-overlay__time {
  font-size: 1.3rem; font-weight: 700;
  margin: 8px 0 12px;
  color: var(--wk-primary);
}
.wk-overlay__rewards {
  margin: 12px 0 20px;
  color: var(--wk-text);
  font-weight: 600; font-size: 1.05rem;
  padding: 10px 16px;
  background: var(--wk-primary-soft);
  border-radius: var(--wk-radius-sm);
  display: inline-block;
}

/* Stats row (XP / streak / perfect) */
.wk-overlay__stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 8px;
}
.wk-overlay-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
}
.wk-overlay-stat[hidden] { display: none !important; }
.wk-overlay-stat i { font-size: 0.95rem; }
.wk-overlay-stat strong { font-size: 1rem; }
.wk-overlay-stat--xp { background: #fff4e6; color: #c2410c; }
.wk-overlay-stat--xp i { color: #ff8d00; }
.wk-overlay-stat--streak { background: #ffedd5; color: #9a3412; }
.wk-overlay-stat--streak i { color: #f97316; }
.wk-overlay-stat--perfect { background: #fef3c7; color: #92400e; }
.wk-overlay-stat--perfect i { color: #f59e0b; }

/* Badges unlocked */
.wk-overlay-badges {
  margin: 16px 0;
  padding: 12px;
  background: #fff8f2;
  border-radius: 12px;
}
.wk-overlay-badges[hidden] { display: none !important; }
.wk-overlay-badges h3 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9a3412;
  font-weight: 700;
}
.wk-overlay-badges-list {
  display: flex; justify-content: center;
  flex-wrap: wrap; gap: 8px;
}
.wk-overlay-badge {
  padding: 6px 12px;
  background: white;
  border: 1px solid #ffd9b3;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #c2410c;
}

/* Share buttons */
.wk-overlay-share {
  margin: 20px 0 4px;
  padding-top: 16px;
  border-top: 1px solid #f3f4f6;
  text-align: center;
}
.wk-overlay-share__label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin: 0 0 10px;
  font-weight: 600;
}
.wk-overlay-share__buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.wk-share-btn {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  background: #fff;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s ease, background .18s ease, color .18s ease, border-color .18s ease;
  padding: 0;
}
.wk-share-btn:active { transform: scale(0.94); }
.wk-share-btn--whatsapp { color: #25d366; border: 1.5px solid #25d366; }
.wk-share-btn--whatsapp:hover { background: #25d366; color: #fff; }
.wk-share-btn--facebook { color: #1877f2; border: 1.5px solid #1877f2; }
.wk-share-btn--facebook:hover { background: #1877f2; color: #fff; }
.wk-share-btn--copy { color: #6b7280; border: 1.5px solid #d1d5db; }
.wk-share-btn--copy:hover { background: #6b7280; color: #fff; border-color: #6b7280; }

/* Cross-promo (try also) */
.wk-overlay-more {
  margin: 20px 0 12px;
  padding-top: 16px;
  border-top: 1px solid #f3f4f6;
}
.wk-overlay-more__label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin: 0 0 10px;
  font-weight: 600;
}
.wk-overlay-more__links {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.wk-overlay-promo-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  color: #374151;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
}
.wk-overlay-promo-link:hover {
  background: #fff8f2;
  border-color: #ffd9b3;
  color: #c2410c;
}
.wk-overlay-promo-link i { color: #ff8d00; }

/* Countdown */
.wk-overlay-countdown {
  margin-top: 16px;
  padding: 10px 14px;
  background: #f9fafb;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.wk-overlay-countdown strong {
  color: #111827;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.wk-overlay__actions {
  display: flex; gap: 10px;
  margin-top: 20px;
}
.wk-overlay__actions .wk-btn,
.wk-overlay__actions .btn {
  flex: 1;
  min-height: 48px;
  border-radius: var(--wk-radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 6px;
  font-weight: 700;
  padding: 12px 16px;
  border: none;
  cursor: pointer;
}
.wk-overlay__actions .wk-btn--primary {
  background: var(--wk-primary); color: white;
}
.wk-overlay__actions .wk-btn--secondary {
  background: var(--wk-surface);
  color: var(--wk-primary);
  border: 2px solid var(--wk-primary);
}

/* ============================================================
   Login-required modal (shown on archive puzzles + hint for anonymous)
   ============================================================ */
.mk-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.mk-modal[hidden] { display: none; }
.mk-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(2px);
}
.mk-modal__content {
  position: relative;
  background: white;
  border-radius: 20px;
  padding: 32px 24px 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
  animation: mk-modal-in 0.3s ease-out;
}
@keyframes mk-modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.mk-modal__close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  border: none; background: #f3f4f6;
  border-radius: 50%;
  color: #6b7280; cursor: pointer;
  font-size: 0.9rem;
}
.mk-modal__close:hover { background: #e5e7eb; }
.mk-modal__icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #fff4e6;
  color: #ff8d00;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
}
.mk-modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: #1f2937;
}
.mk-modal__desc {
  color: #6b7280;
  font-size: 0.95rem;
  margin: 0 0 20px;
}
.mk-modal__benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  text-align: left;
}
.mk-modal__benefits li {
  padding: 6px 0;
  font-size: 0.9rem;
  color: #374151;
  display: flex; align-items: center; gap: 8px;
}
.mk-check {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 20px; height: 20px;
  background: #dcfce7;
  color: #15803d;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.mk-modal__actions {
  display: flex; flex-direction: column; gap: 10px;
}
.mk-modal__google {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  color: #1f2937;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.15s;
}
.mk-modal__google:hover { background: #f9fafb; border-color: #9ca3af; }
.mk-modal__register {
  color: #ff8d00;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  padding: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.mk-modal__register:hover { color: #e67700; text-decoration: underline; }

/* Ad-reward CTA inside the no-hints modal */
.mk-modal__ad-btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  background: linear-gradient(135deg, #ff8d00 0%, #e67e00 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 141, 0, 0.3);
  font-family: inherit;
  transition: all 0.15s;
}
.mk-modal__ad-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #e67700 0%, #cc6600 100%);
  transform: translateY(-1px);
}
.mk-modal__ad-btn:active { transform: translateY(0); }
.mk-modal__ad-btn:disabled { opacity: 0.6; cursor: wait; }
.mk-modal__ad-btn i { font-size: 1.1rem; }

/* Driver.js popover custom styling */
.driver-popover.mk-tour-popover {
  background: var(--c-surface);
  border-radius: var(--r-card);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  font-family: inherit;
}
.driver-popover.mk-tour-popover .driver-popover-title {
  color: var(--c-text);
  font-size: 16px; font-weight: 600;
}
.driver-popover.mk-tour-popover .driver-popover-description {
  color: var(--c-text-2);
  font-size: 14px;
  line-height: 1.5;
}
.driver-popover.mk-tour-popover .driver-popover-next-btn,
.driver-popover.mk-tour-popover .driver-popover-prev-btn {
  background: var(--c-orange);
  color: white;
  border: none;
  border-radius: var(--r-pill);
  padding: 6px 14px;
  font-size: 13px; font-weight: 500;
  text-shadow: none;
}
.driver-popover.mk-tour-popover .driver-popover-prev-btn {
  background: var(--c-kb-action);
  color: var(--c-text-2);
}
