/* Pattern Lock Game Styles */

:root {
    --color-bg: #1a1a2e;
    --color-text: #fff;
    --color-text-secondary: rgba(255, 255, 255, 0.7);
    --color-primary: #FFD93D;
    --color-success: #4CAF50;
    --color-error: #e74c3c;
    --color-dot-base: rgba(255, 255, 255, 0.3);
    --color-dot-overlay: rgba(255, 255, 255, 0.1);
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    background: var(--color-bg);
    color: var(--color-text);
    overflow: hidden;
}

.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 {
    text-align: center;
    padding: 20px;
    max-width: 400px;
    width: 100%;
}

.title {
    font-size: 2.5rem;
    margin: 0 0 5px;
    color: var(--color-primary);
}

.tagline {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    margin: 0 0 20px;
}

/* Controls - shown only in idle state */
.controls-inline {
    margin-bottom: 20px;
}

.control-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-dot-overlay);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.control-pill .swipe::before {
    content: '👆';
}

/* Level display */
.level-display {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.level-value {
    color: var(--color-primary);
    font-weight: 700;
}

/* Instruction */
.instruction {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    margin: 0 0 20px;
    min-height: 1.5em;
}

/* Pattern container - square grid for 3x3 dots */
.pattern-container {
    position: relative;
    width: min(80vw, 280px);
    height: min(80vw, 280px);
    margin: 0 auto 20px;
    touch-action: none; /* Prevent default touch behaviors */
}

/* Canvas layer for drawing lines between dots */
#pattern-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let touch events pass through to dots */
}

.dots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    position: relative;
}

.dot-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dot {
    width: 20px;
    height: 20px;
    background: var(--color-dot-base);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.dot.showing {
    background: var(--color-success);
    transform: scale(1.4);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
}

.dot.selected {
    background: var(--color-primary);
    transform: scale(1.3);
    box-shadow: 0 0 15px rgba(255, 217, 61, 0.6);
}

.dot.error {
    background: var(--color-error);
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.6);
}

.dot.correct {
    background: var(--color-success);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
}

/* Result - shown only in result state */
.result {
    display: none;
}

.result-text {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 10px;
}

.result-text.success {
    color: var(--color-success);
}

.result-text.failure {
    color: var(--color-error);
}

.best-score {
    font-size: 1.2rem;
    color: var(--color-text-secondary);
    margin: 0 0 20px;
}

.share-container {
    margin-top: 15px;
}

/* Home link */
.home-link {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 10px 20px;
    z-index: 100;
    transition: color 0.2s;
}

.home-link:hover {
    color: var(--color-text);
}

/* State visibility */
.state-idle .level-display,
.state-idle .instruction,
.state-idle .pattern-container,
.state-idle .result {
    display: none;
}

.state-showing .controls-inline,
.state-showing .tagline,
.state-showing .result {
    display: none;
}

.state-input .controls-inline,
.state-input .tagline,
.state-input .result {
    display: none;
}

.state-result .controls-inline,
.state-result .tagline,
.state-result .level-display,
.state-result .instruction {
    display: none;
}

.state-result .result {
    display: block;
}

.state-result .pattern-container {
    opacity: 0.5;
    pointer-events: none;
}
