:root {
    --circle-bg: #1a1a2e;
    --circle-canvas: #16213e;
    --circle-line: #FFD93D;
    --circle-text: #fff;
    --circle-text-dim: rgba(255, 255, 255, 0.6);
    --color-excellent: #4CAF50;
    --color-good: #FFD93D;
    --color-poor: #FF6B6B;
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    background-color: var(--circle-bg);
    color: var(--circle-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;
}

.title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--circle-line);
}

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

#canvas {
    width: 100%;
    height: 100%;
    background-color: var(--circle-canvas);
    border-radius: 16px;
    cursor: crosshair;
    touch-action: none;
}

.canvas-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.25rem;
    color: var(--circle-text-dim);
    pointer-events: none;
    transition: opacity 0.2s;
}

.state-drawing .canvas-hint,
.state-result .canvas-hint {
    opacity: 0;
}

.instruction {
    font-size: 1rem;
    color: var(--circle-text-dim);
    margin-bottom: 0.5rem;
}

.score {
    font-size: 4rem;
    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);
}

.score.excellent { color: var(--color-excellent); }
.score.good { color: var(--color-good); }
.score.poor { color: var(--color-poor); }

.best-score {
    font-size: 1rem;
    color: var(--circle-text-dim);
    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;
}

/* Override share button for dark theme */
.share-btn {
    background: var(--circle-line);
    color: #333;
}

.share-btn:hover {
    background: #ffe566;
}

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

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

/* Hide instruction during result */
.state-result .instruction {
    display: none;
}

/* 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 */
.home-link {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--circle-text);
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.85rem;
    transition: background 0.2s, transform 0.1s;
    z-index: 10;
}

.home-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

.home-link:active {
    transform: translateX(-50%) scale(0.95);
}

/* Add padding at bottom of content to prevent overlap with fixed home-link */
.content {
    padding-bottom: 4rem;
}

/* Responsive */
@media (max-width: 400px) {
    .title { font-size: 1.5rem; }
    .score { font-size: 2.5rem; }
    .canvas-wrapper { max-width: 250px; }
    .best-score { font-size: 0.9rem; }
    .hint { font-size: 0.8rem; }
}

@media (max-height: 600px) {
    .title { font-size: 1.25rem; margin-bottom: 0.25rem; }
    .canvas-wrapper { max-width: 200px; margin-bottom: 0.5rem; }
    .score { font-size: 2rem; margin: 0.25rem 0; }
    .content { padding-bottom: 3rem; }
}

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