/* Play page — full-viewport terminal client */

/* Hide site background image; terminal IS the background */
.play-page::before {
    display: none;
}

.play-page {
    overflow: hidden;
    background: #0a0a0a;
}

/* Terminal fills between navbar and vitals bar */
#terminal-container {
    position: fixed;
    top: 32px;
    bottom: 66px;
    left: 0;
    right: 0;
    background: #0a0a0a;
    overflow: hidden;
}

#terminal-container .xterm {
    height: 100%;
    padding: 2px 4px;
}

/* Vitals bar — fixed bottom */
.vitals-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 36px;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    gap: 0.75rem;
    font-size: 0.72rem;
    z-index: 100;
}

.vitals-bar.hidden {
    display: none;
}

/* When vitals are hidden, shift down past input bar only */
.vitals-bar.hidden ~ #terminal-container,
body:has(.vitals-bar.hidden) #terminal-container {
    bottom: 30px;
}

body:has(.vitals-bar.hidden) .input-bar {
    bottom: 0;
}

body:has(.vitals-bar.hidden) .side-panel {
    bottom: 30px;
}

.vitals-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.vitals-name {
    color: #d7af5f;
    font-weight: 600;
    white-space: nowrap;
}

.vitals-worth {
    color: #808080;
    font-size: 0.68rem;
    white-space: nowrap;
}

.vitals-gauges {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 1;
    min-width: 0;
    justify-content: center;
}

.gauge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.gauge-label {
    color: #606060;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    width: 30px;
}

.gauge-track {
    width: 80px;
    height: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.gauge-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 1px;
}

.gauge-hp .gauge-fill {
    background: #5faf5f;
}

.gauge-hp .gauge-fill.low {
    background: #af5f5f;
}

.gauge-hp .gauge-fill.mid {
    background: #d7af5f;
}

.gauge-mana .gauge-fill {
    background: #5f87af;
}

.gauge-move .gauge-fill {
    background: #d7af5f;
}

.gauge-text {
    color: #808080;
    font-size: 0.68rem;
    white-space: nowrap;
    min-width: 55px;
    flex-shrink: 0;
}

.vitals-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    margin-left: auto;
}

.vitals-status {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.vitals-status.connected {
    color: #5faf5f;
}

.vitals-status.reconnecting {
    color: #d7af5f;
}

.vitals-status.disconnected {
    color: #af5f5f;
}

/* Connection overlay */
.connect-status {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(5, 5, 5, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 1rem 1.5rem;
    color: #808080;
    font-size: 0.85rem;
    z-index: 200;
}

.connect-status.hidden {
    display: none;
}

.connect-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.connect-btn {
    background: rgba(95, 175, 95, 0.15);
    border: 1px solid rgba(95, 175, 95, 0.4);
    border-radius: 3px;
    color: #5faf5f;
    font-family: 'Berkeley Mono', 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
    font-size: 0.8rem;
    padding: 0.4rem 1.2rem;
    cursor: pointer;
    letter-spacing: 0.5px;
}

.connect-btn:hover {
    background: rgba(95, 175, 95, 0.25);
    border-color: rgba(95, 175, 95, 0.6);
}

.connect-btn.hidden {
    display: none;
}

/* Input bar — between terminal and vitals */
.input-bar {
    position: fixed;
    bottom: 36px;
    left: 0;
    right: 0;
    min-height: 30px;
    background: #0a0a0a;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: flex-start;
    padding: 4px 0.5rem;
    z-index: 100;
}

.input-prompt {
    color: #5faf5f;
    font-family: 'Berkeley Mono', 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 22px;
    margin-right: 0.4rem;
    flex-shrink: 0;
}

.input-field {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #c0c0c0;
    font-family: 'Berkeley Mono', 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 22px;
    height: 22px;
    padding: 0;
    margin: 0;
    resize: none;
    overflow: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
    caret-color: #5faf5f;
}

.input-field::placeholder {
    color: #404040;
}

.input-field.password-mode {
    -webkit-text-security: disc;
    color: #5faf5f;
}

/* Combat bar — prominent full-width bar above input, shown during combat */
.combat-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 66px;
    padding: 3px 0.75rem 4px;
    background: rgba(10, 5, 5, 0.95);
    border-top: 1px solid rgba(175, 95, 95, 0.2);
    z-index: 100;
}

.combat-bar.hidden {
    display: none;
}

.combat-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 2px;
    font-size: 0.68rem;
}

