:root {
    --blue: #1a73e8;
    --blue-dark: #1557b0;
    --green: #1e8e3e;
    --red: #d93025;
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #202124;
    --muted: #5f6368;
    --border: #e0e0e0;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.app-header {
    background: var(--blue);
    color: #fff;
    padding: 18px 16px;
    text-align: center;
}
.app-header h1 { margin: 0; font-size: 22px; }
.subtitle { margin: 4px 0 0; font-size: 13px; opacity: .9; }

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px 16px 140px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .05s;
}
.btn:active { transform: scale(.98); }

.btn-capture {
    background: var(--card);
    color: var(--blue);
    border: 2px dashed var(--blue);
    margin-bottom: 14px;
}
.btn-capture .icon { font-size: 22px; }

.count-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--muted);
}
.link-btn {
    background: none;
    border: none;
    color: var(--red);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
}

.gallery {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: #ddd;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.thumb .remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 15px;
    line-height: 26px;
    cursor: pointer;
    padding: 0;
}
.thumb .overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    background: rgba(0,0,0,.45);
    opacity: 0;
    transition: opacity .2s;
}
.thumb.uploading .overlay { opacity: 1; }
.thumb.done .overlay { opacity: 1; background: rgba(30,142,62,.7); }
.thumb.failed .overlay { opacity: 1; background: rgba(217,48,37,.7); }

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

.empty-hint {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin-top: 30px;
}

.upload-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}
.upload-bar .btn-upload {
    max-width: 640px;
    margin: 0 auto;
    background: var(--green);
    color: #fff;
}
.btn-upload:disabled {
    background: #b7c0c9;
    cursor: not-allowed;
}

.status {
    max-width: 640px;
    margin: 8px auto 0;
    text-align: center;
    font-size: 13px;
    min-height: 18px;
}
.status.err { color: var(--red); }
.status.ok { color: var(--green); }
