Improve text input styling and behavior to match book design theme. Changes include: 1. Update input styling to span full width with subtle bottom border. 2. Add custom blinking cursor with terminal-like behavior. 3. Implement auto-focus functionality for better UX. 4. Reset cursor position after command submission.

This commit is contained in:
2025-04-01 11:11:10 +00:00
parent 1882acac8c
commit 5cb31a65d9
3 changed files with 161 additions and 47 deletions
+53 -33
View File
@@ -259,20 +259,6 @@ cap {
transition: opacity 0.5s;
}
#choices {
display: grid;
grid-template-columns: repeat(3, 1fr);
width: calc(var(--book-width) * 0.39)px;
}
#choices *:first-child {
grid-column: 1 / -1;
}
#choices ol.categorized {
list-style-type: lower-alpha;
}
/*
Class applied to all choices
(Will always appear inside <p> element by default.)
@@ -582,32 +568,66 @@ ol.choice {
/* Input area */
#input_area {
display: flex;
margin-bottom: 15px;
display: block;
margin-top: 15px;
margin-bottom: 10px;
width: 100%;
}
/* Command input container */
#command_input {
width: 100%;
position: relative;
margin-top: 10px;
}
/* Input wrapper for positioning cursor */
.input-wrapper {
position: relative;
width: 100%;
display: inline-block;
}
/* Player input styling */
#player_input {
flex: 1;
padding: 8px 12px;
border: 1px solid #d1c8b9;
background: rgba(255, 255, 255, 0.8);
width: 100%;
background: transparent;
border: none;
border-bottom: 1px solid #8b7765;
font-family: 'EB Garamond', serif;
font-size: 16px;
font-size: 1.1rem;
color: #333;
outline: none;
border-radius: 4px 0 0 4px;
padding: 5px 0;
caret-color: transparent; /* Hide the default caret */
box-sizing: border-box;
}
#submit_command {
background-color: #8b7765;
border: 1px solid #8b7765;
color: white;
padding: 8px 12px;
cursor: pointer;
font-family: 'EB Garamond', serif;
border-radius: 0 4px 4px 0;
transition: background-color 0.2s;
#player_input:focus {
border-bottom-color: #333;
}
#submit_command:hover {
background-color: #6d5d4d;
/* Custom cursor styling */
#cursor {
position: absolute;
display: inline-block;
width: 8px;
height: 1.2em;
background-color: #333;
top: 6px;
left: 0;
animation: blink 1s step-end infinite;
pointer-events: none; /* Allow clicks to pass through to the input */
}
/* Placeholder styling - lighter and italic */
#player_input::placeholder {
color: #aaa;
font-style: italic;
}
/* Blinking animation */
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0; }
}