* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --home-accent: #7aa2f7;
    --accent: var(--home-accent);
    --text-color: #e0e0e0;
    --status-color: var(--accent);
    --panel-bg: #111;
    --body-bg: #0a0a0a;
    --game-bg: #000;
    --game-status-color: var(--accent);
    --title-shadow: color-mix(in srgb, var(--accent) 40%, transparent);
    --countdown-color: #ffd700;
}

body {
    font-family: "Courier New", monospace;
    background-color: var(--body-bg);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

#container {
    max-width: 1200px;
    width: 100%;
}

#connection-panel,
#lobby-panel {
    text-align: center;
    padding: 40px;
    background: var(--panel-bg);
    border: 2px solid var(--accent);
    border-radius: 8px;
}

#lobby-panel {
    position: relative;
}

h1 {
    font-size: 3em;
    margin-bottom: 5px;
    color: var(--accent);
    text-shadow: 0 0 15px var(--title-shadow);
}

.subtitle {
    color: #888;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.subtitle:empty {
    display: none;
}

h2 {
    color: var(--accent);
    margin-bottom: 20px;
}

#username-form {
    margin: 20px 0;
}

label {
    display: block;
    margin-bottom: 10px;
    font-size: 1.2em;
}

input {
    background: #000;
    border: 2px solid var(--accent);
    color: var(--accent);
    padding: 10px 20px;
    font-size: 1.1em;
    font-family: "Courier New", monospace;
    width: 300px;
    max-width: 100%;
}

input:focus {
    outline: none;
    box-shadow: 0 0 10px var(--title-shadow);
}

button {
    --accent-hover: color-mix(in srgb, var(--accent), white 20%);
    --accent-active: color-mix(in srgb, var(--accent), black 20%);
    background: var(--accent);
    color: #000;
    border: none;
    padding: 12px 30px;
    font-size: 1.1em;
    font-family: "Courier New", monospace;
    cursor: pointer;
    margin: 5px;
    font-weight: bold;
    border-radius: 4px;
}

button:hover {
    background: var(--accent-hover);
}

button:active {
    background: var(--accent-active);
}

button:disabled {
    background: #555;
    cursor: not-allowed;
}

button.btn-outline {
    background: rgba(0, 0, 0, 0.6);
    color: var(--accent);
    border: 2px solid var(--accent);
}

button.btn-outline:hover {
    background: var(--accent-hover);
    color: #000;
}

button.btn-outline:active {
    background: var(--accent-active);
    color: #000;
}

a {
    color: inherit;
    text-decoration: none;
}

#top-links {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 5;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

#top-links a,
#top-links summary {
    font-family: "Courier New", monospace;
    font-size: 0.9em;
    padding: 6px 10px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--accent);
    border: 1px solid var(--accent);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

#top-links summary::-webkit-details-marker {
    display: none;
}

#top-links a:hover,
#top-links summary:hover {
    background: var(--accent);
    color: #000;
}

#download-dropdown {
    position: relative;
}

#download-dropdown[open] summary {
    background: var(--accent);
    color: #000;
}

#download-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 240px;
    background: var(--panel-bg);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 8px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.dl-game + .dl-game {
    margin-top: 6px;
    border-top: 1px solid #222;
    padding-top: 6px;
}

.dl-game-name {
    padding: 4px 12px;
    color: var(--accent);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#download-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

#download-menu li a {
    display: block;
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--accent);
    font-size: 0.9em;
}

#download-menu li a:hover {
    background: var(--accent);
    color: #000;
}

#download-menu li.active a::before {
    content: "▸ ";
}

.dl-version {
    color: #555;
    font-size: 0.85em;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 4px;
}

.dl-note {
    margin-top: 8px;
    padding: 8px 12px;
    border-top: 1px solid #222;
    color: #888;
    font-size: 0.75em;
    line-height: 1.5;
}

.dl-note strong {
    color: var(--accent);
}

.dl-note code {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 6px;
    background: #1c1c1c;
    border: 1px solid #2a2a2a;
    color: var(--accent);
    border-radius: 3px;
    font-family: "Courier New", monospace;
    font-size: 0.95em;
    white-space: pre;
}

.dl-note .dl-code {
    position: relative;
    display: block;
    margin: 6px 0 0;
    padding: 6px 32px 6px 10px;
    background: #1c1c1c;
    border: 1px solid #2a2a2a;
    color: var(--accent);
    border-radius: 3px;
    font-family: "Courier New", monospace;
    font-size: 0.95em;
    line-height: 1.4;
    white-space: pre;
    cursor: pointer;
    outline: none;
    transition: background 0.15s;
}

