* { box-sizing: border-box; }
:root { --ink: #44506a; --soft: #7a6a58; --accent: #56637a; --card: #fff; --bg1: #fffaf2; --bg2: #f3dcc0; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Arial Rounded MT Bold", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 50% 0%, var(--bg1), var(--bg2)) fixed;
  -webkit-tap-highlight-color: transparent;
}
header { display: flex; align-items: center; gap: 16px; padding: 14px 18px; max-width: 920px; margin: 0 auto; }
header h1 { margin: 0; font-size: clamp(22px, 4vw, 32px); }
.back { color: var(--soft); text-decoration: none; font-size: 16px; white-space: nowrap; }
main { max-width: 920px; margin: 0 auto; padding: 0 16px 60px; }
.screen[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* įkėlimas */
.upload {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin: 12px auto 0; max-width: 520px; padding: 34px 20px;
  background: var(--card); border-radius: 28px; cursor: pointer; text-align: center;
  box-shadow: 0 6px 0 #e2cfb5, 0 12px 30px rgba(80, 50, 20, .15);
  border: 3px dashed #e8d3b6;
  transition: transform .1s;
}
.upload:active { transform: translateY(3px); }
.upload .big { font-size: 64px; line-height: 1; }
.upload b { font-size: clamp(22px, 4vw, 28px); }
.upload small { color: var(--soft); font-size: 16px; }
.tip { text-align: center; color: var(--soft); font-size: 14px; max-width: 520px; margin: 14px auto 28px; }
h2 { font-size: 20px; margin: 10px 0 12px; }

/* galerija */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.gcard { background: var(--card); border-radius: 20px; padding: 10px; text-align: center; box-shadow: 0 4px 14px rgba(80, 50, 20, .12); }
.gcard .pic { display: block; width: 100%; aspect-ratio: 1; border-radius: 14px; background: #fbf3e8; overflow: hidden; }
.gcard .pic img, .gcard .pic svg { width: 100%; height: 100%; object-fit: contain; display: block; }
.gcard .nm { font-weight: 800; margin: 8px 0 6px; font-size: 17px; }
.gcard .acts { display: flex; justify-content: center; gap: 6px; }
.gcard .acts a, .gcard .acts button {
  border: none; background: #f4ebde; border-radius: 12px; padding: 7px 10px; font-size: 17px; text-decoration: none; color: inherit;
}
.gcard .acts .playc { background: var(--accent); color: #fff; font-weight: 800; padding: 7px 14px; }

/* apdorojimas */
#busy { text-align: center; padding-top: 30px; }
.busybox { position: relative; width: min(70vw, 300px); margin: 0 auto; border-radius: 24px; overflow: hidden; box-shadow: 0 10px 30px rgba(80, 50, 20, .2); }
.busybox img { display: block; width: 100%; }
.scan { position: absolute; left: 0; right: 0; height: 30%; background: linear-gradient(transparent, rgba(255,255,255,.65), transparent); animation: scan 1.4s ease-in-out infinite alternate; }
@keyframes scan { from { top: -30%; } to { top: 100%; } }
#busyText { font-size: 20px; font-weight: 800; margin: 20px 0 10px; }
.bar { width: min(80vw, 320px); height: 12px; margin: 0 auto; background: #ead8bf; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 5%; background: var(--accent); border-radius: 99px; transition: width .3s; }

/* rezultatas */
.duo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; }
.card { position: relative; background: var(--card); border-radius: 24px; box-shadow: 0 8px 24px rgba(80, 50, 20, .14); overflow: hidden; }
.card .lbl { position: absolute; left: 10px; top: 8px; font-size: 13px; color: var(--soft); background: rgba(255,255,255,.8); padding: 2px 8px; border-radius: 99px; }
.photo { width: min(34vw, 260px); aspect-ratio: 400 / 520; background: repeating-conic-gradient(#f1e6d6 0 25%, #fff 0 50%) 0 0 / 22px 22px; display: grid; place-items: center; }
.photo canvas { max-width: 92%; max-height: 92%; cursor: crosshair; }
.pv { width: min(50vw, 360px); aspect-ratio: 400 / 520; padding: 8px 8px 0; background: linear-gradient(#fdf3e6 70%, #ecc995 70%); }
.pv svg { width: 100%; height: 100%; overflow: visible; display: block; }
.arrow { font-size: 34px; color: #c9a77c; }
@media (max-width: 560px) { .arrow { display: none; } .photo { width: 32vw; } .pv { width: 58vw; } }

.names { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 18px 0 8px; }
.names label { display: flex; flex-direction: column; font-size: 14px; color: var(--soft); gap: 4px; }
.names input { font: inherit; font-size: 18px; font-weight: 700; color: var(--ink); padding: 10px 14px; border-radius: 14px; border: 2px solid #ead8bf; width: 210px; background: #fff; }
.primary {
  display: block; margin: 14px auto 10px; padding: 18px 54px; border: none; border-radius: 999px;
  font-size: clamp(24px, 5vw, 32px); font-weight: 800; color: #fff; background: var(--accent);
  box-shadow: 0 6px 0 #3c4659, 0 10px 24px rgba(40, 50, 70, .3);
}
.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #3c4659; }
.row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.ghost { border: none; background: rgba(255,255,255,.7); color: var(--ink); font-size: 16px; padding: 10px 18px; border-radius: 99px; }

/* taisymai */
#editor { margin-top: 20px; background: var(--card); border-radius: 24px; padding: 16px 18px; box-shadow: 0 6px 20px rgba(80, 50, 20, .12); }
.grp { margin: 6px 0 14px; }
.grp > b { display: block; font-size: 15px; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 2px solid #ead8bf; background: #fff; border-radius: 99px; padding: 7px 14px; font-size: 15px; color: var(--ink); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot { display: flex; align-items: center; gap: 6px; border: 2px solid #ead8bf; border-radius: 99px; padding: 4px 12px 4px 4px; background: #fff; font-size: 14px; cursor: pointer; }
.slot.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.slot input { width: 30px; height: 30px; border: none; padding: 0; background: none; border-radius: 50%; cursor: pointer; }
.pal { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; font-size: 13px; color: var(--soft); }
.pal button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #ddd; }
.hint { font-size: 13px; color: var(--soft); margin: 4px 0 0; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 99px; font-size: 16px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 20;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* peržiūros animacija */
.pv svg g, .pv svg ellipse, .gcard svg g { transform-box: view-box; }
.pv svg #mimi-breathe { transform-origin: 200px 476px; animation: breathe 7s ease-in-out infinite; }
.pv svg .lid { transition: transform .1s; }
@keyframes breathe {
  0%, 100% { transform: rotate(-1.4deg) scale(1, 1); }
  25%      { transform: rotate(0deg) scale(1.012, 1.024); }
  50%      { transform: rotate(1.4deg) scale(1, 1); }
  75%      { transform: rotate(0deg) scale(1.012, 1.024); }
}
