:root {
    color-scheme: light;
    --ink: #182235;
    --muted: #647084;
    --paper: #fffaf1;
    --surface: rgba(255, 255, 255, .94);
    --line: #dce2ea;
    --accent: #0f766e;
    --accent-strong: #0a5c56;
    --rose: #d94671;
    --sun: #f5b841;
    --sky: #3b82f6;
    --shadow: 0 14px 34px rgba(24, 34, 53, .12);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(255,250,241,.82), rgba(245,248,252,.98)),
        url("https://images.unsplash.com/photo-1555881400-74d7acaacd8b?auto=format&fit=crop&w=1400&q=80") center/cover fixed;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    width: min(100%, 520px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 18px 16px 92px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 48px;
    padding: 6px 0 12px;
    backdrop-filter: blur(14px);
}

.user-link {
    display: inline-grid;
    align-items: center;
    min-height: 44px;
    min-width: 0;
    max-width: 72%;
    padding: 8px 10px 8px 12px;
    border: 1px solid rgba(15, 118, 110, .24);
    border-radius: 8px;
    background: rgba(255, 255, 255, .84);
    box-shadow: 0 8px 20px rgba(24, 34, 53, .08);
}

.user-link strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1rem;
    line-height: 1.15;
}

.user-link small {
    margin-top: 2px;
    color: var(--accent-strong);
    font-size: .78rem;
    font-weight: 800;
}

.admin-link {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(255, 255, 255, .72);
    color: var(--muted);
    font-size: .84rem;
    font-weight: 800;
}

.screen {
    display: grid;
    gap: 16px;
}

.hero-panel,
.page-heading {
    padding: 24px 0 8px;
}

.eyebrow,
.section-kicker {
    margin: 0 0 10px;
    color: var(--accent-strong);
    font-size: .74rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 470px;
    margin-bottom: 14px;
    font-size: 2.65rem;
    line-height: .98;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 8px;
    font-size: 1.24rem;
    line-height: 1.18;
    letter-spacing: 0;
}

.lede,
.page-heading p,
.status-panel p,
.health-panel p,
.action-tile span {
    color: var(--muted);
    line-height: 1.48;
}

.lede {
    max-width: 420px;
    margin-bottom: 8px;
    font-size: 1.04rem;
}

.sublede {
    margin-bottom: 0;
    color: var(--muted);
    font-size: .96rem;
    font-weight: 800;
    line-height: 1.4;
}

.status-panel,
.quick-actions,
.list-section,
.health-panel,
.login-panel,
.user-profile-panel,
.notice-panel,
.final-celebration-panel,
.photo-card,
.confirm-panel,
.vote-category,
.vote-photo-card,
.result-section,
.winner-card,
.ranking-row,
.tiebreak-panel,
.tiebreak-card,
.leaderboard-section,
.leader-row,
.daily-winner-card,
.gallery-section,
.gallery-day,
.gallery-photo-card,
.admin-section,
.admin-day,
.admin-photo-card,
.admin-vote-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.status-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
}

.status-panel p:last-child,
.health-panel p:last-child {
    margin-bottom: 0;
}

.status-pill {
    flex: 0 0 auto;
    padding: 8px 10px;
    border-radius: 999px;
    color: #fff;
    background: var(--accent);
    font-size: .76rem;
    font-weight: 900;
}

.quick-actions,
.list-section,
.health-panel,
.login-panel,
.user-profile-panel,
.notice-panel,
.final-celebration-panel,
.photo-card,
.confirm-panel,
.vote-category,
.vote-photo-card,
.result-section,
.winner-card,
.ranking-row,
.tiebreak-panel,
.tiebreak-card,
.leaderboard-section,
.leader-row,
.daily-winner-card,
.gallery-section,
.gallery-day,
.gallery-photo-card,
.admin-section,
.admin-day,
.admin-photo-card,
.admin-vote-row {
    padding: 18px;
}

.notice-panel {
    border-color: rgba(15, 118, 110, .24);
    color: var(--accent-strong);
    background: rgba(255, 255, 255, .96);
    font-weight: 800;
    line-height: 1.45;
}

.notice-panel.is-error {
    border-color: rgba(217, 70, 113, .35);
    color: #9f1239;
}

