:root {
    --background-color: #262b3c;
    --box-bg: #2c3141;
    --text-color: #dadce0;
    --root-bg: #6aaa64;
    --unknown-bg: #3b4150;
    --prefilled-bg: #939b9f;
    --key-bg: #565f7e;
    --solution-text: #6aaa64;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: "EB Garamond", serif;
    font-size: 14pt;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    margin: 0;
    min-height: 100vh;
    box-sizing: border-box;
}

ul {
    margin: 1em;
}

ul.dashed > li:before {
    content: "- ";
}

#app-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* --- Modals --- */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
}

.modal-content {
    background-color: var(--box-bg);
    color: var(--text-color);
    margin: 15% auto;
    padding: 20px;
    border-radius: 10px;
    width: fit-content;
    max-width: 80%;
    position: relative;
}

.close-button {
    color: var(--text-color);
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.modal-content h3 {
    margin-top: 0;
    color: var(--root-bg);
}
.modal-content ul {
    list-style: none;
    padding-left: 0;
}
.modal-content li {
    margin-bottom: 10px;
}
.modal-content ul ul {
    padding-left: 20px;
    margin-top: 5px;
}
.modal-content label {
    display: block;
    margin-top: 15px;
}

/* --- Top Bar --- */
.top-bar {
    background-color: var(--box-bg);
    border-radius: 15px;
    padding: 10px 20px;
    width: 90%;
    max-width: 600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.top-bar-icon {
    font-size: 24px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* --- Clue Area --- */
.clue-area {
    width: 90%;
    max-width: 600px;
    margin-bottom: 20px;
    text-align: center;
}
.clue-text {
    color: var(--text-color);
    margin-bottom: 10px;
    font-size: 1.5em;
}
.solution-display {
    color: var(--solution-text);
    font-weight: bold;
    min-height: 1.5em;
    transition: opacity 0.5s ease-in-out;
    font-size: 1.5em;
    text-align: center;
    opacity: 0;
    visibility: hidden;
}

.solution-display.not-solved-indicator {
    color: red;
    font-size: 2.5em;
    opacity: 1;
    visibility: visible;
}

.top-bar {
    background-color: var(--box-bg);
    border-radius: 15px;
    padding: 10px 20px;
    width: 90%;
    max-width: 600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.top-bar-icon {
    font-size: 24px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
}

.top-bar-title {
    font-size: 1.4em;
    font-weight: bold;
    text-align: center;
    flex-grow: 1;
    margin: 0 10px;
    user-select: none;
    -webkit-user-select: none;
}

.grid-container {
    display: grid;
    /* grid-template-columns will be set by JS */
    /* grid-template-rows will be set by JS */
    gap: 5px;
    justify-content: center;
    margin-bottom: 20px;
}
.grid-cell {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    font-weight: bold;
    text-transform: uppercase;
    user-select: none;
    -webkit-user-select: none;
}

.grid-cell.cell-unknown:focus {
    outline: 2px solid var(--text-color);
    outline-offset: 1px;
}

.cell-root {
    background-color: var(--root-bg);
    color: white;
}
.cell-unknown {
    background-color: var(--unknown-bg);
    color: var(--text-color);
    cursor: text;
    border: none;
    outline: none;
    text-align: center;
    padding: 0;
    font-size: 1.5em;
    font-weight: bold;
    text-transform: uppercase;
    font-family: "EB Garamond", serif;
}

.cell-unknown[inputmode="none"] {
     cursor: default;
}

.cell-prefilled {
    background-color: var(--prefilled-bg);
    color: var(--text-color);
}

.cell-prefilled-unknown {
    background-color: var(--prefilled-bg);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    font-weight: bold;
    text-transform: uppercase;
    user-select: none;
    -webkit-user-select: none;
}

.cell-empty {
    background-color: transparent;
    pointer-events: none;
}

.possible-words {
    display: none; /* Hidden by default, shown via JS */
    background-color: var(--box-bg);
    border-radius: 15px;
    padding: 15px;
    width: 90%;
    max-width: 600px;
    min-height: 4.5em;
    margin-bottom: 20px;
    text-align: center;
}
.possible-words.visible {
    display: block;
}
.possible-words h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--text-color);
}
.word-list span {
    display: inline-block;
    background-color: var(--key-bg);
    color: var(--text-color);
    padding: 5px 10px;
    margin: 5px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.word-list span:hover {
    background-color: var(--unknown-bg);
}
.word-list i {
    color: var(--text-color);
}

/* --- Keyboard Area --- */
.keyboard {
    background-color: var(--box-bg);
    border-radius: 15px;
    padding: 15px;
    width: fit-content;
    max-width: 100%;
    text-align: center;
}
.keyboard-row {
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
    gap: 6px;
}
.key {
    background-color: var(--key-bg);
    color: var(--text-color);
    border: none;
    border-radius: 5px;
    padding: 10px;
    min-width: 30px;
    max-width: 60px;
    height: 40px;
    font-family: "EB Garamond", serif;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    flex-grow: 1;
    display: flex;
    justify-content: center;
    overflow: hidden;
    align-items: center;
    transition: background-color 0.2s;
}
.key.key-pressed-visual {
    background-color: var(--unknown-bg);
    outline: none;
}
@media (hover: hover) and (pointer: fine) {
    .key:hover {
        background-color: var(--unknown-bg);
        outline: none;
    }
}

/* Wider keys like Enter/Backspace */
.key-large {
    min-width: 50px;
    flex-grow: 2;
}

/* --- Next Puzzle Arrow --- */
#nextPuzzleLink {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3em;
    color: var(--solution-text);
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;

    text-decoration: none;
}

#nextPuzzleLink.visible {
    opacity: 1;
    visibility: visible;
}

#nextPuzzleLink #nextPuzzleArrowContent span {
    display: block;
}
