/* =========================================================
   Profilok, matricák, írás, memória – stílusok
   ========================================================= */
.theme-nagybetuk  { --c: #f25f3a; --cd: #c9411f; --cl: #ffe9e2; }
.theme-kisbetuk   { --c: #e0a106; --cd: #b07d00; --cl: #fff4d6; }
.theme-szamjegyek { --c: #0f8fd6; --cd: #0a6ea8; --cl: #e2f3fd; }
.theme-memoria    { --c: #6c63ff; --cd: #4b42d6; --cl: #ecebff; }

/* ---------- Felső sáv: ki tanul ---------- */
.profile-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px 4px 6px;
  background: var(--card); border-radius: 999px; box-shadow: 0 4px 0 var(--line); font-weight: 900;
}
.profile-chip[hidden] { display: none; }
.pc-avatar { font-size: 1.6rem; }
.pc-name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star-total { white-space: nowrap; }
.menu-footer { margin-top: 18px; padding-top: 12px; border-top: 3px dashed var(--line); display: grid; gap: 4px; }

/* ---------- Kezdőlap: sorozat, matricák ---------- */
.home-stats, .album-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: -8px 0 8px; }
.stat-card {
  display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 20px;
  padding: 12px 18px; box-shadow: 0 5px 0 var(--line); font-size: 1.08rem;
}
a.stat-card:hover { transform: translateY(-2px); }
.stat-icon { font-size: 2rem; }
.stat-card b { font-size: 1.3rem; }

/* ---------- Felugró üzenet ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 20px;
  font-weight: 900; font-size: 1.15rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  animation: toastIn .4s ease-out;
}
.toast.out { opacity: 0; transform: translate(-50%, 20px); transition: .4s; }
.toast-big { font-size: 2rem; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 30px) scale(.9); } }

/* ---------- Eredmény: új matrica ---------- */
.result-name { margin: 6px 0 0; font-weight: 900; color: var(--muted); font-size: 1.1rem; }
.new-sticker {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  margin: 16px auto 0; padding: 12px 18px; border-radius: 20px; max-width: 460px;
  background: #fff6d6; border: 3px dashed var(--gold); font-weight: 900;
}
.new-sticker a { color: var(--cd); text-decoration: underline; }
.ns-emoji { font-size: 3rem; animation: starIn .6s ease-out; }

/* ---------- Profilválasztó ---------- */
.profiles { max-width: 820px; margin: 0 auto; }
.profiles-head { display: flex; align-items: center; gap: 18px; margin: 10px 0 22px; }
.profiles-head h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); }
.profiles-head p { margin: 4px 0 0; color: var(--muted); font-size: 1.15rem; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.profile-card { position: relative; }
.profile-pick, .add-card {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 18px 10px; border-radius: 24px; cursor: pointer;
  background: var(--card); border: 4px solid var(--line); box-shadow: 0 6px 0 var(--line);
  transition: transform .12s, border-color .15s;
}
.profile-pick:hover, .add-card:hover { transform: translateY(-4px); border-color: var(--gold); }
.profile-card.current .profile-pick { border-color: var(--gold); }
.add-card { border-style: dashed; background: transparent; box-shadow: none; }
.pf-avatar { font-size: 4rem; line-height: 1.1; }
.pf-name { font-size: 1.3rem; font-weight: 900; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pf-stars { color: var(--muted); font-weight: 800; }
.pf-delete {
  position: absolute; top: -10px; right: -10px; width: 42px; height: 42px; border-radius: 50%;
  border: 0; cursor: pointer; background: var(--bad); font-size: 1.2rem; box-shadow: 0 4px 0 #b8274b;
}
.profile-form { margin-top: 20px; border-top-color: var(--gold); }
.pf-label { display: block; font-weight: 900; font-size: 1.2rem; margin: 0 0 8px; }
.pf-input {
  width: 100%; font: inherit; font-size: 1.5rem; font-weight: 900; padding: 12px 16px;
  border: 3px solid var(--line); border-radius: 16px; margin-bottom: 18px; color: var(--ink);
}
.pf-input:focus { border-color: var(--gold); outline: none; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.avatar-opt {
  font-size: 2.2rem; height: 62px; border-radius: 16px; cursor: pointer;
  border: 3px solid var(--line); background: var(--card);
}
.avatar-opt.on { border-color: var(--gold); background: #fff6d6; transform: scale(1.08); }
.pf-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }
.pf-manage { text-align: center; margin-top: 22px; }
.link-btn { border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 800; font-size: 1rem; text-decoration: underline; }

/* ---------- Matricaalbum ---------- */
.album .section-title { margin-top: 6px; }
.album-stats { margin: 0 0 16px; }
.next-sticker { display: flex; align-items: center; gap: 16px; border-top-color: var(--gold); padding: 16px 20px; margin-bottom: 20px; }
.ns-mystery { font-size: 3rem; animation: bob 2s ease-in-out infinite; }
.ns-body { flex: 1; display: grid; gap: 8px; }
.bar.big { height: 16px; background: #eee9f5; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 14px; }
.sticker {
  aspect-ratio: 1; border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.sticker.on {
  background: var(--card); box-shadow: 0 6px 0 var(--line); font-size: 3.4rem;
  transform: rotate(var(--r)); border: 4px solid #fff; outline: 3px dashed var(--line);
}
.sticker.on:hover { transform: rotate(0) scale(1.1); }
.sticker.locked { background: #eee9f5; color: #b9b3c6; font-size: 2rem; font-weight: 900; }
.sticker.locked small { font-size: .85rem; }

/* ---------- Írás: jelek rácsa ---------- */
.start-next { margin-bottom: 16px; }
.glyph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 10px; }
.glyph-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  aspect-ratio: 1; background: var(--card); border-radius: 18px;
  border: 3px solid var(--cl); box-shadow: 0 5px 0 var(--cl); transition: transform .1s;
}
.glyph-tile:hover { transform: translateY(-3px); border-color: var(--c); }
.glyph-tile.done { background: var(--cl); }
.gt-ch { font-size: 2.3rem; font-weight: 900; color: var(--cd); line-height: 1; }
.glyph-tile .stars { font-size: .95rem; letter-spacing: 0; }
.gt-new { font-size: .8rem; color: var(--muted); font-weight: 800; }

/* ---------- Írás: nyomkövetés ---------- */
.trace { max-width: 640px; margin: 0 auto; }
.trace-card { text-align: center; padding-bottom: 18px; }
.trace-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.trace-ch { color: var(--c); font-size: 1.3em; }
.nav-glyph { display: grid; place-items: center; font-size: 1.1rem; color: var(--cd); }
.nav-glyph.off { opacity: .25; pointer-events: none; }
.trace-svg {
  width: 100%; max-width: 380px; height: auto; display: block; margin: 8px auto 0;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair;
  background: #fffdf7; border-radius: 22px; border: 3px solid var(--line);
}
.trace-svg.shake { animation: shake .4s; }
.guide { stroke: #d9e6f7; stroke-width: .6; }
.guide.mid { stroke-dasharray: 2 2; }
.guide.base { stroke: #9fbbe0; stroke-width: 1; }
.ghost { fill: none; stroke: #ece7f3; stroke-width: 13; stroke-linecap: round; stroke-linejoin: round; }
.ghost.next { stroke: #e2dbee; }
.cur-path {
  fill: none; stroke: var(--cd); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 4 4; animation: march 1s linear infinite;
}
.arrow-fill { fill: var(--cd); }
@keyframes march { to { stroke-dashoffset: -8; } }
.start-dot { fill: #2db86a; stroke: #fff; stroke-width: 1.4; animation: pulse 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.start-num { fill: #fff; font-size: 6px; font-weight: 900; text-anchor: middle; pointer-events: none; }
@keyframes pulse { 50% { transform: scale(1.25); } }
.done-stroke { fill: none; stroke: var(--c); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; animation: pop .3s; }
.done-stroke.is-dot { stroke-width: 10; }
.user-line { fill: none; stroke: var(--c); stroke-opacity: .55; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.demo-dot { fill: var(--gold); stroke: #fff; stroke-width: 1.2; pointer-events: none; }
.trace-svg.finished .ghost { stroke: transparent; }
.trace-actions { display: flex; justify-content: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.trace-actions .btn { padding: 10px 18px; font-size: 1.05rem; }
.trace-done { margin-top: 10px; }
.trace-done .result-stars .stars { font-size: 3rem; }

/* ---------- Memória ---------- */
.memory { max-width: 760px; margin: 0 auto; }
.mem-stats { flex: 1; display: flex; justify-content: flex-end; gap: 16px; font-weight: 800; flex-wrap: wrap; }
.mem-stats span { background: var(--card); padding: 8px 14px; border-radius: 999px; box-shadow: 0 4px 0 var(--line); }
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mem-card { aspect-ratio: 1; border: 0; padding: 0; background: none; cursor: pointer; perspective: 800px; }
.mem-inner {
  position: relative; display: block; width: 100%; height: 100%;
  transition: transform .45s; transform-style: preserve-3d;
}
.mem-card.flipped .mem-inner { transform: rotateY(180deg); }
.mem-front, .mem-back {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: 20px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.mem-front {
  background: var(--c); box-shadow: 0 6px 0 var(--cd); font-size: 2.4rem;
  background-image: radial-gradient(circle at 30% 30%, rgba(255,255,255,.25) 0 18%, transparent 19%);
}
.mem-back {
  background: var(--card); border: 4px solid var(--cl); box-shadow: 0 6px 0 var(--line);
  transform: rotateY(180deg); font-size: clamp(2.2rem, 7vw, 3.4rem); padding: 6px;
}
.mem-card.matched .mem-back { border-color: var(--good); background: #e3f7ec; animation: pop .4s; }
.mem-word { font-size: clamp(1.1rem, 3.4vw, 1.6rem); font-weight: 900; color: var(--cd); }
.mem-num { font-size: clamp(2.2rem, 7vw, 3.2rem); font-weight: 900; color: var(--cd); }
.mem-frames .mem-back .ten-frame .cell { width: clamp(9px, 2.4vw, 16px); height: clamp(9px, 2.4vw, 16px); }
.mem-frames .mem-back .ten-frame { gap: 2px; padding: 3px; }

@media (max-width: 560px) {
  .mem-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .profile-grid { grid-template-columns: repeat(2, 1fr); }
  .pf-avatar { font-size: 3.2rem; }
  .pc-name { display: none; }
  .profile-chip { padding: 4px 6px; }
  .glyph-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .gt-ch { font-size: 1.9rem; }
}

/* ---------- Írott betűk és szavak ---------- */
.theme-irottbetuk  { --c: #c2410c; --cd: #9a3412; --cl: #ffedd5; }
.theme-irottszavak { --c: #7c3aed; --cd: #5b21b6; --cl: #ede9fe; }
.glyph-grid.cursive .gt-ch, .trace-ch.cursive { font-family: 'Segoe Script', 'Comic Sans MS', cursive; font-weight: 700; }
.glyph-grid.word-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.glyph-grid.word-grid .glyph-tile { aspect-ratio: auto; min-height: 96px; }
.glyph-grid.word-grid .gt-ch { font-size: 1.7rem; }
.trace-svg.wide { max-width: 100%; }