.final-celebration-panel {
    display: grid;
    gap: 16px;
    border-color: rgba(217, 70, 113, .28);
    background: rgba(255, 255, 255, .97);
}

.final-winner-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.final-winner-card {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.final-winner-card img {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: contain;
    background: #eef3f7;
}

.final-winner-card h3 {
    margin: 0 0 4px;
    font-size: 1.08rem;
    line-height: 1.15;
}

.final-winner-card span {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 900;
}

.final-thanks {
    margin-bottom: 0;
    color: var(--muted);
    font-size: .94rem;
    font-weight: 800;
    line-height: 1.45;
}

.final-cochino {
    margin-bottom: 0;
    color: var(--rose);
    font-size: 1.55rem;
    font-weight: 900;
    line-height: 1.05;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.action-tile {
    min-height: 92px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.action-tile strong,
.action-tile span {
    display: block;
}

.action-tile strong {
    margin-bottom: 6px;
    font-size: .98rem;
}

.action-tile span {
    font-size: .84rem;
}

.day-list {
    display: grid;
    gap: 8px;
}

.day-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
}

.day-row.is-voted {
    border-color: rgba(15, 118, 110, .38);
    background: rgba(15, 118, 110, .12);
}

.day-row.is-active {
    border-color: rgba(245, 184, 65, .62);
    background: rgba(245, 184, 65, .2);
}

.day-row.is-locked {
    color: var(--muted);
    opacity: .72;
}

.day-row span {
    font-weight: 800;
}

.day-row small {
    color: var(--muted);
    font-weight: 700;
}

.people-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.people-list span {
    padding: 8px 10px;
    border-radius: 999px;
    color: #fff;
    background: var(--sky);
    font-size: .82rem;
    font-weight: 900;
}

.app-credit {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
    line-height: 1.4;
    text-align: center;
}

.user-choice-list {
    display: grid;
    gap: 10px;
}

.user-choice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 54px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}

.user-choice span {
    font-weight: 900;
}

.user-choice small {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 900;
}

.user-choice.is-current {
    border-color: var(--accent);
    background: rgba(15, 118, 110, .08);
}

.user-choice.is-current small {
    color: var(--accent-strong);
}

.user-profile-panel {
    display: grid;
    gap: 16px;
}

.user-avatar,
.user-avatar-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.user-avatar {
    display: block;
    object-fit: cover;
    background: #eef3f7;
}

.user-avatar-placeholder {
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--sky));
    font-size: 5rem;
    font-weight: 900;
}

.user-profile-panel p:last-child {
    margin-bottom: 0;
}

.upload-grid {
    display: grid;
    gap: 16px;
}

.photo-card {
    display: grid;
    gap: 14px;
}

