assassin-bug/src/game/index.html

645 lines
20 KiB
HTML
Raw Normal View History

2023-04-24 11:23:56 +00:00
<html>
<head>
<title>Assassin bug</title>
<style>
2025-07-18 14:33:56 +00:00
/* ===== CSS RESET & BASE STYLES ===== */
*,
*::before,
*::after {
2023-04-24 11:23:56 +00:00
margin: 0;
padding: 0;
box-sizing: border-box;
}
2025-07-18 14:33:56 +00:00
/* ===== CSS CUSTOM PROPERTIES ===== */
2023-04-24 11:23:56 +00:00
:root {
2025-07-18 14:33:56 +00:00
/* Colors */
2023-04-24 11:23:56 +00:00
--background-color: #2d3142;
2025-07-18 14:33:56 +00:00
--surface-color: rgba(255, 255, 255, 0.05);
2023-04-24 11:23:56 +00:00
--primary-color: #ef8354;
--secondary-color: #ffd462;
--text-color: #f5e7dc;
2025-07-18 14:33:56 +00:00
--text-muted: rgba(245, 231, 220, 0.7);
--border-color: rgba(239, 131, 84, 0.3);
--focus-color: #ffd462;
--success-color: #4caf50;
--error-color: #f44336;
--warning-color: #ff9800;
/* Typography */
--font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
--heading-font-family: Georgia, 'Times New Roman', serif;
--font-size-base: 16px;
--font-size-small: 0.875rem;
--font-size-large: 1.125rem;
2023-04-24 11:23:56 +00:00
--line-height: 1.6;
2025-07-18 14:33:56 +00:00
--font-weight-normal: 400;
--font-weight-bold: 600;
/* Spacing */
--spacing-xs: 0.25rem;
--spacing-sm: 0.5rem;
--spacing-md: 1rem;
--spacing-lg: 1.5rem;
--spacing-xl: 2rem;
--spacing-xxl: 3rem;
/* Borders & Radii */
--border-radius: 8px;
--border-radius-sm: 4px;
--border-radius-lg: 12px;
--border-width: 1px;
/* Shadows */
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
--shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
--shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
--shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
/* Transitions */
--transition-fast: 0.15s ease-out;
--transition-normal: 0.3s ease-out;
--transition-slow: 0.5s ease-out;
/* Layout */
--max-width: 800px;
--dialog-width: 500px;
--mobile-breakpoint: 768px;
}
/* Dark theme adjustments */
:root[data-theme="dark"] {
--background-color: #1a1a1a;
--surface-color: rgba(255, 255, 255, 0.08);
--text-color: #f0f0f0;
--border-color: rgba(255, 255, 255, 0.2);
}
/* ===== BASE TYPOGRAPHY & LAYOUT ===== */
html {
font-size: var(--font-size-base);
scroll-behavior: smooth;
2023-04-24 11:23:56 +00:00
}
body {
2025-07-18 14:33:56 +00:00
background: var(--background-color);
2023-04-24 11:23:56 +00:00
color: var(--text-color);
font-family: var(--font-family);
2025-07-18 14:33:56 +00:00
font-size: var(--font-size-base);
2023-04-24 11:23:56 +00:00
line-height: var(--line-height);
2025-07-18 14:33:56 +00:00
padding: var(--spacing-xl);
min-height: 100vh;
font-weight: var(--font-weight-normal);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
2023-04-24 11:23:56 +00:00
}
2025-07-18 14:33:56 +00:00
/* Typography */
h1, h2, h3, h4, h5, h6 {
2023-04-24 11:23:56 +00:00
font-family: var(--heading-font-family);
color: var(--primary-color);
2025-07-18 14:33:56 +00:00
margin-bottom: var(--spacing-md);
font-weight: var(--font-weight-bold);
line-height: 1.2;
2023-04-24 11:23:56 +00:00
}
2025-07-18 14:33:56 +00:00
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }
2023-04-24 11:23:56 +00:00
p {
2025-07-18 14:33:56 +00:00
margin-bottom: var(--spacing-md);
2023-04-24 11:23:56 +00:00
}
a {
color: var(--primary-color);
text-decoration: none;
2025-07-18 14:33:56 +00:00
transition: color var(--transition-fast);
2023-04-24 11:23:56 +00:00
}
a:hover,
a:focus {
color: var(--secondary-color);
2025-07-18 14:33:56 +00:00
outline: 2px solid var(--focus-color);
outline-offset: 2px;
}
/* Focus styles for accessibility */
:focus-visible {
outline: 2px solid var(--focus-color);
outline-offset: 2px;
2023-04-24 11:23:56 +00:00
}
2025-07-18 14:33:56 +00:00
/* ===== LAYOUT COMPONENTS ===== */
2023-04-24 11:23:56 +00:00
.game-container {
2025-07-18 14:33:56 +00:00
max-width: var(--max-width);
2023-04-24 11:23:56 +00:00
margin: 0 auto;
2025-07-18 14:33:56 +00:00
padding: var(--spacing-xl);
background: var(--surface-color);
border-radius: var(--border-radius);
box-shadow: var(--shadow-lg);
backdrop-filter: blur(10px);
border: var(--border-width) solid var(--border-color);
2023-04-24 11:23:56 +00:00
}
2025-07-18 14:33:56 +00:00
/* ===== FORM CONTROLS ===== */
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
2023-04-24 11:23:56 +00:00
width: 100%;
2025-07-18 14:33:56 +00:00
padding: var(--spacing-sm) var(--spacing-md);
font-size: var(--font-size-base);
font-family: var(--font-family);
margin: var(--spacing-sm) 0;
border: var(--border-width) solid var(--border-color);
border-radius: var(--border-radius-sm);
background: var(--surface-color);
color: var(--text-color);
transition: all var(--transition-fast);
2023-04-24 11:23:56 +00:00
}
2025-07-18 14:33:56 +00:00
input:focus,
select:focus,
textarea:focus {
2023-04-24 11:23:56 +00:00
outline: none;
2025-07-18 14:33:56 +00:00
border-color: var(--focus-color);
box-shadow: 0 0 0 3px rgba(255, 212, 98, 0.1);
2023-04-24 11:23:56 +00:00
}
/* Button styles */
button {
2025-07-18 14:33:56 +00:00
background: var(--primary-color);
color: white;
padding: var(--spacing-sm) var(--spacing-md);
font-size: var(--font-size-base);
font-family: var(--font-family);
font-weight: var(--font-weight-bold);
2023-04-24 11:23:56 +00:00
border: none;
2025-07-18 14:33:56 +00:00
border-radius: var(--border-radius-sm);
2023-04-24 11:23:56 +00:00
cursor: pointer;
2025-07-18 14:33:56 +00:00
transition: all var(--transition-fast);
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--spacing-xs);
min-height: 44px; /* Minimum touch target size */
text-align: center;
2023-04-24 11:23:56 +00:00
}
2025-07-18 14:33:56 +00:00
button:hover:not(:disabled) {
background: var(--secondary-color);
transform: translateY(-1px);
box-shadow: var(--shadow-md);
2023-04-24 11:23:56 +00:00
}
2025-07-18 14:33:56 +00:00
button:active {
transform: translateY(0);
}
button:disabled {
opacity: 0.6;
cursor: not-allowed;
}
/* Button variants */
.btn-secondary {
background: var(--surface-color);
color: var(--text-color);
border: var(--border-width) solid var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
background: var(--primary-color);
color: white;
}
/* ===== DARK THEME SUPPORT ===== */
2023-04-24 11:23:56 +00:00
body.dark-theme {
2025-07-18 14:33:56 +00:00
--background-color: #1a1a1a;
--surface-color: rgba(255, 255, 255, 0.08);
--text-color: #f0f0f0;
--border-color: rgba(255, 255, 255, 0.2);
}
/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
/* High contrast support */
@media (prefers-contrast: high) {
:root {
--border-color: var(--text-color);
--surface-color: transparent;
}
}
/* ===== MOBILE COMMAND INTERFACE ===== */
.mode-toggle {
text-align: center;
margin-bottom: var(--spacing-md);
}
.mode-button {
padding: var(--spacing-sm) var(--spacing-md);
font-size: var(--font-size-small);
min-width: 120px;
position: relative;
}
.input-mode {
margin-top: var(--spacing-md);
}
.mobile-mode {
position: sticky;
bottom: 0;
background: var(--background-color);
border-top: 2px solid var(--primary-color);
padding: var(--spacing-md);
margin: var(--spacing-md) calc(-1 * var(--spacing-xl)) calc(-1 * var(--spacing-xl)) calc(-1 * var(--spacing-xl));
max-height: 50vh;
overflow-y: auto;
border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.command-interface h3 {
margin-top: 0;
margin-bottom: var(--spacing-md);
color: var(--primary-color);
text-align: center;
}
.command-categories-permanent {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: var(--spacing-md);
}
.command-category {
background: var(--surface-color);
border: var(--border-width) solid var(--border-color);
border-radius: var(--border-radius);
padding: var(--spacing-sm);
transition: all var(--transition-fast);
}
.command-category:hover {
border-color: var(--primary-color);
box-shadow: var(--shadow-md);
}
.command-category summary {
cursor: pointer;
padding: var(--spacing-sm);
background: var(--primary-color);
color: white;
border-radius: var(--border-radius-sm);
font-weight: var(--font-weight-bold);
margin-bottom: var(--spacing-sm);
transition: all var(--transition-fast);
list-style: none;
}
.command-category summary::-webkit-details-marker {
display: none;
2023-04-24 11:23:56 +00:00
}
2025-07-18 14:33:56 +00:00
.command-category summary::before {
content: "▶";
margin-right: var(--spacing-xs);
transition: transform var(--transition-fast);
}
.command-category[open] summary::before {
transform: rotate(90deg);
}
.command-category summary:hover {
background: var(--secondary-color);
transform: translateY(-1px);
}
.command-list {
padding: var(--spacing-sm) 0;
}
.command-button {
display: block;
width: 100%;
margin-bottom: var(--spacing-sm);
padding: var(--spacing-sm);
text-align: left;
border: var(--border-width) solid var(--border-color);
background: var(--surface-color);
color: var(--text-color);
border-radius: var(--border-radius-sm);
font-size: var(--font-size-small);
transition: all var(--transition-fast);
}
.command-button:hover {
background: var(--primary-color);
color: white;
transform: translateY(-1px);
box-shadow: var(--shadow-sm);
}
.command-description {
font-size: var(--font-size-small);
opacity: 0.8;
margin-top: var(--spacing-xs);
}
/* ===== DIALOG STYLES ===== */
dialog {
border: 2px solid var(--primary-color);
border-radius: var(--border-radius);
padding: var(--spacing-xl);
background: var(--background-color);
color: var(--text-color);
max-width: var(--dialog-width);
width: 90%;
box-shadow: var(--shadow-xl);
backdrop-filter: blur(10px);
}
dialog::backdrop {
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(2px);
}
.dialog-buttons {
display: flex;
gap: var(--spacing-md);
justify-content: flex-end;
margin-top: var(--spacing-lg);
}
.argument-group {
margin-bottom: var(--spacing-lg);
}
.argument-group label {
display: block;
margin-bottom: var(--spacing-sm);
font-weight: var(--font-weight-bold);
2023-04-24 11:23:56 +00:00
color: var(--primary-color);
}
2025-07-18 14:33:56 +00:00
/* ===== ACCESSIBLE ITEM SELECTOR ===== */
.item-selector {
border: var(--border-width) solid var(--border-color);
border-radius: var(--border-radius);
padding: var(--spacing-md);
background: var(--surface-color);
max-height: 300px;
overflow-y: auto;
}
.item-selector-legend {
font-weight: var(--font-weight-bold);
2023-04-24 11:23:56 +00:00
color: var(--primary-color);
2025-07-18 14:33:56 +00:00
padding: 0 var(--spacing-sm);
}
.item-location-section {
margin-bottom: var(--spacing-md);
2023-04-24 11:23:56 +00:00
}
2025-07-18 14:33:56 +00:00
.item-location-heading {
margin: 0 0 var(--spacing-sm) 0;
font-size: var(--font-size-small);
2023-04-24 11:23:56 +00:00
color: var(--secondary-color);
2025-07-18 14:33:56 +00:00
font-weight: var(--font-weight-bold);
}
.item-radio-container {
margin-bottom: var(--spacing-sm);
padding: var(--spacing-sm);
border-radius: var(--border-radius-sm);
transition: all var(--transition-fast);
}
.item-radio-container:hover {
background: var(--surface-color);
}
.item-radio-container:focus-within {
background: rgba(255, 212, 98, 0.1);
outline: 2px solid var(--focus-color);
outline-offset: 2px;
2023-04-24 11:23:56 +00:00
}
2025-07-18 14:33:56 +00:00
.item-radio {
margin-right: var(--spacing-sm);
accent-color: var(--primary-color);
2023-04-24 11:23:56 +00:00
}
2025-07-18 14:33:56 +00:00
.item-radio-label {
cursor: pointer;
font-weight: var(--font-weight-bold);
display: block;
margin-bottom: var(--spacing-xs);
}
.item-radio-description {
font-size: var(--font-size-small);
color: var(--text-muted);
display: block;
margin-left: 1.5rem;
}
.no-items-message {
text-align: center;
padding: var(--spacing-md);
color: var(--text-muted);
font-style: italic;
}
/* ===== RESPONSIVE DESIGN ===== */
/* Tablet and Mobile */
@media (max-width: 768px) {
body {
padding: var(--spacing-md);
}
.game-container {
padding: var(--spacing-md);
}
.command-categories-permanent {
grid-template-columns: 1fr;
}
.mobile-mode {
margin: var(--spacing-md) calc(-1 * var(--spacing-md)) calc(-1 * var(--spacing-md)) calc(-1 * var(--spacing-md));
}
dialog {
margin: var(--spacing-md);
max-width: calc(100% - 2 * var(--spacing-md));
}
/* Mobile mode hint */
.mode-button {
position: relative;
}
.mode-button::after {
content: "👆 Try this for easier mobile play!";
position: absolute;
top: -35px;
left: 50%;
transform: translateX(-50%);
background: var(--secondary-color);
color: var(--background-color);
padding: var(--spacing-xs) var(--spacing-sm);
border-radius: var(--border-radius-sm);
font-size: var(--font-size-small);
white-space: nowrap;
opacity: 0.9;
pointer-events: none;
z-index: 1000;
}
/* Typography adjustments for mobile */
h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
}
/* Small Mobile */
@media (max-width: 480px) {
body {
padding: var(--spacing-sm);
}
.game-container {
padding: var(--spacing-sm);
}
.mobile-mode {
margin: var(--spacing-sm) calc(-1 * var(--spacing-sm)) calc(-1 * var(--spacing-sm)) calc(-1 * var(--spacing-sm));
}
.command-categories-permanent {
gap: var(--spacing-sm);
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
}
/* Large screens */
@media (min-width: 1200px) {
.game-container {
max-width: 1000px;
}
.command-categories-permanent {
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
}
/* Dark mode preference */
@media (prefers-color-scheme: dark) {
:root {
--background-color: #1a1a1a;
--surface-color: rgba(255, 255, 255, 0.08);
--text-color: #f0f0f0;
--border-color: rgba(255, 255, 255, 0.2);
}
}
/* Print styles */
@media print {
body {
background: white;
color: black;
font-size: 12pt;
}
.mobile-mode,
.mode-toggle,
button {
display: none;
}
2023-04-24 11:23:56 +00:00
}
</style>
</head>
<body>
<h1>Assassin bug</h1>
<div class="game-container" id="play-area" hidden=true>
2025-07-18 14:33:56 +00:00
<!-- Mode Toggle -->
<div class="mode-toggle">
<button id="toggle-input-mode" class="mode-button">📱 Mobile Mode</button>
</div>
<!-- Output Area -->
2023-04-24 11:23:56 +00:00
<div aria-live="polite" id="output-area"></div>
2025-07-18 14:33:56 +00:00
<!-- Text Input Mode -->
<div id="text-input-mode" class="input-mode">
<input type="text" id="input-area" placeholder="Type command" />
</div>
<!-- Mobile Command Mode -->
<div id="mobile-command-mode" class="input-mode mobile-mode" hidden>
<div class="command-interface">
<h3>Commands</h3>
<div class="command-categories-permanent">
<details class="command-category" open>
<summary>Movement</summary>
<div class="command-list" data-category="Movement"></div>
</details>
<details class="command-category" open>
<summary>Actions</summary>
<div class="command-list" data-category="Actions"></div>
</details>
<details class="command-category" open>
<summary>System</summary>
<div class="command-list" data-category="System"></div>
</details>
</div>
</div>
</div>
<!-- Command Argument Dialog -->
<dialog id="command-dialog" aria-labelledby="command-title" aria-describedby="command-arguments">
<form method="dialog">
<h3 id="command-title">Command</h3>
<div id="command-arguments" role="group" aria-label="Command arguments"></div>
<div class="dialog-buttons">
<button type="button" id="execute-command" aria-describedby="command-title">Execute Command</button>
<button type="button" id="cancel-command">Cancel</button>
</div>
</form>
</dialog>
2023-04-24 11:23:56 +00:00
</div>
<div id="save-game-found" hidden=true>
<h1>Found a save game</h1>
<button id="load-save-game">Load</button>
<button id="start-new-game">New</button>
</div>
<div id="before-play">
<h1>Welcome</h1>
<button id="begin">Begin the adventure</button>
</div>
</body>
2021-11-03 11:08:40 +00:00
</html>