/* Kraina Pamięci: style. Brand ASZ: granat + złoto, nagłówki Baloo 2. */

@font-face { font-family: 'Baloo 2'; src: url('../../misja-energia/assets/fonts/baloo-2-latin-ext-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('../../misja-energia/assets/fonts/baloo-2-latin-ext-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('../../misja-energia/assets/fonts/baloo-2-latin-ext-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --navy: #131f4a;
  --navy2: #1c2c66;
  --panel: #1b2a5e;
  --gold: #FFC300;
  --gold2: #ffd54d;
  --ink: #ffffff;
  --line: rgba(255, 255, 255, .16);
  --good: #81C784;
  --bad: #FF8A80;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh;
  background: radial-gradient(120% 90% at 50% 0%, var(--navy2), var(--navy));
  color: var(--ink);
  font-family: 'Segoe UI', Verdana, sans-serif;
  line-height: 1.45;
}
h1, h2, h3, .btn { font-family: 'Baloo 2', 'Segoe UI', sans-serif; }
h1 { font-weight: 800; font-size: clamp(28px, 5.4vw, 42px); margin: 4px 0 6px; }
h2 { font-weight: 800; font-size: clamp(20px, 3.6vw, 27px); margin: 0 0 4px; }
h3 { font-weight: 800; font-size: 22px; margin: 0 0 8px; }
img { max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }

.hidden { display: none !important; }
.kicker { text-transform: uppercase; letter-spacing: .14em; font-weight: 700; opacity: .72; font-size: 13px; margin: 0; }
.lead { opacity: .85; margin: 0 0 18px; }
.fineprint { opacity: .55; font-size: 13px; margin-top: 22px; }

.screen { min-height: 100svh; padding: 20px 16px 40px; }

/* ---------- przyciski ---------- */
.btn {
  display: inline-block; border: 0; border-radius: 999px;
  padding: 12px 26px; font-weight: 700; font-size: 17px;
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.btn-gold { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #4a2f00; }
.btn-ghost { background: transparent; border: 2px solid rgba(255, 255, 255, .3); color: var(--ink); }
.btn-danger { background: transparent; border: 2px solid var(--bad); color: var(--bad); }

/* ---------- ekran graczy ---------- */
.players-wrap { width: min(100%, 560px); margin: 0 auto; text-align: center; padding-top: 4vh; }
.guide-img { width: 150px; height: 150px; object-fit: contain; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35)); }
.guide-img.small { width: 92px; height: 92px; }

.players-list { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.player-row { display: flex; gap: 8px; align-items: stretch; }
.player-pick {
  flex: 1; display: flex; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--line);
  border-radius: 16px; padding: 10px 14px; text-align: left;
  transition: background .12s ease, transform .12s ease;
}
.player-pick:hover { background: rgba(255, 255, 255, .12); transform: translateY(-1px); }
.pname { font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 19px; flex: 1; }
.pmeta { opacity: .8; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.player-del {
  width: 44px; border-radius: 16px; border: 1px solid var(--line);
  background: transparent; font-size: 22px; line-height: 1; opacity: .6;
}
.player-del:hover { opacity: 1; border-color: var(--bad); color: var(--bad); }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: #26221a; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 20px;
}

.player-form { display: flex; flex-direction: column; gap: 14px; align-items: center; margin-top: 6px; }
.player-form input {
  width: min(100%, 320px); padding: 12px 16px; border-radius: 999px;
  border: 2px solid var(--line); background: rgba(255, 255, 255, .07);
  color: var(--ink); font-size: 17px; text-align: center;
}
.player-form input::placeholder { color: rgba(255, 255, 255, .45); }
.player-form input:focus { outline: 3px solid var(--gold); outline-offset: 2px; border-color: transparent; }
.color-picks { display: flex; gap: 10px; justify-content: center; }
.color-dot { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; }
.color-dot.picked { border-color: #fff; transform: scale(1.12); }

/* ---------- mapa: nagłówek ---------- */
.topbar {
  width: min(100%, 1100px); margin: 0 auto 8px;
  display: flex; align-items: center; gap: 12px;
}
.chip {
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .08); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 16px 6px 6px;
  font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 16px;
}
.chip .avatar { width: 32px; height: 32px; font-size: 16px; }
.chip:hover { background: rgba(255, 255, 255, .14); }
.topstats { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.stat { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.brainic { width: 20px; height: 20px; color: var(--gold); }
.iconbtn {
  background: rgba(255, 255, 255, .08); border: 1px solid var(--line);
  border-radius: 50%; width: 42px; height: 42px; font-size: 18px;
}

.world-head {
  width: min(100%, 1100px); margin: 8px auto 20px;
  display: flex; gap: 18px; align-items: center; text-align: left;
}
.world-head .lead { margin-bottom: 0; }

/* ---------- mapa: krainy ---------- */
.world { width: min(100%, 1100px); margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

.zone {
  border: 1px solid var(--line); border-radius: 24px;
  padding: 20px 20px 16px; position: relative; overflow: hidden;
}
.zone-energia  { background: linear-gradient(160deg, #6b520f, #1a2758); }
.zone-higiena  { background: linear-gradient(160deg, #1a5a6b, #131f4a); }
.zone-jedzenie { background: linear-gradient(160deg, #1d4a3a, #14304e); }
.zone-woda     { background: linear-gradient(160deg, #145a74, #14304e); }
.zone-ruch     { background: linear-gradient(160deg, #7a3a1e, #241a4e); }
.zone-emocje   { background: linear-gradient(160deg, #6e2a4e, #241a4e); }
.zone-sen      { background: linear-gradient(160deg, #322558, #131f4a); }
.zone-turniej  { background: linear-gradient(160deg, #57430f, #1a2758); border-color: rgba(255, 195, 0, .45); }
.zone-turniej.locked { opacity: .8; border-color: var(--line); background: linear-gradient(160deg, #2a2f45, #1a2340); }

.zone-head { display: flex; gap: 16px; align-items: center; }
.zone-head p { margin: 0; opacity: .85; font-size: 15px; }
.zone-emblem {
  flex: none; width: 64px; height: 64px; border-radius: 18px;
  background: rgba(0, 0, 0, .25); display: inline-flex; align-items: center; justify-content: center;
  padding: 8px;
}
.zone-emblem svg { width: 100%; height: 100%; }
.zone-emblem.zone-host { padding: 0; overflow: hidden; }
.zone-emblem.zone-host img { width: 100%; height: 100%; object-fit: cover; border-radius: 18px; }
.zone.locked .zone-emblem { filter: grayscale(1); }
.zone-score {
  margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 5px;
  font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 16px;
  background: rgba(0, 0, 0, .25); border-radius: 999px; padding: 6px 14px; white-space: nowrap;
}

.zone-path {
  position: relative; display: flex; justify-content: space-between;
  gap: 6px; padding: 18px 4px 6px; max-width: 640px; margin: 0 auto;
}
.path-line { position: absolute; left: 34px; right: 34px; top: 34px; height: 30px; width: auto; }
.node {
  position: relative; z-index: 1; background: none; border: 0; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: 5px; width: 72px;
}
.node-nr {
  width: 52px; height: 52px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .1); border: 2.5px solid rgba(255, 255, 255, .35);
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 21px;
  transition: transform .12s ease;
}
.node:hover .node-nr { transform: scale(1.1); }
.node.done .node-nr { background: linear-gradient(180deg, var(--gold2), var(--gold)); border-color: var(--gold); color: #4a2f00; }
.node.locked { cursor: default; }
.node.locked .node-nr { opacity: .5; border-style: dashed; }
.lockic { width: 20px; height: 20px; opacity: .8; }
.node-stars { display: inline-flex; gap: 1px; }
.node-stars .star { width: 15px; height: 15px; }

.star { width: 22px; height: 22px; fill: rgba(255, 255, 255, .22); }
.star.on { fill: var(--gold); }

.zone-tip { margin: 10px 0 0; font-size: 13.5px; opacity: .6; text-align: center; }

.turniej-row { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.badge {
  display: inline-block; background: rgba(255, 195, 0, .15); border: 1px solid rgba(255, 195, 0, .5);
  color: var(--gold2); border-radius: 999px; padding: 6px 16px;
  font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 15px; margin-top: 6px;
}

.foot { width: min(100%, 1100px); margin: 26px auto 0; text-align: center; opacity: .6; font-size: 13.5px; display: flex; gap: 8px; justify-content: center; }
.foot a { color: inherit; }

/* ---------- ekran gry ---------- */
.game-top {
  width: min(100%, 980px); margin: 0 auto 10px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.game-title { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: clamp(17px, 3vw, 22px); }
.game-hud { margin-left: auto; display: flex; align-items: center; gap: 16px; font-weight: 700; font-size: 15px; }
.lives { letter-spacing: 1px; }
.spark { opacity: .22; filter: grayscale(1); }
.spark.on { opacity: 1; filter: none; }

.arena { width: min(100%, 980px); margin: 0 auto; }

.seq-status {
  text-align: center; font-family: 'Baloo 2', sans-serif; font-weight: 700;
  font-size: clamp(17px, 3.4vw, 22px); margin: 14px 0 18px; min-height: 1.5em;
}

/* kafelki wzorów i tacka odpowiedzi */
.seq-tiles { display: grid; gap: 14px; justify-content: center; }
.tiles-4 { grid-template-columns: repeat(2, minmax(130px, 200px)); }
.tiles-5, .tiles-6 { grid-template-columns: repeat(3, minmax(105px, 170px)); }
.gtile {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .07); border: 2.5px solid rgba(255, 255, 255, .2);
  border-radius: 20px; padding: 14px 10px 12px;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.gtile .icon { width: clamp(56px, 9vw, 92px); height: clamp(56px, 9vw, 92px); object-fit: contain; pointer-events: none; border-radius: 14px; }
.icon-svg { display: inline-flex; align-items: center; justify-content: center; }
.icon-svg svg { width: 100%; height: 100%; }
.gtile span { font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 15px; }
.gtile:disabled { cursor: default; }
.gtile.lit {
  background: rgba(255, 195, 0, .28); border-color: var(--gold);
  box-shadow: 0 0 24px rgba(255, 195, 0, .55); transform: scale(1.05);
}
.gtile.good { border-color: var(--good); box-shadow: 0 0 18px rgba(129, 199, 132, .5); }
.gtile.bad { border-color: var(--bad); box-shadow: 0 0 18px rgba(255, 138, 128, .5); animation: shake .32s ease; }
.gtile.small { padding: 10px 8px 8px; border-radius: 16px; }
.gtile.small .icon { width: clamp(44px, 7vw, 64px); height: clamp(44px, 7vw, 64px); }
.gtile.small span { font-size: 13px; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ---------- Ogród Par ---------- */
.pairs-grid { display: grid; gap: 12px; justify-content: center; }
.pairs-6  { grid-template-columns: repeat(3, minmax(88px, 150px)); }
.pairs-8  { grid-template-columns: repeat(4, minmax(78px, 140px)); }
.pairs-12 { grid-template-columns: repeat(4, minmax(78px, 140px)); }
.pairs-16 { grid-template-columns: repeat(4, minmax(72px, 130px)); }
.pairs-20 { grid-template-columns: repeat(5, minmax(66px, 118px)); }
.card { background: none; border: 0; padding: 0; perspective: 700px; aspect-ratio: 3 / 4; }
.card-inner {
  position: relative; display: block; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .35s ease;
}
.card.open .card-inner, .card.matched .card-inner { transform: rotateY(180deg); }
.card-back, .card-face {
  position: absolute; inset: 0; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.card-back { background: rgba(255, 255, 255, .08); border: 2.5px solid rgba(255, 255, 255, .22); }
.card-back svg { width: 46%; height: 46%; opacity: .9; }
.card:hover .card-back { background: rgba(255, 255, 255, .13); }
.card-face { background: rgba(255, 255, 255, .1); border: 2.5px solid rgba(255, 255, 255, .3); transform: rotateY(180deg); padding: 6%; }
.card-face .icon { width: 100%; height: 100%; object-fit: cover; pointer-events: none; border-radius: 10px; }
.card.matched .card-face { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 195, 0, .4); }
.card.matched { cursor: default; }

/* ---------- Jaskinia Zniknięć ---------- */
.van-timer { width: min(100%, 460px); height: 10px; margin: 0 auto 16px; background: rgba(255, 255, 255, .12); border-radius: 999px; overflow: hidden; }
.van-timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold2), var(--gold)); border-radius: 999px; }
.van-board { position: relative; display: grid; gap: 12px; justify-content: center; margin-bottom: 20px; }
.van-board.cols-2 { grid-template-columns: repeat(2, minmax(100px, 160px)); }
.van-board.cols-3 { grid-template-columns: repeat(3, minmax(92px, 150px)); }
.van-board.cols-4 { grid-template-columns: repeat(4, minmax(80px, 135px)); }
.van-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .07); border: 2px solid rgba(255, 255, 255, .18);
  border-radius: 18px; padding: 12px 8px 10px;
}
.van-item .icon { width: clamp(48px, 8vw, 80px); height: clamp(48px, 8vw, 80px); object-fit: contain; border-radius: 12px; }
.van-item span { font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 13.5px; text-align: center; }
.van-item.gone { border-style: dashed; border-color: rgba(255, 195, 0, .6); background: rgba(255, 195, 0, .07); }
.qmark { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: clamp(34px, 6vw, 52px); color: var(--gold); line-height: 1.2; }
.van-board.covered::after {
  content: '☁'; position: absolute; inset: -6px; border-radius: 20px;
  background: radial-gradient(90% 90% at 50% 40%, #2a3a78, #131f4a);
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; animation: cloud .5s ease;
}
@keyframes cloud { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
.van-tray { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.van-tray .gtile { width: clamp(86px, 14vw, 120px); }

/* ---------- nakładki ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(9, 14, 34, .72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.panel {
  width: min(100%, 480px); background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .2); border-radius: 24px;
  padding: 26px 24px 22px; text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.panel p { opacity: .88; }
.panel-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.result-panel .guide-img { margin-top: -70px; }
.result-stars { display: flex; gap: 8px; justify-content: center; align-items: baseline; margin: 8px 0 4px; }
.result-stars .star { width: 44px; height: 44px; }
.result-detail { opacity: .9; }
.bigrecord { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 64px; color: var(--gold); line-height: 1; }
.reclabel { opacity: .7; font-size: 14px; }

/* ---------- konfetti i toast ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i {
  position: absolute; top: -24px; width: 10px; height: 15px; border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(112vh) rotate(560deg); } }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--panel); border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px; padding: 11px 22px; font-weight: 600; font-size: 15px;
  z-index: 70; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); max-width: 90vw; text-align: center;
}

/* ---------- responsywność i dostępność ---------- */
@media (max-width: 560px) {
  .screen { padding: 14px 10px 34px; }
  .world-head { flex-direction: column; text-align: center; gap: 8px; }
  .zone-head { flex-wrap: wrap; }
  .zone-score { margin-left: 0; }
  .topstats { gap: 9px; }
  .node { width: 58px; }
  .node-nr { width: 46px; height: 46px; font-size: 18px; }
  .tiles-4 { grid-template-columns: repeat(2, minmax(110px, 1fr)); }
  .tiles-5, .tiles-6 { grid-template-columns: repeat(2, minmax(110px, 1fr)); }
  .pairs-8, .pairs-12, .pairs-16, .pairs-20 { grid-template-columns: repeat(4, minmax(64px, 1fr)); }
  .result-panel .guide-img { margin-top: -56px; width: 76px; height: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .gtile, .node-nr, .player-pick, .card-inner { transition: none; }
  .gtile.bad { animation: none; }
  .van-board.covered::after { animation: none; }
  .confetti { display: none; }
}
