/* ============================================================
   TOKENS
   Motiv: milostný vzkaz / valentýnka — místo poštovní obálky
   teplá růžová a bordó, jemný vzor srdíček, zaoblené tvary.
   Dvojice: romantický nadpisový font (Playfair Display) + čitelný
   text pro učení (Literata) + měkký zaoblený font pro čísla/štítky
   (Quicksand — nahrazuje dřívější "razítkový" strojopis).
   ============================================================ */
:root {
  --paper: #fdf1ee;
  --paper-deep: #f6dde0;
  --paper-shadow: rgba(122, 30, 55, 0.20);
  --ink: #5c2439;
  --ink-soft: #93586c;
  --rose: #c85c78;
  --rose-deep: #9c3652;
  --blush: #f0a8bb;
  --gold: #b8863a;
  --plum: #6b3a5c;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Literata', Georgia, serif;
  --font-mono: 'Quicksand', 'Nunito', sans-serif;

  --radius-card: 10px;
  --max-width: 560px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper-deep);
  background-image:
    radial-gradient(rgba(156, 54, 82, 0.07) 1px, transparent 1px);
  background-size: 3px 3px;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

h1, h2, h3 { margin: 0; }
p { margin: 0; }

button {
  font-family: inherit;
  cursor: pointer;
}

input {
  font-family: inherit;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* ============================================================
   TYPOGRAFIE
   ============================================================ */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rose);
  margin: 0 0 0.6rem;
}

.display-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 6vw, 2.1rem);
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 0.75rem;
}

.display-heading.small {
  font-size: clamp(1.1rem, 4.5vw, 1.4rem);
  margin-bottom: 0;
}

.body-text {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.mono {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ============================================================
   OBRAZOVKY (screen switching)
   ============================================================ */
.screen {
  display: none;
  min-height: 100dvh;
  min-height: 100vh;
  width: 100%;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ============================================================
   RŮŽOVÝ RÁMEČEK SE SRDÍČKY (signature prvek č.1 — nahrazuje
   dřívější letecké pruhy obálky)
   ============================================================ */
.stripe-border {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background-color: var(--rose-deep);
  background-image:
    radial-gradient(circle at 18% 28%, rgba(255,255,255,0.12) 0, rgba(255,255,255,0.12) 2px, transparent 3px),
    radial-gradient(circle at 78% 62%, rgba(255,255,255,0.10) 0, rgba(255,255,255,0.10) 2px, transparent 3px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Cpath d='M36 58C20 46 10 37 10 25c0-8 6-14 14-14 6 0 10 3 12 8 2-5 6-8 12-8 8 0 14 6 14 14 0 12-10 21-26 33z' fill='%23ffffff' fill-opacity='0.09'/%3E%3C/svg%3E");
  background-size: auto, auto, 72px 72px;
}

.paper-panel {
  background: var(--paper);
  width: 100%;
  max-width: var(--max-width);
  padding: 2.4rem 1.6rem 2rem;
  border-radius: var(--radius-card);
  box-shadow: 0 18px 40px var(--paper-shadow);
  position: relative;
}

.center-panel {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wax-seal {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--rose) 0%, var(--rose-deep) 70%);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 3px 0 rgba(0,0,0,0.15), inset 0 2px 4px rgba(255,255,255,0.25);
}

/* ============================================================
   TLAČÍTKA
   ============================================================ */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  padding: 0.85rem 1.4rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-height: 48px;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  width: 100%;
  margin-top: 0.5rem;
  box-shadow: 0 3px 0 var(--rose-deep);
}

.btn-primary:hover { box-shadow: 0 3px 0 var(--rose); }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--ink);
}

/* ============================================================
   ZAMČENO / ODPOČET
   ============================================================ */
.countdown {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  color: var(--plum);
  margin-top: 1.2rem;
  display: flex;
  gap: 0.9rem;
  justify-content: center;
}

.countdown-unit { display: flex; flex-direction: column; align-items: center; }
.countdown-unit strong { font-size: 1.5rem; }
.countdown-unit span { font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }

/* ============================================================
   FORMULÁŘ HESLA
   ============================================================ */
#password-form { width: 100%; margin-top: 0.5rem; }

#password-input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff8f6;
  color: var(--ink);
  text-align: center;
}

.form-hint {
  min-height: 1.4rem;
  color: var(--rose-deep);
  font-size: 0.85rem;
  margin-top: 0.6rem;
}

/* ============================================================
   SLIDESHOW / VZKAZ PLNÝ LÁSKY (signature prvek — introdukce)
   ============================================================ */
#screen-slideshow {
  background: var(--paper-deep);
  position: relative;
  align-items: center;
  justify-content: center;
}

.skip-link {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-decoration: underline;
  z-index: 5;
  padding: 0.5rem;
}

.postcard-stage {
  width: 100%;
  max-width: var(--max-width);
  padding: 1.5rem;
  perspective: 1400px;
}

.postcard {
  background: var(--paper);
  border-radius: var(--radius-card);
  min-height: 280px;
  padding: 2.4rem 1.6rem;
  box-shadow: 0 18px 40px var(--paper-shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s ease, opacity 0.35s ease;
}

.postcard.flip-out { transform: rotateY(90deg); opacity: 0; }
.postcard.flip-in { transform: rotateY(0deg); opacity: 1; }

/* malé srdíčko v rohu vzkazu — nahrazuje dřívější poštovní razítko */
.postcard::before {
  content: "♡";
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--blush);
  opacity: 0.8;
  transform: rotate(10deg);
}

