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

body {
    font-family: system-ui, sans-serif;
    background: linear-gradient(160deg, #f7d9d9, #f3e4c8, #d9e8f7);
    background-attachment: fixed;
    color: #3a3a3a;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    padding: 24px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.5);
    position: sticky;
    top: 0;
}

header h1 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #4a3f3c;
}

.category-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 28px;
    max-width: 500px;
    margin: 0 auto;
    justify-content: center;
    min-height: calc(100vh - 120px);
}

.category {
    display: block;
    text-align: center;
    text-decoration: none;
    color: #4a3f3c;
    padding: 50px;
    font-size: 1.75rem;
    font-weight: 500;
    border: none;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.category:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    background: rgba(255, 255, 255, 1);
}

.category:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.sign-out-btn {
    display: block;
    margin: 40px auto 20px auto;
    padding: 12px 24px;
    background: #ffdddd;
    color: #7a2a2a;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.sign-out-btn:hover {
    background: #ffcccc;
}

.category-page,
.add-page,
.artwork-page {
    padding: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.add-page {
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.artwork-page {
    padding: 28px;
    max-width: 760px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    color: #4a3f3c;
    animation: fadeIn 0.4s ease;
}

.artwork-page h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #4a3f3c;
    text-align: center;
    margin-bottom: 6px;
}

.add-button,
.back-button,
.submit-button {
    width: auto;
    padding: 18px 24px;
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    margin-top: 12px;
    margin-left: 18px;
    margin-right: 18px;
    transition: 0.12s ease;
}

.add-button {
    background: #ffffff;
    color: #4a3f3c;
    float: right;
}

.back-button {
    background: #ffadad;
    color: #4a3f3c;
    float: left;
}

.submit-button {
    background: #ffffff;
    color: #4a3f3c;
}

.add-button:hover,
.back-button:hover,
.submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

.top-button-overlap {
    margin: 16px 0 24px;
}

.input-label {
    font-size: 1rem;
    font-weight: 600;
    color: #4a3f3c;
}

.text-input,
.file-input,
.textarea-input {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #d0c7c4;
    font-size: 1rem;
    background: #ffffff;
}

.textarea-input {
    min-height: 140px;
    resize: vertical;
}

.image-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.preview-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.preview-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.preview-name {
    font-size: 0.65rem;
    color: #4a3f3c;
    word-break: break-word;
}

.preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail-preview {
    margin-top: 10px;
    margin-bottom: 20px;
}

.thumbnail-box {
    position: relative;
    width: 100%;
    height: 180px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    background: rgba(255, 255, 255, 0.9);
}

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

.thumbnail-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 28px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(6px);
    padding: 32px 26px;
    border-radius: 18px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    text-align: center;
    animation: fadeIn 0.4s ease;
}

.login-card h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #4a3f3c;
    margin-bottom: 22px;
}

.login-input {
    width: 100%;
    padding: 14px;
    margin-bottom: 16px;
    border-radius: 12px;
    border: 1px solid #d0c7c4;
    font-size: 1rem;
    background: #ffffff;
    color: #3a3a3a;
    transition: border 0.15s ease, box-shadow 0.15s ease;
}

.login-input:focus {
    outline: none;
    border-color: #c8b8b3;
    box-shadow: 0 0 0 3px rgba(200, 184, 179, 0.25);
}

