:root {
    --bg: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.85);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #22d3ee;
    --accent-hover: #06b6d4;
    --left-color: #f43f5e;
    --right-color: #22d3ee;
    --font-family: 'Inter', sans-serif;
}

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

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg);
    font-family: var(--font-family);
    color: var(--text-primary);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: default;
}

#ui-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 240px;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--accent);
}

h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

hr {
    border: none;
    height: 1px;
    background-color: var(--panel-border);
    width: 100%;
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    min-width: 32px;
    text-align: right;
}

.difficulty-row {
    display: flex;
    gap: 6px;
}

.diff-btn {
    flex: 1;
    padding: 6px 0;
    border: 1px solid var(--panel-border);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.diff-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.11);
    color: var(--text-primary);
}

.diff-btn.active {
    background: rgba(34, 211, 238, 0.15);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.turn-btn {
    flex: 1;
    padding: 14px 10px;
    border: none;
    border-radius: 10px;
    font-family: var(--font-family);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
    letter-spacing: 0.02em;
}

.turn-btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

.turn-btn:active:not(:disabled) {
    transform: translateY(0);
}

.turn-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.left-btn {
    background: var(--left-color);
    color: white;
    box-shadow: 0 0 16px rgba(244, 63, 94, 0.3);
}

.left-btn:hover:not(:disabled) {
    box-shadow: 0 0 24px rgba(244, 63, 94, 0.55);
}

.right-btn {
    background: var(--right-color);
    color: #0f172a;
    box-shadow: 0 0 16px rgba(34, 211, 238, 0.3);
}

.right-btn:hover:not(:disabled) {
    box-shadow: 0 0 24px rgba(34, 211, 238, 0.55);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.text-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 9px 14px;
    color: var(--text-primary);
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-size: 14px;
    width: 100%;
    text-align: center;
}

.text-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.2);
}

.text-btn.primary {
    background: linear-gradient(135deg, var(--accent), #0ea5e9);
    border-color: transparent;
    color: #0f172a;
    font-weight: 600;
}

.text-btn.primary:hover {
    box-shadow: 0 0 16px 4px rgba(34, 211, 238, 0.35);
}

.hint {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    min-height: 36px;
}

.hidden {
    visibility: hidden;
    pointer-events: none;
}

@keyframes wiggle {
    0%   { transform: translateX(0); }
    20%  { transform: translateX(-6px); }
    40%  { transform: translateX(6px); }
    60%  { transform: translateX(-4px); }
    80%  { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

.wiggle {
    animation: wiggle 0.4s ease;
}
