:root {
    --night: #061a3a;
    --night-2: #0b2553;
    --sky: #41bdf2;
    --sky-soft: #dff6ff;
    --paper: #f6fbff;
    --ink: #0a1628;
    --muted: #637089;
    --line: #d9e7f2;
    --success: #1f9d66;
    --danger: #d14848;
    --warning: #c78313;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
}

a {
    color: var(--night-2);
    font-weight: 800;
    text-decoration: none;
}

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

.login-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(155deg, var(--night) 0%, var(--night-2) 55%, #143f82 100%);
}

.login-card {
    width: min(100%, 420px);
    padding: 26px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
}

.login-card h1,
.topbar h1,
.section-head h2,
.form-panel h2 {
    margin: 0;
    letter-spacing: 0;
}

.login-card h1 {
    margin-top: 18px;
    font-size: 2rem;
}

.login-logo {
    display: block;
    width: min(340px, 96%);
    max-height: 260px;
    object-fit: contain;
    margin: 0 auto 26px;
}

.login-field {
    display: block;
}

.login-card p,
.hint,
.event-card p,
.member-card p {
    color: var(--muted);
}

.stack {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--night);
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 13px;
    background: #fff;
    color: var(--ink);
}

textarea {
    resize: vertical;
}

.primary-button,
.small-button,
.icon-button,
.danger-button,
.segmented button {
    border: 0;
    border-radius: 8px;
    font-weight: 900;
    cursor: pointer;
}

.primary-button {
    padding: 14px 16px;
    background: var(--sky);
    color: var(--night);
}

.primary-button.login-button {
    background: linear-gradient(180deg, var(--night) 0%, var(--night-2) 55%, #143f82 100%);
    color: #fff;
}

.install-button {
    width: 100%;
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
    color: var(--night);
    font-weight: 900;
}

.install-status {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 800;
    text-align: center;
}

.danger-form {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.danger-button {
    width: 100%;
    min-height: 44px;
    padding: 12px 14px;
    background: #ffe8e8;
    color: #8a1d1d;
}

.small-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 12px;
    background: var(--sky);
    color: var(--night);
    white-space: nowrap;
}

.icon-button {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.alert {
    margin: 18px 0;
    padding: 12px;
    border-radius: 8px;
    background: #ffe8e8;
    color: #8a1d1d;
    font-weight: 800;
}

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 18px 20px;
    background: var(--night);
    color: #fff;
    border-bottom: 4px solid var(--sky);
}

.topbar h1 {
    font-size: 1.45rem;
}

.menu {
    position: static;
}

.menu summary {
    list-style: none;
}

.menu summary::-webkit-details-marker {
    display: none;
}

.menu-button {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    gap: 4px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    cursor: pointer;
}

.menu-button span {
    width: 22px;
    height: 2px;
    border-radius: 99px;
    background: #fff;
    transition: transform .18s ease, opacity .18s ease;
}

.menu[open] .menu-button span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.menu[open] .menu-button span:nth-child(2) {
    opacity: 0;
}

.menu[open] .menu-button span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.menu-panel {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    width: 100%;
    display: grid;
    gap: 2px;
    padding: 10px 18px 14px;
    border-top: 1px solid rgba(255, 255, 255, .14);
    background: linear-gradient(180deg, var(--night) 0%, var(--night-2) 58%, #143f82 100%);
    box-shadow: 0 18px 44px rgba(6, 26, 58, .28);
    animation: menuDrop .18s ease-out;
}

@keyframes menuDrop {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-panel a,
.menu-panel button {
    width: 100%;
    display: block;
    border: 0;
    border-radius: 8px;
    padding: 14px 10px;
    background: transparent;
    color: #fff;
    font-weight: 900;
    text-align: left;
    cursor: pointer;
}

.menu-panel a:hover,
.menu-panel button:hover {
    background: rgba(255, 255, 255, .12);
}

.eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--sky);
    font-size: .76rem;
    font-weight: 950;
    text-transform: uppercase;
}

.content {
    width: min(100%, 780px);
    margin: 0 auto;
    padding: 18px;
}

.notice-panel,
.form-panel {
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--line);
}

.notice-panel {
    display: grid;
    gap: 4px;
    margin-top: 14px;
    padding: 14px;
    border-color: #f7cf77;
    background: #fff7e5;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 20px 0 12px;
}

.section-actions {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 14px;
}

.filter-bar {
    margin: 0 0 14px;
}

.filter-bar label {
    max-width: 280px;
}

