/*
Theme Name: Speakster
Theme URI: https://speakster.pl
Author: Joanna Patyk-Taous
Description: Generator warm-upów dla lektorów angielskiego. Losowe pytania, słówka i gramatyka na start lekcji.
Version: 2.5.3
Requires PHP: 7.4
Text Domain: speakster
*/

:root {
  --ink: #2a1454;
  --violet: #5b21d6;
  --violet-dark: #4a17b8;
  --lime: #a3e635;
  --lime-dark: #7fb520;
  --paper: #faf8ff;
  --white: #ffffff;
  --muted: #6f6a85;
  --radius: 20px;
  --shadow: 0 8px 24px rgba(42, 20, 84, 0.10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { overflow-x: hidden; max-width: 100%; }

body {
  font-family: 'Work Sans', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, .logo, .bubble-text {
  font-family: 'Fraunces', Georgia, serif;
}

button { font-family: 'Work Sans', sans-serif; }

.app-title { font-weight: 900; }

.logo { font-weight: 900; }
.logo .lo-a { color: var(--violet); }
.logo .lo-b { color: var(--lime); -webkit-text-stroke: 0.5px var(--violet-dark); }

/* ---------- Header ---------- */
.site-header {
  padding: 24px 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}

.logo-link { display: inline-block; line-height: 0; }

.site-logo {
  width: clamp(110px, 22vw, 150px);
  height: auto;
  transition: transform 0.15s ease;
}

.logo-link:hover .site-logo { transform: scale(1.04) rotate(-2deg); }

.logo-link:focus-visible { outline: 3px solid var(--violet); outline-offset: 4px; border-radius: 12px; }

.site-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
}

/* Trzy narzedzia jako jedna grupa */
.nav-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--white);
  padding: 5px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.nav-tools .nav-tool {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-tools .nav-tool:hover { color: var(--ink); background: rgba(163, 230, 53, 0.22); }
.nav-tools .nav-tool.active { background: var(--lime); color: var(--ink); box-shadow: inset 0 -2px 0 var(--lime-dark); }
.nav-tools .nav-tool:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }

/* Link informacyjny, celowo pod grupa narzedzi */
.nav-meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 4px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}
.nav-meta:hover, .nav-meta.active { color: var(--violet); }
.nav-meta:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }

.cross-link { margin-top: 18px; font-size: 0.92rem; color: var(--muted); }
.cross-link a { color: var(--violet); font-weight: 700; text-decoration: none; }
.cross-link a:hover { opacity: 0.8; }

/* Strona SOS */
.rescue-page .rescue-panel { margin-top: 10px; }

/* ---------- Layout ---------- */
.app {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 24px 64px;
  text-align: center;
}

.app-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 600;
  margin-bottom: 6px;
}

.app-sub {
  color: var(--muted);
  margin-bottom: 28px;
}

/* ---------- Controls ---------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-bottom: 12px;
}

.control-group {
  display: flex;
  max-width: 100%;
  gap: 8px;
  background: var(--white);
  padding: 6px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.chip {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover { color: var(--ink); }

.chip.active {
  background: var(--ink);
  color: var(--white);
}

.chip:focus-visible,
.draw-btn:focus-visible,
.mode-btn:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
}

/* ---------- Bubble flip card ---------- */
.bubble-wrap {
  margin: 36px auto 20px;
  max-width: 620px;
  position: relative;
}

.bubble-flip {
  perspective: 1400px;
  cursor: pointer;
  outline: none;
}

.bubble-flip:focus-visible .bubble-inner {
  box-shadow: 0 0 0 3px var(--violet), var(--shadow);
  border-radius: 28px;
}

.bubble-inner {
  display: grid;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
  position: relative;
}

.bubble-inner.flipped { transform: rotateY(180deg); }

.bubble-face {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: clamp(32px, 6vw, 56px) clamp(24px, 5vw, 48px);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.face-front {
  background: var(--white);
}

.face-front::after {
  content: '';
  position: absolute;
  bottom: -18px;
  left: 60px;
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 20px solid var(--white);
}

.face-back {
  background: var(--violet);
  color: var(--white);
  transform: rotateY(180deg);
}

.bubble-text {
  font-size: clamp(1.3rem, 3.4vw, 1.9rem);
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: break-word;
  max-width: 100%;
}

.bubble-meta {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.back-label {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lime);
  font-weight: 600;
}

.back-big {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.3rem, 3.4vw, 1.9rem);
  font-weight: 500;
  line-height: 1.35;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: min(460px, 100%);
}

