* { box-sizing: border-box; }

:root {
    --accent: #e94560;
    --accent-dark: #c73650;
    --bg: #0f1123;
    --bg-card: rgba(255, 255, 255, 0.06);
    --bg-card-solid: #1a1d3a;
    --text: #eef0ff;
    --text-muted: #9aa0c3;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(233, 69, 96, 0.25), transparent),
        radial-gradient(ellipse 60% 40% at 90% 10%, rgba(83, 92, 232, 0.2), transparent);
    background-repeat: no-repeat;
    color: var(--text);
    min-height: 100vh;
}

.wrap {
    max-width: 640px;
    margin: 0 auto;
    padding: 15px;
}

header.site {
    background: transparent;
    padding: 18px 20px;
}
header.site a { color: #fff; text-decoration: none; }
header.site h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.brandicon {
    height: 1.15em;
    width: auto;
    vertical-align: -0.24em;
}
header.site h1 a:hover { opacity: 0.85; }

.card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 16px;
    padding: 22px;
    margin: 18px 0;
    backdrop-filter: blur(8px);
}
.card h2 {
    margin-top: 0;
    font-size: 19px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

input[type=text], input[type=email], input[type=password] {
    width: 100%;
    padding: 13px 15px;
    font-size: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus {
    border-color: var(--accent);
}
input::placeholder { color: #6b7194; }

button, .btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 22px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
    margin: 2px 2px 2px 0;
}
button:hover, .btn:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(233, 69, 96, 0.35);
}
button.danger, .btn.danger { background: #8f2b3c; }
button.danger:hover, .btn.danger:hover { background: #7a2131; box-shadow: 0 6px 18px rgba(143, 43, 60, 0.4); }

.muted { color: var(--text-muted); font-size: 14px; line-height: 1.55; }

/* ---------- Landing page ---------- */
.hero {
    text-align: center;
    padding: 30px 15px 10px;
}
.hero h1 {
    font-size: clamp(34px, 7vw, 52px);
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.08;
    margin: 18px 0 14px;
}
.hero h1 .grad {
    background: linear-gradient(90deg, #e94560, #ff8a5c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero p.sub {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 460px;
    margin: 0 auto 26px;
    line-height: 1.55;
}
.hero-art { margin: 0 auto; max-width: 420px; display: block; }
.hero-art .float1 { animation: floaty 4s ease-in-out infinite; }
.hero-art .float2 { animation: floaty 5s ease-in-out 0.8s infinite; }
@keyframes floaty {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-9px); }
}

.bigstart {
    display: inline-block;
    padding: 20px 55px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-align: center;
    background: linear-gradient(135deg, #e94560, #ff6b5c);
    color: #fff;
    border: none;
    border-radius: 60px;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(233, 69, 96, 0.45);
    transition: transform 0.15s, box-shadow 0.15s;
}
.bigstart:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 40px rgba(233, 69, 96, 0.6);
    background: linear-gradient(135deg, #e94560, #ff6b5c);
}

.steps {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin: 24px 0;
}
.step {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 16px;
    padding: 20px 15px;
    text-align: center;
}
.step .num {
    display: inline-block;
    width: 30px; height: 30px;
    line-height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    margin-bottom: 10px;
}
.step h3 { margin: 6px 0; font-size: 16px; }
.step p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.step svg { display: block; margin: 0 auto 6px; }

.trustbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 22px;
    margin: 10px 0 25px;
    font-size: 13.5px;
    color: var(--text-muted);
}
.trustbar span::before { content: "\2713\00a0"; color: var(--accent); font-weight: 700; }

footer.site {
    text-align: center;
    padding: 30px 15px;
    color: #565c80;
    font-size: 13px;
}

/* ---------- Pictures grid ---------- */
.picgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.picgrid .pic { position: relative; cursor: pointer; }
.picgrid img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}
.picgrid .pic.selected img,
.picgrid .pic.selected video { outline: 4px solid var(--accent); }
.picgrid .pic .check {
    display: none;
    position: absolute;
    top: 6px; right: 8px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    width: 26px; height: 26px;
    text-align: center;
    line-height: 26px;
    font-weight: bold;
}
.picgrid .pic.selected .check { display: block; }
.picgrid .caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 12px;
    padding: 3px 7px;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ---------- QR box ---------- */
.qrbox { text-align: center; }
.qrbox img {
    max-width: 250px;
    background: #fff;
    padding: 12px;
    border-radius: 14px;
}
.qrbox .bigcode {
    font-size: 30px;
    letter-spacing: 7px;
    font-weight: 800;
    margin: 10px 0 4px;
    color: var(--accent);
}

/* ---------- Guest camera page ---------- */
.guest-hero { text-align: center; padding: 10px 10px 2px; }
.guest-emoji {
    font-size: 52px;
    line-height: 1;
    margin-bottom: 4px;
    animation: floaty 4s ease-in-out infinite;
}
.guest-hero h2 {
    margin: 0 0 5px;
    font-size: clamp(24px, 6vw, 30px);
    font-weight: 800;
    letter-spacing: -0.6px;
    background: linear-gradient(90deg, #e94560, #ff8a5c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.guest-hero p.lead {
    margin: 0 auto;
    max-width: 360px;
    color: var(--text-muted);
    font-size: 15.5px;
    line-height: 1.5;
}
.photo-tally {
    display: inline-block;
    margin-top: 14px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    padding: 7px 18px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}
.photo-tally b { color: var(--accent); }
.fieldlabel {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 6px 3px;
}
.fieldlabel span { font-weight: 400; opacity: 0.7; }
.guest-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.guest-actions .btn { margin: 0; }
.btn.ghost { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.16); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.16); box-shadow: none; }
.guest-footnote { text-align: center; margin: 16px auto 0; max-width: 430px; }
.guest-tip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(83, 92, 232, 0.14);
    border: 1px solid rgba(124, 132, 255, 0.35);
    border-radius: 12px;
    padding: 11px 13px;
    margin: 2px 0 4px;
    font-size: 14px;
    line-height: 1.45;
    color: #dfe2ff;
}
.guest-tip .tip-ico {
    flex: 0 0 auto;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(124, 132, 255, 0.2);
    border-radius: 10px;
    animation: tiltPhone 3s ease-in-out infinite;
}
.guest-tip b { color: #fff; }
@keyframes tiltPhone {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-12deg); }
}

