/**
 * Minimal webclient styles for LORD.
 * No build step - pure CSS served as a static file.
 */

@font-face {
    font-family: 'Web437-IBM-VGA';
    src: url('font/Web437_IBM_VGA_9x16.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

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

html, body {
    height: 100%;
    background: #000;
    color: #aaa;
    font-family: 'Courier New', monospace;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 44px;
}

#game {
    display: flex;
    justify-content: safe center;
    align-items: flex-start;
    flex: 0 0 auto;
    padding: 8px;
    /* Keep all 80 columns: scroll sideways on narrow screens, never truncate. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100vw;
}

@media (min-height: 700px) and (min-width: 780px) {
    #game { padding-top: 24px; }
}

#terminal-container {
    width: fit-content;
    height: fit-content;
}

/* RIP overlay - canvas sits over the terminal */
#rip-game-wrapper {
    position: relative;
}

#rip-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 10;
    background: #000;
}

#rip-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

/* When RIP is active, terminal floats over the canvas */
#rip-game-wrapper.rip-active #terminal-container {
    z-index: 20;
}

/* Controls bar */
#controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: #111;
    border-top: 1px solid #333;
    font-size: 12px;
    color: #888;
    z-index: 100;
}

#controls label {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    min-height: 44px;
}

#controls input[type="checkbox"] {
    margin-right: 4px;
    cursor: pointer;
}

#logout-btn {
    background: #333;
    color: #ccc;
    border: 1px solid #555;
    padding: 2px 10px;
    min-height: 44px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px;
}

#logout-btn:hover {
    background: #555;
    color: #fff;
}

#admin-link { color: #c9b48e; text-decoration: none; }
#admin-link:hover, #admin-link:focus-visible { color: #fff; text-decoration: underline; }

#feedback-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 9px;
    color: #c9b48e;
    text-decoration: underline;
}
#feedback-link:hover, #feedback-link:focus-visible { color: #fff; }

/* Connection status indicator */
#status {
    font-size: 11px;
    color: #666;
    z-index: 100;
}

#status.connected {
    color: #0a0;
}

#status.disconnected {
    color: #a00;
}

/* RIP pick list overlay */
.rip-picklist-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    background: rgba(0, 0, 0, 0.7);
}

.rip-picklist {
    background: #111;
    border: 2px solid #555;
    padding: 8px;
    max-height: 80%;
    overflow-y: auto;
    min-width: 200px;
}

.rip-picklist-item {
    padding: 4px 8px;
    cursor: pointer;
    color: #aaa;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.rip-picklist-item:hover {
    background: #333;
    color: #fff;
}

.rip-picklist-item.selected {
    background: #004;
    color: #5ff;
}

/* ── Prompt controls: DOS-palette touch buttons below the terminal ── */
#prompt-controls {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 8px 8px 12px;
    font-family: 'Web437-IBM-VGA', 'Courier New', monospace;
    font-size: 16px;
    color: #aaa;
}
#prompt-controls.pc-pending { opacity: 0.55; }
.pc-idle { color: #555; font-size: 14px; padding: 12px 0; text-align: center; }
.pc-label { color: #55ffff; margin-bottom: 6px; }
.pc-sr {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}
.pc-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 6px;
}
.pc-btn {
    min-height: 44px;
    min-width: 44px;
    background: #0000aa;
    color: #ffffff;
    border: 1px solid #5555ff;
    border-radius: 0;
    font: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.pc-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    text-align: left;
}
.pc-key {
    color: #ffff55;
    min-width: 2ch;
}
.pc-key::before { content: '('; color: #aa00aa; }
.pc-key::after { content: ')'; color: #aa00aa; }
.pc-text { overflow-wrap: anywhere; }
.pc-btn:hover:not(:disabled), .pc-btn:focus-visible {
    background: #00aaaa;
    color: #000;
    outline: none;
}
.pc-btn:hover:not(:disabled) .pc-key, .pc-btn:focus-visible .pc-key { color: #000; }
.pc-btn:disabled { background: #222; border-color: #444; color: #666; cursor: default; }
.pc-btn:disabled .pc-key { color: #666; }
.pc-form {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    align-items: stretch;
}
.pc-field {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    background: #000;
    color: #ffff55;
    border: 1px solid #aaa;
    border-radius: 0;
    padding: 6px 8px;
    font: inherit;
    font-size: 16px; /* prevents iOS zoom */
}
.pc-field:focus { outline: none; border-color: #55ffff; }
.pc-field:disabled { color: #555; border-color: #333; }
.pc-textarea { resize: vertical; min-height: 96px; }
.pc-submit { padding: 0 16px; }

@media (max-width: 600px) {
    .pc-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pc-form { flex-wrap: wrap; }
    .pc-submit { flex: 1 0 100%; }
}
.pc-anykey { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.pc-hint { color: #555; font-size: 14px; }
