@import url('https://fonts.googleapis.com/css2?family=Libertinus+Serif+Display&family=Literata:ital,opsz,wght@0,7..72,200..900;1,7..72,200..900&family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&family=Sedan+SC&display=swap');

:root {
    /* oklch */
    --bg-dark: oklch(0.1 0.05 20);
    --bg: oklch(0.15 0.05 20);
    --bg-light: oklch(0.2 0.05 20);
    --text: oklch(0.96 0.1 20);
    --text-muted: oklch(0.76 0.1 20);
    --highlight: oklch(0.5 0.1 20);
    --shadow: 0px 4px 4px #00000030,
        0px 12px 12px #00000015;
    --border: oklch(0.4 0.1 20);
    --border-muted: oklch(0.3 0.1 20);
    --primary: oklch(0.76 0.1 20);
    --secondary: oklch(0.76 0.1 200);
    --danger: oklch(0.7 0.1 30);
    --warning: oklch(0.7 0.1 100);
    --success: oklch(0.7 0.1 160);
    --info: oklch(0.7 0.1 260);
}

:root[data-theme="light"] {
    /* oklch */
    --bg-dark: oklch(0.92 0.05 20);
    --bg: oklch(0.96 0.05 20);
    --bg-light: oklch(1 0.05 20);
    --text: oklch(0.15 0.1 20);
    --text-muted: oklch(0.4 0.1 20);
    --highlight: oklch(1 0.1 20);
    --border: oklch(0.6 0.1 20);
    --border-muted: oklch(0.7 0.1 20);
    --primary: oklch(0.4 0.1 20);
    --secondary: oklch(0.4 0.1 200);
    --danger: oklch(0.5 0.1 30);
    --warning: oklch(0.5 0.1 100);
    --success: oklch(0.5 0.1 160);
    --info: oklch(0.5 0.1 260);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    font-family: var(--font);
}

body {
    display: flex;
    align-items: center;
    margin: 0;
    background: no-repeat linear-gradient(135deg, var(--bg), var(--text));
    width: 100%;
    min-height: 100dvh;
}

h1 {
    margin: 0;
    padding: 0;
    font-weight: 700;
    font-size: clamp(1.5rem, 6dvw, 3rem);
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -2px;
}

h2 {
    margin: 0;
    padding: 0;
    font-weight: 700;
    font-size: clamp(1.25rem, 5vw, 2.5rem);
    color: var(--text);
    line-height: 1.15;
    letter-spacing: -1px;
}

h3 {
    margin: 0;
    padding: 0;
    font-weight: 700;
    font-size: clamp(1rem, 4vw, 2rem);
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.5px;
}

h4 {
    margin: 0;
    padding: 0;
    font-weight: 700;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    color: var(--text);
    line-height: 1.25;
    letter-spacing: 0px;
}

h5 {
    margin: 0;
    padding: 0;
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.25rem);
    color: var(--text);
    line-height: 1.3;
    letter-spacing: 0px;
}

h6 {
    margin: 0;
    padding: 0;
    font-weight: 700;
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    color: var(--text);
    line-height: 1.35;
    letter-spacing: 0px;
}

p,
span,
a,
li,
td,
th,
label,
input,
textarea {
    margin: 0;
    padding: 0;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-muted);
    line-height: 1.5;
    letter-spacing: 0px;
}

header {
    display: flex;
    flex-flow: column nowrap;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin-bottom: 1rem;
    width: 100%;
}

nav {
    display: flex;
    flex-flow: row wrap;
    justify-content: center;
    align-items: center;
    width: 100%;
    font-size: clamp(1rem, 2dvw, 1.5rem);
    gap: 1rem;
    margin: 1rem 2rem;
}

button {
    padding: clamp(0.25rem, 0.5vw, 0.5rem) clamp(0.5rem, 1vw, 1rem);
    border-radius: 0.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    background-color: var(--text);
    color: var(--bg-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 2px;
}

button:hover {
    background-color: var(--text-muted);
    border-color: var(--text-muted);
}

button .action {
    background-color: var(--primary);
}

button .action:hover {
    background-color: var(--secondary);
}

select {
    /* Hide the default arrow and reset appearance */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    /* Use your color variables for styling */
    background-color: var(--bg-light);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.2s ease-in-out;
    min-width: 150px;
}

select:hover {
    border-color: var(--border);
    box-shadow: var(--shadow);
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary);
}

/* Style the dropdown options */
option {
    padding: 1rem;
    text-align: center;
    background-color: var(--bg-light);
    color: var(--text);
    cursor: pointer;
}

option:hover {
    background-color: var(--bg);
}

/* Style the light theme specifically */
:root[data-theme="light"] select {
    background-color: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.install{
    border: 2px solid var(--text);
    border-radius: 50px;
    background-color: var(--primary);
    color: var(--bg-dark);
    transition: all 0.125s ease-in-out;
}

.install:hover{
    border-color: var(--primary);
    background-color: var(--secondary);
}

.container {
    width: clamp(20rem, 90dvw, 50rem);
    min-height: fit-content;
    margin: 1rem auto;
    padding: 1rem;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-muted);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

/* Title card styles */
.title-card {
    display: flex;
    flex-flow: column nowrap;
    background: var(--bg-light);
    padding: 0.5rem 1rem;
    margin: 1rem;
    border-radius: 0.5rem 0.5rem 0 0;
    border: 0.0625rem solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-0.625rem);
    transition: all 0.3s ease;
}