.photo-card-header,
.confirm-panel {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.status-pill.is-ready {
    background: var(--sky);
}

.status-pill.is-empty {
    color: var(--ink);
    background: var(--sun);
}

.photo-preview {
    display: grid;
    gap: 8px;
    margin: 0;
}

.photo-preview img,
.empty-preview {
    width: 100%;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #eef3f7;
}

.photo-preview img {
    display: block;
    object-fit: cover;
}

.photo-preview figcaption {
    display: grid;
    gap: 2px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.photo-preview figcaption strong {
    color: var(--ink);
    font-size: .9rem;
}

.empty-preview {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: .88rem;
    font-weight: 900;
}

.upload-form {
    display: grid;
    gap: 10px;
}

.text-field {
    display: grid;
    gap: 8px;
    color: var(--accent-strong);
    font-weight: 900;
}

.text-field small {
    color: var(--muted);
    font-size: .78rem;
}

.text-field input {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

.file-picker {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px dashed var(--accent);
    border-radius: 8px;
    background: rgba(15, 118, 110, .06);
    color: var(--accent-strong);
    font-weight: 900;
}

.file-picker input {
    width: 100%;
    color: var(--muted);
    font-size: .86rem;
}

.text-button {
    width: 100%;
    min-height: 42px;
    border: 0;
    background: transparent;
    color: var(--rose);
    font-weight: 900;
    cursor: pointer;
}

.danger-button {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--rose);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.danger-button.is-compact {
    min-width: 94px;
    width: auto;
    padding: 0 12px;
}

.user-status-list,
.vote-photo-list {
    display: grid;
    gap: 10px;
}

.user-status-row,
.category-heading,
.vote-photo-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-status-row {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
}

.user-status-row span {
    font-weight: 900;
}

.user-status-row small {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 900;
}

.vote-category {
    display: grid;
    gap: 14px;
}

.vote-photo-card {
    display: grid;
    gap: 12px;
    background: #fff;
    box-shadow: none;
}

.vote-photo-card img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 78vh;
    border-radius: 8px;
    object-fit: contain;
    background: #eef3f7;
}

.vote-photo-meta strong {
    font-size: 1rem;
}

.vote-photo-meta span {
    color: var(--muted);
    font-size: .84rem;
    font-weight: 900;
}

.vote-photo-meta form {
    margin: 0;
}

.result-section {
    display: grid;
    gap: 14px;
}

.winner-grid {
    display: grid;
    gap: 10px;
}

.winner-card {
    display: grid;
    gap: 12px;
    background: #fff;
    box-shadow: none;
}

.winner-card img,
.ranking-row img {
    display: block;
    width: 100%;
    border-radius: 8px;
    background: #eef3f7;
}

.winner-card img {
    height: auto;
    max-height: 82vh;
    object-fit: contain;
}

.winner-card h2,
.winner-card p {
    margin-bottom: 0;
}

.ranking-list {
    display: grid;
    gap: 8px;
}

.ranking-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    background: #fff;
    box-shadow: none;
}

.ranking-row img {
    aspect-ratio: 1;
    object-fit: cover;
}

.ranking-row strong,
.ranking-row span {
    display: block;
}

.ranking-row span {
    margin-top: 4px;
    color: var(--muted);
    font-size: .84rem;
    font-weight: 900;
}

.tiebreak-panel {
    display: grid;
    gap: 14px;
    border-color: rgba(217, 70, 113, .28);
}

.tiebreak-grid {
    display: grid;
    gap: 10px;
}

.tiebreak-card {
    display: grid;
    gap: 12px;
    background: #fff;
    box-shadow: none;
}

.tiebreak-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    object-fit: cover;
    background: #eef3f7;
}

.tiebreak-card strong,
.tiebreak-card span {
    display: block;
}

.tiebreak-card span,
.tiebreak-note {
    color: var(--muted);
    font-size: .84rem;
    font-weight: 900;
}

.tiebreak-note {
    margin-bottom: 0;
}

.leaderboard-section {
    display: grid;
    gap: 14px;
}

.leader-list,
.daily-winner-list,
.gallery-day-list {
    display: grid;
    gap: 8px;
}

.leader-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fff;
    box-shadow: none;
}

.leader-row.is-leader {
    border-color: rgba(15, 118, 110, .35);
    background: rgba(15, 118, 110, .08);
}

.leader-row span {
    color: var(--muted);
    font-size: .84rem;
    font-weight: 900;
}

.daily-winner-card {
    display: grid;
    gap: 10px;
    background: #fff;
    box-shadow: none;
}

.daily-winner-card h2 {
    margin-bottom: 0;
}

.daily-winner-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.daily-winner-row span {
    color: var(--muted);
    font-size: .84rem;
    font-weight: 900;
    text-align: right;
}

.gallery-section,
.gallery-day,
.gallery-category {
    display: grid;
    gap: 14px;
}

.gallery-day {
    background: #fff;
    box-shadow: none;
}

.gallery-day[open] {
    border-color: rgba(15, 118, 110, .32);
}

.collapsible-section[open] {
    border-color: rgba(15, 118, 110, .32);
}

.gallery-day-summary,
.collapsible-summary,
.admin-day-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 48px;
    cursor: pointer;
    list-style: none;
}

.gallery-day-summary::-webkit-details-marker,
.collapsible-summary::-webkit-details-marker,
.admin-day-summary::-webkit-details-marker {
    display: none;
}

.gallery-day-summary span,
.collapsible-summary h2,
.admin-day-summary span {
    margin-bottom: 0;
    font-size: 1.12rem;
    font-weight: 900;
}

.gallery-day-summary small,
.collapsible-summary small {
    display: inline-grid;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: var(--accent);
    font-size: 0;
    font-weight: 900;
}

.admin-day-summary small {
    display: inline-grid;
    flex: 0 0 auto;
    min-width: 34px;
    min-height: 34px;
    padding: 7px 10px;
    place-items: center;
    border-radius: 8px;
    color: var(--accent-strong);
    background: rgba(15, 118, 110, .1);
    font-size: .78rem;
    font-weight: 900;
    text-align: right;
}

