html:not([data-lang]) body { visibility: hidden; }

.app {
    width: min(100%, 620px);
    margin: 0 auto;
    padding: max(66px, calc(env(safe-area-inset-top) + 60px)) 18px 28px;
}
.qr-workspace > h1 {
    margin-bottom: 16px;
    font-size: clamp(24px, 4vw, 32px);
    line-height: 1.2;
    letter-spacing: -.025em;
}
.qr-grid {
    display: grid;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
}
.url-form, .qr-result {
    min-width: 0;
    padding: clamp(14px, 3vw, 20px);
}
.url-form {
    display: grid;
    gap: 12px;
    align-content: start;
}
.qr-form-options { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 16px; }
.qr-submit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.qr-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.field-label { display: block; margin-bottom: 6px; padding: 0; color: var(--muted); }
.url-form input[type="url"] {
    width: 100%;
    min-height: 44px;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--input);
    color: var(--text);
    font-size: 16px;
}
.url-form input::placeholder { color: #838389; }
.mode-switch { display: flex; flex-wrap: wrap; gap: 6px; }
.mode-option { display: grid; position: relative; }
.mode-option > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mode-option > span {
    display: block;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    cursor: pointer;
}
.mode-option:hover > span { color: var(--text); }
.mode-option > input:checked + span { background: #303034; border-color: #67676c; color: var(--text); }
.mode-option > input:focus-visible + span { outline: 2px solid #c5c5ce; outline-offset: 2px; }
.logo-option {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    color: var(--text);
    cursor: pointer;
}
.logo-option > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.logo-track {
    position: relative;
    width: 36px;
    height: 20px;
    border: 1px solid #5c5c61;
    border-radius: 999px;
    background: #29292d;
    transition: background .16s ease, border-color .16s ease;
}
.logo-track::after {
    content: "";
    position: absolute;
    inset: 3px auto auto 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #b5b5bc;
    transition: transform .16s ease, background .16s ease;
}
.logo-option > input:checked + .logo-track { background: var(--accent); border-color: var(--accent); }
.logo-option > input:checked + .logo-track::after { transform: translateX(16px); background: #252529; }
.logo-option > input:focus-visible + .logo-track { outline: 2px solid #c5c5ce; outline-offset: 3px; }
.form-error { color: var(--danger); }

.qr-result {
    display: grid;
    gap: 12px;
    border-top: 1px solid var(--border);
}
.qr-result-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.qr-result h2 { font-size: 15px; }
.preview-frame { display: grid; justify-items: center; }
.preview-expired { color: var(--muted); }
.preview-expired p { margin-bottom: 3px; color: var(--text); font-weight: 650; }
.preview-qr {
    display: block;
    width: 160px;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    background: #fff;
}
.qr-timer { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.qr-timer p { color: var(--muted); font-size: 13px; }
.timer { font-weight: 700; font-variant-numeric: tabular-nums; }
.timer[data-state="expired"] { color: var(--danger); }
.preview-actions, .modal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.preview-actions { justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--border); }

.modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 16px;
}
.modal-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / 65%); backdrop-filter: blur(4px); }
.modal-card {
    position: relative;
    width: min(440px, 100%);
    max-height: calc(100dvh - 32px);
    overflow: auto;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #1b1b1e;
    animation: qr-modal-in .16s ease both;
}
.qr-zoom {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(460px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    color: var(--text);
}
.qr-zoom::backdrop { background: rgb(0 0 0 / 65%); backdrop-filter: blur(4px); }
.qr-zoom-image {
    display: block;
    margin-inline: auto;
    width: min(100%, 400px, max(120px, calc(100dvh - 128px)));
    height: auto;
    border-radius: 4px;
    background: #fff;
}
.modal.is-closing .modal-card { animation: qr-modal-out .15s ease both; }
@keyframes qr-modal-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes qr-modal-out { to { opacity: 0; transform: translateY(6px); } }
.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 23px;
    line-height: 1;
}
.modal-close:hover { background: #303034; color: var(--text); }
.modal-title { margin-bottom: 12px; padding: 0 30px 12px 0; border-bottom: 1px solid var(--border); font-size: 17px; }
.modal-hint { margin-bottom: 10px; color: var(--muted); }
.modal-url {
    margin-bottom: 14px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--input);
    overflow-wrap: anywhere;
}
.modal-actions { justify-content: flex-end; }

@media (max-width: 620px) {
    .app { padding-inline: 14px; }
}
@media (max-width: 440px) {
    .preview-actions { justify-content: flex-start; }
    .preview-actions > * { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
    .logo-track, .logo-track::after { transition: none; }
    .modal-card, .modal.is-closing .modal-card { animation: none; }
}
