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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
    overflow-y: auto;
}

body.guestbook-page {
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
}

.birthday-landing {
    text-align: center;
    color: white;
    cursor: pointer;
    animation: fadeIn 1.5s ease-in;
}

.birthday-title {
    font-size: 72px;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: 3px;
}

.birthday-subtitle {
    font-size: 24px;
    opacity: 0.9;
    animation: pulse 2s ease-in-out infinite;
}

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

.guestbook-actions {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translate(-50%, -100%);
    display: none;
    gap: 10px;
    align-items: center;
    z-index: 200;
}

.guestbook-actions.visible {
    display: flex;
}

.guestbook-actions .guestbook-button,
.guestbook-actions .guestbook-list-button {
    white-space: nowrap;
}

.guestbook-button {
    padding: 15px 30px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 200;
    display: none;
}

.guestbook-button.visible {
    display: block;
}

.guestbook-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

.guestbook-list-button {
    padding: 12px 22px;
    background: rgba(255, 255, 255, 0.92);
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.guestbook-list-button:hover {
    transform: translateY(-2px);
    background: #667eea;
    color: white;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.guestbook-list-wrapper {
    width: 100%;
    max-width: 980px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(6px);
}

.guestbook-list-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.guestbook-list-header h1 {
    font-size: 36px;
    color: #4a3b7a;
    margin-bottom: 8px;
}

.guestbook-list-header p {
    color: #5a5576;
    line-height: 1.5;
}

.guestbook-list-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.guestbook-pill {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.12);
    color: #4c51bf;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.guestbook-list-grid {
    display: grid;
    gap: 16px;
}

.guestbook-list-card {
    padding: 18px 20px;
    border-radius: 16px;
    background: white;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.guestbook-list-card .guestbook-name {
    font-size: 16px;
}

.guestbook-list-card .guestbook-message {
    font-size: 15px;
}

.guestbook-list-card .guestbook-date {
    font-size: 12px;
    color: #6b6b7a;
}

.signatures-handwriting .guestbook-list-card {
    border: 1px dashed rgba(0, 0, 0, 0.08);
}

.signatures-handwriting .guestbook-name {
    font-size: 18px;
    margin-bottom: 8px;
}

.signatures-handwriting .guestbook-message {
    font-size: 17px;
    line-height: 1.7;
}

.signatures-handwriting .guestbook-list-card {
    font-family: inherit;
    color: #4a4a4a;
}

.guestbook-status {
    margin-bottom: 16px;
    font-weight: 700;
    color: #4a3b7a;
}

.guestbook-disclaimer {
    margin-top: 20px;
    font-size: 12px;
    color: #5a5576;
    opacity: 0.8;
    text-align: center;
}

.final-slide {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
    align-items: center;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
}

.final-message {
    font-size: 32px;
    font-weight: 800;
    color: #4a3b7a;
    line-height: 1.3;
}

.final-video video {
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    display: block;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .final-slide {
        grid-template-columns: 1fr;
        gap: 16px;
        width: 100%;
        max-width: 100%;
    }
    
    .final-message {
        font-size: 26px;
        text-align: center;
    }
    
    .final-video video {
        width: 100%;
        max-height: 60vh;
        object-fit: contain;
    }
}

@media (max-width: 480px) {
    .final-message {
        font-size: 22px;
        line-height: 1.4;
    }
    
    .final-video video {
        max-height: 50vh;
    }
}

.guestbook-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.guestbook-modal.active {
    display: flex;
}

.guestbook-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #667eea;
}

.guestbook-content h2 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 32px;
}

.guestbook-content p {
    color: #666;
    margin-bottom: 25px;
}

.guestbook-entries {
    margin-top: 20px;
    display: grid;
    gap: 16px;
}

.guestbook-card {
    padding: 18px 16px;
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    line-height: 1.6;
}

.guestbook-name {
    font-weight: 700;
    margin-bottom: 6px;
    color: #4a4a4a;
}

.guestbook-message {
    margin-bottom: 8px;
    color: #3a3a3a;
}

.guestbook-date {
    font-size: 12px;
    color: #666;
}

.guestbook-error, .guestbook-empty {
    text-align: center;
    padding: 12px;
    color: #555;
}

#guestbook-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#guestbook-form input,
#guestbook-form textarea {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

#guestbook-form input:focus,
#guestbook-form textarea:focus {
    outline: none;
    border-color: #667eea;
}

#guestbook-form button {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#guestbook-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#form-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    display: none;
}

#form-status.success {
    background: #d4edda;
    color: #155724;
    display: block;
}