.pill {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.95rem;
}

.flip-hint {
  margin-top: 26px;
  font-size: 0.82rem;
  color: var(--muted);
  visibility: hidden;
}

.bubble-inner.pop { animation: pop 0.28s ease; }

@keyframes pop {
  0% { transform: scale(0.96); opacity: 0.4; }
  60% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .bubble-inner.pop { animation: none; }
  .bubble-inner { transition: none; }
}

/* ---------- Draw button ---------- */
.draw-btn {
  background: var(--lime);
  color: var(--ink);
  border: none;
  font-size: 1.15rem;
  font-weight: 600;
  padding: 16px 40px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(42, 20, 84, 0.18);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  margin-top: 8px;
}

.draw-btn:hover { transform: translateY(-2px); }
.draw-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(42, 20, 84, 0.18); }

.hint {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

kbd {
  background: var(--white);
  border: 1px solid #e4ddcf;
  border-radius: 6px;
  padding: 1px 7px;
  font-family: inherit;
  font-size: 0.85em;
}

/* ---------- Mode switch ---------- */
.mode-switch {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
  gap: 6px;
  background: var(--white);
  padding: 6px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}

.mode-btn {
  border: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
}

.mode-btn.active {
  background: var(--violet);
  color: var(--white);
}

/* ---------- Newsletter CTA ---------- */
.cta {
  margin: 48px auto 0;
  max-width: 620px;
  background: var(--ink);
  color: var(--white);
  border-radius: var(--radius);
  padding: 32px 28px;
  text-align: center;
}

.cta h2 { font-size: 1.4rem; margin-bottom: 8px; }
.cta p { color: #cfc9e6; font-size: 0.95rem; margin-bottom: 18px; }

.cta a.cta-btn {
  display: inline-block;
  background: var(--lime);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  padding: 12px 28px;
  border-radius: 999px;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 0.85rem;
  color: var(--muted);
}

.site-footer a { color: var(--violet); text-decoration: none; }

/* ---------- Podstrony ---------- */
.page-content { text-align: left; max-width: 680px; }
.page-content .app-title { text-align: center; margin-bottom: 24px; }
.entry { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 26px; }
.entry h2 { font-size: 1.15rem; margin: 22px 0 8px; }
.entry h2:first-child { margin-top: 0; }
.entry p, .entry li { font-size: 0.98rem; }
.entry ul, .entry ol { padding-left: 22px; margin: 10px 0; }
.entry li { margin-bottom: 6px; }
.entry a { color: var(--violet); }

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .app { padding: 8px 14px 48px; }
  .controls { gap: 8px; }
  .control-group { flex-wrap: wrap; justify-content: center; border-radius: 20px; }
  .chip { padding: 8px 13px; font-size: 0.9rem; }
  .bubble-face { min-height: 160px; padding: 26px 18px; }
  .bubble-wrap { margin-left: 0; margin-right: 0; }
  .mode-btn { padding: 9px 14px; font-size: 0.92rem; }
  .nav-tools .nav-tool { padding: 0 13px; font-size: 0.9rem; }
  .site-nav { gap: 8px; }
  .app { padding-left: 12px; padding-right: 12px; }
  .face-front::after { left: 40px; }
  .draw-btn { width: 100%; max-width: 320px; }
  .hint { display: none; }
  .cta { padding: 26px 18px; }
  .entry { padding: 22px 18px; }
}

/* ---------- Stopka: nawigacja ---------- */
.footer-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-bottom: 10px;
}

.footer-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
}

.footer-nav a:hover { color: var(--violet); }

/* ---------- Strona "Jak to dziala" ---------- */
.sx-lead {
  font-size: 1.08rem;
  text-align: center;
  max-width: 520px;
  margin: 0 auto 26px;
}

.sx-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 34px;
}

.sx-step {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px 18px;
  position: relative;
  text-align: center;
}

.sx-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--ink);
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 900;
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.sx-step h3 { font-size: 1.02rem; margin-bottom: 6px; }
.sx-step p { font-size: 0.92rem; color: var(--muted); line-height: 1.5; }
.sx-step strong { color: var(--violet); }

