Files
wownerogue/html/styles/stylesheet.css
T
jwinterm 63e3006aca launch features: win feed, public stats, share-a-win, live CTA
Four pre-launch additions to make the game feel alive and shareable:

- Live win feed: server broadcasts 'win_feed' on every escape; client shows a
  transient toast ('X escaped with the bag') so the room feels active.
- Public stats: GET /api/stats (10s-cached) returns games + escapes in the last
  24h and total paid out; a status-area strip polls it for social proof.
- Share-a-win: game-over screen gets 'Share to X' + 'Copy link' buttons pointing
  at the /verify page, which now renders OpenGraph/Twitter-card meta (brand OG
  image per instance) so shared links unfurl with a preview.
- Land-on-action: a dismissible 'N games live now — watch' CTA appears on connect
  when games are in progress, opening the existing spectator panel. Non-intrusive:
  hidden while playing/spectating and never hijacks the canvas.
2026-06-01 09:17:48 -04:00

464 lines
11 KiB
CSS

/* Font declarations */
@font-face {
font-family: 'PixelOperator';
src: url('fonts/pixel-operator/PixelOperator.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'PixelOperator';
src: url('fonts/pixel-operator/PixelOperator-Bold.ttf') format('truetype');
font-weight: bold;
font-style: normal;
}
/* Updated layout with 5-row structure */
.container {
display: grid;
grid-template-areas:
"header header header"
"status game game"
"chat game game"
"input input input"
"footer footer footer";
grid-template-columns: 350px 1fr 1fr;
grid-template-rows: auto auto 1fr auto auto;
height: 100vh;
width: 100%;
max-width: 100vw;
overflow: hidden;
gap: 1px;
background-color: #222;
}
/* Header area */
.banner {
grid-area: header;
background-color: #111;
padding: 5px;
color: white;
text-align: left;
border-bottom: 1px solid #444;
font-family: 'PixelOperator', monospace;
font-weight: bold;
font-size: 24px;
letter-spacing: 1px;
}
/* Status area for block height display */
.status {
grid-area: status;
background-color: #222;
padding: 10px;
color: #0f0;
font-family: monospace;
display: flex;
flex-direction: column;
justify-content: flex-start;
border-right: 1px solid #444;
}
/* Make sure rotdis is properly visible across all browsers */
.rotdis {
grid-area: game;
background-color: #000;
border: 2px solid #444;
display: flex !important; /* Using flex to center canvas */
justify-content: center;
align-items: center;
/* min-height: 608px; */ /* REMOVED to allow shrinking */
width: 100%; /* Ensure it takes full width of its grid area */
height: 100%; /* Ensure it takes full height of its grid area */
position: relative;
overflow: hidden; /* Important to clip canvas if it somehow overflows */
z-index: 5;
}
.rotdis canvas {
display: block !important;
image-rendering: pixelated;
image-rendering: -moz-crisp-edges;
image-rendering: crisp-edges;
max-width: 100%; /* ADDED: Scale down to fit container width */
max-height: 100%; /* ADDED: Scale down to fit container height */
object-fit: contain; /* ADDED: Maintain aspect ratio when scaling */
}
/* Add debug overlay to see container bounds */
/* Chat messages area */
.chat-container {
grid-area: chat;
background-color: #222;
display: flex;
flex-direction: column;
border-right: 1px solid #444;
overflow: hidden; /* Prevents chat from causing scrolling */
}
#messageBox {
flex-grow: 1;
overflow-y: auto;
padding: 10px;
height: 100%;
max-height: 100%;
}
#messages {
list-style-type: none;
margin: 0;
padding: 0;
color: #fff; /* Default text color */;
}
#messages li {
padding: 3px 5px;
margin-bottom: 2px;
word-break: break-word;
}
/* Chat input area, now in its own row */
.input-container {
grid-area: input;
background-color: #333;
padding: 10px;
border-top: 1px solid #444;
border-bottom: 1px solid #444;
}
#chatForm {
display: flex;
width: 100%;
}
#chatInput {
flex-grow: 1;
padding: 8px;
border: none;
background-color: #444;
color: #fff;
border-radius: 3px 0 0 3px;
}
#chatForm button {
padding: 0 20px;
background-color: #555;
color: white;
border: none;
cursor: pointer;
border-radius: 0 3px 3px 0;
}
/* Add this to your stylesheet to use the font in other places */
#staticbanner {
font-family: 'PixelOperator', monospace;
font-weight: bold;
letter-spacing: 1px;
padding: 10px;
}
.footer {
grid-area: footer;
background-color: #111;
color: #888;
padding: 5px;
text-align: center;
font-size: 0.8em;
font-family: 'PixelOperator', sans-serif;
}
/* Game messages styling */
li.game-start {
color: #0f0;
font-weight: bold;
text-align: center;
margin: 5px 0;
padding: 2px 0;
background: rgba(0,255,0,0.1);
}
li.error {
color: #f00;
font-weight: bold;
font-family: monospace;
padding: 2px 5px;
background: rgba(255,0,0,0.1);
border-left: 2px solid #f00;
}
li.debug {
color: #0ff;
font-family: monospace;
font-size: 0.9em;
padding-left: 10px;
border-left: 2px solid #0ff;
}
/* Utility */
.hidden {
display: none !important;
}
/* Modal styling */
.modal-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.85);
display: flex;
justify-content: center;
align-items: center;
z-index: 10000;
padding: 20px;
}
.modal-content {
background: #0a0a0f;
border: 2px solid #0ff;
border-radius: 6px;
width: min(480px, 90vw);
padding: 20px;
color: #0ff;
font-family: 'PixelOperator', monospace;
position: relative;
box-shadow: 0 0 18px rgba(0, 255, 255, 0.2);
}
.modal-content h2 {
margin-top: 0;
margin-bottom: 8px;
font-size: 20px;
}
.modal-description {
margin-top: 0;
margin-bottom: 16px;
font-size: 12px;
color: #9cf;
}
.modal-label {
display: block;
margin-bottom: 6px;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.05em;
}
#addressModalInput {
width: 100%;
background: #020205;
border: 1px solid #0ff;
border-radius: 4px;
color: #0ff;
padding: 10px;
font-family: monospace;
resize: vertical;
min-height: 100px;
box-shadow: inset 0 0 6px rgba(0, 255, 255, 0.15);
}
.modal-actions {
margin-top: 16px;
display: flex;
justify-content: flex-end;
gap: 12px;
}
.modal-actions button {
padding: 8px 16px;
border-radius: 4px;
border: 1px solid #0ff;
background: #031c28;
color: #0ff;
cursor: pointer;
font-family: inherit;
}
.modal-actions button#addressModalSave {
background: #013d2a;
border-color: #0f7;
color: #0f7;
}
.modal-actions button:hover {
box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}
.modal-close {
position: absolute;
top: 8px;
right: 10px;
background: transparent;
border: none;
color: #0ff;
font-size: 18px;
cursor: pointer;
}
.modal-feedback {
margin-top: 12px;
font-size: 12px;
min-height: 16px;
}
.modal-feedback.error {
color: #ff6b6b;
}
.modal-feedback.success {
color: #5dff9c;
}
.modal-feedback.info {
color: #9cf6ff;
}
/* =========================================================================
Win feed toasts (global "someone escaped" announcements)
========================================================================= */
#win-feed {
position: fixed;
top: 56px;
right: 12px;
z-index: 1800;
display: flex;
flex-direction: column;
gap: 6px;
pointer-events: none;
max-width: min(320px, 80vw);
}
.win-toast {
background: rgba(0, 30, 0, 0.92);
border: 1px solid #0f0;
border-left: 4px solid #4ade80;
border-radius: 6px;
color: #cffccf;
font-family: 'PixelOperator', monospace;
font-size: 13px;
padding: 8px 12px;
box-shadow: 0 0 14px rgba(0, 255, 0, 0.18);
opacity: 0;
transform: translateX(40px);
transition: opacity 0.35s ease, transform 0.35s ease;
}
.win-toast.show { opacity: 1; transform: translateX(0); }
.win-toast strong { color: #4ade80; }
/* =========================================================================
Mobile / touch support
========================================================================= */
#touch-dpad { display: none; }
/* Short button labels (START / WATCH) are shown only on mobile; see media query. */
.lbl-short { display: none; }
@media (max-width: 820px) {
/* Stack the desktop 3-column grid into a single column.
Rows: header / status / game / CHAT(flex) / input / footer.
The game row is `auto` (sized by the canvas's own aspect ratio at full width)
and the CHAT row takes the leftover space (1fr) instead — so the play area fills
the screen width and chat gets whatever height remains. */
.container {
grid-template-areas:
"header"
"status"
"game"
"chat"
"input"
"footer";
grid-template-columns: 1fr;
grid-template-rows: auto auto auto 1fr auto auto;
height: 100vh;
height: 100dvh; /* exclude mobile browser chrome where supported */
}
/* Game area: full width, height follows the 800x608 (25x19 tile) canvas ratio.
This makes the dungeon fill the screen width instead of being letterboxed by a
short, height-constrained grid row. The canvas fills the box exactly. */
.rotdis {
grid-area: game;
width: 100%;
aspect-ratio: 800 / 608;
height: auto;
min-height: 0;
box-sizing: border-box;
border-width: 1px;
}
.rotdis canvas {
width: 100% !important;
height: 100% !important;
}
.banner { font-size: 16px; padding: 4px 6px; }
#staticbanner { font-size: 15px !important; }
.status {
border-right: none;
border-bottom: 1px solid #444;
flex-direction: row;
flex-wrap: wrap;
gap: 4px 14px;
padding: 6px 8px;
font-size: 12px;
}
/* Chat fills the leftover vertical space and scrolls internally. */
.chat-container { min-height: 0; }
#messageBox { max-height: none; height: 100%; }
.footer { font-size: 9px; padding: 2px 4px; line-height: 1.3; }
/* Use the short labels (START / WATCH) and compact the three primary action
buttons so they share a single row on most phones. */
.lbl-full { display: none; }
.lbl-short { display: inline; }
#startButton, #watchGamesButton, #shopButton {
padding: 7px 6px !important;
font-size: 13px !important;
margin: 5px 0 0 0 !important;
flex: 1 1 0;
min-width: 0;
white-space: nowrap;
}
/* Fixed-width modals would overflow tiny screens — make them fit */
#payment-ui, #history-panel, #leaderboard-panel {
min-width: 0 !important;
width: 94vw !important;
max-width: 94vw !important;
max-height: 88vh !important;
overflow-y: auto !important;
padding: 14px !important;
}
}
/* On-screen D-pad — styling defined unconditionally; shown on small screens (media query
above) OR any touch device (body.touch set by touchControls.js for landscape/tablets). */
@media (max-width: 820px) { #touch-dpad { display: grid; } }
body.touch #touch-dpad { display: grid; }
#touch-dpad {
grid-template-areas: ". up ." "left . right" ". down .";
gap: 6px;
position: fixed;
right: 12px;
bottom: 70px;
z-index: 1500;
opacity: 0.4;
touch-action: none;
}
#touch-dpad button {
width: 44px; height: 44px;
font-size: 17px;
background: rgba(0,40,0,0.5);
color: #0f0;
border: 2px solid rgba(0,255,0,0.7);
border-radius: 9px;
padding: 0;
-webkit-user-select: none; user-select: none;
touch-action: manipulation;
}
#touch-dpad button:active { background: rgba(0,255,0,0.9); color: #000; }
#dpad-up { grid-area: up; }
#dpad-down { grid-area: down; }
#dpad-left { grid-area: left; }
#dpad-right { grid-area: right; }