/* E-USTAZ — дизайн «Қағаз»: зелёные бумажные слои, как на её баннере */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
:root {
  --green: #00584F; --dark: #0C3930; --teal: #4A9798; --mid: #1F6D64;
  --mint: #E3F1EE; --paper: #F7F9F8; --ink: #16302B; --muted: #5E716D;
}
body { font-family: 'Nunito', system-ui, sans-serif; background: var(--paper); color: var(--ink); min-height: 100vh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
a { color: inherit; }

/* Шапка и бумажные волны */
.hero { background: linear-gradient(160deg, var(--dark) 0%, var(--green) 75%); color: #fff; padding: 18px 16px 30px; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; border: 28px solid rgba(74, 151, 152, .35); right: -90px; top: -70px; animation: float 9s ease-in-out infinite; }
.bar, .hero h1 { max-width: 560px; margin: 0 auto; position: relative; z-index: 1; }
.bar { display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-family: 'Oswald', sans-serif; font-weight: 700; font-size: 28px; letter-spacing: 1.5px; color: #fff; text-decoration: none; }
.logo svg { width: 30px; height: 30px; color: #9FD3CF; }
.langs { display: flex; background: rgba(255, 255, 255, .14); border-radius: 999px; padding: 4px; }
.langs button { padding: 6px 12px; border-radius: 999px; font-weight: 800; font-size: 13px; color: #fff; transition: .2s; }
.langs button.active { background: #fff; color: var(--green); }
.hero h1 { font-weight: 900; font-size: clamp(24px, 6vw, 34px); line-height: 1.2; margin-top: 28px; }
.waves { display: block; width: 100%; height: 70px; margin-top: -1px; }
.waves path { filter: drop-shadow(0 5px 5px rgba(12, 57, 48, .25)); animation: sway 8s ease-in-out infinite alternate; }
.waves .w1 { fill: var(--teal); animation-duration: 9s; }
.waves .w2 { fill: var(--mid); animation-duration: 7s; animation-direction: alternate-reverse; }
.waves .w3 { fill: var(--green); animation-duration: 5.5s; }

/* Карточка */
main { width: 100%; max-width: 560px; margin: -34px auto 0; padding: 0 16px; position: relative; z-index: 2; flex: 1; }
.card { background: #fff; border-radius: 28px; padding: 22px 18px; box-shadow: 0 18px 40px -18px rgba(12, 57, 48, .35); display: flex; flex-direction: column; gap: 14px; animation: rise .45s ease both; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; border: 2.5px dashed var(--teal); border-radius: 22px; padding: 24px 14px 18px; background: #FBFDFC; cursor: pointer; transition: .2s; }
.drop:hover, .drop.over { background: var(--mint); border-color: var(--green); }
.drop-icon { width: 74px; height: 74px; border-radius: 50%; background: var(--mint); display: grid; place-items: center; font-size: 36px; color: var(--green); margin-bottom: 6px; animation: float 3s ease-in-out infinite; }
.drop strong { font-size: 20px; font-weight: 900; color: var(--dark); }
.hint { color: var(--muted); font-size: 15px; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin-top: 12px; }
.types span { display: flex; align-items: center; gap: 8px; background: var(--mint); border-radius: 12px; padding: 9px 10px; font-size: 14px; font-weight: 800; color: var(--dark); }
.types i { font-size: 18px; color: var(--green); }
.picked { display: flex; align-items: center; gap: 12px; background: var(--mint); border-radius: 16px; padding: 10px 12px; animation: pop .4s cubic-bezier(.2, 1.5, .4, 1) both; }
.picked > i { width: 44px; height: 44px; flex: none; border-radius: 12px; background: #fff; display: grid; place-items: center; font-size: 22px; color: var(--green); }
.picked div, .fp-meta div { min-width: 0; display: flex; flex-direction: column; }
.picked b, .fp-meta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picked small, .fp-meta small { color: var(--muted); font-size: 13px; }
#turnstile { display: flex; justify-content: center; }
#turnstile:empty { display: none; }
.error { color: #C2412D; font-weight: 700; font-size: 14px; text-align: center; }
.error:empty { display: none; }
.progress { height: 8px; background: var(--mint); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--green)); border-radius: 99px; transition: width .2s; }
.limit { text-align: center; color: var(--muted); font-size: 13px; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; font-weight: 800; font-size: 16px; padding: 12px 18px; text-decoration: none; transition: transform .15s, box-shadow .15s, background .2s; }
.btn i { font-size: 18px; }
.primary { background: var(--green); color: #fff; box-shadow: 0 5px 0 var(--dark); }
.primary:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--dark); }
.primary:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--dark); }
.primary:disabled { background: #A9BDB8; box-shadow: 0 5px 0 #8EA39E; cursor: not-allowed; transform: none; }
.primary.loading { background: var(--green); box-shadow: 0 5px 0 var(--dark); cursor: wait; }
.big { width: 100%; min-height: 58px; font-size: 18px; }
.outline { border: 2px solid var(--green); color: var(--green); background: #fff; }
.outline:hover, .ghost:hover { background: var(--mint); }
.ghost { color: var(--green); }
.btn .busy { display: none; }
.btn.loading .idle { display: none; }
.btn.loading .busy { display: inline-flex; align-items: center; gap: 10px; }
.spin { width: 20px; height: 20px; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: turn .8s linear infinite; }
.spin.dark { width: 40px; height: 40px; border-color: var(--mint); border-top-color: var(--green); }

/* Готово */
#screen-result, #screen-loading, #screen-missing { align-items: center; text-align: center; }
#screen-result > .btn { width: 100%; }
.done { width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 34px; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
h2 { font-size: 28px; font-weight: 900; color: var(--dark); }
.qr-box { background: #fff; border: 2px solid var(--mint); border-radius: 22px; padding: 12px; animation: pop .55s .12s cubic-bezier(.2, 1.5, .4, 1) both; box-shadow: 0 10px 24px -14px rgba(12, 57, 48, .4); }
.qr-box canvas { display: block; width: 220px; height: 220px; image-rendering: pixelated; }
.link-row { display: flex; gap: 8px; width: 100%; }
.link-row input { flex: 1; min-width: 0; border: 0; background: var(--mint); border-radius: 999px; padding: 0 16px; font: inherit; font-weight: 700; font-size: 14px; color: var(--dark); }
.direct { width: 100%; text-align: left; padding-top: 4px; border-top: 2px dashed var(--mint); }
.direct small { display: block; color: var(--muted); font-weight: 700; font-size: 13px; margin: 8px 0 6px 6px; }
.direct input { font-size: 12px; font-weight: 600; }
.direct .btn { width: 48px; padding: 0; min-height: 44px; }

/* Страница файла */
.fp-preview { aspect-ratio: 4 / 3; background: var(--mint); border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; overflow: hidden; }
.fp-preview > i { font-size: 84px; color: var(--green); animation: float 3s ease-in-out infinite; }
.fp-preview img { width: 100%; height: 100%; object-fit: contain; }
.fp-preview audio { width: 88%; }
.fp-preview model-viewer { width: 100%; height: 100%; --poster-color: transparent; }
.fp-meta { display: flex; align-items: center; gap: 12px; }
.fp-meta > i { font-size: 26px; color: var(--green); }
.fp-actions { display: grid; gap: 10px; }
@media (min-width: 420px) { .fp-actions:has(> :nth-child(2):not([hidden])) { grid-template-columns: 1fr 1fr; } }
.note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); background: #FFF7E6; border-radius: 12px; padding: 8px 10px; }
.note i { color: #B7791F; font-size: 16px; }
.missing-icon { font-size: 64px; color: var(--teal); }
.own { display: block; text-align: center; margin-top: 18px; font-weight: 800; color: var(--green); }

/* Подвал */
.foot { margin-top: 44px; }
.foot .waves { transform: scaleY(-1); height: 60px; }
.foot .waves .w2 { fill: var(--green); }
.foot .waves .w3 { fill: var(--dark); }
.foot-in { background: var(--dark); color: #fff; text-align: center; padding: 6px 16px 28px; margin-top: -1px; }
.foot-in p { font-weight: 800; opacity: .85; }
.socials { display: flex; justify-content: center; gap: 14px; margin: 12px 0 16px; }
.socials a { width: 48px; height: 48px; border-radius: 50%; background: #fff; color: var(--green); display: grid; place-items: center; font-size: 22px; transition: transform .2s; }
.socials a:hover { transform: translateY(-4px) rotate(-6deg); }
.foot-in small { opacity: .6; }

@keyframes float { 50% { transform: translateY(-8px); } }
@keyframes sway { from { transform: translateX(-40px); } to { transform: translateX(40px); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
@keyframes turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
