* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: #fafafa;
    color: #222;
}

h1 {
    margin: 0 0 20px;
    font-size: 32px;
    line-height: 1.1;
}

.container {
    max-width: 560px;
    margin: 48px auto;
    padding: 0 20px;
}

.card {
    background: white;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}

.boot-card {
    text-align: center;
    color: #555;
}

label {
    display: block;
    margin-top: 16px;
    margin-bottom: 6px;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

input,
textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #bdbdbd;
    border-radius: 8px;
    background: #fff;
    color: #222;
    font: inherit;
}

input:focus,
textarea:focus {
    border-color: #176b3a;
    box-shadow: 0 0 0 3px rgb(23 107 58 / 14%);
    outline: none;
}

textarea {
    resize: vertical;
}

input[type="file"] {
    padding: 9px 10px;
    cursor: pointer;
}

button {
    margin-top: 16px;
    padding: 10px 16px;
    border: 1px solid #222;
    border-radius: 8px;
    background: #222;
    color: white;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

button:hover:not(:disabled) {
    background: #444;
    border-color: #444;
}

button:disabled {
    border-color: #cfcfcf;
    background: #ececec;
    color: #888;
    cursor: not-allowed;
}

button:focus-visible {
    box-shadow: 0 0 0 3px rgb(34 34 34 / 18%);
    outline: none;
}

.msg {
    min-height: 1.2em;
    margin-top: 12px;
    color: #b00020;
}

.msg:not(:empty) {
    border: 1px solid #f0b8c0;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff5f6;
    font-size: 14px;
    line-height: 1.4;
}

.flash-message {
    margin: 0;
    border: 1px solid #b9dfc8;
    border-radius: 8px;
    padding: 10px 12px;
    background: #f1fbf5;
    color: #176b3a;
    font-size: 14px;
    font-weight: 600;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 16px;
}

.topbar-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.topbar-user {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.35;
}

.topbar-user-label {
    margin-right: 4px;
}

.topbar-email {
    font-weight: 500;
    overflow-wrap: anywhere;
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 12px;
}

.topbar nav a {
    color: #333;
    font-size: 14px;
    font-weight: 600;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.timeline-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-intro {
    margin: 0;
    color: #555;
}

.timeline-panel {
    border-style: dashed;
}

.timeline-loading {
    color: #666;
}

.timeline-empty {
    border-color: #d6d6d6;
    background: #f7f7f7;
    color: #555;
    line-height: 1.45;
    text-align: center;
}

.timeline-error {
    border-color: #f0b8c0;
    background: #fff5f6;
    color: #b00020;
    line-height: 1.45;
}

.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-month-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-month-header {
    margin: 6px 2px 0;
    color: #444;
    font-size: 16px;
    font-weight: 700;
}

.timeline-entry-card {
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.timeline-entry-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.timeline-entry-thumb {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: 8px;
    background: #f0f0f0;
}

.timeline-missing-photo {
    margin: 0;
    border: 1px dashed #d6d6d6;
    border-radius: 8px;
    padding: 32px 12px;
    background: #f7f7f7;
    color: #666;
    text-align: center;
}

.timeline-entry-caption {
    margin: 10px 0 0;
    color: #333;
    line-height: 1.35;
}

.timeline-entry-uploaded-at {
    margin: 10px 0 0;
    color: #222;
    font-size: 14px;
    font-weight: 600;
}

.timeline-entry-taken-on {
    margin: 4px 0 0;
    color: #777;
    font-size: 12px;
}

.timeline-load-more {
    align-self: center;
    min-width: 140px;
    margin-top: 4px;
}

.timeline-load-more-msg {
    min-height: 1.2em;
    margin: -4px 0 0;
    color: #b00020;
    font-size: 14px;
    text-align: center;
}

.entry-detail-panel {
    border-style: dashed;
}

.entry-detail-loading {
    color: #666;
}

.entry-detail-error {
    border-color: #f0b8c0;
    background: #fff5f6;
    color: #b00020;
    line-height: 1.45;
}

.entry-detail-not-found {
    border-color: #d6d6d6;
    background: #f7f7f7;
    color: #555;
    line-height: 1.45;
}

.entry-detail-image {
    display: block;
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    background: #f0f0f0;
}

.entry-detail-image-link {
    display: block;
    cursor: zoom-in;
}

.entry-detail-back-link {
    display: inline-block;
    margin-bottom: 12px;
}

.entry-detail-caption {
    margin: 10px 0 0;
    color: #333;
    line-height: 1.35;
}

.entry-detail-uploaded-at {
    margin: 10px 0 0;
    color: #222;
    font-size: 14px;
    font-weight: 600;
}

.entry-detail-taken-on {
    margin: 4px 0 0;
    color: #777;
    font-size: 12px;
}

.entry-detail-nav {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.entry-detail-nav-disabled {
    color: #999;
}

.upload-selected-file {
    margin: 8px 0 0;
    color: #555;
    font-size: 14px;
}

#loginForm,
.upload-form {
    display: flex;
    flex-direction: column;
}

#loginForm label:first-of-type,
.upload-form label:first-of-type {
    margin-top: 0;
}

.upload-intro {
    margin: 0 0 4px;
    color: #555;
}

.upload-preview {
    display: block;
    width: 100%;
    height: clamp(180px, 56vw, 320px);
    margin-top: 10px;
    object-fit: contain;
    border-radius: 8px;
    background: #f0f0f0;
}

@media (max-width: 640px) {
    .container {
        margin: 20px auto;
        padding: 0 16px;
    }

    .card {
        padding: 16px;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar nav {
        justify-content: flex-start;
    }

    .timeline-entry-card {
        padding: 12px;
    }

    .upload-preview {
        height: clamp(170px, 68vw, 300px);
    }
}

@media (max-width: 380px) {
    .container {
        padding: 0 12px;
    }
}