.profile-authorizations {
    display: grid;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.profile-authorizations h2 {
    margin: 0 0 2px;
    color: var(--night);
    font-size: 1rem;
}

.switch-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    color: var(--night);
    font-weight: 900;
}

.switch-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-ui {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: #d8e4ef;
    box-shadow: inset 0 0 0 1px rgba(6, 26, 58, .08);
    transition: background .18s ease;
}

.switch-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(6, 26, 58, .2);
    transition: transform .18s ease;
}

.switch-row input:checked + .switch-ui {
    background: linear-gradient(180deg, var(--night), #0a3974);
}

.switch-row input:checked + .switch-ui::after {
    transform: translateX(20px);
}

.switch-row input:focus-visible + .switch-ui {
    outline: 3px solid rgba(59, 196, 255, .45);
    outline-offset: 3px;
}

.switch-row input:disabled + .switch-ui {
    opacity: .5;
}

.permission-status {
    min-height: 1.2em;
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 800;
}

[hidden] {
    display: none !important;
}

.photo-upload {
    display: grid;
    gap: 8px;
    color: var(--night);
    font-weight: 800;
}

.photo-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.file-button {
    display: grid;
    place-items: center;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--night);
    font-weight: 900;
    text-align: center;
    cursor: pointer;
}

.small-file-button {
    min-height: 38px;
    padding: 9px 12px;
}

.file-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.photo-preview {
    display: grid;
    grid-template-columns: repeat(3, 72px);
    gap: 8px;
}

.photo-preview:empty {
    display: none;
}

.detail-photo-upload {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f3f8fc;
}

.profile-avatar-preview {
    width: 92px;
    height: 92px;
    overflow: hidden;
    border-radius: 8px;
    background: #eef3f8;
}

.profile-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-thumb {
    position: relative;
    width: 72px;
    height: 72px;
}

.photo-thumb img,
.photo-preview img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.thumb-remove {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: var(--night);
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}

.thumb-remove input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.event-list,
.member-grid {
    display: grid;
    gap: 14px;
}

.event-card,
.member-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(6, 26, 58, .08);
}

.event-card {
    padding: 14px;
}

.empty-panel {
    padding: 16px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-weight: 800;
}

.event-main {
    display: grid;
    grid-template-columns: 62px 1fr;
    gap: 13px;
}

.date-pill {
    width: 62px;
    height: 76px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    border-radius: 8px;
    background: var(--night);
    color: #fff;
}

.date-link {
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease;
}

.date-link:hover,
.date-link:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(6, 26, 58, .2);
}

.date-pill strong {
    display: block;
    color: var(--sky);
    font-size: 1.45rem;
    line-height: 1;
}

.date-pill span {
    font-size: .7rem;
    font-weight: 900;
    line-height: 1;
}

.date-pill .date-day {
    text-transform: lowercase;
}

.date-pill .date-month {
    letter-spacing: .02em;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.tag {
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--sky-soft);
    color: var(--night);
    font-size: .74rem;
    font-weight: 950;
}

.tag.muted {
    background: #eef3f8;
    color: var(--muted);
}

.event-card h3,
.member-card h3 {
    margin: 0 0 6px;
    font-size: 1.08rem;
}

.event-card p,
.member-card p {
    margin: 4px 0;
}

.score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--night);
    color: #fff;
    font-weight: 950;
}

.score-game {
    display: flex;
    width: 150px;
    max-width: 100%;
    margin: 12px auto 0;
    padding: 10px 14px;
    font-size: 1.18rem;
    line-height: 1;
}

.gbc-score {
    color: var(--sky);
}

.event-note {
    margin-top: 12px;
    padding: 10px;
    border-radius: 8px;
    background: #f3f8fc;
}

.past-event {
    opacity: .78;
}

.archive-head {
    margin-top: 28px;
}

.archive-head span {
    color: var(--muted);
    font-weight: 900;
}

.archive-details {
    display: grid;
    gap: 12px;
}

.archive-details summary {
    cursor: pointer;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--night);
    font-weight: 900;
}

.archive-list {
    margin-top: 12px;
}

.locked-vote {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 14px;
    padding: 10px;
    border-radius: 8px;
    background: #eef3f8;
    color: var(--muted);
    font-weight: 900;
}

.locked-vote span {
    color: var(--night);
}

.attendance-form {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px;
    border-radius: 8px;
    background: #eef3f8;
}

.segmented.two-options {
    grid-template-columns: repeat(2, 1fr);
}

.segmented button {
    min-height: 40px;
    background: transparent;
    color: var(--muted);
}