.combat-name {
    color: #cf8080;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.combat-condition {
    color: #606060;
    font-size: 0.62rem;
    white-space: nowrap;
    margin-left: auto;
}

.combat-pct {
    color: #808080;
    font-size: 0.62rem;
    white-space: nowrap;
    min-width: 2.5em;
    text-align: right;
}

.combat-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

.combat-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 1px;
    background: #5faf5f;
}

.combat-fill.low {
    background: #af5f5f;
}

.combat-fill.mid {
    background: #d7af5f;
}

/* Affects strip — between terminal and combat/input bar */
.affects-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 66px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 3px 0.5rem;
    background: rgba(5, 5, 5, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 100;
}

.affects-bar.hidden {
    display: none;
}

.affect-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    font-size: 0.62rem;
    color: #909090;
    white-space: nowrap;
}

.affect-pill .affect-name {
    color: #a0a0a0;
}

.affect-pill .affect-dur {
    color: #606060;
}

.affect-pill.wearing-off {
    border-color: rgba(175, 95, 95, 0.5);
    color: #af5f5f;
}

.affect-pill.wearing-off .affect-name {
    color: #cf8080;
}

.affect-pill.wearing-off .affect-dur {
    color: #af5f5f;
}

.affect-pill.permanent .affect-dur {
    color: #5f875f;
}

/* Side panel — right side, resizable: map on top, tabs below */
.side-panel {
    position: fixed;
    top: 32px;
    bottom: 66px;
    right: 0;
    width: 240px;
    min-width: 140px;
    max-width: 50vw;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.side-panel.hidden {
    display: none;
}

.panel-drag {
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    z-index: 51;
}

.panel-drag:hover,
.panel-drag.dragging {
    background: rgba(95, 175, 95, 0.3);
}

/* Map section (top half of side panel) */
.panel-map {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.panel-map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.panel-section-title {
    color: #606060;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-close {
    background: none;
    border: none;
    color: #505050;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.panel-close:hover {
    color: #af5f5f;
}

#map-canvas {
    flex: 1;
    width: 100%;
    min-height: 0;
    image-rendering: pixelated;
}

/* Panel status line (below map: room name + time/weather) */
.panel-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.2rem 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
    min-height: 20px;
}