.sx-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 26px 0 8px;
  text-align: left;
}
.sx-tool {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sx-tool .sx-tool-tag {
  align-self: flex-start;
  background: var(--lime);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}
.sx-tool h3 { font-size: 1.05rem; color: var(--ink); margin: 0; }
.sx-tool p { font-size: 0.92rem; color: var(--muted); line-height: 1.5; margin: 0; }
.sx-tool a.sx-tool-link {
  margin-top: auto;
  color: var(--violet);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.92rem;
}
.sx-tool a.sx-tool-link:hover { opacity: 0.75; }
@media (max-width: 760px) {
  .sx-tools { grid-template-columns: 1fr; }
}

.sx-h2 {
  text-align: center;
  font-size: 1.35rem;
  margin-bottom: 18px;
}

.sx-uses {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 30px;
}

.sx-use {
  background: var(--white);
  border-radius: var(--radius);
  border-left: 6px solid var(--violet);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.sx-use h3 { font-size: 0.98rem; margin-bottom: 4px; color: var(--violet-dark); }
.sx-use p { font-size: 0.9rem; color: var(--muted); line-height: 1.5; }

.sx-cta {
  background: var(--ink);
  color: var(--white);
  border-radius: var(--radius);
  padding: 20px 24px;
  text-align: center;
}

.sx-cta p { font-size: 0.98rem; }
.sx-cta a { color: var(--lime); }

/* Podstrona z siatkami: pelna szerokosc karty tresci */
.page-content .entry:has(.sx-steps) { background: transparent; box-shadow: none; padding: 0; }

@media (max-width: 640px) {
  .sx-steps { grid-template-columns: 1fr; }
  .sx-uses { grid-template-columns: 1fr; }
}

.site-footer a {
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  text-decoration: none;
  font-size: 1em;
}

.site-footer a:hover,
.sx-cta a:hover { opacity: 0.85; }

.entry a, .sx-lead a, .sx-use a { color: var(--violet); font-weight: 600; text-decoration: none; }
.entry a:hover, .sx-lead a:hover, .sx-use a:hover { opacity: 0.75; }

/* Link Patyczanki na ciemnym tle: wyzsza waga niz regula ogolna powyzej */
.entry .sx-cta a, .sx-cta a {
  color: var(--lime);
  font-family: inherit;
  font-weight: 700;
  text-decoration: none;
}
.entry .sx-cta a:hover, .sx-cta a:hover { opacity: 0.85; }

/* ---------- Kalambury ---------- */
.k-modes { margin-bottom: 18px; }

.k-tools-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  margin-top: 14px;
}

.k-palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 7px;
  background: var(--white);
  padding: 8px 10px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.k-color {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  background: var(--sw, var(--ink));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85);
  transform: scale(1);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
}
.k-color:hover { transform: scale(1.18) translateY(-2px); }
.k-color.active {
  transform: scale(1.22);
  box-shadow: inset 0 0 0 2px #fff, 0 0 0 3px var(--ink);
}
.k-color:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
.k-color.pop { animation: k-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes k-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.45) rotate(-6deg); }
  100% { transform: scale(1.22); }
}

.k-sizes {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  padding: 6px 8px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.k-size {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}
.k-size span { display: block; border-radius: 50%; background: var(--ink); transition: transform 0.15s ease; }
.k-size:hover { background: rgba(91, 33, 214, 0.08); }
.k-size:hover span { transform: scale(1.15); }
.k-size.active { background: var(--lime); }
.k-size:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }

.k-eraser-btn { display: inline-flex; align-items: center; gap: 7px; }
.k-eraser-ico { transition: transform 0.18s ease; }
.k-eraser-btn:hover .k-eraser-ico { transform: rotate(-12deg) translateY(-1px); }
.k-eraser-btn.active .k-eraser-ico { transform: rotate(-18deg); }

@media (prefers-reduced-motion: reduce) {
  .k-color, .k-color:hover, .k-size span, .k-eraser-ico { transition: none; transform: none; }
  .k-color.pop { animation: none; }
}

