:root {
    --bg: #0b0b10;
    --yellow: #FFBF26;
    --blue: #6392EE;
    --orange: #FF9D5E;
    --red: #FF6464;
    --green: #3AC884;
    --purple: #BF67FF;
    --teal: #3AACC8;
    --black: #1B1B1B;
    --dark-gray: #666666;
    --light-gray: #A8A8A8;
    --separator-gray: #EFEFEF;
}

html {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body {
    --dot-color: #D3D3D3;
    --dot-size: .8px;
    --dot-spacing: 16px;
    --off-black: #1b1b1b;

    font-family: "SF Pro Rounded", "SF Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    background-image: radial-gradient(circle, var(--dot-color) var(--dot-size), transparent var(--dot-size));
    background-size: var(--dot-spacing) var(--dot-spacing);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 12px;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    position: relative;
    box-sizing: border-box;
}

@media (min-width: 1024px) {
    body {
        padding: 48px;
    }
}

.top-logo, .page-container {
    opacity: 1;
}

.top-logo {
    display: block;
    margin: 0 auto 20px;
    height: 36px;
    max-width: 120px;
    width: auto;
    object-fit: contain;
}

@keyframes gelatineLogo {
    from, to { transform: scale(1, 1); }
    25% { transform: scale(0.9, 1.1); }
    50% { transform: scale(1.1, 0.9); }
    75% { transform: scale(0.95, 1.05); }
}

.top-logo:hover {
    animation: gelatineLogo 500ms ease-out;
}

@media (min-width: 1024px) {
    .top-logo {
        margin: 0 auto 32px;
        height: 48px;
        max-width: 140px;
    }
}

.page-container {
    width: 100%;
    max-width: 500px;
    position: relative;
}

@media (min-width: 768px) {
    .page-container {
        max-width: 900px;
    }
}

@media (min-width: 1024px) {
    .page-container {
        max-width: 1024px;
        padding: 0 24px;
    }
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Recipe Header */
.recipe-header {
    background-color: white;
    border-radius: 32px;
    box-shadow: 0px 2px 19px 0px rgba(0,0,0,0.1);
    padding: 22px 22px 16px;
    margin-bottom: 20px;
    animation: fadeInScale 0.5s ease-out forwards;
}

@media (min-width: 1024px) {
    .recipe-header {
        max-width: 600px;
        margin: 0 auto 28px;
        margin-bottom: 40px;
    }
}

.recipe-title {
    margin: 0 0 14px 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--off-black);
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

@media (min-width: 1024px) {
    .recipe-title {
        font-size: 24px;
        margin: 0 0 18px 0;
    }
}

.recipe-title.loading {
    color: #d0d0d0;
}

.recipe-text {
    font-size: 20px;
    padding-bottom: 16px;
    text-align: left;
    color: var(--off-black);
    line-height: 1.5;
}

@media (min-width: 1024px) {
    .recipe-text {
        font-size: 20px;
        padding-bottom: 20px;
    }
}

.recipe-text-placeholder {
    width: 100%;
    height: 60px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.recipe-text .highlight {
    display: inline-flex;
    padding: 0px 8px;
    justify-content: center;
    align-items: center;
    gap: 4px;
    border-radius: 15px;
    color: white;
    font-weight: 500;
    font-size: 15px;
    border: 1px solid white;
}

@media (min-width: 1024px) {
    .recipe-text .highlight {
        font-size: 16px;
        padding: 0px 9px;
    }
}

.recipe-text .chip-photo {
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.70) 0%, rgba(255, 255, 255, 0.70) 100%), var(--blue, #6392EE);
    color: #6392ee;
}

.recipe-text .chip-text {
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.70) 0%, rgba(255, 255, 255, 0.70) 100%), var(--green, #3AC884);
    color: #3AC884;
}

.recipe-text .chip-list {
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.70) 0%, rgba(255, 255, 255, 0.70) 100%), var(--red, #FF6464);
    color: #FF6464;
}

