1+ * {
2+ box-sizing : border-box;
3+ }
4+
15body {
26 margin : 0 ;
3- display : flex;
4- justify-content : center;
5- align-items : center;
7+ padding : 0 ;
68 height : 100vh ;
9+ width : 100vw ;
10+ overflow : hidden;
711 background-color : hsl (0 , 0% , 75% );
12+ font-family : Arial, Helvetica, sans-serif;
813}
914
1015# calculator {
11- font-family : Arial , Helvetica , sans-serif ;
12- background-color : hsl ( 0 , 0 % , 15 % ) ;
13- border-radius : 1 rem ; /* was 15px */
14- max-width : 90 vw ; /* responsive width */
15- width : 400 px ; /* fallback for large screens */
16+ width : 100 % ;
17+ height : 100 % ;
18+ display : flex;
19+ flex-direction : column;
20+ background : linear-gradient ( 135 deg , hsl ( 0 , 0 % , 20 % ) , hsl ( 0 , 0 % , 15 % ));
1621 overflow : hidden;
1722}
1823
1924# display {
20- width : calc (100% - 2rem ); /* padding-aware */
21- padding : 1.25rem ; /* was 20px */
22- font-size : 4rem ; /* scales with container */
25+ width : 100% ;
26+ padding : 2rem ;
27+ flex : 0 0 20% ;
28+ font-size : clamp (2rem , 10vh , 5rem );
2329 text-align : right;
2430 border : none;
25- background-color : hsl (0 , 0% , 20 % );
26- color : white ;
31+ background-color : hsl (0 , 0% , 10 % );
32+ color : # ffffff ;
2733 overflow-x : auto;
34+ overflow-y : hidden;
35+ resize : none;
36+ font-weight : bold;
2837}
2938
3039# keys {
3140 display : grid;
3241 grid-template-columns : repeat (4 , 1fr );
33- gap : 0.625rem ; /* was 10px */
34- padding : 1.5rem ; /* was 25px */
42+ gap : 1rem ;
43+ padding : 1.5rem ;
44+ flex : 1 ;
45+ grid-auto-rows : 1fr ;
46+ min-height : 0 ;
47+ width : 100% ;
48+ max-width : 80rem ;
49+ margin : 0 auto;
3550}
3651
3752button {
38- width : 100% ; /* fill grid cell */
39- aspect-ratio : 1 ; /* keep buttons square */
40- border-radius : 50% ; /* circular buttons */
53+ border-radius : 0.5rem ;
4154 border : none;
4255 background-color : hsl (0 , 0% , 30% );
4356 color : white;
44- font-size : 1.5 rem ; /* scales better on smaller screens */
57+ font-size : clamp ( 1 rem , 5 vw , 3 rem );
4558 font-weight : bold;
4659 cursor : pointer;
47- transition : background-color 0.2s ;
60+ transition : all 0.15s ease;
61+ box-shadow : 0 4px 8px rgba (0 , 0 , 0 , 0.3 );
62+ display : flex;
63+ align-items : center;
64+ justify-content : center;
4865}
4966
5067button : hover {
5168 background-color : hsl (0 , 0% , 40% );
69+ transform : translateY (-2px );
70+ box-shadow : 0 6px 12px rgba (0 , 0 , 0 , 0.4 );
5271}
5372
5473button : active {
5574 background-color : hsl (0 , 0% , 50% );
75+ transform : translateY (0 );
76+ box-shadow : 0 2px 4px rgba (0 , 0 , 0 , 0.2 );
5677}
5778
5879.operator-btn {
@@ -66,3 +87,27 @@ button:active {
6687.operator-btn : active {
6788 background-color : hsl (35 , 100% , 75% );
6889}
90+
91+ /* Mobile/Responsive adjustments */
92+ @media (max-width : 600px ) {
93+ # keys {
94+ gap : 0.75rem ;
95+ padding : 1rem ;
96+ }
97+
98+ # display {
99+ padding : 1.5rem 1rem ;
100+ }
101+ }
102+
103+ @media (max-width : 400px ) {
104+ # keys {
105+ gap : 0.5rem ;
106+ padding : 0.75rem ;
107+ }
108+
109+ # display {
110+ padding : 1rem ;
111+ font-size : clamp (1.5rem , 8vh , 3rem );
112+ }
113+ }
0 commit comments