.gallery-day-summary small::before,
.collapsible-summary small::before {
    content: "+";
    font-size: 1.2rem;
    line-height: 1;
}

.gallery-day[open] .gallery-day-summary small::before,
.collapsible-section[open] .collapsible-summary small::before {
    content: "-";
}

.gallery-day-content,
.collapsible-content,
.admin-day-content {
    display: grid;
    gap: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.gallery-category-heading h3 {
    margin: 0;
    font-size: 1.04rem;
    line-height: 1.2;
}

.gallery-photo-grid {
    display: grid;
    gap: 12px;
}

.gallery-photo-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: #fff;
    box-shadow: none;
}

.gallery-photo-card.is-winner {
    border-color: rgba(15, 118, 110, .38);
    background: rgba(15, 118, 110, .06);
}

.gallery-photo-card img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 76vh;
    border-radius: 8px;
    object-fit: contain;
    background: #eef3f7;
}

.gallery-photo-meta {
    display: grid;
    gap: 4px;
}

.gallery-photo-meta strong,
.gallery-photo-meta small {
    overflow-wrap: anywhere;
}

.gallery-photo-meta small {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 900;
}

.winner-badge {
    width: fit-content;
    padding: 5px 8px;
    border-radius: 999px;
    color: #fff;
    background: var(--accent);
    font-size: .72rem;
    font-weight: 900;
}

.admin-section,
.admin-category,
.admin-day-list,
.admin-photo-list,
.admin-vote-list {
    display: grid;
    gap: 12px;
}

.admin-day {
    background: #fff;
    box-shadow: none;
}

.admin-day[open] {
    border-color: rgba(15, 118, 110, .32);
}

.admin-photo-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: #fff;
    box-shadow: none;
}

.admin-photo-card img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 70vh;
    border-radius: 8px;
    object-fit: contain;
    background: #eef3f7;
}

.admin-photo-meta {
    display: grid;
    gap: 4px;
}

.admin-photo-meta strong,
.admin-photo-meta small,
.admin-vote-row span,
.admin-vote-row small {
    overflow-wrap: anywhere;
}

.admin-photo-meta small,
.admin-vote-row span,
.admin-vote-row small {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 900;
}

.admin-vote-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    background: #fff;
    box-shadow: none;
}

.admin-vote-row div {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.admin-vote-row form {
    margin: 0;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 7px;
    color: #fff;
    background: var(--accent);
    font-weight: 900;
    cursor: pointer;
}

.button:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.button:hover {
    background: var(--accent-strong);
}

.secondary-button {
    color: var(--ink);
    background: var(--sun);
}

.secondary-button:hover {
    color: #fff;
    background: var(--rose);
}

.link-button {
    width: fit-content;
}

.bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: min(100%, 520px);
    margin: 0 auto;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 -10px 30px rgba(24, 34, 53, .1);
}

.nav-item {
    display: grid;
    min-height: 42px;
    place-items: center;
    border-radius: 7px;
    color: var(--muted);
    font-size: .74rem;
    font-weight: 900;
}

.nav-item.is-active {
    color: #fff;
    background: var(--accent);
}

.is-zoomable {
    cursor: zoom-in;
}

body.has-open-lightbox {
    overflow: hidden;
}

.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(10, 16, 28, .94);
}

.photo-lightbox[hidden] {
    display: none;
}

.photo-lightbox img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    object-fit: contain;
    background: #111827;
}

.photo-lightbox-close {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    right: 14px;
    z-index: 101;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: 999px;
    color: #fff;
    background: rgba(24, 34, 53, .86);
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
}

@media (max-width: 380px) {
    .app-shell {
        padding-right: 12px;
        padding-left: 12px;
    }

    h1 {
        font-size: 2.25rem;
    }

    .action-grid {
        grid-template-columns: 1fr;
    }

    .status-panel {
        gap: 12px;
        align-items: flex-start;
        flex-direction: column;
    }

    .photo-card-header,
    .confirm-panel,
    .category-heading,
    .vote-photo-meta {
        flex-direction: column;
    }

    .photo-lightbox {
        padding: 12px;
    }
}
