@font-face {
  font-family: "Fredoka";
  src: url("fonts/fredoka-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --cream: #fff8ec;
  --cream-2: #fff1d6;
  --ink: #2b2118;
  --ink-soft: #6f5f50;
  --sun: #ffd43b;
  --sun-d: #e8a800;
  --coral: #ff7a59;
  --coral-d: #e8603d;
  --pink: #ff9eb5;
  --mint: #6fd6b5;
  --sky: #7cc4ff;
  --lilac: #b9a4ff;
  --card: #ffffff;
  --line: #f0e2c8;
  --radius: 22px;
  --shadow: 0 10px 30px -12px rgba(120, 80, 20, .28);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 8% 4%, #ffd43b55 0, transparent 28%),
    radial-gradient(circle at 96% 12%, #ff9eb544 0, transparent 30%),
    radial-gradient(circle at 80% 70%, #7cc4ff2e 0, transparent 32%),
    radial-gradient(#f3dfb6 1.2px, transparent 1.2px);
  background-size: auto, auto, auto, 26px 26px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}
h1, h2, h3, .brand, .btn, .pill { font-family: "Fredoka", "Nunito", ui-rounded, system-ui, sans-serif; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 18px; }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 0; }
.brand { font-weight: 700; font-size: 1.5rem; letter-spacing: -.5px; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; }
.brand .face { width: 1.55em; height: 1.55em; margin: 0 .04em; }
.lang { display: inline-flex; background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 3px; font-family: "Fredoka", sans-serif; font-weight: 600; font-size: .9rem; }
.lang a { text-decoration: none; color: var(--ink-soft); padding: 4px 14px; border-radius: 999px; }
.lang a[aria-current="true"] { background: var(--sun); color: var(--ink); }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 26px 0 6px; position: relative; }
.wordmark {
  font-family: "Fredoka", sans-serif; font-weight: 700;
  font-size: clamp(3.6rem, 15vw, 8rem);
  letter-spacing: -.04em; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
  user-select: none;
}
.wordmark .face { width: 1.45em; height: 1.45em; margin: 0 .02em; overflow: visible; cursor: pointer; }
.face .eye-l, .face .eye-r, .face .tongue { transform-box: fill-box; transform-origin: center; }
.face:hover .eye-l { animation: wob 0.5s ease-in-out infinite alternate; }
.face:hover .eye-r { animation: wob 0.5s ease-in-out infinite alternate-reverse; }
.face:hover .tongue { animation: lick 0.6s ease-in-out infinite alternate; }
@keyframes wob { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
@keyframes lick { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(3px) rotate(6deg); } }

.hero h1 { text-wrap: balance; font-size: clamp(1.35rem, 3.6vw, 2rem); font-weight: 600; max-width: 640px; margin: 8px auto 6px; line-height: 1.2; }
.hero .sub { color: var(--ink-soft); font-size: 1.08rem; max-width: 520px; margin: 0 auto; }
.sparkle { position: absolute; width: 34px; height: 34px; opacity: .9; pointer-events: none; }
.sparkle.s1 { left: 6%; top: 40px; }
.sparkle.s2 { right: 7%; top: 90px; width: 26px; height: 26px; }
.sparkle.s3 { left: 14%; top: 190px; width: 20px; height: 20px; }
@media (max-width: 640px) { .sparkle { display: none; } }

/* ---------- converter card ---------- */
.tool { margin-top: 26px; background: var(--card); border: 2px solid var(--line); border-radius: 30px; padding: 22px; box-shadow: var(--shadow); }
.drop {
  border: 3px dashed #ffb99f; background: linear-gradient(180deg, #fffaf3, #fff3df);
  border-radius: 24px; padding: 34px 16px; text-align: center; cursor: pointer;
  transition: transform .2s, border-color .2s, background .2s;
  display: block;
}
.drop:hover, .drop.over { border-color: var(--coral); transform: translateY(-3px) rotate(-.4deg); background: #fff0dd; }
.drop:focus-visible, .btn:focus-visible, .pill:focus-visible, .thumb:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.drop svg { width: 110px; height: 90px; }
.drop .t { font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 1.4rem; margin-top: 6px; }
.drop .s { color: var(--ink-soft); font-size: .95rem; }
input[type=file] { display: none; }

.controls { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 22px; text-align: center; }
.controls .label { font-family: "Fredoka", sans-serif; font-weight: 500; color: var(--ink-soft); font-size: .95rem; margin-bottom: -6px; }
.formats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.pill {
  background: #fff; color: var(--ink); border: 2.5px solid var(--line); border-radius: 16px;
  padding: 9px 26px; font-weight: 600; font-size: 1.1rem; cursor: pointer; transition: all .15s;
}
.pill:hover { border-color: var(--sun-d); transform: translateY(-2px); }
.pill[aria-pressed="true"] { background: var(--sun); border-color: var(--sun-d); box-shadow: 0 4px 0 var(--sun-d); transform: translateY(-2px); }
.quality { display: flex; flex-direction: column; align-items: center; gap: 4px; transition: opacity .2s; width: min(340px, 100%); }
.quality .row { display: flex; align-items: center; gap: 12px; width: 100%; font-weight: 700; }
.quality input[type=range] { flex: 1; accent-color: var(--coral); height: 28px; }
.quality .note { font-size: .82rem; color: var(--ink-soft); min-height: 1.2em; }
.quality.off { opacity: .45; }

.actions { display: none; justify-content: center; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.btn {
  border: none; border-radius: 16px; padding: 12px 24px; font-weight: 600; font-size: 1.02rem; cursor: pointer;
  background: var(--coral); color: #fff; box-shadow: 0 4px 0 var(--coral-d); transition: transform .12s, box-shadow .12s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--coral-d); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--coral-d); }
.btn.ghost { background: #fff; color: var(--ink); border: 2.5px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.small { padding: 8px 16px; font-size: .92rem; }

/* ---------- results ---------- */
.list { margin-top: 18px; display: grid; gap: 12px; }
.item { display: flex; align-items: center; gap: 16px; padding: 12px; background: #fffaf2; border: 2px solid var(--line); border-radius: 20px; animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.thumb {
  position: relative; flex: none; width: 104px; height: 104px; border-radius: 16px; overflow: hidden; border: 2px solid var(--line);
  cursor: zoom-in; padding: 0; background:
    conic-gradient(#e9dfcc 25%, #fff 0 50%, #e9dfcc 0 75%, #fff 0) 0 0 / 16px 16px;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb .badge {
  position: absolute; left: 6px; bottom: 6px; background: var(--ink); color: #fff; font-family: "Fredoka", sans-serif; font-weight: 600;
  font-size: .72rem; padding: 2px 9px; border-radius: 999px; letter-spacing: .5px;
}
.thumb .spin { position: absolute; inset: 0; display: grid; place-items: center; background: #fffaf2cc; font-size: 1.6rem; }
.info { flex: 1; min-width: 0; }
.name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { color: var(--ink-soft); font-size: .88rem; }
.chip { display: inline-block; margin-top: 4px; font-size: .78rem; font-weight: 800; padding: 2px 10px; border-radius: 999px; background: #d7f7ea; color: #14704f; }
.chip.up { background: #ffe3d9; color: #a2411f; }
.side { display: flex; flex-direction: column; gap: 6px; align-items: stretch; flex: none; }
.side .rm { background: none; border: none; color: var(--ink-soft); font-size: .85rem; cursor: pointer; text-decoration: underline; font-family: inherit; }
.err { color: #c0392b; font-weight: 700; font-size: .9rem; }
@media (max-width: 560px) {
  .item { flex-wrap: wrap; }
  .thumb { width: 84px; height: 84px; }
  .side { flex-direction: row; width: 100%; justify-content: space-between; align-items: center; }
}

dialog { border: none; border-radius: 26px; padding: 16px; max-width: min(92vw, 900px); background: #fff; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(43, 33, 24, .6); backdrop-filter: blur(3px); }
dialog .frame { background: conic-gradient(#e9dfcc 25%, #fff 0 50%, #e9dfcc 0 75%, #fff 0) 0 0 / 18px 18px; border-radius: 16px; display: grid; place-items: center; }
dialog img { max-width: 100%; max-height: 70vh; display: block; }
dialog .cap { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; font-weight: 700; flex-wrap: wrap; }

/* ---------- ad ---------- */
.ad { margin: 30px auto 0; min-height: 90px; border: 2px dashed var(--line); border-radius: 18px; display: grid; place-items: center; color: #c9b896; font-size: .8rem; }

/* ---------- sections ---------- */
section.block { margin-top: 64px; }
section.block > h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); text-align: center; letter-spacing: -.5px; margin-bottom: 6px; }
section.block > .lead { text-align: center; color: var(--ink-soft); margin-bottom: 26px; }
.grid { display: grid; gap: 16px; }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 20px 18px 22px; text-align: center; box-shadow: var(--shadow); transition: transform .2s; }
.card:hover { transform: translateY(-4px) rotate(-.5deg); }
.card svg { width: 92px; height: 92px; margin-bottom: 6px; }
.card h3 { text-wrap: balance; font-size: 1.15rem; font-weight: 600; line-height: 1.25; margin-bottom: 4px; }
.card p { color: var(--ink-soft); font-size: .95rem; }
.steps .card { position: relative; padding-top: 28px; }
.steps .num {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%); width: 34px; height: 34px; border-radius: 50%;
  background: var(--coral); color: #fff; font-family: "Fredoka", sans-serif; font-weight: 700; display: grid; place-items: center; box-shadow: 0 3px 0 var(--coral-d);
}
.trust { margin-top: 36px; }
.trust .card { padding: 14px 14px 16px; display: flex; align-items: center; gap: 12px; text-align: left; box-shadow: none; }
.trust .card svg { width: 58px; height: 58px; margin: 0; flex: none; }
.trust .card h3 { font-size: 1.05rem; margin: 0; }
.trust .card p { font-size: .88rem; }

footer { text-align: center; color: var(--ink-soft); font-size: .88rem; padding: 54px 16px 40px; }
footer a { color: var(--ink-soft); margin: 0 8px; }
footer .brand { display: flex; }
footer .mini { display: inline-block; vertical-align: middle; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
