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

body {
     margin-top: 12px;
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.card-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.card {
    width: 40.45075rem;
    height: 25rem;
    perspective: 1000px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card.flipped .card-inner {
    transform: rotateX(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    background-color: #fff;
    border-radius: 8px;
}

.card-back {
    background-color: #333;
    color: #fff;
    transform: rotateX(180deg);
}

.buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

button, .button {
    padding: 8px 16px;
    font-size: 16px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.button {
    padding-top: 10px;
}

button:hover, .button:hover {
    filter: brightness(1.1);
    scale: 1.01;
}

button:disabled, .button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:active {
    filter: brightness(0.9);
    scale: 0.99;
}

button:active,
button:focus,
.button:active,
.button:focus {
    background-color: #777;
}

.card-list-container {
    margin-top: 24px;
    width: 40.45075rem;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);

    display: flex;
    flex-direction: column;
    gap: 1rem;
}


.terms-list-buttons  {
    display: flex;
    justify-content: space-between;
}

.terms-list-buttons > div {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

#terms-list-container {
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    min-height: 1rem;

    overflow: hidden;
    height: auto;
    opacity: 1;
    transition: height 0.5s ease, opacity 0.5s ease;

    display: flex;
    flex-direction: column;
}

#terms-list-container.hide {
    height: 0;
    opacity: 0;
}

#terms-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.editable-card {
    display: flex;
    width: 100%;
    justify-content: space-between;
}

#add-term-btn {
    height: min-content;
    padding: 0;
}

.editable-card .editable-definition {
    width: 100%;
}

.card-info {
    margin-bottom: 12px;
    font-size: 18px;
    color: #666;
}

.save-load {
    margin-top: 24px;
    display: flex;
    gap: 12px;
}

#popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 24px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

@media screen and (max-width: 768px) {
    .card-container {
        flex-direction: column;
        width: 100%;
    }

    .card {
        width: 100%;
    }

    .card-list-container {
        width: 100%;
    }
    
}

#background-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none; /* Prevent interaction with the canvas */
}

#background-selector {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
}