:root {
    --primary-color: #FF9F1C;
    --secondary-color: #2EC4B6;
    --accent-color: #E71D36;
    --light-color: #FDFFFC;
    --dark-color: #011627;
}

body {
    margin: 0;
    overflow: hidden;
    background-color: #87CEEB; /* Sky blue fallback */
}

canvas {
    display: block;
    touch-action: none; /* Prevent default touch actions like scrolling */
}

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    pointer-events: auto;
    transition: opacity 0.3s;
    backdrop-filter: blur(5px);
}

.hidden {
    opacity: 0;
    pointer-events: none;
    display: none; /* simple hide */
}

h1 {
    font-size: 3rem; /* Reduced from 4rem */
    text-shadow: 3px 3px 0px var(--primary-color);
    margin-bottom: 10px;
    font-weight: 900;
    text-align: center;
    padding: 0 20px;
    max-width: 100%;
    box-sizing: border-box;
}

/* Optional: Make the highscore list on start screen look good */
.highscore-container {
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    margin-top: 30px; /* Added spacing between start button and highscore */
    width: 100%; /* Use full available width up to max-width */
    max-width: 340px; /* Slightly wider */
    box-sizing: border-box;
}
.highscore-container h3 {
    margin-top: 0;
    margin-bottom: 10px;
}
.highscore-container ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 1.1rem;
    max-height: 150px;
    overflow-y: auto;
}
.highscore-container li {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

p {
    font-size: 1.5rem;
    margin-bottom: 30px;
    text-align: center;
    padding: 0 20px;
    max-width: 100%;
    box-sizing: border-box;
}

#settings-panel {
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.2);
    padding: 16px 18px;
    border-radius: 16px;
    width: min(520px, 90%);
    margin-bottom: 18px;
}

#settings-panel.hidden {
    display: none;
}

#settings-panel h3 {
    margin: 0 0 6px 0;
    font-size: 1.4rem;
}

.settings-hint {
    font-size: 1rem;
    margin: 0 0 10px 0;
    color: #fff2cf;
}

#words-input {
    width: 100%;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 10px 12px;
    font-size: 1rem;
    resize: vertical;
}

.settings-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.settings-actions button {
    font-size: 1rem;
    padding: 10px 18px;
}

#settings-toggle-btn {
    background: #ff9fd2;
    box-shadow: 0 6px 0 #b85a87;
    font-size: 1.1rem;
    margin-bottom: 14px;
}

button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 0 #1b8a7f;
    transition: transform 0.1s, box-shadow 0.1s;
    font-weight: bold;
    margin-top: 10px;
}

button:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #1b8a7f;
}

button:hover {
    background-color: #3ddbdc;
}

#score-display {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    color: white;
    background: rgba(0,0,0,0.45);
    padding: 10px 20px;
    border-radius: 15px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid rgba(255, 215, 0, 0.6);
}

.coin-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff6b3, #ffd700 55%, #c98a00 100%);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.6), 0 2px 6px rgba(0,0,0,0.3);
    border: 2px solid #b87700;
}

.coin-label {
    font-size: 1.3rem;
    color: #ffe8a3;
}

.coin-fly {
    position: absolute;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff6b3, #ffd700 55%, #c98a00 100%);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.6), 0 2px 6px rgba(0,0,0,0.3);
    border: 2px solid #b87700;
    transition: left 1.6s ease-in-out, top 1.6s ease-in-out, opacity 1.6s ease-in-out;
    pointer-events: none;
    z-index: 10;
}

.help-bubble {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #fffaf0;
    border: 4px solid #ff9cc2;
    color: #111;
    font-size: 1.6rem;
    font-weight: 800;
    padding: 10px 22px;
    border-radius: 22px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 20;
}

.help-bubble::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -14px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 14px solid #fffaf0;
}

.highscore-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

input {
    padding: 10px 20px;
    font-size: 1.2rem;
    border-radius: 10px;
    border: 2px solid var(--secondary-color);
}

#highscore-list {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    width: 300px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
}

#highscore-ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

#highscore-ul li {
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    display: flex;
    justify-content: space-between;
}

#shop-items {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 16px 0 10px 0;
}

.shop-item {
    background: #ffb347;
    box-shadow: 0 6px 0 #c57a1a;
    font-size: 1.1rem;
}

.shop-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