#form-status.error {
    background: #f8d7da;
    color: #721c24;
    display: block;
}

.card-container {
    perspective: 1500px;
    width: 100%;
    max-width: 800px;
    height: 600px;
    position: relative;
}

.card-cover {
    position: absolute;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    padding: 40px 30px;
    overflow-y: auto;
    z-index: 10;
}

.card-cover:hover {
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.4);
}

.card-title {
    font-size: 48px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 30px;
    letter-spacing: 2px;
    text-align: center;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    flex: 1;
}

.photo-grid::-webkit-scrollbar {
    width: 6px;
}

.photo-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.photo-grid::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.grid-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #f0f0f0;
    animation: fadeInGrid 0.5s ease forwards;
    opacity: 0;
    cursor: pointer;
}

.grid-item:nth-child(1) { animation-delay: 0.1s; }
.grid-item:nth-child(2) { animation-delay: 0.15s; }
.grid-item:nth-child(3) { animation-delay: 0.2s; }
.grid-item:nth-child(4) { animation-delay: 0.25s; }
.grid-item:nth-child(5) { animation-delay: 0.3s; }
.grid-item:nth-child(6) { animation-delay: 0.35s; }
.grid-item:nth-child(7) { animation-delay: 0.4s; }
.grid-item:nth-child(8) { animation-delay: 0.45s; }

@keyframes fadeInGrid {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.grid-item:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


.gallery-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.polaroid {
    background: white;
    padding: 16px;
    padding-bottom: 60px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeIn 0.5s ease;
}

.polaroid.final-wide {
    max-width: 960px;
    padding: 20px;
}

.polaroid.rotate-left-1 { transform: rotate(-3deg); }
.polaroid.rotate-left-2 { transform: rotate(-2deg); }
.polaroid.rotate-left-3 { transform: rotate(-1deg); }
.polaroid.rotate-right-1 { transform: rotate(1deg); }
.polaroid.rotate-right-2 { transform: rotate(2deg); }
.polaroid.rotate-right-3 { transform: rotate(3deg); }
.polaroid.rotate-none { transform: rotate(0deg); }

.polaroid:hover {
    transform: rotate(0deg) scale(1.02);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(0, 0, 0, 0.1);
}

.photo-container {
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #f0f0f0;
    position: relative;
}

.photo-container img,
.photo-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: opacity 0.3s ease;
}

.caption {
    margin-top: 20px;
    text-align: center;
    font-size: 18px;
    color: #333;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.nav-button {
    position: absolute;
    background: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 10;
    color: #667eea;
}

.nav-button:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.nav-button:active {
    transform: scale(0.95);
}

.nav-button.prev {
    left: -80px;
}

.nav-button.next {
    right: -80px;
}

.counter {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 250;
}

.overlay-polaroid {
    position: absolute;
    background: white;
    padding: 12px;
    padding-bottom: 45px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(0, 0, 0, 0.1);
    max-width: 350px;
    width: 80%;
    opacity: 0;
    transform: scale(0.8) rotate(0deg);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.overlay-polaroid.show {
    opacity: 1;
    transform: scale(1) rotate(5deg);
}

.overlay-polaroid:nth-child(1) {
    top: 10%;
    right: 5%;
    transform: scale(0.8) rotate(8deg);
}

.overlay-polaroid:nth-child(1).show {
    transform: scale(1) rotate(8deg);
}

.overlay-polaroid:nth-child(2) {
    bottom: 5%;
    left: 5%;
    transform: scale(0.8) rotate(-6deg);
}

.overlay-polaroid:nth-child(2).show {
    transform: scale(1) rotate(-6deg);
}

.overlay-polaroid img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

@media (max-width: 768px) {
    .overlay-polaroid {
        max-width: 260px;
        width: 70%;
        padding: 10px;
        padding-bottom: 30px;
    }
    
    .overlay-polaroid:nth-child(1) {
        top: 8%;
        right: 5%;
        transform: scale(0.9) rotate(4deg);
    }
    
    .overlay-polaroid:nth-child(1).show {
        transform: scale(1) rotate(4deg);
    }
    
    .overlay-polaroid:nth-child(2) {
        bottom: 8%;
        left: 5%;
        transform: scale(0.9) rotate(-4deg);
    }
    
    .overlay-polaroid:nth-child(2).show {
        transform: scale(1) rotate(-4deg);
    }
}

@media (max-width: 480px) {
    .overlay-polaroid {
        max-width: 180px;
        width: 65%;
        padding: 8px;
        padding-bottom: 24px;
    }
    
    .overlay-polaroid:nth-child(1) {
        top: 10%;
        right: 8%;
        transform: scale(0.85) rotate(3deg);
    }
    
    .overlay-polaroid:nth-child(1).show {
        transform: scale(0.95) rotate(3deg);
    }
    
    .overlay-polaroid:nth-child(2) {
        bottom: 10%;
        left: 8%;
        transform: scale(0.85) rotate(-3deg);
    }
    
    .overlay-polaroid:nth-child(2).show {
        transform: scale(0.95) rotate(-3deg);
    }
}

.navigation-map {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-width: 90vw;
    overflow-x: auto;
    z-index: 100;
}

.navigation-map::-webkit-scrollbar {
    height: 4px;
}

.navigation-map::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

.navigation-map::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 2px;
}