.panel-room {
    color: #5fafaf;
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

.panel-time {
    font-size: 0.65rem;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 0.5rem;
    color: #606060;
}

/* Horizontal split divider between map and tabs */
.panel-hsplit {
    height: 4px;
    cursor: row-resize;
    background: rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
}

.panel-hsplit:hover,
.panel-hsplit.dragging {
    background: rgba(95, 175, 95, 0.3);
}

/* Tabs section (bottom half of side panel) */
.panel-tabs {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.panel-tab-bar {
    display: flex;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #505050;
    font-family: 'Berkeley Mono', 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.3rem 0;
    cursor: pointer;
    position: relative;
}

.panel-tab:hover {
    color: #808080;
}

.panel-tab.active {
    color: #a0a0a0;
    border-bottom-color: #5faf5f;
}

.panel-tab .tab-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 5px;
    height: 5px;
    background: #5faf5f;
    border-radius: 50%;
}

.panel-tab-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.tab-pane {
    display: none;
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 0.35rem 0.5rem;
    font-size: 0.7rem;
}

.tab-pane.active {
    display: block;
}

/* Scrollbar styling for tab panes */
.tab-pane::-webkit-scrollbar {
    width: 4px;
}

.tab-pane::-webkit-scrollbar-track {
    background: transparent;
}

.tab-pane::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Room tab */
.room-section-label {
    color: #505050;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.4rem;
    margin-bottom: 0.2rem;
}

.room-section-label:first-child {
    margin-top: 0;
}

.room-entry {
    padding: 1px 0;
    color: #808080;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-entry.player {
    color: #d7af5f;
}

.room-entry.npc {
    color: #808080;
}

.room-entry.item {
    color: #707070;
}

.room-empty {
    color: #404040;
    font-style: italic;
    padding: 0.5rem 0;
}

/* Group tab */
.group-empty {
    color: #404040;
    font-style: italic;
    padding: 0.5rem 0;
}

.group-leader-label {
    color: #505050;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}

.group-member {
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.group-member:last-child {
    border-bottom: none;
}

.group-member-name {
    color: #d7af5f;
    font-size: 0.7rem;
}

.group-member-info {
    color: #505050;
    font-size: 0.6rem;
}

.group-member-bars {
    display: flex;
    gap: 3px;
    margin-top: 2px;
}

.group-bar {
    flex: 1;
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 1px;
    overflow: hidden;
}

.group-bar-fill {
    height: 100%;
    border-radius: 1px;
    transition: width 0.3s ease;
}

.group-bar.hp .group-bar-fill {
    background: #5faf5f;
}

.group-bar.hp .group-bar-fill.low {
    background: #af5f5f;
}

.group-bar.hp .group-bar-fill.mid {
    background: #d7af5f;
}

.group-bar.mana .group-bar-fill {
    background: #5f87af;
}

.group-bar.move .group-bar-fill {
    background: #d7af5f;
}

.group-member-tnl {
    color: #404040;
    font-size: 0.58rem;
    margin-top: 1px;
}

/* Chat tab */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-msg {
    font-size: 0.68rem;
    line-height: 1.3;
    word-wrap: break-word;
}

.chat-channel {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-right: 3px;
}

.chat-speaker {
    color: #a0a0a0;
    margin-right: 2px;
}

.chat-text {
    color: #808080;
}

/* Channel colors */
.ch-yell { color: #d7af5f; }
.ch-say { color: #5faf5f; }
.ch-tell { color: #af5faf; }
.ch-reply { color: #af5faf; }
.ch-newbie { color: #5fafdf; }
.ch-pray { color: #d7d75f; }
.ch-cabal { color: #af5f5f; }
.ch-clan { color: #5f87af; }
.ch-faction { color: #5fafaf; }

/* Panel toggle button */
.panel-toggle {
    position: fixed;
    top: 36px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(5, 5, 5, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    color: #505050;
    font-size: 1rem;
    cursor: pointer;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.panel-toggle:hover {
    color: #5faf5f;
    border-color: rgba(95, 175, 95, 0.3);
}

.panel-toggle.hidden {
    display: none;
}

/* Popout button (in navbar) */
.popout-btn {
    background: none;
    border: none;
    color: #606060;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 0.15rem;
    line-height: 1;
    vertical-align: middle;
}

.popout-btn:hover {
    color: #5faf5f;
}

/* Popout mode — no navbar, terminal fills to top */
.play-page.popout .navbar,
.play-page.popout .mobile-overlay,
.play-page.popout .mobile-nav,
.play-page.popout .popout-btn {
    display: none !important;
}

.play-page.popout #terminal-container {
    top: 0;
}

.play-page.popout .side-panel {
    top: 0;
}

.play-page.popout .panel-toggle {
    top: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .side-panel,
    .panel-toggle {
        display: none !important;
    }

    #terminal-container {
        right: 0 !important;
        top: 32px;
        bottom: 102px;
    }

    .vitals-bar {
        height: auto;
        min-height: 36px;
        flex-wrap: wrap;
        padding: 0.35rem 0.5rem;
        gap: 0.25rem;
    }

    .vitals-gauges {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
    }

    .gauge-track {
        width: 60px;
    }

    .vitals-worth {
        display: none;
    }
}

@media (max-width: 480px) {
    .navbar {
        height: 40px;
    }

    #terminal-container {
        top: 40px;
    }

    .gauge-label {
        display: none;
    }

    .gauge-text {
        font-size: 0.6rem;
        min-width: 40px;
    }

    .gauge-track {
        width: 50px;
    }
}
