/* XP-gyűjtő – unikornisos, varázslatos, lila */
:root {
  --main: #C3B1E1;        /* levendula fő szín */
  --main-strong: #A98FD6;
  --dark: #4C1D95;        /* sötétlila szöveg a levendulán */
  --ink: #2E1065;
  --muted: #6B5B8A;
  --bg: #F5F3FF;
  --card: #FFFFFF;
  --line: #E4DCF3;
  --pink: #EC4899;
  --red: #C0262D;
  --green: #2F7D4F;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(76, 29, 149, 0.10);
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background:
  radial-gradient(1200px 500px at 110% -10%, rgba(236, 72, 153, 0.10), transparent 60%),
  radial-gradient(900px 500px at -10% 110%, rgba(195, 177, 225, 0.45), transparent 60%), var(--bg); }
.hidden { display: none !important; }
h1, h2, h3 { color: var(--dark); margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
a { color: var(--dark); }
.muted { color: var(--muted); }
.mt { margin-top: 1rem; }
.error { color: var(--red); min-height: 1.2em; margin: .4rem 0; font-weight: 600; }
.neg { color: var(--red); }
.pos { color: var(--green); }

/* Csillagos háttérdísz a sarkokban */
.sparkles { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.sparkles::before, .sparkles::after { position: absolute; font-size: 1.4rem; opacity: .35; }
.sparkles::before { content: "✦ ✧ ✦"; top: 92px; right: 18px; color: var(--main-strong); letter-spacing: .6rem; }
.sparkles::after { content: "🌈 ✧"; bottom: 14px; left: 16px; letter-spacing: .5rem; }

/* Gombok, mezők */
.btn { font: inherit; font-weight: 700; border: 0; border-radius: 999px; padding: .6rem 1.2rem; cursor: pointer;
  background: var(--main); color: var(--dark); transition: transform .1s, box-shadow .2s, background .2s; }
.btn:hover { background: var(--main-strong); box-shadow: 0 4px 14px rgba(76, 29, 149, .18); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.btn-primary { background: linear-gradient(135deg, var(--main), #DCCEF2); }
.btn-ghost { background: transparent; color: var(--dark); border: 2px solid var(--main); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: #FBE3E4; color: var(--red); }
.btn-danger:hover { background: #F6C9CB; }
.btn-small { padding: .3rem .8rem; font-size: .9rem; }
.btn-icon { padding: .25rem .55rem; border-radius: 10px; font-size: .95rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
input, select { font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: .5rem .7rem; min-width: 0; }
input:hover, select:hover { border-color: var(--main); }
label { font-weight: 700; color: var(--dark); font-size: .9rem; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 600; margin-top: .8rem; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem; border: 1px solid var(--line); position: relative; z-index: 1; }

/* Bejelentkezés */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: .35rem; text-align: center; }
.login-card label { text-align: left; margin-top: .6rem; }
.login-card .btn { margin-top: .6rem; }
.login-logo { font-size: 3rem; animation: float 3s ease-in-out infinite; }

/* Felső sáv */
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(245, 243, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--dark); }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.nav a { text-decoration: none; padding: .35rem .8rem; border-radius: 999px; font-weight: 700; color: var(--dark); }
.nav a:hover { background: #ECE5F8; }
.nav a.active { background: var(--main); }

.xpbar { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: auto auto 1fr auto; gap: .7rem; align-items: center; padding: .2rem 1rem .7rem; text-decoration: none; color: var(--dark); }
.xp-icon { font-size: 1.5rem; }
.xp-text { font-size: .95rem; white-space: nowrap; }
.xp-track { height: 14px; border-radius: 999px; background: #E9E2F6; overflow: hidden; position: relative; }
.xp-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--main), var(--pink)); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.xp-fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, .7) 45%, transparent 70%); background-size: 200% 100%; animation: shimmer 2.8s linear infinite; }
.xp-num { font-size: .85rem; font-weight: 700; white-space: nowrap; }

.view { max-width: 1100px; margin: 0 auto; padding: 1.2rem 1rem 3rem; position: relative; z-index: 1; outline: none; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* Hónapléptető */
.stepper { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.stepper h1 { margin: 0 .3rem; min-width: 11ch; text-align: center; }
.month-pick { display: inline-flex; gap: .4rem; }
.badge { display: inline-flex; align-items: center; gap: .3rem; background: linear-gradient(135deg, var(--main), #F7C6E0); color: var(--dark); font-weight: 800; padding: .3rem .8rem; border-radius: 999px; font-size: .9rem; }
.badge-soft { background: #ECE5F8; font-weight: 700; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 1fr 150px auto; gap: .5rem; align-items: center; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
.row:last-child { border-bottom: 0; }
.row-name { font-weight: 700; }
.row-name small { display: block; font-weight: 600; color: var(--muted); }
.row input.amount { text-align: right; width: 100%; }
.row.saved input.amount { border-color: #9BD3B0; }
.row.err input.amount { border-color: var(--red); }
.row .note { grid-column: 1 / -1; display: none; }
.row.show-note .note { display: block; }
.row .note input { width: 100%; }
.rec { color: var(--muted); font-size: .85rem; font-weight: 600; }
.row-total { grid-column: 1 / -1; text-align: right; font-size: .85rem; color: var(--muted); margin-top: -.2rem; }
.empty-mark { color: #B3A5CC; }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1rem; }
.stat { text-align: center; }
.stat .label { color: var(--muted); font-weight: 700; font-size: .9rem; }
.stat .value { font-size: 1.5rem; font-weight: 800; color: var(--dark); }
.stat .value.neg { color: var(--red); }

/* Táblázat */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: .45rem .6rem; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: #fff; }
thead th { background: var(--main); color: var(--dark); position: sticky; top: 0; }
thead th:first-child { background: var(--main); z-index: 1; }
thead th a { color: var(--dark); text-decoration: none; }
thead th a:hover { text-decoration: underline; }
thead th.incomplete a::after { content: " •"; color: var(--pink); }
tr.section td { color: var(--dark); font-weight: 800; background: #fff; }
tr.total td { font-weight: 800; background: var(--bg); }
tr.balance td { font-weight: 800; background: var(--main); color: var(--dark); }
tr.balance td.neg { color: var(--red); }
td.blank { color: #C9BEDD; }

/* Listák */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: .5rem; padding: .55rem .4rem; border-bottom: 1px dashed var(--line); flex-wrap: wrap; border-radius: 10px; }
.list li:last-child { border-bottom: 0; }
.list li.dragging { opacity: .5; }
.list li.drag-over { background: #F1ECFA; }
.list .grow { flex: 1; min-width: 8rem; font-weight: 700; }
.list .archived .grow { color: var(--muted); text-decoration: line-through; }
.handle { cursor: grab; color: var(--main-strong); font-size: 1.1rem; user-select: none; }
.form-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
.form-row .field { display: flex; flex-direction: column; gap: .2rem; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { background: #ECE5F8; border-radius: 999px; padding: .15rem .6rem; font-size: .85rem; font-weight: 700; display: inline-flex; gap: .3rem; align-items: center; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--dark); font-weight: 800; padding: 0; }
.rec-item { flex-direction: column; align-items: stretch !important; }
.rec-head { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.rec-panel { background: var(--bg); border-radius: 12px; padding: .7rem; margin-top: .5rem; }

/* Szintek */
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .7rem; }
.level { border: 2px solid var(--line); border-radius: 14px; padding: .7rem; text-align: center; background: #fff; }
.level .ico { font-size: 1.8rem; filter: grayscale(1); opacity: .5; }
.level.reached { border-color: var(--main); background: linear-gradient(160deg, #fff, #F1ECFA); }
.level.reached .ico { filter: none; opacity: 1; }
.level.current { box-shadow: 0 0 0 3px var(--pink); }
.big-xp { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center; }
.big-xp .ico { font-size: 3.5rem; animation: float 3s ease-in-out infinite; }
.big-xp .xp-track { height: 22px; }
.events { font-size: .92rem; }
.events li { justify-content: space-between; }

/* Értesítések és animációk */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 50; }
.toast { background: var(--dark); color: #fff; padding: .6rem 1rem; border-radius: 14px; box-shadow: var(--shadow); font-weight: 700; animation: pop .35s ease-out, fadeout .5s ease-in 3s forwards; }
.toast.xp { background: linear-gradient(135deg, var(--main), #F7C6E0); color: var(--dark); }
.toast.gift { background: linear-gradient(135deg, #F7C6E0, var(--main), #BFE3F7); color: var(--dark); font-size: 1.1rem; }
.toast.error { background: var(--red); }
.float-xp { position: fixed; z-index: 60; pointer-events: none; font-weight: 800; color: var(--pink); animation: rise 1.2s ease-out forwards; text-shadow: 0 1px 0 #fff; }
.levelup { position: fixed; inset: 0; background: rgba(46, 16, 101, .45); display: grid; place-items: center; z-index: 70; padding: 1rem; }
.levelup-card { background: #fff; border-radius: 24px; padding: 2rem; text-align: center; max-width: 360px; position: relative; overflow: hidden; animation: pop .4s ease-out; }
.levelup-icon { font-size: 4rem; animation: float 2.5s ease-in-out infinite; }
.levelup-stars { position: absolute; inset: 0; pointer-events: none; }
.levelup-stars span { position: absolute; top: -10%; animation: fall 2.2s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeout { to { opacity: 0; transform: translateY(8px); } }
@keyframes rise { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-50px); } }
@keyframes fall { to { transform: translateY(120vh) rotate(240deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Mobil */
@media (max-width: 760px) {
  .grid2, .summary { grid-template-columns: 1fr; }
  .summary { gap: .5rem; }
  .xpbar { grid-template-columns: auto 1fr auto; }
  .xp-text { grid-column: 2 / 4; font-size: .85rem; }
  .xp-track { grid-column: 1 / 3; }
  .row { grid-template-columns: 1fr 120px auto; }
  .stepper h1 { font-size: 1.25rem; min-width: 0; }
  .topbar-inner { gap: .4rem; }
  .nav a { padding: .3rem .55rem; font-size: .9rem; }
  .sparkles::before { display: none; }
}
