fuzzyworld

herd / files / index.html

index.html

7.3 KB · history · blame

1<!doctype html>
2<html lang="en">
3 <head>
4 <meta charset="UTF-8" />
5 <link rel="icon" type="image/png" href="/plant.png" />
6 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7 <title>Herd</title>
8 <style>
9 *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
10 html, body { width: 100%; height: 100%; overflow: hidden; background: #2d5a1b; }
11
12 canvas { display: block; position: absolute; top: 0; left: 0; }
13
14 /* ── UI overlay ───────────────────────────────────────────────── */
15 #ui {
16 position: absolute; top: 0; left: 0; width: 100%; height: 100%;
17 font-family: system-ui, sans-serif;
18 color: #fff;
19 pointer-events: none;
20 }
21
22 .screen {
23 position: absolute; top: 0; left: 0; width: 100%; height: 100%;
24 display: flex; flex-direction: column; align-items: center; justify-content: center;
25 gap: 18px;
26 pointer-events: all;
27 }
28
29 .hidden { display: none !important; }
30
31 /* ── Level select ─────────────────────────────────────────────── */
32 #screen-level-select h1 {
33 font-size: clamp(2rem, 6vw, 3.5rem);
34 font-weight: bold;
35 text-shadow: 0 2px 8px rgba(0,0,0,0.35);
36 }
37
38 #screen-level-select .tagline {
39 color: rgba(255,255,255,0.75);
40 font-size: clamp(0.85rem, 2.4vw, 1.1rem);
41 margin-top: -6px;
42 }
43
44 #level-grid {
45 display: grid;
46 grid-template-columns: repeat(5, 1fr);
47 gap: 10px;
48 padding: 0 20px;
49 max-width: 860px;
50 width: 100%;
51 }
52
53 .level-btn {
54 background: rgba(255,255,255,0.15);
55 border: none; border-radius: 10px;
56 color: #fff;
57 cursor: pointer;
58 display: flex; flex-direction: column; align-items: center; justify-content: center;
59 padding: 10px 6px; min-height: 88px; gap: 3px;
60 pointer-events: all;
61 transition: background 0.15s;
62 font-family: inherit;
63 }
64 .level-btn:hover:not(.locked) { background: rgba(255,255,255,0.28); }
65 .level-btn.locked { background: rgba(255,255,255,0.06); cursor: default; }
66
67 .level-btn .lv-lock { font-size: clamp(1.2rem, 2.5vw, 1.6rem); color: rgba(255,255,255,0.25); line-height: 1; }
68 .level-btn .lv-num { font-size: clamp(1rem, 2.5vw, 1.5rem); font-weight: bold; line-height: 1; }
69 .level-btn .lv-name { font-size: clamp(0.6rem, 1.1vw, 0.72rem); color: rgba(255,255,255,0.65); text-align: center; line-height: 1.2; }
70 .level-btn.locked .lv-name { color: rgba(255,255,255,0.2); }
71 .level-btn .lv-best { font-size: clamp(0.55rem, 1vw, 0.68rem); color: rgba(255,255,255,0.45); }
72
73 #level-select-footer {
74 display: flex; flex-direction: column; align-items: center; gap: 3px;
75 margin-top: 4px;
76 }
77 #level-select-footer a {
78 color: rgba(255,255,255,0.45); font-size: 11px; text-decoration: none; pointer-events: all;
79 }
80 #level-select-footer a:hover { color: rgba(255,255,255,0.75); }
81
82 /* ── HUD ──────────────────────────────────────────────────────── */
83 #hud {
84 position: absolute; top: 0; left: 0; width: 100%; height: 100%;
85 pointer-events: none;
86 }
87
88 #hud-counter {
89 position: absolute; top: 12px; left: 12px;
90 background: rgba(0,0,0,0.45); border-radius: 8px;
91 padding: 7px 14px; font-size: 16px; font-weight: bold; white-space: nowrap;
92 }
93 #hud-counter small {
94 font-size: 11px; font-weight: normal; color: rgba(255,255,255,0.45); margin-left: 4px;
95 }
96
97 #hud-timer {
98 position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
99 display: flex; flex-direction: column; align-items: center; gap: 4px;
100 }
101 #timer-track {
102 width: 160px; height: 10px;
103 background: rgba(0,0,0,0.4); border-radius: 5px; overflow: hidden;
104 }
105 #timer-fill { height: 100%; border-radius: 4px; transition: background-color 0.5s; }
106 #timer-text { font-size: 12px; }
107
108 #hud-shrink {
109 position: absolute; top: 12px; right: 12px;
110 background: rgba(0,0,0,0.45); border-radius: 8px;
111 padding: 7px 14px; font-size: 13px; white-space: nowrap;
112 transition: background 0.3s;
113 }
114 #hud-shrink.urgent { background: rgba(220,50,50,0.85); }
115
116 #hud-level-name {
117 position: absolute; bottom: 10px; left: 12px;
118 color: rgba(255,255,255,0.6); font-size: 11px;
119 }
120
121 #btn-menu {
122 position: absolute; bottom: 12px; right: 12px;
123 background: rgba(0,0,0,0.45); color: #fff;
124 border: none; border-radius: 8px; padding: 6px 16px;
125 font-size: 13px; cursor: pointer; font-family: inherit; pointer-events: all;
126 }
127 #btn-menu:hover { background: rgba(0,0,0,0.65); }
128
129 /* ── End screen ───────────────────────────────────────────────── */
130 #screen-end { background: rgba(0,0,0,0.55); gap: 14px; text-align: center; cursor: pointer; }
131
132 #end-title { font-size: clamp(2rem, 7vw, 3.5rem); font-weight: bold; }
133 #end-sub { font-size: clamp(1rem, 3.5vw, 1.4rem); }
134 #end-time { color: rgba(255,255,255,0.7); font-size: clamp(0.85rem, 2.5vw, 1.05rem); }
135 #end-record { color: #ffd700; font-size: clamp(0.85rem, 2.4vw, 1rem); font-weight: bold; }
136 #end-subtitle { color: rgba(255,255,255,0.6); font-style: italic; font-size: clamp(0.75rem, 2.2vw, 0.95rem); max-width: 480px; padding: 0 16px; }
137 </style>
138 </head>
139 <body>
140 <canvas id="game"></canvas>
141
142 <div id="ui">
143 <!-- Level select -->
144 <div id="screen-level-select" class="screen">
145 <h1>Herd</h1>
146 <p class="tagline">Tap a level to begin</p>
147 <div id="level-grid"></div>
148 <footer id="level-select-footer">
149 <a href="https://code.fuzzyworld.net/herd/" target="_blank" rel="noopener">code.fuzzyworld.net/herd</a>
150 <a href="https://www.flaticon.com/authors/icongeek26/outline?author_id=296&type=standard" target="_blank" rel="noopener" style="font-size:10px;opacity:0.6">Icon by Icongeek26 via Flaticon</a>
151 </footer>
152 </div>
153
154 <!-- HUD (visible during PLAYING / WIN / FAIL) -->
155 <div id="hud" class="hidden">
156 <div id="hud-counter"></div>
157 <div id="hud-timer" class="hidden">
158 <div id="timer-track"><div id="timer-fill"></div></div>
159 <span id="timer-text"></span>
160 </div>
161 <div id="hud-shrink" class="hidden"></div>
162 <div id="hud-level-name"></div>
163 <button id="btn-menu">☰ Menu</button>
164 </div>
165
166 <!-- End screen -->
167 <div id="screen-end" class="screen hidden">
168 <h2 id="end-title"></h2>
169 <p id="end-sub"></p>
170 <p id="end-time" class="hidden"></p>
171 <p id="end-record" class="hidden">★ New best time!</p>
172 <p id="end-subtitle" class="hidden"></p>
173 </div>
174 </div>
175
176 <script type="module" src="/src/main.ts"></script>
177 </body>
178</html>