:root {
  --card: #3a2742dd;
  --ink: #ffeaf3;
  --muted: #cdb0c4;
  --line: #6a4a78;
  --field: #2a1c3380;
  --veil: rgba(32, 18, 42, .72);
  --rose: #ee8fb5;
  --rose-d: #d2688f;
  --rose-shadow: #b44f76;
  --lav: #c9a6ec;
  --lav-d: #9d78cf;
  --mint: #a6e8cf;
  --mint-d: #6fcfa9;
  --yt: #f2728a;
  --sp: #45c991;
  --sc: #f59a5a;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box
}

html {
  height: 100%;
  scroll-padding-top: env(safe-area-inset-top, 0px)
}

body {
  margin: 0;
  min-height: 100%;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: #fbe6ef;
  overflow-x: hidden
}

/* tapeta */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #fbe6ef url("content/ℓili posted !! ⋆_ೃ࿔_.jpg") 78% 0/cover no-repeat
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--veil);
  transition: background .3s
}

#petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1
}

.page {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 16px 40px
}

main {
  width: 100%;
  max-width: 460px;
  margin: 0 auto
}

/* telefon: twarz postaci widoczna nad kartą */
@media (max-width:760px) {
  .page {
    justify-content: flex-end;
    padding-top: 34vh
  }
}



.top {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  margin: 0 0 14px
}

.wing {
  flex: none;
  width: 76px;
  height: 50px;
  transition: transform .2s
}

.wing.work {
  animation: beat .55s ease-in-out infinite alternate
}

.wing.done {
  animation: hop .6s ease-out 2
}

@keyframes beat {
  to {
    transform: scale(1.12)
  }
}

@keyframes hop {
  50% {
    transform: translateY(-14px) rotate(-6deg)
  }
}

.bubble {
  position: relative;
  background: #fff;
  color: #5a3d4f;
  border: 3px solid var(--line);
  border-radius: 20px;
  padding: 9px 16px;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 4px 0 var(--line)
}

.bubble::before {
  content: "";
  position: absolute;
  left: -10px;
  bottom: 12px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-left: 3px solid var(--line);
  border-bottom: 3px solid var(--line);
  transform: rotate(45deg)
}

h1 {
  font-family: "Mochiy Pop One", system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(20px, 5vw, 28px);
  line-height: 1.25;
  margin: 0 0 4px;
  color: var(--ink);
  text-shadow: 0 2px 12px #0008;
  text-align: center;
  white-space: nowrap;
}

.sub {
  margin: 0 0 16px;
  color: var(--ink);
  opacity: .8;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 3px solid var(--line);
  border-radius: 30px;
  padding: 22px 20px 22px;
  box-shadow: 0 7px 0 var(--line), 0 22px 40px #d2688f26
}

label.field,
.formats legend {
  display: block;
  font-weight: 800;
  font-size: 15px;
  margin: 0 0 8px 6px;
  padding: 0
}

.input-wrap {
  position: relative
}

input[type=text] {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--field);
  border: 3px solid var(--line);
  border-radius: 20px;
  padding: 14px 112px 14px 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s
}

input[type=text]::placeholder {
  color: var(--muted);
  opacity: .85
}

input[type=text]:focus-visible {
  border-color: var(--lav-d);
  box-shadow: 0 0 0 5px #c9a6ec40
}

.chip {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 999px;
  color: #fff;
  background: var(--muted);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none
}

.chip.on {
  opacity: 1
}

.chip.youtube {
  background: var(--yt)
}

.chip.spotify {
  background: var(--sp)
}

.chip.soundcloud {
  background: var(--sc)
}

.hint {
  min-height: 20px;
  margin: 8px 8px 0;
  font-size: 13.5px;
  color: var(--muted)
}

.hint.err {
  color: var(--rose-d);
  font-weight: 700
}

.formats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0 6px;
  border: 0;
  padding: 0
}

.formats legend {
  grid-column: 1/-1
}

.fmt {
  position: relative
}

.fmt input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
  margin: 0
}

.fmt span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 11px 6px;
  border-radius: 18px;
  border: 3px solid var(--line);
  background: var(--field);
  font-weight: 800;
  transition: transform .15s, background .2s
}

.fmt small {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px
}

.fmt input:checked+span {
  background: linear-gradient(145deg, var(--rose), var(--lav));
  border-color: transparent;
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 5px 0 var(--lav-d)
}

.fmt input:checked+span small {
  color: #fff
}

.fmt input:focus-visible+span {
  outline: 3px solid var(--lav-d);
  outline-offset: 3px
}

.fmt input:not(:checked)+span:hover {
  transform: translateY(-2px)
}

.note {
  margin: 10px 8px 0;
  font-size: 13px;
  color: var(--muted);
  min-height: 36px
}

