# Task: tilt-maze marble game in Three.js

Build `index.html`: ONE file (HTML + CSS + JS inline) that loads Three.js r170 with exactly this import map and no other libraries (write your own physics):
`<script type="importmap">{"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.170.0/build/three.module.js"}}</script>`
Load the levels with `fetch('levels.json')` (the file is in this directory; do not change it).

## Levels
`levels.json` is an array of 3 levels; each level is an array of equal-length strings. Characters: `#` wall, `.` floor, `S` start, `G` goal, `O` hole.
World coordinates: the centre of cell (column c, row r) is at x = c, z = r. Cells are 1 × 1. Floor at y = 0, walls are 1 unit tall boxes filling their cell. Ball radius 0.3.

## Gameplay
- Arrow keys or WASD tilt the board (max 12°, eased); the ball rolls under gravity (9.81) along the tilt. Right/D tilts so the ball accelerates towards +x, Down/S towards +z.
- Rolling friction so a free ball comes to rest. Ball speed capped at 6 units/s.
- The ball never overlaps or passes through a wall, whatever the speed or frame rate (circle vs. box collision, sub-steps).
- Ball centre within 0.35 of a hole centre → it falls; after a short fall animation (≤ 1.5 s of game time) it respawns at S of the same level, at rest.
- Ball centre within 0.4 of the goal centre → next level, ball at the new S at rest. After the third level the game is finished: show an overlay element with `id="win"` containing the text `Tebrikler` and the total time.
- A HUD shows the level (e.g. `Seviye 1/3`) and an elapsed timer for the current level.
- Camera: angled top-down view that frames the whole level; resizes with the window; devicePixelRatio capped at 2.
- Nice look: lit scene with shadows, a shiny marble, visible goal and holes.

## Test API (required, exactly)
Physics must run on a fixed 120 Hz step, independent of the rendering frame rate. Expose:
```js
window.__game = {
  level,        // getter: 1-based current level number
  state,        // getter: 'loading' | 'playing' | 'falling' | 'finished'
  ball,         // getter: {x, z, vx, vz} in world units
  walls,        // getter: number of wall cells built for the current level
  setInput(x, z),  // override keyboard tilt input; x, z in [-1, 1] (1 = full tilt towards +x / +z); setInput(null) returns control to the keyboard
  setBall(x, z),   // teleport the ball (velocity 0)
  advance(sec),    // synchronously simulate `sec` seconds of game time in fixed steps (also advances timers and the fall animation); tilt easing is skipped during advance: input applies at full value immediately
  restart(),       // back to level 1, at S, timers reset
};
```
`state` must become `'playing'` as soon as the level is ready. Rendering keeps running with requestAnimationFrame; `advance` must work while it does.

`node check.mjs` runs a smoke test (3 checks). A much longer hidden test uses the API above (collisions, tunnelling, holes, goals, determinism, keyboard, fps). Test your work. Work only in this directory. When done, reply with one line.
