Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -111,13 +111,33 @@ def reset_current_game():
|
|
111 |
CSS = """
|
112 |
body, .gradio-container {
|
113 |
background: #fff0f5 !important;
|
114 |
-
padding: 1rem;
|
115 |
box-sizing: border-box;
|
116 |
min-height: 100vh;
|
117 |
display: flex;
|
118 |
justify-content: center;
|
119 |
align-items: center;
|
120 |
flex-direction: column;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
|
123 |
/* Board container: perfect square, responsive */
|
@@ -137,7 +157,7 @@ body, .gradio-container {
|
|
137 |
.game-btn {
|
138 |
width: 100%;
|
139 |
height: 100%;
|
140 |
-
font-size: 3.5rem !important;
|
141 |
border-radius: 12px !important;
|
142 |
background: #fff0f5 !important;
|
143 |
border: 2px solid #f9a8d4 !important;
|
@@ -157,7 +177,7 @@ body, .gradio-container {
|
|
157 |
.neat-button {
|
158 |
padding: 12px 16px;
|
159 |
border-radius: 8px;
|
160 |
-
font-size: 1rem;
|
161 |
margin: 6px 0;
|
162 |
background: #fce7f3;
|
163 |
border: 1px solid #f472b6;
|
@@ -165,6 +185,7 @@ body, .gradio-container {
|
|
165 |
font-weight: 600;
|
166 |
width: 100%;
|
167 |
box-sizing: border-box;
|
|
|
168 |
}
|
169 |
.neat-button:hover {
|
170 |
background: #f9a8d4;
|
@@ -174,14 +195,22 @@ body, .gradio-container {
|
|
174 |
|
175 |
/* Status */
|
176 |
#status {
|
177 |
-
font-size: 1.2rem;
|
178 |
font-weight: bold;
|
179 |
color: #db2777;
|
180 |
text-align: center;
|
181 |
margin: 1rem 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
}
|
183 |
|
184 |
-
/* Responsive adjustments */
|
185 |
@media (max-width: 768px) {
|
186 |
#board-container {
|
187 |
width: 90vw;
|
@@ -191,34 +220,21 @@ body, .gradio-container {
|
|
191 |
gap: 8px;
|
192 |
}
|
193 |
.game-btn {
|
194 |
-
font-size: 2.5rem !important;
|
195 |
}
|
196 |
.neat-button {
|
197 |
-
font-size: 0.
|
198 |
}
|
199 |
#status {
|
200 |
-
font-size: 1rem;
|
201 |
-
}
|
202 |
-
}
|
203 |
-
|
204 |
-
@media (min-width: 1200px) {
|
205 |
-
#board-container {
|
206 |
-
width: 480px;
|
207 |
-
height: 480px;
|
208 |
-
max-width: 600px;
|
209 |
-
max-height: 600px;
|
210 |
-
gap: 16px;
|
211 |
-
}
|
212 |
-
.game-btn {
|
213 |
-
font-size: 4rem !important;
|
214 |
}
|
215 |
}
|
216 |
"""
|
217 |
|
218 |
with gr.Blocks(title="Tic Tac Toe", css=CSS) as demo:
|
219 |
gr.Markdown("""
|
220 |
-
<h1
|
221 |
-
<p
|
222 |
""")
|
223 |
|
224 |
with gr.Row():
|
@@ -229,7 +245,7 @@ with gr.Blocks(title="Tic Tac Toe", css=CSS) as demo:
|
|
229 |
reset_btn = gr.Button("π Reset Game", elem_classes=["neat-button"])
|
230 |
|
231 |
gr.Markdown("""
|
232 |
-
<div
|
233 |
<ul>
|
234 |
<li><strong>Player 1:</strong> β</li>
|
235 |
<li><strong>Player 2 / Computer:</strong> β</li>
|
|
|
111 |
CSS = """
|
112 |
body, .gradio-container {
|
113 |
background: #fff0f5 !important;
|
114 |
+
padding: 1rem 1.5rem;
|
115 |
box-sizing: border-box;
|
116 |
min-height: 100vh;
|
117 |
display: flex;
|
118 |
justify-content: center;
|
119 |
align-items: center;
|
120 |
flex-direction: column;
|
121 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
122 |
+
color: #5b021f;
|
123 |
+
}
|
124 |
+
|
125 |
+
/* Heading and subtext */
|
126 |
+
h1 {
|
127 |
+
font-size: clamp(1.8rem, 5vw, 2.5rem);
|
128 |
+
color: #db2777;
|
129 |
+
margin-bottom: 0.2rem;
|
130 |
+
text-align: center;
|
131 |
+
font-weight: 700;
|
132 |
+
user-select: none;
|
133 |
+
}
|
134 |
+
|
135 |
+
.subtext {
|
136 |
+
font-size: clamp(1rem, 3vw, 1.1rem);
|
137 |
+
color: #9d174d;
|
138 |
+
text-align: center;
|
139 |
+
margin-bottom: 1.5rem;
|
140 |
+
user-select: none;
|
141 |
}
|
142 |
|
143 |
/* Board container: perfect square, responsive */
|
|
|
157 |
.game-btn {
|
158 |
width: 100%;
|
159 |
height: 100%;
|
160 |
+
font-size: clamp(2rem, 6vw, 3.5rem) !important;
|
161 |
border-radius: 12px !important;
|
162 |
background: #fff0f5 !important;
|
163 |
border: 2px solid #f9a8d4 !important;
|
|
|
177 |
.neat-button {
|
178 |
padding: 12px 16px;
|
179 |
border-radius: 8px;
|
180 |
+
font-size: clamp(0.9rem, 3vw, 1.1rem);
|
181 |
margin: 6px 0;
|
182 |
background: #fce7f3;
|
183 |
border: 1px solid #f472b6;
|
|
|
185 |
font-weight: 600;
|
186 |
width: 100%;
|
187 |
box-sizing: border-box;
|
188 |
+
user-select: none;
|
189 |
}
|
190 |
.neat-button:hover {
|
191 |
background: #f9a8d4;
|
|
|
195 |
|
196 |
/* Status */
|
197 |
#status {
|
198 |
+
font-size: clamp(1rem, 4vw, 1.2rem);
|
199 |
font-weight: bold;
|
200 |
color: #db2777;
|
201 |
text-align: center;
|
202 |
margin: 1rem 0;
|
203 |
+
user-select: none;
|
204 |
+
}
|
205 |
+
|
206 |
+
/* Player legend text */
|
207 |
+
.player-legend {
|
208 |
+
font-size: clamp(0.85rem, 3vw, 1rem);
|
209 |
+
color: #831843;
|
210 |
+
margin-top: 0.5rem;
|
211 |
+
user-select: none;
|
212 |
}
|
213 |
|
|
|
214 |
@media (max-width: 768px) {
|
215 |
#board-container {
|
216 |
width: 90vw;
|
|
|
220 |
gap: 8px;
|
221 |
}
|
222 |
.game-btn {
|
223 |
+
font-size: clamp(1.8rem, 7vw, 2.5rem) !important;
|
224 |
}
|
225 |
.neat-button {
|
226 |
+
font-size: clamp(0.85rem, 4vw, 1rem);
|
227 |
}
|
228 |
#status {
|
229 |
+
font-size: clamp(0.95rem, 4vw, 1.1rem);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
}
|
231 |
}
|
232 |
"""
|
233 |
|
234 |
with gr.Blocks(title="Tic Tac Toe", css=CSS) as demo:
|
235 |
gr.Markdown("""
|
236 |
+
<h1>π TIC TAC TOE π - By Shafaq Mandha</h1>
|
237 |
+
<p class="subtext">Play solo or with a friend β may the best player win!</p>
|
238 |
""")
|
239 |
|
240 |
with gr.Row():
|
|
|
245 |
reset_btn = gr.Button("π Reset Game", elem_classes=["neat-button"])
|
246 |
|
247 |
gr.Markdown("""
|
248 |
+
<div class="player-legend">
|
249 |
<ul>
|
250 |
<li><strong>Player 1:</strong> β</li>
|
251 |
<li><strong>Player 2 / Computer:</strong> β</li>
|