.segmented button.active,
.segmented button:hover {
    background: var(--night);
    color: var(--sky);
}

.event-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.event-footer {
    justify-content: space-between;
    margin-top: 12px;
    color: var(--muted);
    font-weight: 800;
}

.event-footer a {
    margin-left: auto;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 14px;
}

.ghost-button {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--night);
}

.event-detail {
    display: grid;
    gap: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(6, 26, 58, .08);
}

.detail-hero {
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: 14px;
    align-items: center;
}

.detail-date {
    width: 76px;
    height: 92px;
}

.detail-date strong {
    font-size: 1.8rem;
}

.detail-hero h2 {
    margin: 0 0 6px;
    font-size: 1.45rem;
    line-height: 1.1;
}

.detail-hero p {
    margin: 0;
    color: var(--muted);
    font-weight: 800;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.detail-info {
    padding: 12px;
    border-radius: 8px;
    background: #f3f8fc;
}

.detail-info span,
.detail-section h3,
.answer-columns h4 {
    display: block;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 950;
    text-transform: uppercase;
}

.detail-info strong {
    display: block;
    margin-top: 4px;
    color: var(--night);
    font-size: 1.08rem;
}

.detail-section {
    display: grid;
    gap: 10px;
}

.detail-section h3,
.answer-columns h4 {
    margin: 0;
}

.detail-section p {
    margin: 0;
}

.detail-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
    gap: 10px;
}

.detail-gallery a {
    display: block;
    overflow: hidden;
    aspect-ratio: 1;
    border-radius: 8px;
    background: #eef3f8;
}

.detail-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-page {
    display: grid;
    gap: 18px;
}

.gallery-event {
    display: grid;
    gap: 10px;
}

.gallery-event header span {
    display: block;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 950;
    text-transform: uppercase;
}

.gallery-event h2 {
    margin: 2px 0 0;
    color: var(--night);
    font-size: 1.08rem;
}

.gallery-open {
    overflow: hidden;
}

.gallery-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    align-items: center;
    background: rgba(6, 26, 58, .94);
}

.gallery-overlay[hidden] {
    display: none;
}

.gallery-close {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 1.35rem;
    font-weight: 950;
}

.gallery-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    touch-action: pan-x;
    padding: 68px 18px 28px;
    outline: none;
}

.gallery-track.zoom-active {
    overflow: hidden;
    scroll-snap-type: none;
}

.gallery-slide {
    flex: 0 0 100%;
    display: grid;
    place-items: center;
    min-height: calc(100vh - 96px);
    margin: 0;
    scroll-snap-align: center;
}

.gallery-slide img {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    border-radius: 8px;
    object-fit: contain;
    cursor: zoom-in;
    transform-origin: center center;
    transition: transform .16s ease;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: pan-x;
}

.gallery-slide.is-zoomed img {
    cursor: grab;
    transition: none;
    touch-action: none;
}

.attendance-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.attendance-summary div {
    padding: 12px;
    border-radius: 8px;
    background: var(--night);
    color: #fff;
}

.attendance-summary strong {
    display: block;
    color: var(--sky);
    font-size: 1.7rem;
    line-height: 1;
}

.attendance-summary span {
    font-weight: 900;
}

.answer-columns {
    display: grid;
    gap: 12px;
}

.answer-row {
    display: grid;
    gap: 3px;
    margin-top: 8px;
    padding: 10px;
    border-radius: 8px;
    background: #f3f8fc;
}

.answer-person {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.answer-avatar {
    width: 58px;
    height: 58px;
    font-size: .86rem;
}

.answer-person > div:last-child {
    min-width: 0;
}

.answer-person strong,
.answer-person span {
    overflow-wrap: anywhere;
    word-break: normal;
}

.answer-person span {
    display: block;
    margin-top: 2px;
}

.answer-row span,
.muted-text {
    color: var(--muted);
    font-weight: 800;
}

.member-card {
    display: grid;
    grid-template-columns: 58px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 13px;
}

.member-card.inactive {
    opacity: .55;
}

.avatar {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 8px;
    background: var(--night);
    color: var(--sky);
    font-weight: 950;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.form-panel {
    padding: 16px;
}

.form-panel h2 {
    margin-bottom: 16px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.check-row input {
    width: 20px;
    height: 20px;
}

@media (min-width: 760px) {
    .content {
        padding: 28px;
    }

    .event-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .answer-columns {
        grid-template-columns: repeat(3, 1fr);
    }
}