.k-ai { background: var(--violet); color: var(--white); }
.k-ai[disabled] { opacity: 0.5; cursor: not-allowed; }
.k-ai-answer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.22rem;
  line-height: 1.35;
  color: var(--violet-dark);
  font-weight: 600;
  min-height: 1.6em;
  margin: 12px 0 2px;
}
.k-ai-answer.reveal { animation: k-reveal 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes k-reveal {
  0%   { opacity: 0; transform: translateY(8px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.k-ai-answer.hit { color: #2f8f3c; }
.k-ai-answer.hit::after { content: " 🎉"; }

/* Trzy pulsujace kropki */
.k-dots { display: inline-flex; gap: 5px; align-items: center; }
.k-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--violet);
  display: block;
  animation: k-bounce 1s infinite ease-in-out;
}
.k-dots i:nth-child(2) { animation-delay: 0.15s; background: #e0559b; }
.k-dots i:nth-child(3) { animation-delay: 0.3s; background: var(--lime-dark); }
@keyframes k-bounce {
  0%, 80%, 100% { transform: translateY(0) scale(0.85); opacity: 0.55; }
  40%           { transform: translateY(-7px) scale(1); opacity: 1; }
}

.k-ai-answer.thinking .k-think-txt { animation: k-pulse 1.4s ease-in-out infinite; }
@keyframes k-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* Skanowanie plotna w trakcie myslenia */
.k-canvas-wrap { position: relative; }
canvas.k-scanning { position: relative; }
canvas.k-scanning::after { content: none; }
.k-canvas-wrap.scanning::after { content: none; }

canvas.k-scanning {
  box-shadow: 0 0 0 3px rgba(91, 33, 214, 0.25);
  animation: k-scan-glow 1.6s ease-in-out infinite;
}
@keyframes k-scan-glow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(91, 33, 214, 0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(163, 230, 53, 0.45); }
}

@media (prefers-reduced-motion: reduce) {
  .k-dots i, .k-ai-answer.thinking .k-think-txt, canvas.k-scanning { animation: none; }
  .k-ai-answer.reveal { animation: none; }
}

/* Widocznosc zaleznie od trybu gry */
body[data-kmode="class"] .k-ai,
body[data-kmode="class"] .k-ai-answer { display: none; }
body[data-kmode="ai"] .k-yes { display: none; }

/* Paleta tylko w trakcie rysowania */
body[data-kphase="idle"] .k-tools-row,
body[data-kphase="peek"] .k-tools-row,
body[data-kphase="between"] .k-tools-row { visibility: hidden; }

.kalambury { max-width: 720px; }

.k-hud {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 14px 0;
  font-size: 0.95rem;
  color: var(--muted);
}
.k-hud strong { color: var(--ink); font-size: 1.05rem; }
#k-timer.low { color: #d6213c; }

.k-stage {
  position: relative;
  background: var(--white);
  border-radius: 22px;
  box-shadow: var(--shadow);
  height: min(58vh, 480px);
  overflow: hidden;
}

.k-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.k-idle, .k-peek-panel {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--white);
  padding: 20px;
  text-align: center;
}

body[data-kphase="idle"] .k-idle,
body[data-kphase="between"] .k-idle { display: flex; }
body[data-kphase="peek"] .k-peek-panel { display: flex; }

body[data-kphase="between"] .k-idle::before {
  content: '';
}

.k-warn {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 340px;
}

.k-wordbox {
  background: var(--ink);
  color: var(--white);
  border-radius: 16px;
  padding: 22px 34px;
}

.k-word {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 900;
}

/* Miedzy rundami pokazujemy haslo nad przyciskiem startu */
body[data-kphase="between"] .k-idle { gap: 10px; }
body[data-kphase="between"] .k-idle::after { content: none; }

.k-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

.k-tool, .k-btn {
  border: none;
  border-radius: 999px;
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 20px;
  cursor: pointer;
}

.k-tool { background: var(--white); color: var(--ink); box-shadow: var(--shadow); }
.k-tool.active { background: var(--ink); color: var(--white); }

.k-yes { background: var(--lime); color: var(--ink); }
.k-no { background: #f3ede2; color: var(--muted); }

body[data-kphase="idle"] .k-actions,
body[data-kphase="peek"] .k-actions { visibility: hidden; }
body[data-kphase="between"] .k-actions .k-yes,
body[data-kphase="between"] .k-actions .k-no { visibility: hidden; }

.k-hint { margin-top: 14px; display: block !important; }

/* Haslo miedzy rundami: wyswietlane w panelu idle */
body[data-kphase="between"] .k-idle .k-between-word { display: block; }

@media (max-width: 480px) {
  .k-stage { height: 52vh; }
  .k-hud { gap: 14px; font-size: 0.88rem; }
}

.k-between-word {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--violet-dark);
}

/* ---------- Linki w tresci "Jak to dziala" ---------- */
.sx-use a, .sx-lead a {
  color: var(--violet);
  font-weight: 600;
  text-decoration: none;
}
.sx-use a:hover, .sx-lead a:hover { color: var(--violet-dark); }


/* ---------- Lesson Rescue ---------- */
.rescue-panel { margin: 28px auto 8px; max-width: 640px; }
.rescue-intro { color: var(--muted); font-size: 1rem; max-width: 460px; margin: 0 auto 22px; }
.rescue-clock { position: relative; width: 190px; height: 190px; margin: 0 auto 18px; }
.rescue-clock svg { transform: rotate(-90deg); }
.rescue-track { fill: none; stroke: #e9e3f8; stroke-width: 12; stroke-linecap: round; }
.rescue-bar {
  fill: none; stroke: url(#sx-rescue-grad); stroke-width: 12; stroke-linecap: round;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.rescue-time {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.rescue-time b {
  font-family: 'Fraunces', serif; font-weight: 900; font-size: 3.4rem; line-height: 1; color: var(--ink);
}
.rescue-time span { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.rescue-mins {
  display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  background: var(--white); padding: 6px; border-radius: 999px; box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.rmin {
  border: none; background: transparent; color: var(--muted);
  font-size: 0.95rem; font-weight: 600; font-family: inherit;
  padding: 8px 16px; border-radius: 999px; cursor: pointer; transition: all 0.15s ease;
}
.rmin:hover { color: var(--ink); }
.rmin.active { background: var(--violet); color: var(--white); }
.rmin:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.rescue-list { margin-top: 26px; display: grid; gap: 10px; text-align: left; }
.rescue-item {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px;
  opacity: 0; transform: translateY(10px);
  animation: rescue-in 0.4s ease forwards;
}
@keyframes rescue-in { to { opacity: 1; transform: none; } }
.rescue-item-top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px;
}
.rescue-item-top b { font-size: 1rem; color: var(--ink); }
.rescue-badge {
  flex: none; font-size: 0.78rem; font-weight: 600; color: var(--violet-dark);
  background: #efe9fb; border-radius: 999px; padding: 3px 10px;
}
.rescue-item p { font-size: 0.9rem; color: var(--muted); line-height: 1.5; }
.rescue-total { margin-top: 6px; text-align: center; font-weight: 600; color: var(--violet); font-size: 0.92rem; }
.rescue-empty { text-align: center; color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .rescue-item { animation: none; opacity: 1; transform: none; }
  .rescue-bar { transition: none; }
}


/* ---------- Intro na stronie glownej ---------- */

/* Nakladka jest w HTML od razu, wiec strona nigdy nie mrugnie.
   Bez klasy intro-pending (druga wizyta, ograniczone animacje) nie pokazuje sie wcale. */
.intro { display: none; }

html.intro-pending .intro {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 99999;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 420ms ease;
}
html.intro-pending .intro.out { opacity: 0; }
html.intro-pending body { overflow: hidden; }

/* Tlo jako osobna warstwa: gasnie niezaleznie od lecacego logo */
.intro-bg {
  position: absolute;
  inset: 0;
  background: #ffffff;
  opacity: 1;
  transition: opacity 520ms ease;
}
.intro-bg.out { opacity: 0; }

/* Logo w naglowku czeka ukryte do konca przelotu */
html.intro-pending .site-logo { opacity: 0; }
html.intro-pending .site-logo.landed { opacity: 1; }

/* Wyladowanie: delikatne drganie jak tracony dzwoneczek.
   Punkt obrotu u gory, mala amplituda, szybkie wygaszanie. */
.site-logo.landed {
  transform-origin: 50% 12%;
  animation: logo-ring 900ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
@keyframes logo-ring {
  0%   { transform: rotate(0deg) scale(1); }
  8%   { transform: rotate(-3.2deg) scale(1.02); }
  20%  { transform: rotate(2.4deg) scale(1.01); }
  32%  { transform: rotate(-1.7deg) scale(1); }
  44%  { transform: rotate(1.2deg); }
  56%  { transform: rotate(-0.8deg); }
  68%  { transform: rotate(0.5deg); }
  80%  { transform: rotate(-0.3deg); }
  90%  { transform: rotate(0.15deg); }
  100% { transform: rotate(0deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .site-logo.landed { animation: none; }
}

.intro-stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 0 20px;
}

.intro-logo {
  width: 210px;
  height: auto;
  transform-origin: center center;
  animation: intro-pop 620ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes intro-pop {
  0%   { opacity: 0; transform: scale(0.62) rotate(-8deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.intro-claim {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.4rem, 4.2vw, 2.1rem);
  color: var(--ink);
  margin: 0;
  min-height: 1.4em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: opacity 240ms ease, transform 240ms ease;
}
.intro-claim.out { opacity: 0; transform: translateY(-6px); }

.intro-caret {
  display: inline-block;
  width: 3px;
  height: 1.05em;
  background: var(--violet);
  border-radius: 2px;
  animation: intro-blink 620ms steps(1) infinite;
}
@keyframes intro-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

@media (max-width: 640px) {
  .intro-logo { width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  .intro { display: none !important; }
}
