* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    --border-radius: 0px;
    --outer-padding: 12px;
    --gap: 12px;
    --row-gap: 12px;
    --btn-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --transition-time: 0.15s;
}

.stat-label, .stat-value {
    text-transform: uppercase;
}

body {
    font-family: monospace;
    background: white;
    background-image: url('/dot6.png');
    background-size: 6px 6px;
    background-repeat: repeat;
    background-position: 3px 3px;
    margin: 0;
    padding: 0;
    height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.container {
    width: 100%;
    height: 100%;
    max-width: 600px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

header {
    text-align: left;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: stretch;
    gap: 16px;
}

main {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: var(--gap);
}

h1 {
    color: #333;
    font-size: 24px;
}

.header-bar {
    display: flex;
    align-items: center;
}

.settings-container {
    position: relative;
    margin-left: auto;
}

.settings-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.2s, transform 0.2s;
    line-height: 1;
}

.settings-btn:hover {
    color: #666;
    transform: scale(1.1);
}

.settings-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    box-shadow: 0 0px 32px rgba(0, 0, 0, 0.15);
    padding: var(--outer-padding);
    min-width: 200px;
    z-index: 1000;
}

.settings-dropdown.hidden {
    display: none;
}

.settings-section {
    margin-bottom: 12px;
}

.settings-section:last-child {
    margin-bottom: 0;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.settings-label {
    display: block;
    color: #333;
    font-size: 0.9rem;
    font-weight: 100;
    margin-bottom: 8px;
}

.mode-options {
    display: flex;
    flex-direction: column;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.mode-option:hover {
    background-color: #f5f5f5;
}

.mode-option input[type="radio"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.mode-option span {
    color: #333;
    font-size: 0.95rem;
}

.reset-btn {
    width: 100%;
    background: #999;
    font-family: monospace;
    text-transform: uppercase;
    border: none;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: var(--border-radius);
    transition: transform 0.2s, box-shadow 0.2s;
}

.reset-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--btn-box-shadow);
}

.reset-btn:active {
    transform: translateY(0);
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--row-gap);
}

.stat {
    background: #f5f5f5;
    padding: 8px 10px;
    border-radius: var(--border-radius);
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.stat-2col {
    grid-column: span 2;
}

.stat-label {
    color: #666;
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.stat-value {
    color: #333;
    font-weight: bold;
    font-size: 1rem;
}

.card-container {
    perspective: 1000px;
}

.card {
    width: 100%;
    height: 400px;
    position: relative;
    cursor: pointer;
    outline: none;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius);
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity var(--transition-time) ease-in-out;
}

.card-front {
    background: white;
    opacity: 1;
}

.card-back {
    background: white;
    opacity: 0;
    pointer-events: none;
}

.card.flipped .card-front {
    opacity: 0;
    pointer-events: none;
}

.card.flipped .card-back {
    opacity: 1;
    pointer-events: auto;
}

.color-display {
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.reveal-btn {
    position: absolute;
    inset: 0;
    width: 100%;
    padding: 15px 20px;
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity var(--transition-time) ease-in-out;
    color: #999;
    font-weight: 100;
    background-color: #fff;
    font-family: monospace;
    text-transform: uppercase;
    opacity: 1;
}

.reveal-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--btn-box-shadow);
}

.reveal-btn:active {
    transform: translateY(0);
}

.difficulty-buttons.show-difficulty .reveal-btn {
    opacity: 0;
    pointer-events: none;
}

.difficulty-buttons .diff-btn {
    opacity: 0;
    pointer-events: none;
}

.difficulty-buttons.show-difficulty .diff-btn {
    opacity: 1;
    pointer-events: auto;
}

.rgb-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 40px;
}

.rgb-value {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 2rem;
    font-weight: bold;
}

.rgb-value .label {
    color: #666;
    font-size: 1.5rem;
    min-width: 20px;
}

.rgb-value span:last-child {
    color: #333;
}

.color-square {
    width: 20px;
    height: 20px;
    border-radius: var(--border-radius);
    border: 2px solid #ddd;
    flex-shrink: 0;
}

.difficulty-buttons {
    position: relative;
    display: flex;
    gap: var(--row-gap);
    justify-content: center;
    flex-wrap: wrap;
    height: 100%;
    /* max-height: 150px; */
    max-height: 106px;
}

.diff-btn {
    flex: 1;
    padding: 8px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(0,0,0,0.1);
    font-size: 1rem;
    font-family: monospace;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity var(--transition-time) ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    color: rgba(0,0,0,0.8);
}

.diff-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--btn-box-shadow);
}

.diff-btn:active {
    transform: translateY(0);
}

.btn-label {
    font-size: 16px;
    text-transform: uppercase;
    font-weight: 600;
}

.btn-time {
    font-size: 12px;
    opacity: 0.9;
}

.btn-again {
    background: #eee;
}

.btn-good {
    background: #ccc;
}

.btn-easy {
    background: #aaa;
}

.complete-message {
    text-align: center;
    background: white;
    padding: 60px 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.complete-message.hidden {
    display: none;
}

.complete-message h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 2rem;
}

.complete-message p {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.next-review {
    margin-top: 20px;
    font-weight: bold;
    color: #333;
}

.creator-link {
    display: block;
    text-align: center;
    color: #667eea;
    font-size: 0.85rem;
    text-decoration: underline;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.creator-link:hover {
    color: #5568d3;
    text-decoration-color: #5568d3;
}


@media (max-width: 600px) {
    .container {
        padding: var(--outer-padding);
    }

    .card {
        height: 350px;
    }

    .rgb-value {
        font-size: 24px;
    }

    .difficulty-buttons {
        /* height: 100%; */
    }

    h1 {
        font-size: 20px;
    }
}
