:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --border: #2a2a32;
    --line-accent: #3b82f6;
    --accent: #3b82f6;
    --text: #252525;
    --text-muted: #888;
}

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

html,
body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 40px 16px;
}

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

.header h1 {
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 600;
    letter-spacing: -0.01em;
}

#stopwatch {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.grid {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    max-width: 520px;
    display: flex;
    justify-content: center;
    touch-action: none;
}

#pattern-grid {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
}

.circle {
    fill: var(--bg);
    stroke: #464545;
    stroke-width: 3px;
}

.circle.invalid {
    stroke: #ff6b6b;
}

.line {
    stroke: var(--line-accent);
    stroke-width: 16px;
    stroke-linecap: round;
}

.line.invalid {
    stroke: #ff6b6b;
}

.controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    flex-direction: column;
    position: relative;
}

#message {
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    min-height: 18px;
}

#message.error {
    color: #ff6b6b;
}

#sim-btn,
#clear-btn,
#stop-btn,
#pause-btn {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text);
    background: transparent;
    width: 120px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 24px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

#sim-btn:hover:not(:disabled),
#clear-btn:hover:not(:disabled),
#stop-btn:hover:not(:disabled),
#pause-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

#sim-btn:disabled,
#clear-btn:disabled,
#stop-btn:disabled,
#pause-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}