body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    background-color: #1a1a1a;
    color: #f0f2f5;
    text-align: center;
    padding: 2rem 1rem;
    box-sizing: border-box;
}

h1 {
    color: #f0f2f5;
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

p {
    color: #aaa;
    margin-bottom: 2rem;
}

button {
    padding: 12px 25px;
    font-size: 18px;
    cursor: pointer;
    background-color: #8a2be2;
    color: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.5);
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover {
    background-color: #9932cc;
    transform: translateY(-2px);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

#result-container {
    display: flex;
    align-items: center;
    margin-top: 2rem;
    width: 100%;
    max-width: 800px; /* Adjust width for side-by-side layout */
    justify-content: center;
}

    .scene {
        margin-right: 0;
        margin-bottom: 2rem;
        width: 180px;
        height: 260px;
    }

.card {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 2s;
    transform-style: preserve-3d;
}

.card.is-flipped {
    transform: rotateY(900deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.card-face--front {
    background: #fff;
    transform: rotateY(180deg);
}

.card-face--back {
    background: #333;
}

.card-face img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#card-meaning-area {
    padding: 1.5rem;
    max-width: 400px; /* Adjust width of the text area */
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
    opacity: 0; /* Initially hidden */
    transform: translateY(20px);
    text-align: left;
}

#card-meaning-area.visible {
    opacity: 1;
    transform: translateY(0);
}

#card-name {
    color: #8a2be2;
    margin-top: 0;
    font-size: 2rem;
}

#card-meaning {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #ccc;
}

#card-category-container {
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: #f0f2f5;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

#card-category-container.visible {
    opacity: 1;
}

#description-container {
    margin-top: 2rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    text-align: left;
    opacity: 0; /* Initially hidden */
    transition: opacity 0.8s ease-in-out;
    min-height: 8em; /* Ensure space for 4-5 lines */
    font-size: 1.1rem;
    line-height: 1.6;
    color: #ccc;
}

#description-container.visible {
    opacity: 1;
}

#bbs-container {
    width: min(90%, 640px);
    margin-top: 2.5rem;
    padding-bottom: 2rem;
    text-align: left;
}

#bbs-title {
    margin: 0 0 1rem;
    color: #f0f2f5;
    font-size: 1.6rem;
}

#comment-form {
    display: grid;
    gap: 0.75rem;
}

#comment-name,
#comment-text {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #f0f2f5;
    font: inherit;
}

#comment-name {
    min-height: 44px;
    padding: 0 0.9rem;
}

#comment-text {
    resize: vertical;
    min-height: 110px;
    padding: 0.8rem 0.9rem;
}

#comment-name::placeholder,
#comment-text::placeholder {
    color: #8d8d98;
}

#comment-submit {
    justify-self: end;
}

#comment-status {
    min-height: 1.4em;
    margin: 0.8rem 0 1rem;
    color: #cfc8dc;
}

#comment-list {
    display: grid;
    gap: 0.9rem;
}

.comment-item {
    padding: 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
}

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
    align-items: baseline;
    color: #c9a7ee;
}

.comment-meta time {
    margin-left: auto;
    color: #8d8d98;
    font-size: 0.9rem;
}

.comment-item p,
.comment-empty {
    margin: 0.7rem 0 0;
    color: #d4d4d8;
    line-height: 1.7;
    white-space: pre-wrap;
}

@media (max-width: 720px) {
    body {
        justify-content: flex-start;
    }

    h1 {
        font-size: 2rem;
    }

    #result-container {
        flex-direction: column;
    }

    .comment-meta time {
        width: 100%;
        margin-left: 0;
    }
}
