/* 📅 Головоломки дня (/daily). Мобильный вьюпорт 390px — основной. */
.dl-body {
  --dl-c: #1f9d55; --dl-p: #c9a227; --dl-a: #3a3848;
  /* клетка влезает и по ширине, и по высоте: доска + клавиатура на одном экране телефона */
  --dl-cell: max(38px, min(56px, calc((100vw - 32px - 4 * 6px) / 5), calc((100dvh - 470px) / 6)));
  overflow-x: hidden;
}
.dl-body.dl-cb-on { --dl-c: #f5793a; --dl-p: #3b8fd9; --dl-a: #3a3848; }

.dl-nav { gap: 8px; }
.dl-nav .nav-right { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dl-langs { display: flex; gap: 2px; }
.dl-lang { padding: 6px; border-radius: 8px; text-decoration: none; font-size: 18px; line-height: 1; opacity: 0.6; min-width: 34px; text-align: center; }
.dl-lang.active-locale { opacity: 1; background: rgba(255, 255, 255, 0.1); }
@media (max-width: 420px) {
  .dl-brand-txt { display: none; }
  .dl-play { padding: 7px 10px; font-size: 13px; }
}

.dl-wrap { max-width: 520px; margin: 0 auto; padding: 8px 16px 40px; box-sizing: border-box; width: 100%; }
.dl-head { text-align: center; margin: 4px 0 6px; }
@media (max-height: 900px) and (max-width: 520px) { .dl-sub { display: none; } }
.dl-title { font-family: var(--font-display); font-size: clamp(22px, 6vw, 30px); margin: 4px 0; }
.dl-sub { color: var(--text-secondary); font-size: 14px; margin: 0 0 8px; }
.dl-chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.dl-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px; font-weight: 700; white-space: nowrap;
}
.dl-chip:empty { display: none; }
.dl-timer { font-variant-numeric: tabular-nums; }

.dl-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0; }
.dl-tab {
  padding: 10px 8px; min-height: 44px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05); color: var(--text); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
}
.dl-tab.active { background: linear-gradient(135deg, var(--neon-violet, #8b5cf6), var(--neon-pink, #ec4899)); border-color: transparent; }

.dl-tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; align-items: center; margin: 6px 0; }
.dl-tool {
  padding: 6px 10px; min-height: 36px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05); color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.dl-tool.active { border-color: var(--neon-pink, #ec4899); background: rgba(236, 72, 153, 0.16); }
.dl-cb input { width: 16px; height: 16px; accent-color: var(--neon-pink, #ec4899); margin: 0; }
.dl-msg { min-height: 22px; text-align: center; font-weight: 700; color: var(--neon-gold, #fbbf24); font-size: 14px; }

/* ── доска ── */
.dl-board { display: grid; gap: 6px; justify-content: center; margin: 4px auto 10px; }
.dl-row { display: grid; grid-template-columns: repeat(5, var(--dl-cell)); gap: 6px; }
.dl-cell {
  width: var(--dl-cell); height: var(--dl-cell); box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.16); border-radius: 8px;
  font-family: var(--font-display); font-size: calc(var(--dl-cell) * 0.5); font-weight: 800; color: #fff;
  text-transform: uppercase; user-select: none;
}
.dl-row.dl-active .dl-cell { border-color: rgba(255, 255, 255, 0.26); }
.dl-cell.dl-typed { border-color: rgba(255, 255, 255, 0.6); animation: dlPop 0.12s ease-out; }
.dl-cell.dl-c, .dl-key.dl-c { background: var(--dl-c); border-color: var(--dl-c); }
.dl-cell.dl-p, .dl-key.dl-p { background: var(--dl-p); border-color: var(--dl-p); }
.dl-cell.dl-a, .dl-key.dl-a { background: var(--dl-a); border-color: var(--dl-a); }
/* дальтоники: не только цвет — ещё и узор */
.dl-cb-on .dl-cell.dl-c { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.22) 0 4px, transparent 4px 10px); }
.dl-cb-on .dl-cell.dl-p { background-image: radial-gradient(rgba(255,255,255,0.35) 1.5px, transparent 2px); background-size: 9px 9px; }
.dl-cb-on .dl-cell.dl-c::after { content: '✓'; position: absolute; font-size: 10px; inset-inline-end: 3px; top: 1px; }
.dl-cell { position: relative; }
.dl-cell.dl-flip { animation: dlFlip 0.5s ease both; }
.dl-row.dl-shake { animation: dlShake 0.4s; }
@keyframes dlPop { 50% { transform: scale(1.08); } }
@keyframes dlFlip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes dlShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .dl-cell.dl-flip, .dl-row.dl-shake, .dl-cell.dl-typed { animation: none; } }

/* ── клавиатура: физическая раскладка, всегда слева направо ── */
.dl-kb { display: grid; gap: 6px; margin: 8px 0 0; direction: ltr; user-select: none; }
.dl-kb-row { display: flex; gap: 4px; justify-content: center; }
.dl-key {
  flex: 1 1 0; min-width: 0; max-width: 44px; height: 50px; padding: 0;
  border: 0; border-radius: 6px; background: rgba(255, 255, 255, 0.16); color: #fff;
  font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; text-transform: uppercase;
  touch-action: manipulation;
}
.dl-key:active { transform: scale(0.94); }
.dl-key.dl-key-wide { flex: 1.5 1 0; max-width: 64px; font-size: 20px; text-transform: none; }
[lang="he"] .dl-key { font-size: 17px; }

/* ── итог ── */
.dl-result {
  margin: 6px 0 12px; padding: 14px; border-radius: 16px; text-align: center;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.12);
}
.dl-result-title { font-family: var(--font-display); font-size: 18px; font-weight: 800; }
.dl-result-text { margin: 6px 0 10px; font-size: 15px; overflow-wrap: anywhere; }
.dl-result-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.dl-result-next { margin-top: 10px; font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ── статистика / помощь ── */
.dl-modal { max-width: 380px; width: calc(100% - 32px); max-height: calc(100dvh - 40px); overflow-y: auto; }
.dl-modal p { font-size: 14px; line-height: 1.45; margin: 8px 0; }
.dl-help-ex { display: flex; align-items: center; gap: 10px; }
.dl-help-ex .dl-cell { --dl-cell: 34px; flex: 0 0 auto; font-size: 16px; }
.dl-cb-hint { color: var(--text-secondary); font-size: 13px !important; }
.dl-stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin-bottom: 10px; }
.dl-stat b { display: block; font-size: 26px; font-family: var(--font-display); }
.dl-stat span { font-size: 11px; color: var(--text-secondary); line-height: 1.2; display: block; }
.dl-dist-h { margin: 8px 0 6px; font-size: 14px; text-align: center; }
.dl-dist { display: grid; gap: 4px; margin-bottom: 14px; }
.dl-dist-row { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.dl-dist-row i { font-style: normal; background: var(--dl-a); padding: 2px 6px; text-align: end; border-radius: 4px; min-width: 18px; box-sizing: border-box; }
.dl-dist-row i.dl-dist-me { background: var(--dl-c); }
.dl-close { width: 100%; }

.dl-toast {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 1200;
  padding: 10px 16px; border-radius: 12px; background: #f4f2fb; color: #14102a; font-weight: 800;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); max-width: calc(100vw - 32px); text-align: center;
}

/* ── нонограмма ── */
.dl-nono-hint { font-size: 13px; color: var(--text-secondary); text-align: center; margin: 4px 0 6px; line-height: 1.4; }
.dl-nono {
  --ng-cell: min(28px, calc((100vw - 32px - var(--rc) * 13px - 6px) / var(--n)));
  display: grid; grid-template-columns: calc(var(--rc) * 13px + 4px) calc(var(--n) * var(--ng-cell));
  grid-template-rows: calc(var(--cc) * 14px + 4px) auto;
  justify-content: center; margin: 6px auto 10px; user-select: none; touch-action: none;
}
.ng-cols { display: grid; grid-template-columns: repeat(var(--n), var(--ng-cell)); align-items: end; }
.ng-rows { display: grid; grid-template-rows: repeat(var(--n), var(--ng-cell)); }
.ng-clue { font-size: 11px; font-weight: 800; color: var(--text); display: flex; gap: 2px; font-variant-numeric: tabular-nums; }
.ng-col { flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 3px; line-height: 13px; }
.ng-row { align-items: center; justify-content: flex-end; padding-inline-end: 4px; gap: 4px; }
.ng-clue.ng-done { color: rgba(244, 242, 251, 0.32); }
.ng-grid {
  display: grid; grid-template-columns: repeat(var(--n), var(--ng-cell)); grid-template-rows: repeat(var(--n), var(--ng-cell));
  border: 2px solid rgba(255, 255, 255, 0.55); border-radius: 4px; overflow: hidden; touch-action: none;
}
.ng-cell {
  width: var(--ng-cell); height: var(--ng-cell); padding: 0; border: 0; margin: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.14); border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04); cursor: pointer; position: relative; touch-action: none;
}
.ng-cell.ng-bx { border-right: 2px solid rgba(255, 255, 255, 0.45); }
.ng-cell.ng-by { border-bottom: 2px solid rgba(255, 255, 255, 0.45); }
.ng-cell.ng-on { background: #e9e6ff; }
.ng-cell.ng-x::after { content: '✕'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, 0.45); font-size: calc(var(--ng-cell) * 0.55); }
.dl-nono.ng-solved .ng-cell.ng-on { background: #4ade80; }
.dl-nono.ng-solved .ng-cell.ng-x::after { content: ''; }

/* ── конфетти ── */
.dl-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1300; overflow: hidden; }
.dl-confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: dlFall 2.2s ease-in forwards; }
@keyframes dlFall { to { top: 105%; transform: rotate(540deg); } }

.dl-foot { text-align: center; margin-top: 18px; }
.dl-foot a { color: var(--text-secondary); }
