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

body {
    font-family: 'Courier New', monospace;
    background: #0a0a0a;
    color: #fff;
    overflow: hidden;
}

#app {
    width: 100vw;
    height: 100vh;
}

#game-container {
    display: none;
    width: 100%;
    height: 100%;
    position: relative;
}

#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#timer {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 25px;
    border-radius: 8px;
    border: 2px solid #4ecdc4;
    font-size: 32px;
    font-weight: bold;
    color: #4ecdc4;
    text-align: center;
    min-width: 150px;
}

#strikes {
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid #ff6b6b;
    font-size: 18px;
    color: #ff6b6b;
}

#game-status {
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid #4ecdc4;
    font-size: 18px;
    color: #4ecdc4;
}

#canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#bomb-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
}

#session-info {
    margin-bottom: 10px;
}

#connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

#connection-indicator {
    font-size: 20px;
}

#connection-indicator.connected {
    color: #4ecdc4;
}

#connection-indicator.disconnected {
    color: #ff6b6b;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.menu-content {
    text-align: center;
    background: rgba(26, 26, 26, 0.95);
    padding: 40px;
    border-radius: 12px;
    border: 2px solid #4ecdc4;
    max-width: 800px;
}

.menu-content h1 {
    color: #4ecdc4;
    margin-bottom: 40px;
    font-size: 32px;
}

#menu-cards {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.menu-card {
    background: rgba(26, 26, 26, 0.95);
    border: 2px solid #4ecdc4;
    border-radius: 12px;
    padding: 30px;
    min-width: 280px;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    transition: all 0.3s;
}

.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(78, 205, 196, 0.3);
    border-color: #5eddd4;
}

.menu-card h2 {
    color: #4ecdc4;
    margin: 0;
    font-size: 24px;
    text-align: center;
}

.menu-card p {
    color: #999;
    margin: 0;
    text-align: center;
    font-size: 14px;
}

.menu-card button {
    width: 100%;
    margin-top: 10px;
}

#menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

button {
    background: #4ecdc4;
    color: #000;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

button:hover {
    background: #5eddd4;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(78, 205, 196, 0.3);
}

button:active {
    transform: translateY(0);
}

#join-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    margin-top: 10px;
}

#join-form input[type="text"] {
    padding: 12px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    background: #1a1a1a;
    color: #fff;
    border: 2px solid #4ecdc4;
    border-radius: 6px;
    outline: none;
    width: 100%;
}

#join-form input[type="text"]:focus {
    border-color: #5eddd4;
}

#join-form label {
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

#join-form input[type="radio"] {
    cursor: pointer;
}

#join-form button {
    background: #ff6b6b;
    width: 100%;
}

#join-form button:hover {
    background: #ff7b7b;
}

#manual-container {
    display: none;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: #1a1a1a;
    color: #fff;
    padding: 20px;
}

#manual-menu-view {
    max-width: 1200px;
    margin: 0 auto;
}

#manual-menu-title {
    color: #4ecdc4;
    text-align: center;
    font-size: 36px;
    margin-bottom: 40px;
    margin-top: 20px;
}

#manual-module-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
    padding: 20px;
}

.module-card {
    background: rgba(26, 26, 26, 0.95);
    border: 2px solid #4ecdc4;
    border-radius: 12px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    min-height: 250px;
    justify-content: center;
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(78, 205, 196, 0.3);
    border-color: #5eddd4;
}

.module-card-icon {
    font-size: 64px;
    margin-bottom: 10px;
}

.module-card h2 {
    color: #4ecdc4;
    margin: 0;
    font-size: 24px;
    text-align: center;
}

.module-card p {
    color: #999;
    margin: 0;
    text-align: center;
    font-size: 14px;
}

#manual-detail-view {
    max-width: 800px;
    margin: 0 auto;
}

.manual-back-button {
    background: #4ecdc4;
    color: #000;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
    display: inline-block;
}

.manual-back-button:hover {
    background: #5eddd4;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(78, 205, 196, 0.3);
}

#manual-content {
    max-width: 800px;
    margin: 0 auto;
}

#manual-content h1 {
    color: #ff6b6b;
    border-bottom: 2px solid #ff6b6b;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

#manual-content h2 {
    color: #4ecdc4;
    margin-top: 30px;
    margin-bottom: 15px;
}

.module-description {
    background: #2a2a2a;
    border-left: 4px solid #4ecdc4;
    padding: 15px;
    margin-bottom: 20px;
    color: #fff;
    font-size: 14px;
    line-height: 1.6;
    font-style: italic;
}

.session-info {
    background: #2a2a2a;
    padding: 10px;
    margin: 20px 0;
    border-radius: 5px;
}

.rule {
    background: #2a2a2a;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #4ecdc4;
}

.rule-number {
    font-weight: bold;
    color: #ff6b6b;
}

.wire-color {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin: 0 5px;
    vertical-align: middle;
}

.wire-color.red { background: #ff0000; }
.wire-color.blue { background: #0066ff; }
.wire-color.green { background: #00ff00; }
.wire-color.white { background: #ffffff; border: 2px solid #000; }
.wire-color.yellow { background: #ffff00; }

.wire-module-display {
    background: #2a2a2a;
    padding: 15px;
    margin: 10px 0;
    border-radius: 5px;
    border-left: 4px solid #4ecdc4;
}

.wire-module-display h3 {
    color: #4ecdc4;
    margin-bottom: 10px;
}

.wire-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

/* Lobby Styles */
#lobby-container {
    display: none;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    overflow-y: auto;
}

.lobby-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

#lobby-header {
    text-align: center;
    width: 100%;
}

#lobby-header h1 {
    color: #4ecdc4;
    font-size: 36px;
    margin-bottom: 15px;
}

#lobby-session-info {
    color: #999;
    font-size: 14px;
}

#lobby-session-id {
    font-size: 48px;
    font-weight: bold;
    color: #4ecdc4;
    letter-spacing: 4px;
}

