:root {
    --primary-color: #d32f2f;
    --secondary-color: #2c3e50;
    --gold-color: #fbc02d;
    --background-color: #8e0000;
    --text-color: #333;
    --card-bg: #fffaf0;
    --scratch-overlay: #bdc3c7;
    --scratch-border: #c0392b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #8e0000 0%, #b71c1c 100%);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
}

.background-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.bg-item {
    position: absolute;
    bottom: -50px;
    font-size: 2rem;
    animation: floatUp 10s linear infinite;
    left: calc((var(--i) - 8) * 5%);
    animation-duration: calc(15s + var(--i) * 0.5s);
    animation-delay: calc(var(--i) * -2s);
    opacity: 0.8;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}

@keyframes floatUp {
    0% {
        transform: translateY(100px) rotate(0deg) scale(0.8);
        opacity: 0;
    }
    10% {
        opacity: 0.9;
    }
    90% {
        opacity: 0.9;
    }
    100% {
        transform: translateY(-110vh) rotate(360deg) scale(1.1);
        opacity: 0;
    }
}

.horizontal-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.bg-item-horizontal {
    position: absolute;
    left: -50px;
    font-size: 2rem;
    animation: floatRight 15s linear infinite;
    top: calc(var(--i) * 10%); /* Distribute vertically */
    animation-duration: calc(20s + var(--i) * 1s);
    animation-delay: calc(var(--i) * -5s);
    opacity: 0.8;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}

@keyframes floatRight {
    0% {
        transform: translateX(-100px) rotate(0deg) scale(0.8);
        opacity: 0;
    }
    10% {
        opacity: 0.9;
    }
    90% {
        opacity: 0.9;
    }
    100% {
        transform: translateX(110vw) rotate(360deg) scale(1.1);
        opacity: 0;
    }
}

.container {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.lang-switch {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 20px;
}

.lang-btn {
    background: none;
    border: 1px solid #ddd;
    padding: 5px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    color: var(--secondary-color);
}

.lang-btn:hover {
    background-color: #eee;
}

header h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

header p {
    color: #c0392b;
    margin-bottom: 25px;
    font-size: 1.1rem;
    font-weight: 500;
}

.interface {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group {
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    outline: none;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 6px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.1s;
}

button:active {
    transform: scale(0.98);
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: #c0392b;
}

.disabled-btn {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.disabled-btn:hover {
    background-color: #bdc3c7;
}

.secondary-btn {
    background-color: var(--gold-color);
    color: #d32f2f;
    margin-top: 15px;
    font-weight: bold;
}

.share-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.share-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

.share-buttons button {
    flex: 1;
    margin-top: 0; /* Override default margin-top from .secondary-btn */
}

#share-link-container {
    padding-bottom: 20px;
}

#share-link {
    width: 100%;
}

.secondary-btn:hover {
    background-color: #f9a825;
}

.hidden {
    display: none !important;
}

.canvas-container {
    position: relative;
    width: 100%;
    height: 200px; /* Fixed height for the scratch area */
    border: 2px solid var(--scratch-border);
    border-radius: 8px;
    overflow: hidden;
    background-color: #eee;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px; /* Add margin-top for separation */
}

/* The hidden text behind the canvas */
.hidden-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
    z-index: 1; /* Below the canvas */
    padding: 10px;
    word-wrap: break-word;
    pointer-events: none; /* Let clicks pass through to canvas if needed, though canvas is on top */
}

#scratch-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2; /* Above the text */
    cursor: crosshair;
}

.instructions p {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 10px;
}

@media (max-width: 480px) {
    .container {
        padding: 20px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
}