:root {
    --bg:        #faf6f1;
    --card:      #ffffff;
    --ink:       #2c2a28;
    --muted:     #8a807a;
    --line:      #ece5dd;
    --gold:      #c2a36b;
    --gold-deep: #a7884f;
    --rose:      #d98a8a;
    --ok-bg:     #eaf7ee;  --ok-ink:  #2f7d46;
    --err-bg:    #fdeceb;  --err-ink: #c0392b;
    --radius:    18px;
    --shadow:    0 10px 40px rgba(70, 50, 30, .10);
    --font:      "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    --serif:     Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    min-height: 100%;
}

body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 24px 16px 64px;
    position: relative;
}

.bg-decor {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 15% 10%, rgba(217,138,138,.10), transparent 42%),
        radial-gradient(circle at 85% 20%, rgba(194,163,107,.12), transparent 45%),
        radial-gradient(circle at 50% 100%, rgba(194,163,107,.08), transparent 55%);
}

/* ---------- Card ---------- */
.card {
    width: 100%;
    max-width: 560px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 26px;
}
.gallery-card { max-width: 1000px; }

/* ---------- Hero ---------- */
.hero { text-align: center; margin-bottom: 26px; }
.hero-emoji { font-size: 44px; line-height: 1; margin-bottom: 8px; }
.hero h1 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(24px, 5vw, 32px);
    margin: 6px 0;
    letter-spacing: .3px;
}
.muted { color: var(--muted); font-size: 15px; margin: 4px 0; line-height: 1.55; }
.opt { color: var(--muted); font-weight: 400; font-size: 13px; }

/* ---------- Fields ---------- */
.field { margin-bottom: 18px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
@media (max-width: 460px) { .field-row { flex-direction: column; gap: 0; } }

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 7px;
    color: var(--ink);
}

input[type=text], textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    font-size: 16px;          /* 16px → iOS zoom engeli */
    font-family: inherit;
    color: var(--ink);
    background: #fdfbf9;
    transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus, textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(194,163,107,.18);
    background: #fff;
}
textarea { resize: vertical; }

/* ---------- Dropzone ---------- */
.dropzone {
    display: block;
    border: 2px dashed #ddd0bf;
    border-radius: 14px;
    padding: 26px 18px;
    text-align: center;
    cursor: pointer;
    background: #fdfaf6;
    transition: border-color .15s, background .15s, transform .1s;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--gold);
    background: #fbf6ee;
}
.dropzone:active { transform: scale(.995); }
.dz-icon { font-size: 30px; }
.dz-text { font-size: 15px; margin-top: 8px; color: var(--ink); }
.dz-text strong { color: var(--gold-deep); }
.dz-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- Preview ---------- */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.preview-grid:empty { margin-top: 0; }
.pv {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #f3ece2;
}
.pv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv .rm {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px; border: none; border-radius: 50%;
    background: rgba(0,0,0,.6); color: #fff; cursor: pointer;
    font-size: 14px; line-height: 22px; padding: 0;
}
.pv .rm:hover { background: rgba(0,0,0,.8); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    border: none; border-radius: 12px;
    padding: 14px 22px;
    font-size: 16px; font-weight: 600; font-family: inherit;
    cursor: pointer; text-decoration: none;
    transition: transform .1s, box-shadow .15s, opacity .15s;
}
.btn.primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-deep));
    color: #fff;
    box-shadow: 0 6px 18px rgba(167,136,79,.35);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 9px 24px rgba(167,136,79,.42); }
.btn.primary:active { transform: translateY(0); }
.btn.ghost {
    background: transparent; color: var(--gold-deep);
    border: 1.5px solid var(--gold);
}
.btn.ghost:hover { background: #fbf6ee; }
.btn.small { padding: 9px 16px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.spinner {
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,.45);
    border-top-color: #fff; border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Captcha ---------- */
.captcha-wrap { display: flex; justify-content: center; }
.captcha-wrap > div { transform-origin: center; }

/* ---------- Messages ---------- */
.form-msg { margin-top: 16px; padding: 13px 15px; border-radius: 11px; font-size: 14.5px; text-align: center; }
.form-msg.ok  { background: var(--ok-bg);  color: var(--ok-ink); }
.form-msg.err { background: var(--err-bg); color: var(--err-ink); }

.alert { padding: 13px 15px; border-radius: 11px; font-size: 14px; margin-bottom: 18px; line-height: 1.5; }
.alert.error   { background: var(--err-bg); color: var(--err-ink); }
.alert.success { background: var(--ok-bg);  color: var(--ok-ink); }
.alert.info    { background: #fbf3e6; color: var(--gold-deep); border: 1px solid #ecd9b5; }
.alert code, .muted code { background: rgba(0,0,0,.05); padding: 1px 5px; border-radius: 4px; font-size: 13px; }

/* ---------- Footer / links ---------- */
.card-footer { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); text-align: center; }
.link-gallery { color: var(--gold-deep); font-weight: 600; text-decoration: none; font-size: 15px; }
.link-gallery:hover { text-decoration: underline; }

/* ---------- Gallery ---------- */
.count-badge { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.g-item {
    position: relative; display: block;
    aspect-ratio: 1; border-radius: 12px; overflow: hidden;
    background: #f3ece2; border: 1px solid var(--line);
    text-decoration: none;
}
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.g-item:hover img { transform: scale(1.05); }
.g-cap {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 18px 10px 8px; color: #fff;
    background: linear-gradient(transparent, rgba(0,0,0,.72));
    display: flex; flex-direction: column; gap: 1px;
}
.g-cap-name {
    font-size: 12.5px; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.g-cap-note {
    font-size: 11.5px; font-weight: 400; opacity: .9;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-state { text-align: center; padding: 30px 10px; }
.empty-state p { color: var(--muted); margin: 10px 0 18px; }

/* ---------- Setup page ---------- */
.setup-page .card { max-width: 600px; }
.steps { line-height: 1.9; color: var(--ink); }
.token-box {
    width: 100%; min-height: 90px; margin: 12px 0; padding: 12px;
    font-family: ui-monospace, "Consolas", monospace; font-size: 13px;
    border: 1.5px solid var(--gold); border-radius: 10px; background: #fffdf8;
    word-break: break-all;
}

.form.is-disabled, form.is-disabled { opacity: .55; pointer-events: none; }