#lobby-players-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#player-cards-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-width: 1000px;
}

.player-card {
    background: rgba(26, 26, 26, 0.95);
    border: 2px solid #4ecdc4;
    border-radius: 12px;
    padding: 20px;
    min-width: 200px;
    max-width: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    transition: all 0.3s;
    position: relative;
}

.player-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(78, 205, 196, 0.3);
}

.player-card.is-defuser {
    border-color: #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.player-card.is-defuser::before {
    content: "DEFUSER";
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff6b6b;
    color: #000;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
}

.player-name-input {
    background: transparent;
    border: 2px solid #4ecdc4;
    border-radius: 6px;
    padding: 8px 12px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    text-align: center;
    width: 100%;
    outline: none;
    transition: border-color 0.3s;
}

.player-name-input:focus {
    border-color: #5eddd4;
}

.player-name-input:disabled {
    border-color: #666;
    color: #999;
    cursor: not-allowed;
}

.player-type {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.select-defuser-btn {
    background: #4ecdc4;
    color: #000;
    border: none;
    padding: 8px 16px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.select-defuser-btn:hover {
    background: #5eddd4;
    transform: translateY(-2px);
}

#random-defuser-btn-container {
    margin-top: 10px;
}

.random-btn {
    background: #ff6b6b;
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.random-btn:hover {
    background: #ff7b7b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3);
}

#lobby-host-controls {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.lobby-settings-group {
    width: 100%;
    text-align: center;
}

.lobby-settings-group h3 {
    color: #4ecdc4;
    margin-bottom: 15px;
    margin-top: 30px;
    font-size: 18px;
}

.circular-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.circular-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #4ecdc4;
    background: transparent;
    color: #4ecdc4;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.circular-btn:hover {
    background: rgba(78, 205, 196, 0.2);
    transform: scale(1.1);
}

.circular-btn.active {
    background: #4ecdc4;
    color: #000;
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.5);
}

#start-game-btn {
    margin-top: 60px;
    padding: 15px 40px;
    font-size: 18px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

#start-game-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
}

#start-game-btn:disabled:hover {
    background: #666;
    transform: none;
    box-shadow: none;
}

#lobby-waiting-message {
    text-align: center;
    color: #666;
    font-size: 16px;
}

/* Terminal Input Overlay */
#terminal-input-overlay {
    position: absolute;
    z-index: 200;
    pointer-events: none;
    /* Debug: uncomment to see overlay bounds */
    /* border: 2px solid red; */
    /* background: rgba(255, 0, 0, 0.1); */
}

#terminal-input {
    background: transparent;
    border: none;
    outline: none;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 48px;
    font-weight: bold;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    caret-color: #00ff00;
    pointer-events: auto;
    opacity: 0.01; /* Nearly transparent but still clickable - text appears on canvas */
}

#terminal-input::placeholder {
    color: rgba(0, 255, 0, 0.5);
}

/* Terminal Module Manual Styles */
.terminal-rule-card {
    background: #2a2a2a;
    border: 2px solid #4ecdc4;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    position: relative;
    transition: all 0.3s;
}

.terminal-rule-card:hover {
    border-color: #5eddd4;
    box-shadow: 0 4px 12px rgba(78, 205, 196, 0.2);
}

.terminal-rule-number {
    position: absolute;
    top: -12px;
    left: 20px;
    background: #4ecdc4;
    color: #000;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
}

.terminal-io-container {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.terminal-input-display {
    flex: 1;
    min-width: 200px;
    background: #0a0a0a;
    border: 2px solid #00ff00;
    border-radius: 6px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    position: relative;
}

.terminal-prompt {
    color: #00ff00;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.terminal-arrow {
    font-size: 32px;
    color: #4ecdc4;
    font-weight: bold;
    flex-shrink: 0;
    padding: 0 10px;
}

.terminal-command-display {
    flex: 1;
    min-width: 200px;
    background: #1a1a1a;
    border: 2px solid #4ecdc4;
    border-radius: 6px;
    padding: 15px;
    font-family: 'Courier New', monospace;
}

.terminal-command-text {
    color: #4ecdc4;
    font-size: 16px;
    font-weight: bold;
    background: transparent;
    border: none;
    display: block;
    width: 100%;
}

/* Wire Module Manual Styles */
.wire-rule-card {
    background: #2a2a2a;
    border: 2px solid #ff6b6b;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    position: relative;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.wire-rule-card:hover {
    border-color: #ff7b7b;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
}

.wire-rule-number {
    position: absolute;
    top: -10px;
    left: 16px;
    background: #ff6b6b;
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
}

.wire-phrase-display {
    margin-top: 0;
    padding: 0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.wire-condition-text {
    color: #ff6b6b;
    font-weight: bold;
}

.wire-action-text {
    color: #4ecdc4;
    font-weight: bold;
}

/* Button Module Manual Styles */
.button-rule-card {
    background: #2a2a2a;
    border: 2px solid #ffd93d;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    position: relative;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.button-rule-card:hover {
    border-color: #ffed66;
    box-shadow: 0 4px 12px rgba(255, 217, 61, 0.2);
}

.button-rule-number {
    position: absolute;
    top: -10px;
    left: 16px;
    background: #ffd93d;
    color: #000;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
}

.button-phrase-display {
    margin-top: 0;
    padding: 0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.button-condition-text {
    color: #ffd93d;
    font-weight: bold;
}

.button-action-text {
    color: #4ecdc4;
    font-weight: bold;
}

