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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--tg-theme-bg-color, #1a1a2e);
    color: var(--tg-theme-text-color, #e0e0e0);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 16px;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

#app {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

#header {
    text-align: center;
}

#header h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--tg-theme-text-color, #ffffff);
}

#instruction {
    font-size: 14px;
    color: var(--tg-theme-hint-color, #888);
    line-height: 1.4;
}

#shape-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--tg-theme-link-color, #64b5f6);
    text-transform: uppercase;
    letter-spacing: 2px;
}

#canvas-container {
    width: 300px;
    height: 300px;
    border-radius: 16px;
    border: 2px solid var(--tg-theme-hint-color, #333);
    overflow: hidden;
    touch-action: none;
    background: var(--tg-theme-secondary-bg-color, #16213e);
}

#trace-canvas {
    width: 300px;
    height: 300px;
    cursor: crosshair;
    display: block;
}

#status-bar {
    width: 100%;
    max-width: 300px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--tg-theme-hint-color, #888);
}

#accuracy-display {
    font-weight: 600;
}

#result-message {
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    width: 100%;
    max-width: 300px;
}

#result-message.success {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

#result-message.fail {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
}

#result-message.locked {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.4);
}

#result-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

#result-text {
    font-size: 14px;
    line-height: 1.5;
}

#retry-btn {
    padding: 12px 32px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: var(--tg-theme-button-color, #64b5f6);
    color: var(--tg-theme-button-text-color, #fff);
    transition: opacity 0.2s;
}

#retry-btn:active {
    opacity: 0.7;
}

.hidden {
    display: none !important;
}

/* Prevent pull-to-refresh and bounce scrolling on mobile */
html, body {
    overscroll-behavior: none;
    position: fixed;
    width: 100%;
    height: 100%;
}
