* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  display: flex; justify-content: center; background: #26233a;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, sans-serif; color: #37324f;
}
#app {
  display: flex; flex-direction: column; width: min(430px, 100%); height: 100vh; height: 100dvh; overflow: hidden;
  background: linear-gradient(#8fd0ff, #eaf7ff 70%); transition: background-color .6s;
}
#app.night { background: linear-gradient(#34407a, #8d86c4 70%); }
#app.off { background: linear-gradient(#101330, #2d2c5a 70%); }
#top { padding: max(10px, env(safe-area-inset-top)) 12px 0; text-align: center; }
#bar { display: grid; grid-template-columns: 112px 1fr 112px; align-items: center; margin-bottom: 6px; }
.left { display: flex; gap: 4px; justify-self: start; }
.right { display: flex; gap: 4px; justify-self: end; }
.chip { background: #fffe; border-radius: 14px; padding: 5px 7px; font-weight: 700; font-size: 13px; white-space: nowrap; }
h1 { font-size: 17px; min-width: 0; }
#title, #title:disabled { background: none; box-shadow: none; color: #fff; opacity: 1; font-size: 16px; min-height: 36px; max-width: 100%; text-shadow: 0 2px 4px #0005; }
.round { min-height: 34px; width: 34px; padding: 0; border-radius: 12px; font-size: 15px; box-shadow: none; background: #fffc; }
.photo { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; background: #1d1630ee; color: #fff; text-align: center; }
.photo img { max-width: min(100%, 360px); max-height: 62vh; border-radius: 18px; border: 6px solid #fff; }
.photo button, .photo-save { width: min(100%, 300px); }
.photo-save { background: #ffd95e; color: #37324f; border-radius: 18px; padding: 14px; font-weight: 700; text-decoration: none; }
.keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
#panel > .keys { grid-column: 1 / -1; }
.key { min-height: 110px; font-size: 30px; color: #37324f; touch-action: manipulation; }
h2 { font-size: 15px; color: #fff; text-shadow: 0 2px 4px #0006; text-align: center; }
#panel > h2, #panel > .claim { grid-column: 1 / -1; }
.claim { min-height: 48px; padding: 8px 12px; font-size: 14px; }
[data-badge]:not([data-badge=""]) { position: relative; }
[data-badge]:not([data-badge=""])::after { content: attr(data-badge); position: absolute; top: 2px; right: 6px; min-width: 20px; border-radius: 10px; background: #e5342f; color: #fff; font-size: 12px; line-height: 20px; }
.arrow { position: absolute; z-index: 2; top: 50%; width: 52px; height: 64px; margin-top: -32px; padding: 0; font-size: 40px; line-height: 1; border-radius: 20px; background: #ffffffcc; touch-action: none; user-select: none; -webkit-user-select: none; }
.arrow:active { transform: scale(.94); }
#goLeft { left: 8px; }
#goRight { right: 8px; }
button.chip { min-height: 30px; box-shadow: none; background: #fffe; font-size: 13px; }
#panel > .simon, #panel > .slide, #panel > progress, #panel > .wide { grid-column: 1 / -1; }
progress { width: 100%; height: 14px; accent-color: #ffb300; }
.simon { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pad { min-height: 74px; opacity: .6; }
.pad.lit { opacity: 1; transform: scale(.96); box-shadow: 0 0 0 4px #fff; }
.slide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: min(100%, 270px); justify-self: center; }
.piece { aspect-ratio: 1; min-height: 0; padding: 0; border-radius: 8px; background-size: 300% 300%; box-shadow: none; }
.piece.hole { opacity: 0; }
.piece { position: relative; }
.piece span { position: absolute; left: 3px; top: 3px; min-width: 18px; border-radius: 9px; background: #fffd; font-size: 11px; line-height: 18px; }
.card-thumb { grid-column: span 4 !important; aspect-ratio: 1; background-size: cover; border: 4px solid #fff; border-radius: 10px; }
#app[data-screen="slide"] #panel { max-height: 55%; }
#app[data-screen="journey"] #panel, #app[data-screen="settings"] #panel { max-height: 66%; }
#panel > .words { grid-column: 1 / -1; }
.words { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.words > .task, .word-picture { grid-column: 1 / -1; text-align: center; }
.word-picture, .word-en, .word-next, .words > .task { grid-column: 1 / -1; }
.word-picture { min-height: 84px; }
.word-icon { display: block; font-size: 48px; }
.word-pl { display: block; font-size: 22px; }
.word-en { font-size: 24px; }
.word-next { font-size: 18px; }
.word small { display: block; font-size: 13px; font-weight: 500; }
.word { font-size: 17px; }
.word.good { background: #bdf0ae; }
.word.bad { background: #ffc4c4; }
#app[data-screen="words"] #panel { max-height: 62%; }
#app.day[data-theme="desert"] { background: linear-gradient(#ffd08a, #fff3d6 70%); }
#app.day[data-theme="winter"] { background: linear-gradient(#9fc4e8, #ffffff 70%); }
#app.day[data-theme="candy"] { background: linear-gradient(#ffb3d9, #fff0fa 70%); }
#app.day[data-theme="aurora"], #app.night[data-theme="aurora"] { background: linear-gradient(#0f2d4a, #1f6f6a 45%, #7fe0b0 75%, #e9fff4); }
#app[data-theme="galaxy"].day, #app[data-theme="galaxy"].night { background: radial-gradient(#ffe8ff 1px, transparent 1.5px) 0 0 / 39px 39px, radial-gradient(circle at 70% 20%, #c06bff55, transparent 40%), linear-gradient(#0d0a2e, #3a1f7a 70%); }
#app[data-theme="space"].day, #app[data-theme="space"].night { background: radial-gradient(#fff 1px, transparent 1.5px) 0 0 / 47px 47px, linear-gradient(#17133a, #4b3f8a 70%); }
#app.day[data-weather="rain"] { background: linear-gradient(#8a9bb3, #d3dbe6 70%); }
#app.day[data-weather="snow"] { background: linear-gradient(#b8c8dc, #f4f7fb 70%); }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stat { display: flex; align-items: center; justify-content: center; gap: 5px; background: #fffe; border-radius: 16px; padding: 5px 4px; font-size: 15px; box-shadow: 0 3px 8px #0002; }
.heart { font-size: 18px; line-height: 1; color: #ded9ea; }
.heart.full { color: #ff4f7b; }
.heart.half { background: linear-gradient(90deg, #ff4f7b 50%, #ded9ea 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }
#msg { display: inline-block; margin-top: 8px; background: #fff; border-radius: 16px; padding: 7px 14px; font-weight: 700; font-size: 15px; box-shadow: 0 3px 8px #0002; }
#msg:empty { visibility: hidden; padding: 7px; }
#msg:empty::after { content: "\00a0"; }
#stage { flex: 1; min-height: 0; position: relative; }
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#panel { padding: 8px 10px max(12px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; max-height: 46%; overflow-y: auto; flex-shrink: 0; grid-auto-rows: max-content; align-content: start; }
#panel > * { grid-column: span 3; }
#app[data-screen="shop"] #panel, #app[data-screen="album"] #panel, #app[data-screen="tasks"] #panel, #app[data-screen="stickers"] #panel, #app[data-screen="bundle"] #panel { max-height: 42%; }
button {
  border: 0; border-radius: 18px; min-height: 52px; padding: 8px 2px; cursor: pointer;
  font: 700 13px ui-rounded, "SF Pro Rounded", system-ui, sans-serif; color: #37324f;
  background: linear-gradient(#fff, #eef0ff); box-shadow: 0 5px 0 #a9a6cf, 0 8px 14px #0003;
}
button:active { transform: translateY(4px); box-shadow: 0 1px 0 #a9a6cf; }
button:focus-visible, input:focus-visible { outline: 3px solid #ffb300; outline-offset: 2px; }
button:disabled { opacity: .5; cursor: default; }
button em { display: block; font-style: normal; font-size: 24px; }
button.call { background: linear-gradient(#fff3b8, #ffd95e); box-shadow: 0 5px 0 #c99a1e; }
#panel > .wide, #panel > .row2, #panel > .row3, #panel > .row4, #panel > .row5, #panel > .task, #panel > .card { grid-column: 1 / -1; }
#panel > .half-width { grid-column: span 6; }
#panel > .third-width { grid-column: span 4; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.swatch { min-height: 36px; border: 4px solid #fff; }
.swatch.chosen { border-color: #ffb300; transform: scale(1.04); }
.name-form { display: grid; gap: 10px; }
.task { background: #fffe; border-radius: 14px; padding: 9px 12px; font-weight: 700; font-size: 14px; }
.task.done { background: #dff6d8; }
.slot { font-size: 11px; line-height: 1.2; align-self: stretch; }
label { font-weight: 700; text-align: center; }
input { width: 100%; font: 700 20px ui-rounded, system-ui, sans-serif; text-align: center; padding: 12px; border: 3px solid #a9a6cf; border-radius: 16px; }
.card { background: #fff6d8; border-radius: 12px; padding: 14px; font-size: 15px; line-height: 1.5; transform: rotate(-1.5deg); box-shadow: 0 6px 14px #0003; }

/* album naklejek */
.stickers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sticker {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px 8px; border-radius: 16px; background: #fff; border: 3px solid #e4ddf3;
  box-shadow: 0 3px 0 #d8cfee; text-align: center;
}
.sticker.rare { border-color: #8fc7ff; box-shadow: 0 3px 0 #6fa9e6; }
.sticker.gold { border-color: #ffc93c; box-shadow: 0 3px 0 #e0a800; background: #fffbea; }
.sticker.missing { background: #f3f0fa; opacity: 0.7; }
.sticker-icon { font-size: 30px; line-height: 1.1; }
.stickers.big .sticker-icon { font-size: 52px; }
.sticker-name { font-size: 12px; font-weight: 700; line-height: 1.15; min-height: 2.3em; display: flex; align-items: center; }
.sticker-stars { font-size: 11px; color: #e0a800; letter-spacing: 1px; }
.sticker-count { position: absolute; top: 4px; right: 6px; font-size: 11px; font-weight: 800; color: #6b5a8a; }
.sticker-badge { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: #ff5f8f; color: #fff; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.sticker.new { animation: pop 0.5s ease; }
@keyframes pop { 0% { transform: scale(0.3) rotate(-12deg); } 70% { transform: scale(1.1) rotate(3deg); } 100% { transform: scale(1); } }
.friend-code { display: flex; flex-direction: column; align-items: center; gap: 2px; background: #fff; border-radius: 18px; padding: 12px; border: 3px dashed #b59cff; }
.friend-code strong { font-size: 30px; letter-spacing: 3px; font-variant-numeric: tabular-nums; }
.task.event { background: #fff4c2; border: 2px solid #ffd84d; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .sticker.new { animation: none; } }

.row5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.row5 button { font-size: 12px; padding-left: 2px; padding-right: 2px; }

.sticker-pick { padding: 0; background: none; box-shadow: none; min-height: 0; border-radius: 16px; }
.sticker-pick:active { transform: scale(0.96); box-shadow: none; }

/* szeroki ekran (komputer, tablet poziomo): niebo i wyspa na całe okno,
   pasek u góry i przyciski na dole w czytelnej szerokości pośrodku */
@media (min-width: 760px) {
  #app { width: 100%; }
  #app { position: relative; }
  /* pasek leży na niebie, więc chmury i wyspa sięgają do samej góry okna */
  #top { position: absolute; z-index: 3; top: 0; left: 50%; transform: translateX(-50%); width: min(760px, 100%); pointer-events: none; }
  #top > * { pointer-events: auto; }
  #panel { width: min(760px, 100%); margin: 0 auto; padding-left: 16px; padding-right: 16px; }
  #goLeft { left: max(12px, calc(50% - 420px)); }
  #goRight { right: max(12px, calc(50% - 420px)); }
}