.postcard-text {
  font-family: var(--font-body);
  font-size: clamp(1.15rem, 5vw, 1.5rem);
  line-height: 1.7;
  color: var(--ink);
  text-align: center;
  white-space: pre-wrap;
}

.postcard-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.dots {
  display: flex;
  gap: 0.4rem;
}

.dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-soft);
  opacity: 0.3;
}

.dots span.active {
  opacity: 1;
  background: var(--rose);
}

#slide-next { max-width: 260px; }

/* ============================================================
   APP HEADER
   ============================================================ */
#screen-app { background: var(--paper-deep); }

.app-header {
  background: var(--paper);
  padding: 1.4rem 1.2rem 0.8rem;
  box-shadow: 0 4px 14px var(--paper-shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.heart-btn {
  background: none;
  border: 2px solid var(--rose);
  color: var(--rose);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  min-width: 42px;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  margin: 1rem -1.2rem 0;
  padding: 0 1.2rem 0.6rem;
  scrollbar-width: thin;
}

.tab-btn {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.78rem;
  white-space: nowrap;
  background: var(--paper-deep);
  border: 1px solid transparent;
  color: var(--ink-soft);
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.tab-btn.active {
  background: var(--ink);
  color: var(--paper);
}

.stats-bar {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--paper-deep);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.stat-value { font-size: 1.1rem; color: var(--rose-deep); }
.stat-label {
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
}

/* ============================================================
   STUDIJNÍ PLOCHA + KARTIČKA (signature prvek č.2 — index card)
   ============================================================ */
.study-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.4rem 1.2rem 2.5rem;
}

#empty-mode { display: none; }
#empty-mode.active { display: flex; flex-direction: column; align-items: center; text-align: center; }
#study-mode.hidden { display: none; }

.flip-card {
  width: 100%;
  max-width: var(--max-width);
  min-height: 260px;
  perspective: 1200px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 260px;
  transition: transform 0.5s cubic-bezier(.4,.2,.2,1);
  transform-style: preserve-3d;
}

.flip-card-inner.is-flipped {
  transform: rotateY(180deg);
}

.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  background: var(--paper);
  border-radius: var(--radius-card);
  box-shadow: 0 10px 24px var(--paper-shadow);
  padding: 2.2rem 1.4rem 1.4rem 2.2rem;
  display: flex;
  flex-direction: column;
  border-left: 5px solid var(--rose);
}

/* perforace jako u kartotéčního lístku */
.flip-face::before {
  content: "";
  position: absolute;
  top: 14px; left: 14px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--paper-deep);
  box-shadow: 24px 0 0 var(--paper-deep), inset 0 1px 2px rgba(0,0,0,0.15);
}

.flip-face-back {
  transform: rotateY(180deg);
  border-left-color: var(--plum);
}

.card-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  margin-bottom: 0.8rem;
}

.card-text {
  font-size: clamp(1.05rem, 4.5vw, 1.3rem);
  line-height: 1.55;
  color: var(--ink);
  flex: 1;
}

.tap-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  opacity: 0.7;
  align-self: flex-end;
}

.grade-buttons {
  display: flex;
  gap: 0.6rem;
  width: 100%;
  max-width: var(--max-width);
  margin-top: 1.2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.grade-buttons.visible {
  opacity: 1;
  pointer-events: auto;
}

.btn-grade {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.82rem;
  color: var(--paper);
  box-shadow: 0 3px 0 rgba(0,0,0,0.2);
}

.btn-grade span { font-size: 1.1rem; }
.btn-grade-again { background: var(--rose-deep); }
.btn-grade-good { background: var(--plum); }
.btn-grade-easy { background: var(--gold); }

.progress-line {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--ink-soft);
  text-align: center;
}

/* ============================================================
   HOTOVO / SLABÁ MÍSTA
   ============================================================ */
.weak-spots {
  margin-top: 1.6rem;
  width: 100%;
  max-width: var(--max-width);
}

.weak-spots-title {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.6rem;
  text-align: left;
}

.weak-spot-chip {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--paper-deep);
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
  color: var(--ink);
}

/* ============================================================
   RESPONZIVITA — od tabletů výš
   ============================================================ */
@media (min-width: 640px) {
  .paper-panel { padding: 3rem 3rem 2.5rem; }
  .postcard { padding: 3rem 3rem; min-height: 320px; }
  .app-header { padding: 1.8rem 2rem 1rem; }
  .tabs { margin: 1.2rem -2rem 0; padding: 0 2rem 0.6rem; }
  .study-area { padding: 2rem 2rem 3rem; }
  .flip-face { padding: 2.6rem 2rem 1.8rem 2.6rem; }
  .grade-buttons { gap: 0.9rem; }
}

@media (min-width: 1024px) {
  :root { --max-width: 620px; }
  .display-heading { font-size: 2.4rem; }
}

/* ============================================================
   REDUKOVANÝ POHYB
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .postcard, .flip-card-inner, .btn { transition: none !important; }
}
