/* side-panels.css -- the tabbed side panels shared by mp (mp.html) and the
   pp page (index.html at my.<base>; pp/env/browser/furniture.mjs): the tab
   strip, the panes, the Messages log and the Inventory pane, and the
   control-help (.mp-help) and right-hand (.mp-picker) panels, and the
   farlook box over the left panel (#mp-hover-info). Moved as they were from
   mp.html, which links this file where the rules stood. */

/* --- Control-help panel (left-hand side panel) --------------------- */
/* Mirrors mazesofmenace.net's #keyref styling verbatim (adapted to the
   .mp-help selectors), so the LHS matches the live single-player look and
   balances the right-hand games roster (both use the shared .side-panel
   width, so #game-frame stays centered in #main). */
.mp-help {
    font-family: var(--font-serif);
    /* Small Garamond, matching the games roster on the right. */
    font-size: var(--panel-font-size);
    color: var(--color-accent);
    order: -1;              /* sits before the terminal in the flex row */
    /* No right padding: at larger font sizes it pushed the pane wide enough to
       wrap the flex row; the table's own cell spacing gives enough gap. */
    line-height: 1.22;
}
.mp-help-table { border-spacing: 0; }
.mp-help-table td {
    padding: 0 var(--spacing-sm) 0 0;
    white-space: nowrap;
}
.mp-help-table td:first-child {
    font-family: var(--font-mono);
    color: #444;
    text-align: right;
    padding-right: 0.8em;
}
.mp-help-section td {
    font-family: var(--font-serif);
    color: #6b5b3a;
    font-size: calc(var(--game-font-size) * 0.75);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-top: 0;
    padding-bottom: 0.2em;
    border-bottom: 1px solid #c8b88f;
    text-align: left;
}
.mp-help-section:not(:first-child) td { padding-top: 0.6em; }
body.dark-mode .mp-help { color: #c8c0a8; }
body.dark-mode .mp-help-table td:first-child { color: #d4d4d4; }
body.dark-mode .mp-help-section td { color: #9a8a6a; border-bottom-color: #4a3f28; }

/* --- Game picker (right-hand side panel) --------------------------- */
.mp-picker {
    font-family: var(--font-serif);
    color: var(--color-accent);
    /* No left padding: at larger font sizes it pushed the pane wide enough to
       wrap the flex row. */
    align-self: stretch;
}
.mp-picker-label {
    font-size: calc(var(--game-font-size) * 0.7);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b5b3a;
    border-bottom: 1px solid #c8b88f;
    padding-bottom: 0.2em;
    margin-bottom: 0.3em;
}
/* Tabbed side-panel headers (Controls|Messages, Games|Inventory):
   a two-button tab strip styled like .mp-picker-label. */
.mp-tabs {
    display: flex;
    gap: 1.1em;
    border-bottom: 1px solid #c8b88f;
    margin-bottom: 0.3em;
    flex: 0 0 auto;   /* fixed strip; the pane below takes the rest */
}
.mp-tab {
    position: relative;       /* anchors the unread badge (below) */
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 0 0 0.2em 0;
    font-family: inherit;
    font-size: calc(var(--game-font-size) * 0.7);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #b3a487;            /* inactive tab: dimmed */
    cursor: pointer;
    line-height: 1;
}
.mp-tab:hover { color: #6b5b3a; }
/* Unread badge: absolutely positioned so it OVERLAPS the top-right of the
   label's last letter instead of taking layout space (which, in the tight tab
   strip, wrapped the dot onto the next line). */
.mp-tab.mp-tab-unread::after {
    content: '';
    position: absolute;
    top: -2px; right: -3px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #c0392b;
    pointer-events: none;
}
.mp-tab.active {
    color: #6b5b3a;
    border-bottom-color: #6b5b3a;
    cursor: default;
}
/* !important: pane-specific display rules (e.g. the games pane's
   display:flex for the roster search layout) tie this selector's
   specificity and appear later in the file; hidden must always win. */
.mp-tab-pane.hidden { display: none !important; }
/* The active pane fills the panel below the tab strip and is the single
   scroll container, so its height tracks the TTY exactly. */
.mp-tab-pane { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
body.dark-mode .mp-tabs { border-bottom-color: #4a4030; }
body.dark-mode .mp-tab { color: #7d7156; }
body.dark-mode .mp-tab:hover { color: #b8a36d; }
body.dark-mode .mp-tab.active { color: #b8a36d; border-bottom-color: #b8a36d; }

/* Messages pane — scrolling pline log, one message per line, newest at
   the top by default (bottom when the rc asks for oldest-first), a very
   thin line marking each new game turn. */
#mp-messages-body {
    font-family: var(--font-serif);
    font-size: var(--panel-font-size);
    color: var(--fg-2);
    line-height: 1.25;
}
.mp-msg {
    white-space: normal;
    overflow-wrap: break-word;
    padding: 0.04em 0;
}
.mp-msg.turn-break {
    border-top: 1px solid #d8c8a0;
    margin-top: 0.18em;
    padding-top: 0.22em;
}
body.dark-mode #mp-messages-body { color: #c8c0a8; }
body.dark-mode .mp-msg.turn-break { border-top-color: #4a4030; }
/* The newest message stands out: the first line when the pane is reversed
   (newest at top, the default), the last line otherwise. Brown on the light
   #f9f7f1 background, yellow on the dark #111 one. */
#mp-messages-body.mp-msg-reversed > .mp-msg:first-child,
#mp-messages-body:not(.mp-msg-reversed) > .mp-msg:last-child { color: #8b4513; }
body.dark-mode #mp-messages-body.mp-msg-reversed > .mp-msg:first-child,
body.dark-mode #mp-messages-body:not(.mp-msg-reversed) > .mp-msg:last-child { color: #f0d040; }

/* Inventory pane: #perm-invent is normally an absolute underlay in
   #hover-panel; inside the tab pane it flows normally and scrolls. The
   "Inventory" tab already labels it, so hide its internal pi-header. */
/* Controls help fits within the tty height, so no scrollbar. */
.mp-tab-pane[data-pane="controls"] { overflow: visible; }
/* Clickable command-help letters + inventory items: hover-underline (and a
   pointer cursor) ONLY when a click would be accepted -- body.cmd-ready at the
   command prompt, body.getobj-ready while a command awaits an object letter
   (both set from the engine's input context in main.mjs). */
body.cmd-ready .mp-help-table .mp-key:hover { text-decoration: underline; cursor: pointer; }
body.cmd-ready .mp-tab-pane[data-pane="inventory"] .pi-item:not(.pi-empty-slot):hover,
body.getobj-ready .mp-tab-pane[data-pane="inventory"] .pi-item:not(.pi-empty-slot):hover {
    text-decoration: underline;
    cursor: pointer;
}
.mp-tab-pane #perm-invent {
    position: static;
    inset: auto;
    overflow: visible;
    background: none;
    /* Match the roster's small Garamond. */
    font-size: var(--panel-font-size);
}
.mp-tab-pane #perm-invent .pi-header { display: none; }

/* --- Farlook on rollover (multiplayer/client/farlook-hover.mjs) ---- */
/* Farlook info box over the LHS panel (formatting mirrors index.html's
   #hover-info). Brief hover = a compact box at the top, only as tall as the
   farlook line needs; clicking an item WITH more info pins it and expands to
   the full column height with the encyclopedia (the state machine is in farlook-hover.mjs). */
#mp-hover-info {
    position: absolute;
    top: 0; left: 0; right: 0;   /* no bottom -> height = content (compact) */
    z-index: 6;
    background: var(--color-terminal-bg);
    color: #dddddd;
    padding: 0.7em 0.8em;
    box-sizing: border-box;
    max-height: 100%;
    overflow: hidden;
    visibility: hidden;
    font-family: var(--font-serif);
}
#mp-hover-info.visible { visibility: visible; }
/* Pinned (clicked, has encyclopedia): use the whole column and scroll it. */
#mp-hover-info.pinned {
    bottom: 0;
    overflow-y: auto;
    box-shadow: inset 0 0 0 1px #555555;
    cursor: pointer;
}
/* In dark mode the box is the same color as the page around it, so the brief
   hover box needs the pinned box's border to read as a box at all. */
body.dark-mode #mp-hover-info.visible { box-shadow: inset 0 0 0 1px #555555; }
#mp-hover-symbol {
    font-family: var(--font-mono);
    font-size: calc(var(--game-font-size) * 1.75);
    line-height: 1;
    display: block;
    margin-bottom: 0.3em;
    color: #ffffff;
    white-space: nowrap;
}
#mp-hover-name {
    display: block;
    color: #eeeeee;
    font-weight: 600;
    font-size: var(--panel-font-size);
    margin-bottom: 0.2em;
}
#mp-hover-desc {
    display: block;
    color: #cccccc;
    font-size: var(--panel-font-size);
    line-height: 1.22;
}
#mp-hover-encyclopedia {
    display: block;
    color: #cccccc;
    font-size: var(--panel-font-size);
    line-height: 1.22;
    margin-top: 0.5em;
    padding-top: 0.4em;
    border-top: 1px solid #333333;
}
#mp-hover-encyclopedia:empty { margin-top: 0; padding-top: 0; border-top: 0; }
#mp-hover-encyclopedia em { font-style: italic; }
#mp-hover-encyclopedia span { display: block; }
#mp-hover-encyclopedia span + span { margin-top: 0.3em; }