.dl-note .dl-code:hover,
.dl-note .dl-code:focus-visible {
    background: #262626;
}

.dl-note .dl-code code {
    display: inline;
    margin: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    border-radius: 0;
    font: inherit;
    white-space: inherit;
}

.dl-note .dl-code::after {
    content: "⧉";
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 1em;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.dl-note .dl-code:hover::after,
.dl-note .dl-code:focus-visible::after {
    opacity: 1;
}

.dl-note .dl-code.copied::after {
    content: "✓ copied";
    font-size: 0.75em;
    opacity: 1;
}

#home-link,
#leave-lobby-btn {
    font-family: "Courier New", monospace;
    font-size: 1em;
    padding: 6px 10px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.6);
    font-weight: normal;
    margin: 0;
    cursor: pointer;
}

#home-link {
    position: fixed;
    top: 16px;
    left: 20px;
    z-index: 50;
    color: var(--home-accent);
    border: 1px solid var(--home-accent);
}

#home-link:hover {
    background: var(--home-accent);
    color: #000;
}

#leave-lobby-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    color: var(--accent);
    border: 1px solid var(--accent);
}

#leave-lobby-btn:hover {
    background: var(--accent);
    color: #000;
}

#mode-buttons {
    margin: 20px 0;
}

.room-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #333;
}

.join-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.join-row input {
    width: 120px;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 3px;
}

#status {
    margin-top: 20px;
    font-size: 1.1em;
    color: var(--status-color);
}

#room-code-display {
    font-size: 2em;
    color: var(--accent);
    margin: 15px 0;
    letter-spacing: 5px;
}

#player-list {
    margin: 20px 0;
    font-size: 1.2em;
    line-height: 1.8;
}

#countdown-display {
    font-size: 1.5em;
    color: var(--countdown-color);
    margin: 15px 0;
}

#lobby-extra {
    margin: 10px 0 15px;
    color: var(--accent);
    font-size: 1.1em;
}

#game-container {
    background: var(--game-bg);
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 10px;
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    max-width: 100vw;
    position: fixed;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

#terminal {
    background: var(--game-bg);
    padding: 10px;
    font-size: 14px;
    line-height: 1.2;
    overflow: hidden;
    white-space: pre;
    font-family: "Courier New", monospace;
    flex: 1;
}

#hotspot-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 20;
}

.hotspot {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    background: transparent;
}

#terminal .e {
    display: inline-block;
    width: 2ch;
    text-align: center;
    overflow: hidden;
    vertical-align: top;
}

#terminal .eg {
    display: inline-block;
    font-size: 0.75em;
    line-height: 1.33;
}

#game-status {
    margin-top: 10px;
    text-align: center;
    font-size: 1.1em;
    color: var(--game-status-color);
}


.game-over-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    padding: 30px 50px;
    border: 2px solid #ffd700;
    border-radius: 12px;
    text-align: center;
    z-index: 100;
    cursor: pointer;
}

.game-over-title {
    color: #ffd700;
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 10px;
}

.game-over-winner {
    color: #fff;
    font-size: 1.5em;
}

.game-over-hint {
    color: #888;
    font-size: 0.9em;
    margin-top: 15px;
}

#site-footer {
    position: fixed;
    bottom: 8px;
    left: 0;
    right: 0;
    text-align: center;
    color: #555;
    font-size: 0.8em;
}

.secret-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.92);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 4px;
    z-index: 200;
}

.presence {
    margin-top: 12px;
    color: #888;
    font-size: 0.9em;
    min-height: 1.2em;
}

.queue-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    padding: 12px 18px;
    background: rgba(0, 0, 0, 0.92);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 4px;
    z-index: 200;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.queue-toast:hover {
    background: var(--accent);
    color: #000;
}

#add-bot-control {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    margin: 6px 4px;
}

#add-bot-control button#add-bot-btn {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

#add-bot-control button#add-bot-toggle {
    padding: 4px 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

#add-bot-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--panel-bg);
    border: 1px solid var(--accent);
    border-radius: 4px;
    z-index: 50;
    margin-top: 2px;
    min-width: 100px;
}

#add-bot-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-color);
    padding: 6px 12px;
    cursor: pointer;
}

#add-bot-menu button:hover {
    background: var(--accent);
    color: #000;
}

.remove-bot-x {
    background: none;
    border: none;
    color: #888;
    font-size: 1.1em;
    cursor: pointer;
    padding: 0 4px;
    margin-left: 4px;
}

.remove-bot-x:hover {
    color: #ff5252;
}
