.hidden {
    display: none !important;
}

#start-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#start-screen .button, #start-screen button {
    padding: 10px 20px;
    font-size: 1.2em;
    cursor: pointer;
    border-radius: 5px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
}

#start-screen .button {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

body {
    font-family: sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background: #f0f0f0;
}

#game-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 600px;
}

#game-board {
    width: 100%;
    flex-grow: 1;
    border: 2px solid black;
    border-top: none;
    border-bottom: none;
    position: relative;
    overflow: hidden;
    background: #fff;
}

#top-ui {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #ddd;
}

#bottom-ui {
    padding: 10px;
    background: #ddd;
    display: flex;
    gap: 10px;
}

#answer-input {
    flex-grow: 1;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1.2em;
}

#score {
    font-size: 1.2em;
}

#health {
    font-size: 1.2em;
    letter-spacing: 2px;
}

.card {
    position: absolute;
    width: 150px;
    height: 50px;
    border: 1px solid #333;
    background: lightblue;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    user-select: none;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

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

.card .front, .card .back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 5px;
    box-sizing: border-box;
}

.card .front {
    background: lightblue;
}

.card.new .front {
    background: lightgreen;
}

.card .back {
    background: lightcoral;
    transform: rotateX(180deg);
}

.shields-container {
    position: absolute;
    top: 2px;
    right: 2px;
    display: flex;
    gap: 1px;
}

.shield {
    font-size: 10px;
    opacity: 0.8;
}

.shield.lost {
    animation: shield-lost-animation 0.5s forwards;
}

@keyframes shield-lost-animation {
    to {
        transform: translateY(-20px) scale(0.5);
        opacity: 0;
    }
}

#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#game-over-screen.hidden {
    display: none;
}

#pause-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

#submit-btn {
    padding: 0 15px;
    font-size: 1.5em;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#anki-export-btn {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
}

#anki-export-btn.hidden {
    display: none;
}

#deck-config-screen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    height: 80%;
    max-height: 600px;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

#deck-config-screen h2 {
    margin-top: 0;
    text-align: center;
}

#card-list-container {
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
}

#deck-config-screen ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#deck-config-screen li {
    padding: 8px;
    margin: 4px 0;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    cursor: grab;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#deck-config-screen li.dragging {
    opacity: 0.5;
}

#deck-config-screen li input[type="checkbox"] {
    margin-right: 10px;
    min-width: 16px;
    min-height: 16px;
}

#deck-config-screen li label {
    flex-grow: 1;
}

#start-configured-game-btn {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 1.2em;
    width: 100%;
    cursor: pointer;
}

#debug-pane {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 350px;
    max-height: calc(100% - 20px);
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    padding: 10px;
    font-family: monospace;
    font-size: 12px;
    z-index: 100;
}

#debug-pane table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 11px;
}

#debug-pane th, #debug-pane td {
    border: 1px solid #ddd;
    padding: 4px;
    text-align: left;
    word-break: break-word;
}

#debug-pane th {
    background-color: #f2f2f2;
}

#debug-pane td:nth-child(3), #debug-pane td:nth-child(4),
#debug-pane th:nth-child(3), #debug-pane th:nth-child(4) {
    text-align: center;
    width: 25px;
}

#debug-pane tr.locked {
    color: #999;
}

#game-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: #f9f9f9;
}

#game-options fieldset {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

#game-options legend {
    padding: 0 5px;
    font-weight: bold;
}

#game-options fieldset div, #game-options .debug-option {
    display: flex;
    align-items: center;
}
