@font-face {
    font-family: "Inter";
    src: url("/assets/fonts/InterVariable.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --bg: #eef1fb;
    --card: rgba(255, 255, 255, 0.72);
    --ink: #1c2733;
    --muted: #5b6678;
    --line: rgba(99, 102, 241, 0.16);
    --accent: #6366f1;
    --accent-2: #8b5cf6;
    --grad: linear-gradient(135deg, #6366f1, #8b5cf6);
    --green: #10b981;
    --green-bg: #d1fae5;
    --amber: #d97706;
    --amber-bg: #fef3c7;
    --red: #ef4444;
    --red-bg: #fee2e2;
    --best-bg: rgba(99, 102, 241, 0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(80, 70, 180, 0.10);
    --glass-border: 1px solid rgba(255, 255, 255, 0.6);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background:
        radial-gradient(60rem 40rem at 8% -5%, rgba(99, 102, 241, 0.13), transparent 60%),
        radial-gradient(55rem 38rem at 95% 0%, rgba(139, 92, 246, 0.12), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--ink);
    line-height: 1.5;
}

main {
    max-width: 860px;
    margin: 0 auto;
    padding: 1rem;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--grad);
    padding: 0.9rem max(1rem, calc((100% - 860px) / 2));
    box-shadow: 0 2px 18px rgba(99, 102, 241, 0.30);
}
.logo { font-weight: 700; font-size: 1.2rem; color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem; }
.logo-icon { width: 75px; height: 75px; display: block; }
.lang-switch { color: rgba(255, 255, 255, 0.85); text-decoration: none; font-size: 0.9rem; }
.lang-switch:hover { color: #fff; }

.site-footer {
    max-width: 860px;
    margin: 2rem auto 0;
    padding: 1rem;
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
}

.hero { text-align: center; margin: 2rem 0 1.5rem; }
.hero h1 {
    margin-bottom: 0.3rem;
    font-size: 2rem;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.tagline { color: var(--muted); }

.card {
    background: var(--card);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border: var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.4rem;
    margin-bottom: 1.25rem;
}

@supports not (backdrop-filter: blur(1px)) {
    .card, .alert { background: rgba(255, 255, 255, 0.95); }
}

h1 { font-size: 1.6rem; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin: 1.2rem 0 0.5rem; letter-spacing: -0.01em; }
.card > h2:first-child { margin-top: 0; }

label { display: block; font-weight: 600; font-size: 0.9rem; margin: 0.9rem 0 0.25rem; }
label.check { font-weight: 400; margin: 0.4rem 0; }

input[type="text"], input[type="email"], input[type="url"], input[type="date"], input[type="time"],
input[type="datetime-local"], textarea, select {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font: inherit;
    color: inherit;
    background: rgba(255, 255, 255, 0.85);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 2rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%236366f1' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 0.7rem;
}

input[type="file"] {
    width: 100%;
    font: inherit;
    font-size: 0.9rem;
    color: var(--muted);
}
input[type="file"]::file-selector-button {
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.8rem;
    margin-right: 0.6rem;
    cursor: pointer;
}

.help { color: var(--muted); font-size: 0.83rem; margin: 0.25rem 0 0.6rem; }
.warn { color: var(--amber); font-size: 0.9rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }

/* Buttons */
button { font: inherit; cursor: pointer; }
.btn-primary, .btn-secondary, .btn-danger {
    display: inline-block;
    padding: 0.6rem 1.3rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    text-decoration: none;
    margin-top: 0.6rem;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn-primary {
    background: var(--grad);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(99, 102, 241, 0.42); }
.btn-secondary { background: rgba(255, 255, 255, 0.8); color: var(--accent); border-color: var(--accent); }
.btn-secondary:hover { background: var(--best-bg); }
.btn-danger { background: rgba(255, 255, 255, 0.8); color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.85rem; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.8); }
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger.btn-sm { color: var(--red); border-color: var(--red); }
.btn-danger.btn-sm:hover { background: var(--red-bg); }

/* Honeypot — visually hidden but submittable by naive bots */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Option rows on create form */
.option-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}
.option-row input[type="date"] { flex: 2 1 140px; width: auto; }
.option-row input[type="time"] { flex: 1 1 90px; width: auto; }

/* Calendar import box on create form */
.ics-import {
    margin: 0.8rem 0;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.5);
}
.ics-import summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.ics-import label { margin-top: 0.5rem; }
.ics-import #ics-import-status:empty { display: none; }
.calendar-provider-panel {
    margin: 0.55rem 0;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.55);
}
.calendar-provider-panel .help { margin-bottom: 0.2rem; }
.calendar-provider-panel .btn-secondary,
.calendar-provider-panel .btn-sm { margin-top: 0.25rem; }

/* Alerts */
.alert {
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    background: var(--card);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    box-shadow: var(--shadow);
}
.alert-ok { background: rgba(209, 250, 229, 0.85); border-color: var(--green); }
.alert-error { background: rgba(254, 226, 226, 0.85); border-color: var(--red); }
.alert-info { background: rgba(99, 102, 241, 0.10); border-color: var(--accent); }
.alert-best { background: rgba(99, 102, 241, 0.10); border-color: var(--accent); }
.score-detail { color: var(--muted); font-size: 0.85rem; }

/* Answer cards (vote form) */
.answer-cards { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.8rem 0; }
.answer-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem;
    margin: 0;
    background: rgba(255, 255, 255, 0.55);
}
.answer-card legend { font-weight: 600; padding: 0 0.3rem; }
.answer-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.ans { flex: 1 1 100px; }
.ans input { position: absolute; opacity: 0; }
.ans span {
    display: block;
    text-align: center;
    padding: 0.45rem 0.6rem;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    user-select: none;
    font-size: 0.92rem;
    background: rgba(255, 255, 255, 0.7);
    transition: box-shadow 0.12s ease;
}
.ans input:focus-visible + span { outline: 2px solid var(--accent); }
.ans-yes input:checked + span { background: var(--green-bg); border-color: var(--green); color: #047857; font-weight: 700; box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25); }
.ans-maybe input:checked + span { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); font-weight: 700; box-shadow: 0 2px 8px rgba(217, 119, 6, 0.22); }
.ans-no input:checked + span { background: var(--red-bg); border-color: var(--red); color: var(--red); font-weight: 700; box-shadow: 0 2px 8px rgba(239, 68, 68, 0.22); }

