Rotary_Phone / style.css
Pp's picture
Update style.css
10412e5 verified
:root {
--phone-body-color: #e0dacd; /* Creamy beige */
--dial-plate-bg: linear-gradient(145deg, #d3cabd, #f8f5ee); /* Subtle gradient */
--dial-plate-border: #a89d8a;
--hole-color: #5c554a; /* Dark brown */
--number-color: #403a30;
--finger-stop-color: #b0a492; /* Metallic-ish stop */
--finger-stop-border: #7d7365;
--display-bg: #4a443b; /* Dark display */
--display-text: #ffc107; /* Amber text */
--button-bg: #795548; /* Brown */
--button-text: #ffffff;
--dial-size: 300px; /* Slightly larger */
--hole-size: calc(var(--dial-size) * 0.13);
--number-font-size: calc(var(--dial-size) * 0.075); /* Slightly smaller number */
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #f0ece3; /* Light background */
font-family: 'Orbitron', sans-serif; /* Techy font */
overflow: hidden; /* Prevent scrollbars during drag */
user-select: none; /* Prevent text selection during drag */
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
.phone-body {
background-color: var(--phone-body-color);
padding: 35px;
border-radius: 20px;
box-shadow: 8px 8px 20px rgba(0,0,0,0.25),
inset 0 0 15px rgba(255,255,255,0.3),
inset 0 0 10px rgba(0,0,0,0.1);
display: flex;
flex-direction: column;
align-items: center;
}
.display-panel {
display: flex;
align-items: stretch; /* Make items same height */
width: 90%;
max-width: 320px;
height: 50px;
border-radius: 8px;
overflow: hidden; /* Clip corners */
margin-bottom: 35px;
background-color: var(--display-bg);
box-shadow: inset 3px 3px 8px rgba(0,0,0,0.5);
}
#dialed-numbers {
flex-grow: 1; /* Take available space */
color: var(--display-text);
font-size: 2em;
padding: 5px 15px;
display: flex;
align-items: center;
justify-content: flex-end; /* Numbers align right */
letter-spacing: 3px;
text-shadow: 0 0 5px rgba(255, 193, 7, 0.5); /* Glow effect */
overflow: hidden; /* Prevent long numbers breaking layout */
white-space: nowrap;
}
#call-button {
flex-shrink: 0; /* Don't shrink */
width: 60px; /* Fixed width */
background-color: var(--button-bg);
color: var(--button-text);
border: none;
border-left: 2px solid rgba(0,0,0,0.2);
cursor: pointer;
font-size: 1.5em;
display: flex;
justify-content: center;
align-items: center;
transition: background-color 0.2s;
}
#call-button:hover {
background-color: #9c786c;
}
.dial-assembly {
position: relative;
width: var(--dial-size);
height: var(--dial-size);
}
#dial {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--dial-plate-bg);
border-radius: 50%;
border: 4px solid var(--dial-plate-border);
box-shadow: inset 0 0 15px rgba(0,0,0,0.2), 0 5px 10px rgba(0,0,0,0.2);
transform-origin: center center;
/* This transition controls the visual return speed */
transition: transform 0.55s cubic-bezier(0.15, 0.85, 0.25, 1);
}
.dial-center-design {
position: absolute;
width: 25%;
height: 25%;
top: 50%;
left: 50%;
background: radial-gradient(circle, #c8bba8 0%, var(--finger-stop-color) 100%);
border-radius: 50%;
transform: translate(-50%, -50%);
box-shadow: inset 1px 1px 5px rgba(0,0,0,0.4), 0 0 3px rgba(0,0,0,0.2);
z-index: 3; /* Above holes/numbers */
}
.hole {
position: absolute;
width: var(--hole-size);
height: var(--hole-size);
background-color: var(--hole-color);
border-radius: 50%;
top: 50%; /* Position origin for transform */
left: 50%;
/* Center the hole using negative margins */
margin-left: calc(var(--hole-size) / -2);
margin-top: calc(var(--hole-size) / -2);
cursor: grab;
z-index: 2; /* Above numbers */
box-shadow: inset 2px 2px 4px rgba(0,0,0,0.6);
/* Actual position set by JS translate */
}
.hole.dragging {
cursor: grabbing;
background-color: #7a7061; /* Lighter when dragging */
}
.dial-plate-number {
position: absolute;
/* Define area based on font size for centering */
width: calc(var(--number-font-size) * 1.5);
height: calc(var(--number-font-size) * 1.5);
top: 50%; /* Position origin for transform */
left: 50%;
/* Translate -50% of element size to center it on calculated point */
transform: translate(-50%, -50%);
display: flex;
justify-content: center;
align-items: center;
font-size: var(--number-font-size);
font-weight: 700;
color: var(--number-color);
z-index: 1; /* Below holes */
transform-origin: center center; /* Rotation point for text */
/* Final position and text rotation set by JS */
}
#finger-stop {
position: absolute;
width: 18px;
height: 45px;
background: linear-gradient(to bottom, #cac0b2, var(--finger-stop-color));
border: 1px solid var(--finger-stop-border);
border-radius: 9px 9px 5px 5px; /* Shaped top/bottom */
box-shadow: 1px 1px 4px rgba(0,0,0,0.5);
z-index: 4; /* Above everything */
/* Position & Rotation set by JS */
}
#clear-button {
margin-top: 30px;
padding: 10px 25px;
font-size: 1em;
background-color: var(--button-bg);
color: var(--button-text);
border: none;
border-radius: 5px;
cursor: pointer;
box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
transition: background-color 0.2s, transform 0.1s;
}
#clear-button:hover {
background-color: #9c786c;
}
#clear-button:active {
transform: translateY(1px);
box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}