button.go {
  width: 100%;
  margin-top: 12px;
  font-family: "Mochiy Pop One", system-ui, sans-serif;
  font-size: 18px;
  color: #fff;
  cursor: pointer;
  border: 0;
  border-radius: 22px;
  padding: 15px;
  background: linear-gradient(145deg, var(--rose), var(--rose-d));
  box-shadow: 0 6px 0 var(--rose-shadow);
  transition: transform .12s, box-shadow .12s, filter .2s
}

button.go:hover {
  filter: brightness(1.06)
}

button.go:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--rose-shadow)
}

button.go:focus-visible {
  outline: 3px solid var(--lav-d);
  outline-offset: 4px
}

button.go:disabled {
  filter: grayscale(.5) opacity(.7);
  cursor: not-allowed
}

.status {
  margin-top: 18px;
  display: none
}

.status.show {
  display: block
}

.bar {
  height: 20px;
  border-radius: 999px;
  background: var(--field);
  border: 3px solid var(--line);
  overflow: hidden
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: repeating-linear-gradient(45deg, var(--rose) 0 12px, #f7bdd4 12px 24px);
  background-size: 34px 34px;
  animation: slide 1s linear infinite;
  transition: width .3s
}

@keyframes slide {
  to {
    background-position: 34px 0
  }
}

.bar.finished i {
  background: var(--mint);
  animation: none
}

.stage {
  display: flex;
  justify-content: space-between;
  margin: 10px 6px 0;
  font-weight: 800;
  font-size: 14px
}

.stage span:last-child {
  color: var(--muted)
}

.result {
  display: none;
  margin-top: 14px;
  text-align: center
}

.result.show {
  display: block
}

.result .title {
  font-weight: 800;
  margin: 0 0 4px
}

.result .meta {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px
}

button.dl {
  font: inherit;
  font-weight: 800;
  font-size: 16px;
  color: #26634d;
  cursor: pointer;
  background: var(--mint);
  border: 3px solid var(--mint-d);
  border-radius: 20px;
  padding: 12px 26px;
  box-shadow: 0 5px 0 var(--mint-d);
  transition: transform .12s, box-shadow .12s
}

button.dl:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--mint-d)
}

button.dl:focus-visible {
  outline: 3px solid var(--lav-d);
  outline-offset: 4px
}

.again {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: 0;
  font: inherit;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 14px
}

.foot {
  margin: 16px 6px 0;
  color: var(--ink);
  opacity: .7;
  font-size: 13px;
  font-weight: 600
}


.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  transform: translate(-50%, 40px);
  opacity: 0;
  background: var(--ink);
  color: #3a2742;
  padding: 12px 18px;
  border-radius: 18px;
  font-weight: 600;
  font-size: 14px;
  z-index: 5;
  transition: .3s;
  max-width: 90vw;
  text-align: center
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0)
}

.character-wrap {
  position: fixed;
  bottom: 0;
  left: max(10px, 2vw);
  z-index: 10;
  pointer-events: none;
}

.avatar-img {
  width: auto;
  max-height: 38vh;
  display: block;
  margin-bottom: 0;
}

.manga-bubble {
  position: absolute;
  top: 33%;
  left: 90%;
  width: max-content;
  max-width: 250px;
  pointer-events: auto;
}

/* Auth Gate */
.auth-gate {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-gate.hidden {
  display: none;
}

.auth-box {
  background: var(--card);
  padding: 30px;
  border-radius: 24px;
  border: 3px solid var(--line);
  text-align: center;
  width: 90%;
  max-width: 320px;
}

.auth-box h2 {
  margin: 0 0 10px;
  color: var(--rose-d);
  font-size: 24px;
}

.auth-box p {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 20px;
}

.auth-box input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  text-align: center;
  font-weight: 700;
  outline: none;
}

.auth-box input:focus {
  border-color: var(--rose);
}

.auth-box button {
  width: 100%;
  padding: 12px;
  background: var(--rose);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s;
}

.auth-box button:hover {
  filter: brightness(1.1);
}

#auth-err {
  color: #ff4b4b;
  font-size: 13px;
  margin: 10px 0 0;
  display: none;
}

/* Footer Link Styles */
.foot a {
  color: var(--rose-d);
  text-decoration: none;
  font-weight: 800;
  transition: 0.2s;
}

.foot a:hover {
  filter: brightness(1.2);
}

.lang-switch {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 20;
  display: flex;
  gap: 5px;
  background: var(--card);
  padding: 4px;
  border-radius: 12px;
  border: 3px solid var(--line);
}

.lang-switch button {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}

.lang-switch button.active {
  background: var(--rose);
  color: #fff;
}

@media (prefers-reduced-motion:reduce) {

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important
  }

  #petals {
    display: none
  }
}