/* ---------- Camera button ---------- */
#customButton {
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin: 6px auto 0;
    background: linear-gradient(135deg, #e94560, #ff6b5c);
    color: #fff;
    border-radius: 18px;
    padding: 34px 20px;
    font-size: 26px;
    font-weight: 800;
    box-shadow: 0 6px 24px rgba(233, 69, 96, 0.4);
    transition: transform 0.15s;
    animation: pulseBtn 2.6s ease-in-out infinite;
}
#customButton:active { transform: scale(0.97); }
@keyframes pulseBtn {
    0%, 100% { box-shadow: 0 6px 24px rgba(233, 69, 96, 0.4); }
    50% { box-shadow: 0 8px 34px rgba(233, 69, 96, 0.68); }
}
#fileInput { display: none; }

/* ---------- Party LIVE/ended toggle (host page) ---------- */
.pswitch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    margin: 2px 8px 2px 0;
    vertical-align: middle;
}
.pswitch input { display: none; }
.pswitch .knob {
    width: 52px;
    height: 28px;
    border-radius: 14px;
    background: #8f2b3c;
    position: relative;
    transition: background 0.2s;
    flex: 0 0 auto;
}
.pswitch .knob::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    transition: left 0.2s;
}
.pswitch input:checked + .knob { background: #3dd6a3; }
.pswitch input:checked + .knob::after { left: 27px; }

/* ---------- Range slider ---------- */
input[type=range] { accent-color: var(--accent); }

/* ---------- Upload progress bar ---------- */
#progressWrap {
    display: none;
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 12px;
    height: 28px;
    margin: 8px 0;
    overflow: hidden;
}
#progressBar {
    height: 100%;
    width: 0%;
    min-width: 28px;
    background: linear-gradient(90deg, #e94560, #ff6b5c);
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 28px;
    text-align: center;
    transition: width 0.15s ease;
    white-space: nowrap;
}

/* ---------- Host viewing-queue list (drag to reorder) ---------- */
.piclist { list-style: none; margin: 0; padding: 0; }
.prow {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 6px 8px;
    margin-bottom: 8px;
}
.prow.dragging {
    opacity: 0.65;
    background: var(--bg-card-solid);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.prow .pthumb {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    flex: 0 0 auto;
}
.prow .pcap {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.prow .picspeed {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 6px;
}
.prow .picspeed.overridden { background: var(--accent); }
.prow .picspeed.saved { box-shadow: 0 0 0 2px #3dd6a3; }
.prow .picspeed input {
    width: 40px;
    margin: 0 2px;
    padding: 2px 3px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    text-align: center;
    background: #fff;
    color: #222;
    -moz-appearance: textfield;
    appearance: textfield;
}
.prow .picspeed input::-webkit-outer-spin-button,
.prow .picspeed input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.prow .delform { margin: 0; flex: 0 0 auto; }

/* ---------- Guest download gallery (desktop-friendly, any orientation) ---------- */
.gallerywrap { max-width: 1700px; margin: 0 auto; padding: 0 15px 40px; }
.gallery-toolbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-card-solid);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}
.gallery-toolbar .gallery-intro { max-width: 460px; }
.gallery-toolbar .gallery-intro h2 { margin: 0 0 2px; font-size: 18px; }
.gallery-toolbar .spacer { flex: 1 1 20px; }
.gallery-toolbar form { margin: 0; display: flex; gap: 8px; }
.gallery-toolbar input[type=email] { margin: 0; width: 210px; }
.gallery-toolbar button { margin: 0; }

/* Justified rows: uniform height, natural width -> no cropping.
   Landscape photos stay wide, portrait stay narrow, both fit cleanly. */
.picgrid-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.picgrid-gallery .pic { height: 220px; }
.picgrid-gallery img {
    width: auto;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}
@media (max-width: 1100px) { .picgrid-gallery .pic { height: 180px; } }
@media (max-width: 700px) {
    .picgrid-gallery .pic { height: 130px; }
    .gallery-toolbar form { width: 100%; }
    .gallery-toolbar input[type=email] { width: 100%; }
}