.recipe-text .chip-sketch {
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.70) 0%, rgba(255, 255, 255, 0.70) 100%), var(--yellow, #FFBF26);
    color: #FFBF26;
}

.recipe-text .chip-number {
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.70) 0%, rgba(255, 255, 255, 0.70) 100%), var(--teal, #3AACC8);
    color: #3AACC8;
}

.inline-chip-photo-container {
    display: inline-block;
    vertical-align: middle;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    border: 3px solid var(--blue);
    margin: 0 4px;
    position: relative;
    top: -3px;
}

.inline-chip-photo-container.chip-photo {
    border-color: var(--yellow);
}

.inline-chip-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
    cursor: pointer;
}

/* Creator Info */
.creator-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 2px solid var(--separator-gray);
}

@media (min-width: 1024px) {
    .creator-info {
        padding-top: 20px;
    }
}

.creator-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.creator-left > .creator-avatar-link {
    flex-shrink: 0;
}

.creator-name-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.creator-name-prefix {
    font-size: 16px;
    font-weight: 600;
    color: var(--off-black);
    display: inline-block;
    margin-right: 0.25em;
}

.creator-avatar-placeholder {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.creator-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: #ccc;
}

@media (min-width: 1024px) {
    .creator-avatar {
        width: 52px;
        height: 52px;
    }
    
    .creator-avatar-placeholder {
        width: 52px;
        height: 52px;
    }
}

.creator-avatar-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.creator-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--off-black);
    text-decoration: none;
    display: inline-block;
}

@media (min-width: 1024px) {
    .creator-name {
        font-size: 17px;
    }
    
    .creator-name-prefix {
        font-size: 17px;
    }
}

.creator-name.loading {
    color: #d0d0d0;
}

.creator-name:hover {
    text-decoration: underline;
}

.creator-stats {
    display: flex;
    gap: 16px;
    align-items: center;
}

.creator-stats .stat-item {
    display: flex;
    align-items: center;
    font-size: 20px;
    color: var(--off-black);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.creator-stats .stat-item i {
    font-size: 24px;
}

.creator-stats .stat-item span {
    font-size: 14px;
    font-weight: 600;
}

@media (min-width: 1024px) {
    .creator-stats .stat-item {
        font-size: 22px;
    }
    
    .creator-stats .stat-item i {
        font-size: 26px;
    }
    
    .creator-stats .stat-item span {
        font-size: 15px;
    }
}

.creator-stats .stat-item:hover {
    transform: scale(1.1);
}


/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 200px));
    gap: 10px;
    margin-bottom: 40px;
    justify-content: center;
}

@media (min-width: 768px) {
    .posts-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 200px));
        gap: 20px;
    }
}

@media (min-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 200px));
        gap: 18px;
        margin-bottom: 60px;
    }
}

.post-cell {
    position: relative;
    width: 100%;
    max-width: 200px;
    aspect-ratio: 1 / 1;
    border-radius: 25px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
    background-color: #eee;
    box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.25);
}

.post-cell:hover {
    transform: scale(1.05);
    z-index: 10;
}

.post-cell-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-cell-avatar-container {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
    overflow: hidden;
    background-color: #ccc;
}

.post-cell-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Toast */
.toast {
    visibility: hidden;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 10px 15px;
    position: fixed;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    max-width: 90vw;
    box-sizing: border-box;
}

.toast.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: block;
    opacity: 1;
}

.modal-content {
    margin: auto;
    display: block;
    width: auto;
    max-width: 90%;
    max-height: 80%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: translate(-50%, -50%) scale(1);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.not-found-container {
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.random-recipe-button {
    display: inline-block;
    margin-top: 20px;
    background-color: var(--off-black);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
}

@media (max-width: 500px) {
    body {
        padding: 24px 12px;
    }

    .page-container {
        padding: 0 12px;
    }

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

