/* Use CSS variables from main.css - no need to redefine */

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    background-color: var(--color-bg);
    color: var(--color-text);
    -webkit-tap-highlight-color: transparent;
}

.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}

.content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    width: 100%;
    max-width: 500px;
    padding-bottom: 4rem;
}

.title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--color-primary-dark);
}

.level-display {
    font-size: 1rem;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    max-width: 350px;
    margin: 0 auto 1rem;
}

#canvas {
    width: 100%;
    height: 100%;
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    cursor: crosshair;
    touch-action: none;
    box-shadow: var(--shadow-card);
}

/* Start and end zones */
.start-zone, .end-zone {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.start-zone {
    background: rgba(76, 175, 80, 0.3);
    border: 2px solid var(--color-success);
    color: var(--color-success);
    animation: pulse-start 1.5s ease-in-out infinite;
}

@keyframes pulse-start {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 15px 5px rgba(76, 175, 80, 0.3); }
}

.end-zone {
    background: rgba(255, 107, 107, 0.3);
    border: 2px solid var(--color-accent);
    color: var(--color-accent);
}

.state-idle .start-zone,
.state-idle .end-zone,
.state-tracing .start-zone,
.state-tracing .end-zone {
    opacity: 1;
}

/* Instruction element removed - no longer used */

.lives-display {
    font-size: 1.5rem;
    margin: 0.25rem 0;
    letter-spacing: 0.25rem;
}

.score {
    font-size: 3rem;
    font-weight: 700;
    margin: 0.5rem 0;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s, transform 0.3s;
}

.state-result .score {
    opacity: 1;
    transform: scale(1);
}

.best-score {
    font-size: 1rem;
    color: var(--color-text-light);
    margin-bottom: 0.25rem;
    opacity: 0;
}

.state-result .best-score {
    opacity: 1;
}

.share-container {
    margin: 0.5rem 0;
    opacity: 0;
}

.state-result .share-container {
    opacity: 1;
}

/* Share button uses default styling from main.css */

.hint {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-top: 0.25rem;
    opacity: 0;
}

.state-result .hint {
    opacity: 1;
}

/* Controls use default styling from main.css */
.controls-inline {
    margin-bottom: 0.5rem;
}

/* Hide controls during gameplay and result */
.state-tracing .controls-inline,
.state-result .controls-inline,
.state-result .lives-display,
.state-result .level-display {
    display: none;
}

/* Flash effect when touching edge */
.canvas-wrapper.flash {
    animation: edge-flash 0.2s ease-out;
}

@keyframes edge-flash {
    0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.8); }
    100% { box-shadow: 0 0 20px 10px rgba(255, 107, 107, 0); }
}

/* New best animation */
.state-result.new-best .score {
    animation: score-pop 0.5s ease-out;
}

@keyframes score-pop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Home link uses default styling from main.css */

/* Responsive */
@media (max-width: 400px) {
    .title { font-size: 1.5rem; }
    .score { font-size: 2rem; }
    .canvas-wrapper { max-width: 280px; }
    .start-zone, .end-zone { width: 40px; height: 40px; font-size: 0.55rem; }
}

@media (max-height: 600px) {
    .title { font-size: 1.25rem; margin-bottom: 0.15rem; }
    .canvas-wrapper { max-width: 220px; margin-bottom: 0.5rem; }
    .score { font-size: 1.75rem; margin: 0.25rem 0; }
    .content { padding-bottom: 3rem; }
    .start-zone, .end-zone { width: 35px; height: 35px; font-size: 0.5rem; }
}

@media (min-height: 800px) {
    .canvas-wrapper { max-width: 400px; }
}

/* How-to-play and related games use default styling from main.css */