/* Results table */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table.results { border-collapse: separate; border-spacing: 0; width: 100%; }
table.results th, table.results td {
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    padding: 0.45rem 0.6rem;
    text-align: center;
    font-size: 0.9rem;
    white-space: nowrap;
}
table.results tr > :last-child { border-right: none; }
table.results tr:last-child > td { border-bottom: none; }
table.results thead th { background: var(--best-bg); }
table.results .pname { text-align: left; font-weight: 600; }
table.results .pname { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.pname-remove { margin: 0; }
.pname-remove .del { padding: 0.1rem 0.4rem; line-height: 1; color: var(--muted); }
.pname-remove .del:hover { color: var(--red); border-color: var(--red); }
.opt-date { display: block; font-weight: 600; }
.opt-time { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 400; }
.vote-yes { background: var(--green-bg); color: #047857; font-weight: 700; }
.vote-maybe { background: var(--amber-bg); color: var(--amber); }
.vote-no { background: var(--red-bg); color: var(--red); }
th.best, td.best { box-shadow: inset 0 0 0 2px var(--accent); }
th.chosen { background: var(--green-bg); }
.tally th { font-weight: 400; font-size: 0.8rem; }
.t-yes { color: #047857; margin-right: 0.4rem; }
.t-maybe { color: var(--amber); }

/* Finalize list */
.finalize-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.55);
}
.finalize-row.best { background: var(--best-bg); border-color: var(--accent); }
.finalize-row .opt { flex: 1 1 200px; }
.finalize-row .opt-date, .finalize-row .opt-time { display: inline; margin-right: 0.4rem; }

/* Calendar conflict checker */
.conflict-check { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.6rem; }
.conflict-controls { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.conflict-controls select { width: auto; margin: 0; }
.conflict-controls #conflict-url { width: auto; min-width: 16rem; margin: 0; flex: 1 1 16rem; }
.conflict-controls #conflict-btn { white-space: nowrap; }
.conflict-check .help { margin: 0; }
.conflict-check .calendar-provider-panel { width: 100%; }
.conflict-chip {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #ecfdf5;
    color: #047857;
}
.conflict-chip.busy { background: #fff1f2; color: #dc2626; }

/* Existing options in edit form */
.existing-option-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.55);
    cursor: pointer;
}
.existing-option-row input[type="checkbox"] { flex-shrink: 0; }
.existing-option-row .opt { flex: 1 1 200px; }
.existing-option-row .opt-date, .existing-option-row .opt-time { display: inline; margin-right: 0.4rem; }
.existing-option-row .remove-label { font-size: 0.8rem; color: var(--muted); }
.existing-option-row:has(input:checked) { background: #fff1f2; border-color: #fca5a5; }
.existing-option-row:has(input:checked) .remove-label { color: #dc2626; font-weight: 600; }

/* Share links */
.link-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
code.copyable {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    font-size: 0.82rem;
    word-break: break-all;
    flex: 1 1 280px;
}
.qr-box { margin: 1rem 0; }
#qrcode { background: #fff; display: inline-block; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* Finalized banner */
.finalized { border-color: var(--green); background: rgba(209, 250, 229, 0.8); }
.finalized .chosen-time { font-size: 1.2rem; font-weight: 700; }
.finalized .opt-date, .finalized .opt-time { display: inline; margin-right: 0.5rem; font-size: inherit; color: inherit; }
.cal-links { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* Comments */
.comment { border-top: 1px solid var(--line); padding: 0.6rem 0; }
.comment .when { color: var(--muted); font-size: 0.8rem; margin-left: 0.5rem; }
.comment p { margin: 0.2rem 0 0; }
.comment-form textarea { margin-top: 0.5rem; }

.poll-head .byline { color: var(--muted); margin: 0.1rem 0; }
.poll-head .desc { white-space: pre-line; }
.danger-zone { border-color: rgba(239, 68, 68, 0.35); }

/* Poll brand image: banner mode */
.poll-banner { margin: 1rem 0; }
.poll-banner img {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Poll brand image: full-page background mode (inline background-image on body) */
body.has-bg-image {
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}
body.has-bg-image .card,
body.has-bg-image .alert { background: rgba(255, 255, 255, 0.82); }
body.has-bg-image .poll-head {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border: var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.4rem;
    margin: 1rem 0 1.25rem;
}

@media (max-width: 600px) {
    main { padding: 0.6rem; }
    .card { padding: 1rem; }
    h1 { font-size: 1.3rem; }
    .hero h1 { font-size: 1.5rem; }
    /* Fixed backgrounds repaint badly on mobile */
    body, body.has-bg-image { background-attachment: scroll; }
}