.nav-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    flex-shrink: 0;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-thumb.active {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.nav-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: rotate(-2deg) translateY(20px);
    }
    to {
        opacity: 1;
        transform: rotate(-2deg) translateY(0);
    }
}

.fade-out {
    animation: fadeOut 0.3s ease;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .guestbook-actions {
        position: static;
        transform: none;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 16px;
        order: -1;
    }
    
    .guestbook-actions.visible {
        display: flex;
    }
    
    .gallery-container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .polaroid.final-wide {
        max-width: 95vw;
        padding: 14px;
    }
    
    body {
        padding: 10px;
    }
    
    .guestbook-button {
        padding: 12px 22px;
        font-size: 14px;
    }
    
    .guestbook-list-button {
        padding: 10px 18px;
        font-size: 13px;
    }
    
    .guestbook-list-wrapper {
        padding: 20px;
    }
    
    .guestbook-list-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .guestbook-list-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .birthday-title {
        font-size: 48px;
    }
    
    .birthday-subtitle {
        font-size: 18px;
    }
    
    .guestbook-button {
        bottom: 20px;
        right: 20px;
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .guestbook-content {
        padding: 30px 25px;
    }
    
    .guestbook-content h2 {
        font-size: 28px;
    }
    
    .card-container {
        max-width: 95vw;
        height: 500px;
    }
    
    .card-cover {
        padding: 30px 20px;
    }
    
    .card-title {
        font-size: 36px;
        margin-bottom: 20px;
    }
    
    .photo-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .polaroid {
        max-width: 95vw;
        padding: 12px;
        padding-bottom: 45px;
    }
    
    .photo-container {
        aspect-ratio: 1/1;
    }
    
    .caption {
        margin-top: 15px;
        font-size: 16px;
    }
    
    .nav-button {
        width: 45px;
        height: 45px;
        opacity: 0.9;
    }
    
    .nav-button.prev {
        left: 5px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .nav-button.next {
        right: 5px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .nav-button:active {
        transform: translateY(-50%) scale(0.95);
    }
    
    .counter {
        bottom: -45px;
        font-size: 13px;
        padding: 6px 16px;
    }
    
    .overlay-polaroid {
        max-width: 250px;
        width: 70%;
        padding: 10px;
        padding-bottom: 35px;
    }
    
    .overlay-polaroid:nth-child(1) {
        top: 5%;
        right: -10%;
    }
    
    .overlay-polaroid:nth-child(2) {
        bottom: 0%;
        left: -15%;
    }
    
    .navigation-map {
        bottom: 10px;
        padding: 8px 12px;
        gap: 8px;
        max-width: 95vw;
    }
    
    .nav-thumb {
        width: 50px;
        height: 50px;
        border-width: 2px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .guestbook-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    
    .guestbook-actions.visible {
        display: flex;
    }
    
    .birthday-title {
        font-size: 36px;
    }
    
    .birthday-subtitle {
        font-size: 16px;
    }
    
    .guestbook-actions {
        right: 12px;
        bottom: 12px;
        gap: 6px;
        align-items: stretch;
    }
    
    .guestbook-button,
    .guestbook-list-button {
        width: 100%;
        text-align: center;
    }
    
    .guestbook-button {
        bottom: 15px;
        right: 15px;
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .guestbook-content {
        padding: 25px 20px;
    }
    
    .guestbook-content h2 {
        font-size: 24px;
    }
    
    .card-container {
        height: 450px;
    }
    
    .card-cover {
        padding: 25px 15px;
    }
    
    .card-title {
        font-size: 28px;
        margin-bottom: 15px;
    }
    
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .polaroid {
        padding: 10px;
        padding-bottom: 40px;
    }
    
    .caption {
        font-size: 14px;
        margin-top: 12px;
    }
    
    .nav-button {
        width: 40px;
        height: 40px;
    }
    
    .nav-button svg {
        width: 20px;
        height: 20px;
    }
}