.login-button {
    width: 100%;
    padding: 16px;
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    border-radius: 14px;
    background: #ffffff;
    color: #4a3f3c;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

.login-button:active {
    transform: translateY(0);
}

.login-error {
    margin-top: 12px;
    color: #b33a3a;
    font-size: 0.9rem;
    min-height: 20px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 18px;
    margin-top: 20px;
    justify-content: center;
}

.gallery-item {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    overflow: hidden;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

.gallery-thumb-box {
    width: 100%;
    height: 150px;
    overflow: hidden;
}

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

.gallery-title {
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: #4a3f3c;
    text-align: center;
}

.gallery-item-box {
    position: relative;
}

.gallery-item-box:hover .edit-gallery-btn,
.gallery-item-box:hover .delete-gallery-btn {
    display: flex;
}

.edit-gallery-btn {
    top: 10px;
    right: 10px;
}

.delete-gallery-btn {
    top: 10px;
    left: 10px;
}

.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 14px;
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.page-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.page-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 16px rgba(0,0,0,0.12);
}

.page-card-thumb {
    width: 100%;
    height: 30px;
    object-fit: cover;
    border-radius: 8px;
    background: #f0f0f0;
}

.page-card-text {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #444;
    height: 15px;
    overflow: hidden;
}

.page-card-number {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ffffffcc;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.page-card-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ffdddd;
    color: #7a2a2a;
    border: none;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
}

.page-expanded-row {
    grid-column: 1 / -1;
    background: #ffffff;
    border-radius: 12px;
    padding: 18px;
    margin-top: 6px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    animation: expandFade 0.25s ease;
    position: relative;
    z-index: 2;
}

.close-expanded {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #eee;
    border: none;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.close-expanded:hover {
    background: #ddd;
}

.page-expanded {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.page-image-input {
    margin-top: 4px;
}

.page-image-preview img {
    width: 100%;
    border-radius: 10px;
    margin-top: 6px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.page-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.15);
    background: #fafafa;
    resize: vertical;
    font-size: 0.95rem;
    line-height: 1.4;
}

.page-textarea:focus {
    outline: none;
    border-color: #8a6f68;
    background: #fff;
}

.delete-page-button {
    align-self: flex-start;
    background: #ffdddd;
    color: #7a2a2a;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.15s ease;
}

.delete-page-button:hover {
    background: #ffcccc;
}

.add-image-box {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    height: 150px;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.add-image-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

.add-image-plus {
    font-size: 3rem;
    color: #4a3f3c;
    opacity: 0.6;
}

.art-description-box,
.art-title-box {
    background: rgba(255, 255, 255, 0.9);
    padding: 18px 20px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    line-height: 1.55;
    font-size: 1.05rem;
    position: relative;
}

.art-thumbnail-box {
    width: 100%;
    height: 280px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    background: rgba(255, 255, 255, 0.9);
    position: relative;
}

.art-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 10px;
    margin-bottom: 6px;
    color: #4a3f3c;
}

.art-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.art-gallery-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    cursor: pointer;
    animation: fadeIn 0.4s ease;
}

.art-gallery-image:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

.edit-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 16px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.art-thumbnail-box:hover .edit-icon,
.art-description-box:hover .edit-icon,
.art-title-box:hover .edit-icon {
    display: flex;
}

.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.delete-button {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 14px;
    background: #ffb3b3;
    color: #4a3f3c;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    margin-top: 20px;
}

.delete-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    background: #ff9d9d;
}

.delete-button:active {
    transform: translateY(0);
}

.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    animation: fadeIn 0.25s ease;
}

.confirm-box {
    background: rgba(255, 255, 255, 0.92);
    padding: 28px 26px;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    max-width: 360px;
    width: 90%;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.confirm-box p {
    font-size: 1.1rem;
    color: #4a3f3c;
    margin-bottom: 20px;
}

.confirm-buttons {
    display: flex;
    gap: 14px;
    justify-content: center;
}

.confirm-buttons button {
    flex: 1;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.confirm-buttons .danger {
    background: #ffb3b3;
    color: #4a3f3c;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.confirm-buttons .danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    background: #ff9d9d;
}

.confirm-buttons #cancel-delete {
    background: #ffffff;
    color: #4a3f3c;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.confirm-buttons #cancel-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

.status-message {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    display: none;
}

.status-message.success {
    background: #d8f5d2;
    color: #2f6b2f;
}

.status-message.error {
    background: #f8d7da;
    color: #842029;
}

.placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 0;
    color: #6a5f5c;
    opacity: 0.7;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes expandFade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}