Skip to content

Commit 31dee31

Browse files
CopilotDevn913
andauthored
fix: single-viewport layout, move history scroll, responsive SQL input panel
Agent-Logs-Url: https://github.com/Devn913/SQL_Chess/sessions/052975b6-ec35-4bd5-b064-c6a2d8159115 Co-authored-by: Devn913 <56478595+Devn913@users.noreply.github.com>
1 parent 6fb03b6 commit 31dee31

2 files changed

Lines changed: 26 additions & 16 deletions

File tree

css/style.css

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212

1313
--chess-panel-padding: 4rem; /* total horizontal padding within chess panel (2 × 1rem + margins) */
1414

15-
/* Board size: fills the 70 % chess panel minus padding, capped at 760 px */
16-
--board-sz: clamp(320px, calc(70vw - var(--chess-panel-padding) * 2), 760px);
15+
/* Board size: fills the 70 % chess panel minus padding, capped at 720 px.
16+
Also constrained by viewport height (subtracting ~280px for header 56px +
17+
player bars ~80px + controls ~40px + move history ~100px + gaps ~4px). */
18+
--board-sz: clamp(300px, min(calc(70vw - var(--chess-panel-padding) * 2), calc(100vh - 280px)), 720px);
1719

1820
--text-primary: #e6edf3;
1921
--text-secondary: #8b949e;
@@ -59,7 +61,7 @@ body {
5961
background: var(--bg-base);
6062
color: var(--text-primary);
6163
line-height: 1.5;
62-
overflow-x: hidden;
64+
overflow: hidden;
6365
}
6466

6567
button { cursor: pointer; font-family: inherit; }
@@ -70,7 +72,8 @@ a { color: var(--accent-blue); }
7072
#app {
7173
display: flex;
7274
flex-direction: column;
73-
min-height: 100vh;
75+
height: 100vh;
76+
overflow: hidden;
7477
}
7578

7679
/* ── Header ────────────────────────────────────────────────── */
@@ -167,7 +170,7 @@ a { color: var(--accent-blue); }
167170
width: 70%;
168171
min-width: 0;
169172
overflow-y: auto;
170-
justify-content: center;
173+
scrollbar-width: thin;
171174
}
172175

173176
/* When SQL panel is hidden, chess panel fills the available space */
@@ -377,10 +380,11 @@ a { color: var(--accent-blue); }
377380
gap: .25rem;
378381
padding: .5rem .6rem;
379382
min-height: 2.5rem;
380-
max-height: 120px;
383+
max-height: 160px;
381384
overflow-y: auto;
382385
font-family: var(--font-mono);
383386
font-size: .8rem;
387+
scrollbar-width: thin;
384388
}
385389
.move-pair {
386390
display: flex;
@@ -401,8 +405,8 @@ a { color: var(--accent-blue); }
401405

402406
/* ── SQL Panel ──────────────────────────────────────────────── */
403407
.sql-panel {
404-
flex: 0 0 25%;
405-
width: 25%;
408+
flex: 0 0 30%;
409+
width: 30%;
406410
display: flex;
407411
flex-direction: column;
408412
border-left: 1px solid var(--bg-border);
@@ -461,6 +465,7 @@ a { color: var(--accent-blue); }
461465
flex-direction: column;
462466
gap: .75rem;
463467
scroll-behavior: smooth;
468+
scrollbar-width: thin;
464469
}
465470

466471
.sql-placeholder {
@@ -738,7 +743,7 @@ input:checked + .slider::before { transform: translateX(18px); }
738743
/* ── SQL Input Section ──────────────────────────────────────── */
739744
.sql-input-section {
740745
flex-shrink: 0;
741-
border-top: 1px solid var(--bg-border);
746+
border-bottom: 1px solid var(--bg-border);
742747
background: var(--bg-surface);
743748
display: flex;
744749
flex-direction: column;
@@ -749,8 +754,9 @@ input:checked + .slider::before { transform: translateX(18px); }
749754
display: flex;
750755
align-items: center;
751756
justify-content: space-between;
752-
padding: .4rem .75rem;
757+
padding: .6rem 1rem;
753758
border-bottom: 1px solid var(--bg-border);
759+
min-height: 44px;
754760
}
755761

756762
.sql-input-title {
@@ -840,27 +846,31 @@ input:checked + .slider::before { transform: translateX(18px); }
840846
}
841847

842848
@media (max-width: 900px) {
843-
.app-main { flex-direction: column; }
849+
.app-main { flex-direction: column; overflow-y: auto; overflow-x: hidden; }
844850

845851
.chess-panel {
846852
flex: none;
847853
width: 100%;
848-
justify-content: flex-start;
854+
min-height: auto;
855+
overflow-y: visible;
849856
}
850857

851858
.sql-panel {
852859
flex: none;
853860
width: 100%;
854861
border-left: none;
855862
border-top: 1px solid var(--bg-border);
856-
max-height: 40vh;
863+
height: 45vh;
864+
min-height: 260px;
857865
}
858866
.sql-panel.hidden-panel {
859-
max-height: 0;
867+
height: 0;
868+
min-height: 0;
860869
border-top: none;
861870
}
862871

863-
:root { --board-sz: min(90vw, 420px); }
872+
/* Mobile: limit by both viewport width and height to handle short screens */
873+
:root { --board-sz: min(90vw, 440px, calc(55vh)); }
864874
}
865875

866876
@media (max-width: 480px) {

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ <h2 class="sql-title">
101101
id="sqlMoveInput"
102102
class="sql-move-input"
103103
spellcheck="false"
104-
rows="4"
104+
rows="3"
105105
placeholder="UPDATE chess_piece&#10;SET position = 'e4'&#10;WHERE position = 'e2';&#10;&#10;-- or shorthand: e2 e4"></textarea>
106106
<div class="sql-input-actions">
107107
<span class="sql-run-error hidden" id="sqlRunError"></span>

0 commit comments

Comments
 (0)