* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #d4dce6 0%, #e8f0f5 100%);
    color: #111;
    line-height: 1.6;
    padding: 1.25rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

input, textarea, select {
    font-size: 1rem;
}

/* ====== Glass Container ====== */
.glass {
    position: relative;
    width: 100%;
    max-width: 48rem;
    min-height: calc(100vh - 2.5rem - 2.5rem);
    margin: 1.25rem auto;
    padding: 2.25rem;
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(1.2rem) saturate(180%);
    -webkit-backdrop-filter: blur(1.2rem) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.1);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.glass p {
    margin-bottom: 1rem;
}

header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #111;
}

section {
    margin-bottom: 2rem;
}

/* ====== Labels & Inputs ====== */
label {
    display: inline-block;
    min-width: 6rem;
    font-weight: 500;
}

input[type="text"],
textarea {
    padding: 0.7rem 0.9rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    width: 100%;
    max-width: 25rem;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.55);
}

input[type="text"]:focus,
textarea:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25);
    outline: none;
    background: rgba(255, 255, 255, 0.9);
}

/* ====== Checkbox ====== */
input[type="checkbox"] {
    transform: scale(1.2);
    margin-right: 0.4rem;
    accent-color: #007aff;
}

/* ====== Buttons ====== */
button {
    padding: 0.7rem 1.4rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.25s ease-in-out;
}

button + button {
    margin-left: 0.75rem;
}

button:hover {
    background: linear-gradient(135deg, #3a8ef6, #06d6d9);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

button:active {
    transform: scale(0.97);
}

button.remove {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #f56565;
}

button.remove:hover {
    color: #e53e3e;
}

#logoutBtn {
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
}

#logoutBtn:hover {
    background: linear-gradient(135deg, #e63956, #e63c1f);
}

#storyTitleInput {
    max-width: 35rem;
}

/* ====== Vote Buttons ====== */
.vote-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1.5rem 0;
    justify-content: center;
}

.vote-buttons button {
    flex: 1 1 12%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    color: #111;
    font-size: 1rem;
    font-weight: bold;
    min-width: 2.8rem;
    max-width: 3.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.vote-buttons button:hover {
    background: rgba(255, 255, 255, 0.65);
}

.vote-buttons button:focus-visible {
    outline: 3px solid #007aff;
    outline-offset: 2px;
}

.vote-buttons button.selected {
    background: linear-gradient(135deg, #007aff, #00c6ff);
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.08);
    box-shadow: 0 6px 12px rgba(0, 122, 255, 0.25);
}

/* ====== Lists ====== */
ul {
    list-style: none;
    padding-left: 0;
}

ul li {
    padding: 0.3rem 0;
}

/* ====== Popup Overlay ====== */
.popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup {
    width: 90%;
    max-width: 22rem;
    padding: 2rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(1rem) saturate(180%);
    -webkit-backdrop-filter: blur(1rem) saturate(180%);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.15);
}

.popup p {
    margin-bottom: 1rem;
    color: #111;
}

.card {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(1.2rem) saturate(180%);
    -webkit-backdrop-filter: blur(1.2rem) saturate(180%);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    max-width: 35rem;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.ribbon {
    position: absolute;
    top: 1rem;
    right: -2.8rem;
    transform: rotate(45deg);
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.65) 0%, rgba(0, 242, 254, 0.6) 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.45rem 3.6rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(8px) saturate(180%);
    -webkit-backdrop-filter: blur(8px) saturate(180%);
    border-radius: 0.3rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    box-shadow: 0 8px 16px rgba(0, 122, 255, 0.18), inset 0 0 8px rgba(255, 255, 255, 0.35);
    z-index: 2;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.15);
}

.card:hover .ribbon {
    transform: rotate(45deg) scale(1.02);
    box-shadow: 0 0 18px rgba(0, 122, 255, 0.28);
}

.divider {
    display: block;
    width: 100%;
    height: 1px;
    margin: 1rem 0;
    border: none;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(0.5rem);
    -webkit-backdrop-filter: blur(0.5rem);
    border-radius: 0.5px;
    box-shadow: 0 0.1rem 0.25rem rgba(0, 0, 0, 0.1);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 4px 10px rgba(17, 17, 17, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    color: #111;
    font: 500 14px/1.2 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    margin: 0.5rem 0.5rem 0 0;
}

.chip .label {
    color: rgba(17, 17, 17, 0.7);
}

.chip .count {
    font-weight: 600;
}

.chip:hover {
    background: rgba(255, 255, 255, 0.32);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(17, 17, 17, 0.10);
}

.vote-list {
    display: grid;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 8px 24px rgba(17, 17, 17, 0.06);
}

.vote-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0.18) 100%);
    border: 1px solid rgba(255, 255, 255, 0.32);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.35), 0 6px 14px rgba(17, 17, 17, 0.06);
}

.vote-name {
    min-width: 0;
    font-size: 14px;
    color: rgba(17, 17, 17, 0.9);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vote-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 6px 12px;
    border-radius: 999px;
    line-height: 1;
    color: #0b3d91;
    background: rgba(0, 122, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(6px) saturate(160%);
    -webkit-backdrop-filter: blur(6px) saturate(160%);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.35);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.vote-item:hover .vote-value {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0, 122, 255, 0.18);
    background: rgba(0, 122, 255, 0.18);
}

footer {
    position: absolute;
    bottom: 1rem;
    left: 0;
    width: 100%;
    font-size: 0.75rem;
    text-align: center;
}

.footer-link {
    color: #007aff;
    text-decoration: none;
    transition: color 0.25s ease, transform 0.15s ease;
}

.footer-link:hover {
    color: #005fcc;
}

/* ====== Accessibility ====== */
:focus-visible {
    outline: 3px solid #007aff;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

/* ====== Responsive ====== */
@media (max-width: 48rem) {
    body {
        padding: 0;
    }

    .glass {
        width: 100%;
        min-height: 100vh;
        max-width: none;
        max-height: none;
        margin: 0;
        padding: 1.5rem;
        border-radius: 0;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    button {
        padding: 1rem 0;
        font-size: 1.1rem;
        width: 100%;
        min-height: 3rem;
    }

    button + button {
        margin-left: 0;
        margin-top: 0.5rem;
    }

    button.remove {
        width: auto;
        display: inline-block;
        padding: 0.7rem 1.2rem;
        font-size: 1rem;
        min-height: auto;
    }

    input[type="text"],
    textarea {
        max-width: 100%;
        font-size: 1rem;
    }

    .vote-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 0.8rem;
        justify-content: center;
        align-items: center;
    }

    .vote-buttons button {
        flex: none;
        width: 3.5rem;
        aspect-ratio: 1 / 1;
        height: auto;
        padding: 0;
        line-height: 1;
        box-sizing: border-box;
        margin: 0;
    }

    .popup {
        width: 90%;
        max-width: none;
        padding: 1.25rem;
    }

    .card {
        padding: 1rem;
        border-radius: 0.75rem;
    }

    .ribbon {
        font-size: 0.7rem;
        padding: 0.38rem 3.1rem;
        background: linear-gradient(135deg, rgba(0, 122, 255, 0.68) 0%, rgba(0, 242, 254, 0.62) 100%);
    }
}