/* Mókusörs - kártyajáték stílusok */

:root {
  --cream: #F7F4EF;
  --dark: #1F2A23;
  --sage: #A3AD9A;
  --sage-dark: #8B9682;
  --bg: #EDE4D8;
  --font: 'Baloo 2', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  background: var(--bg);
  color: var(--dark);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
}

.app {
  height: 100dvh;
  height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

/* ---------- Kártya színpad ---------- */

.scene {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 2vh 6vw 1vh;
  perspective: 1800px;
}

.card {
  container-type: inline-size;
  position: relative;
  aspect-ratio: 696 / 1000;
  width: min(92vw, calc(92dvh * 0.696), 430px);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.card:focus-visible .card-inner {
  outline: 3px solid var(--sage-dark);
  outline-offset: 4px;
  border-radius: 7cqw;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.4, 0.15, 0.2, 1);
  transform-style: preserve-3d;
}

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

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 7cqw;
  box-shadow:
    0 2cqw 5cqw rgba(31, 42, 35, 0.22),
    0 0.5cqw 1.5cqw rgba(31, 42, 35, 0.12);
  overflow: hidden;
}

.card-back {
  background: var(--sage);
}

.card-front {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 9cqw 10cqw 7cqw;
}

.card-front.type-kerdes {
  background: var(--cream);
  color: var(--dark);
}

.card-front.type-feladat {
  background: var(--dark);
  color: var(--cream);
}

/* ---------- Kártya belső elemek ---------- */

.card-back-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6cqw;
}

.card-back-content .card-logo {
  width: 17cqw;
  margin: 0;
}

.card-back-content .card-wordmark {
  font-size: 5.4cqw;
}

.card-logo {
  width: 15cqw;
  height: auto;
  display: block;
  flex-shrink: 0;
  margin-bottom: 6cqw;
}

.card-divider {
  width: 2px;
  flex-shrink: 0;
  background: currentColor;
  opacity: 0.45;
}

.divider-top {
  height: 12cqw;
  margin: 0 0 5cqw;
}

.divider-bottom {
  height: 12cqw;
  margin: 5cqw 0 0;
}

.card-text-wrap {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-text {
  margin: 0;
  width: 100%;
  text-align: center;
  font-family: var(--font);
  font-weight: 700;
  line-height: 1.28;
  white-space: pre-wrap;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.card-wordmark {
  font-family: var(--font);
  font-weight: 700;
  font-size: 4.4cqw;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

/* ---------- Haladás / új játék ---------- */

.meta {
  flex: 0 0 auto;
  width: 100%;
  max-width: 420px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1.6rem 1.2rem;
  gap: 1rem;
}

.progress {
  font-size: 0.85rem;
  color: var(--dark);
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.newgame-link {
  appearance: none;
  border: none;
  background: none;
  padding: 0.3rem 0.2rem;
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--dark);
  opacity: 0.5;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.15s ease;
}

.newgame-link:hover,
.newgame-link:focus-visible {
  opacity: 0.85;
}

/* ---------- Pakli vége állapot ---------- */

.end-screen {
  flex: 1 1 auto;
  width: min(88vw, 400px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.9rem;
  padding: 2rem 1.5rem;
}

.end-logo {
  width: 64px;
  height: auto;
  margin-bottom: 0.4rem;
}

.end-title {
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.5rem;
  margin: 0;
  color: var(--dark);
}

.end-subtitle {
  font-size: 0.95rem;
  color: var(--dark);
  opacity: 0.65;
  margin: 0 0 0.6rem;
}

.end-restart-btn {
  appearance: none;
  border: none;
  background: var(--dark);
  color: var(--cream);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.85rem 1.8rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(31, 42, 35, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.end-restart-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(31, 42, 35, 0.25);
}

.end-restart-btn:active {
  transform: translateY(0);
}

/* ---------- Megerősítő párbeszéd ---------- */

.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 35, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 10;
}

.confirm-box {
  background: var(--cream);
  border-radius: 20px;
  padding: 1.6rem 1.4rem 1.3rem;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(31, 42, 35, 0.3);
}

.confirm-text {
  margin: 0 0 1.2rem;
  font-size: 0.95rem;
  color: var(--dark);
  line-height: 1.4;
}

.confirm-actions {
  display: flex;
  gap: 0.7rem;
}

.confirm-btn {
  flex: 1;
  appearance: none;
  border: none;
  border-radius: 999px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.7rem 0.5rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.confirm-cancel {
  background: transparent;
  color: var(--dark);
  opacity: 0.6;
}

.confirm-cancel:hover {
  opacity: 1;
}

.confirm-yes {
  background: var(--dark);
  color: var(--cream);
}

.confirm-yes:hover {
  opacity: 0.9;
}

[hidden] {
  display: none !important;
}