.title-card.show {
    opacity: 1;
    transform: translateY(0);
}

.title-card div{
    display: flex;
    flex-flow: row wrap;
    justify-content: space-between;
}

.clue-bar {
    display: flex;
    width: 100%;
    text-align: center;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 600;
    color: var(--text);
    background-color: var(--bg-light);
    border: 2px solid var(--border);
    border-radius: 0.25rem;
    box-shadow: var(--shadow);
    min-height: 2rem;
    /* keeps height consistent even when empty */
}

.puzzle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1rem solid var(--text);
    border-radius: 10px;
    background-color: var(--text);
    box-shadow: var(--shadow);
    margin: 1rem auto;
    height: 40dvh;
    max-width: 100%;
    aspect-ratio: 1 / 1;
}


.crossword-row {
    display: flex;
    flex: 1;
}

.crossword-cell {
    flex: 1;
    /* each cell expands equally */
    aspect-ratio: 1 / 1;
    /* force cells to stay square */
    border: 1px solid var(--border);
    background-color: var(--text-muted);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.crossword-cell input {
    width: 90%;
    height: 90%;
    font-size: clamp(0.8rem, 2.5vw, 1.5rem);
    text-align: center;
    border: none;
    background-color: var(--text);
    color: var(--bg-light);
}

.crossword-cell.highlight {
    outline: 0.15rem solid var(--bg-dark);
    outline-offset: -2px;
}

.crossword-cell.highlight input {
    background-color: var(--primary);
    color: var(--bg-dark);
}


.crossword-cell.black-cell {
    background-color: var(--bg-dark);
}

.gridnum {
    position: absolute;
    top: 2px;
    left: 2px;
    color: var(--bg-light);
    font-weight: 800;
    font-size: clamp(0.4rem, 1.2vw, 0.8rem);
    line-height: 1;
    pointer-events: none;
}




.helper {
    align-self: center;
    padding: 1rem;
    margin: 1rem;
    background-color: var(--bg-light);
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

.helper>h2 {
    text-align: center;
    border-bottom: 0.25rem solid var(--border);
    padding-bottom: 0.5rem;
}

.clues {
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-evenly;
    align-items: flex-start;
    margin-top: 1rem;
    padding: auto 2rem;
    gap: 1rem;
}

.clues h2 {
    text-align: center;
    padding-bottom: 0.5rem;
    width: 100%;
}

.clues ul {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 20rem;
    overflow-y: scroll;
}

.clues li {
    margin-right: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-muted);
    padding-bottom: 0.5rem;
}

.clues>div {
    display: flex;
    flex-flow: column nowrap;
    gap: 0.5rem;
    align-items: stretch;
    min-height: 3rem;
}

.across,
.down {
    width: 50%;
}

#alert-box {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translate(-50%, -20px);
    /* center horizontally, slide up */
    padding: 1rem 1.5rem;
    border-radius: 12px;
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
    background: rgb(255, 255, 255);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

#alert-box.show {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
}

.modal-content {
    background: var(--bg);
    padding: 2rem;
    border-radius: 12px;
    max-width: 300px;
    width: 90%;
    text-align: justify;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    color: var(--text);
}

.modal-content a {
    color: var(--secondary);
}

.donation-options {
    display: grid;
    gap: 0.75rem;
    margin: 1rem 0;
}

.donate-option {
    padding: 0.75rem;
    border: 1px solid var(--border);
    background: var(--text);
    color: var(--bg-dark);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.donate-option:hover, .donate-option.selected {
    border-color: 1rem solid var(--primary) !important;
    background: var(--text-muted);
    color: var(--bg-dark);
}

#custom-amount {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-muted);
    background: var(--bg-light);
    color: var(--text);
    width: 100%;
}

#custom-amount:invalid {
    border-color: var(--danger);
    outline: none;
    box-shadow: 0 0 0 2px var(--danger);
}

.actions {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    gap: 0.5rem;
}

.actions button {
    flex: 1;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--border);
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

#confirm-donate {
    background: var(--primary);
    color: var(--bg-dark);
}

#confirm-donate:hover {
    background: var(--secondary);
    border-color: var(--highlight);
    color: var(--bg-dark);
}

#close-modal {
    background: var(--text);
    color: var(--bg-dark);
    border-color: var(--danger);
}

#close-modal:hover {
    background: var(--text-muted);
    border-color: var(--highlight);
    color: var(--bg-dark);
}

.hidden {
    display: none;
}

#donate-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    position: fixed;
    top: 50dvh;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background-color: var(--primary);
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 1000;
}

#donate-btn:hover {
    background-color: var(--secondary);
    scale: 1.1;
    transition: all 0.2s ease-in-out;
}

#accept-disclaimer {
    margin-top: 1rem;
    background-color: var(--primary);
    color: var(--bg-dark);
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: bold;
}

#accept-disclaimer:hover {
    background-color: var(--secondary);
}

/* Style the entire scrollbar */
::-webkit-scrollbar {
    background-color: var(--bg-dark);
    width: 0.75rem;
}

/* Style the scrollbar track */
::-webkit-scrollbar-track {
    border-radius: 10px;
    background: var(--bg-dark);
}

/* Style the scrollbar thumb */
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 10px;
}

/* Style the scrollbar thumb on hover */
::-webkit-scrollbar-thumb:hover {
    background: var(--text);
}