@font-face {
    font-family: 'IBMVGA8';
    src: url('../fonts/ibm_vga8.woff') format('woff');
    font-weight: 400;
    font-style: normal;
}

/* =========================================================================
   RWW Dungeon Crawler Skin
   Inspired by: Eye of the Beholder, Dungeon Master, Lands of Lore

   This file is loaded AFTER webclient.css and overrides layout/framing.
   It does NOT redefine character-info, effect-badges, or other
   content styles that already exist in webclient.css.
   ========================================================================= */

/* =========================================================================
   SECTION: Base overrides
   ========================================================================= */

html, body {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    overflow-x: hidden !important;
    background: #000 !important;
    font-family: 'IBMVGA8', monospace !important;
    font-size: 16px !important;
    color: #ccc;
    margin: 0 !important;
    padding: 0 !important;
}

*, *::before, *::after {
    box-sizing: border-box;
}


/* =========================================================================
   SECTION: Skin Frame — The Dungeon Crawler "Mask"
   ========================================================================= */

#skin-frame {
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-rows: 40px 1fr;
    grid-template-columns: 1fr;
    background: #0a0604;
    overflow: hidden;
}

/* --- Top bar --- */
.frame-top {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    border-bottom: 2px solid #3d2b10;
}

/* --- Bottom bar --- */
.frame-bottom {
    display: flex;
    align-items: stretch;
}

/* --- Middle section --- */
.frame-middle {
    display: flex;
    align-items: stretch;
    overflow: hidden;
    position: relative;
    min-height: 0;
}


/* =========================================================================
   SECTION: Frame Corners — Ornate stone corners with rivets
   ========================================================================= */

.frame-corner {
    width: 40px;
    min-width: 40px;
    background: #2a1a0a;
    position: relative;
}

.frame-corner::before {
    content: '';
    position: absolute;
    inset: 3px;
    border: 2px solid #8B6914;
    border-radius: 2px;
}

/* Rivet */
.frame-corner::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #c9a84c, #6b4e1a 70%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 1px 2px rgba(0,0,0,0.8);
}

.frame-corner-tl {
    background: linear-gradient(135deg, #3d2b10 0%, #2a1a0a 50%, #1a1008 100%);
    border-top: 3px solid #8B6914;
    border-left: 3px solid #8B6914;
}
.frame-corner-tl::after { top: 10px; left: 10px; }

.frame-corner-tr {
    background: linear-gradient(225deg, #3d2b10 0%, #2a1a0a 50%, #1a1008 100%);
    border-top: 3px solid #8B6914;
    border-right: 3px solid #6b4e1a;
}
.frame-corner-tr::after { top: 10px; right: 10px; }

.frame-corner-bl {
    background: linear-gradient(45deg, #3d2b10 0%, #2a1a0a 50%, #1a1008 100%);
    border-bottom: 3px solid #6b4e1a;
    border-left: 3px solid #8B6914;
}
.frame-corner-bl::after { bottom: 6px; left: 10px; }

.frame-corner-br {
    background: linear-gradient(315deg, #3d2b10 0%, #2a1a0a 50%, #1a1008 100%);
    border-bottom: 3px solid #6b4e1a;
    border-right: 3px solid #6b4e1a;
}
.frame-corner-br::after { bottom: 6px; right: 10px; }


/* =========================================================================
   SECTION: Frame Edges — Stone borders between corners
   ========================================================================= */

.frame-edge {
    flex: 1;
    position: relative;
}

/* top bar is now just a flat strip, no gradients */

.frame-edge-bottom {
    background:
        repeating-linear-gradient(90deg,
            #2a1a0a 0px, #3d2b10 4px, #2a1a0a 8px),
        linear-gradient(0deg, #3d2b10, #1a1008);
    border-bottom: 3px solid #6b4e1a;
    border-top: 2px solid #0a0604;
}

.frame-edge-left,
.frame-edge-right {
    width: 20px;
    min-width: 20px;
    flex: 0 0 20px;
}

.frame-edge-left {
    background:
        repeating-linear-gradient(180deg,
            #2a1a0a 0px, #3d2b10 4px, #2a1a0a 8px),
        linear-gradient(90deg, #3d2b10, #1a1008);
    border-left: 3px solid #8B6914;
    border-right: 2px solid #0a0604;
}

.frame-edge-right {
    background:
        repeating-linear-gradient(180deg,
            #2a1a0a 0px, #3d2b10 4px, #2a1a0a 8px),
        linear-gradient(270deg, #3d2b10, #1a1008);
    border-right: 3px solid #6b4e1a;
    border-left: 2px solid #0a0604;
}

/* Title text in top frame */
.frame-title {
    font-family: 'IBMVGA8', monospace;
    font-size: 14px;
    color: #c9a84c;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 6px rgba(201, 168, 76, 0.4), 0 2px 1px #000;
    z-index: 1;
}


/* =========================================================================
   SECTION: Game Area — The playable viewport inside the frame
   ========================================================================= */

#game-area {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(200px, 280px) 1fr minmax(180px, 220px);
    grid-template-rows: 1fr;
    gap: 6px;
    padding: 6px;
    /*background: #0a0604;*/
    background: #000000;
    overflow: hidden;
}


/* =========================================================================
   SECTION: Columns — all columns get height:100% from the grid row
   ========================================================================= */

#col-left,
#col-center,
#col-right {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

#col-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    overflow-x: hidden;
}

#col-center {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

#col-right {
    display: flex;
    flex-direction: column;
}


/* =========================================================================
   SECTION: Login State — Hide side columns until logged in
   ========================================================================= */

#skin-frame:not(.logged-in) #col-left,
#skin-frame:not(.logged-in) #col-right {
    display: none;
}

#skin-frame:not(.logged-in) #game-area {
    grid-template-columns: 1fr;
}

#skin-frame:not(.logged-in) .frame-top {
    display: none;
}

#skin-frame:not(.logged-in) .frame-edge-left,
#skin-frame:not(.logged-in) .frame-edge-right {
    display: none;
}

#skin-frame:not(.logged-in) {
    grid-template-rows: 1fr;
}


/* =========================================================================
   SECTION: Panel Frames — Each panel has an inset stone border
   ========================================================================= */

.game-panel {
    flex: 1 1 0;
    display: flex;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.panel-frame {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 3px solid;
    border-color: #4a3520 #2a1a0a #2a1a0a #4a3520;
    background: #000000;
    position: relative;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

/* Inner inset shadow for depth */
.panel-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid;
    border-color: #0a0604 #3d2b10 #3d2b10 #0a0604;
    pointer-events: none;
}

/*.panel-frame-story {
    border-color: #006060 #003030 #003030 #006060;
}

.panel-frame-story::after {
    border-color: #003030 #005050 #005050 #003030;
}*/

.panel-label {
    font-family: 'IBMVGA8', monospace;
    font-size: 11px;
    color: #8B6914;
    text-align: center;
    padding: 2px 0;
    /*background: linear-gradient(180deg, #1a1008 0%, #0f0a05 100%);*/
    border-bottom: 1px solid #3d2b10;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px;
    min-height: 0;
}


/* =========================================================================
   SECTION: Map Panel
   ========================================================================= */

#panel-map {
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    width: 100%;
}

#map-content {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    background: #000;
    align-content: center;
    justify-items: center;
}

#map-content img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    image-rendering: pixelated;
}

/* Clickable cardinal tiles on map */
#map-content img.map-clickable {
    cursor: pointer;
}

#map-content img.map-clickable:hover {
    filter: brightness(1.4);
}


/* =========================================================================
   SECTION: Image View Panel (POV / Portrait)
   ========================================================================= */

#panel-image {
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    width: 100%;
}

#image-content {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

#image-content img {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
}

#image-content img.client-icon {
    width: 100% !important;
    height: 100% !important;
    margin-right: 0 !important;
}


/* =========================================================================
   SECTION: Story Log
   ========================================================================= */

/*
 * #panel-story takes all remaining space in #col-center.
 * It is position:relative so #messagewindow can be pinned inside it.
 * #messagewindow is position:absolute — removed from flow — so it
 * CANNOT push #panel-story taller. It scrolls internally.
 */
#panel-story {
    flex: 1 1 0px;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

#panel-story > .panel-frame-story {
    position: relative !important;
    height: 100% !important;
    overflow: hidden !important;
}

#messagewindow {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overflow-wrap: break-word;
    font-size: 16px;
    line-height: 1.4;
    color: #ccc;
    background: #000000;
    padding: 8px;
    border: none !important;
    border-style: none !important;
    margin: 0 !important;
}


/* =========================================================================
   SECTION: Scrollbar styling
   ========================================================================= */

#messagewindow::-webkit-scrollbar,
.panel-content::-webkit-scrollbar {
    width: 10px;
}

#messagewindow::-webkit-scrollbar-track,
.panel-content::-webkit-scrollbar-track {
    background: #0a0604;
}

#messagewindow::-webkit-scrollbar-thumb,
.panel-content::-webkit-scrollbar-thumb {
    background: #3d2b10;
    border: 1px solid #8B6914;
    border-radius: 0;
}

#messagewindow::-webkit-scrollbar-thumb:hover,
.panel-content::-webkit-scrollbar-thumb:hover {
    background: #4a3520;
}


/* =========================================================================
   SECTION: Command Input
   ========================================================================= */

#panel-input {
    flex: 0 0 auto;
    overflow: hidden;
}

.input-frame {
    border: 3px solid;
    border-color: #4a3520 #2a1a0a #2a1a0a #4a3520;
    background: #000000;
    padding: 4px;
}

.input-row {
    display: flex;
    gap: 4px;
}

.inputfield {
    flex: 1;
    font-family: 'IBMVGA8', monospace !important;
    font-size: 16px !important;
    color: #0f0 !important;
    background: #0a0604 !important;
    border: 2px inset #3d2b10 !important;
    padding: 4px 8px !important;
    resize: none;
    outline: none;
    min-height: 28px;
    max-height: 80px;
}

.inputfield:focus {
    border-color: #8B6914 !important;
    box-shadow: 0 0 4px rgba(139, 105, 20, 0.4);
}

.input-btn {
    font-family: 'IBMVGA8', monospace;
    font-size: 18px;
    color: #c9a84c;
    background: linear-gradient(180deg, #3d2b10 0%, #2a1a0a 100%);
    border: 2px outset #6b4e1a;
    padding: 2px 12px;
    cursor: pointer;
    min-width: 36px;
}

.input-btn:hover {
    background: linear-gradient(180deg, #4a3520 0%, #3d2b10 100%);
}

.input-btn:active {
    border-style: inset;
}

.prompt {
    font-size: 12px;
    color: #8B6914;
    padding: 0 4px 2px;
    min-height: 0;
}


/* =========================================================================
   SECTION: Side Panel overrides for crawler skin
   ========================================================================= */

/* --- Action bar: pressable icons above side panel --- */
#panel-actions {
    flex: 0 0 auto;
    padding: 4px 0;
}

.action-bar {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.action-btn {
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    filter: brightness(1.4);
}

.action-btn:active {
    filter: brightness(0.8);
}

.action-btn img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

#panel-side .panel-frame {
    border: none !important;
}

#panel-side .panel-frame::after {
    border: none !important;
}

#panel-side {
    flex: 1;
    min-height: 0;
}

#side-content {
    text-align: center;
}

/* Side panel equip/inventory boxes: match time-section double border */
.equip-section,
.inventory-section {
    border: 2px double #8B4513 !important;
    background-color: rgba(139, 69, 19, 0.08) !important;
}

/* --- Status badges with recovery action --- */
.effect-badge.has-recovery {
    cursor: pointer !important;
}

.effect-badge.has-recovery:hover {
    filter: brightness(1.4);
}

/* Hide original text on hover, show recovery command */
.effect-badge.has-recovery:hover .badge-label {
    display: none;
}

.effect-badge.has-recovery .badge-recovery {
    display: none;
}

.effect-badge.has-recovery:hover .badge-recovery {
    display: inline;
}

/* Side panel icons: no borders */
.side-panel .panel-icon {
    border: none !important;
    background: none !important;
}

.side-panel .panel-icon:hover {
    border: none !important;
    background: none !important;
    filter: brightness(1.3);
}

/* Tighten spacing for narrower right column — label inside bar */
.side-panel .bar-container {
    width: 100%;
    height: 35px !important;
    display: block;
    position: relative;
}

.side-panel .bar-label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #fff;
    text-shadow: 1px 1px 1px #000, 0 0 3px #000;
    z-index: 1;
    pointer-events: none;
}

.side-panel img {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
}


/* =========================================================================
   SECTION: Clickable item icons — pointer cursor on hover
   ========================================================================= */

.panel-icon[data-item],
.equip-icon[data-item],
img.client-icon[data-item],
.clickable-item {
    cursor: pointer !important;
}

.panel-icon[data-item]:hover,
.equip-icon[data-item]:hover,
img.client-icon[data-item]:hover {
    filter: brightness(1.3);
}

.clickable-item:hover {
    text-decoration: underline;
    color: #fff !important;
}

/* =========================================================================
   SECTION: Override borders (remove GoldenLayout remnants)
   ========================================================================= */

.lm_content {
    border: none !important;
}

/* client-icon in story log */
img.client-icon {
    width: 64px !important;
    height: 64px !important;
    vertical-align: middle;
    margin-right: 4px !important;
    image-rendering: pixelated;
}


/* =========================================================================
   SECTION: Look Object Box — detail view when looking at a specific target
   ========================================================================= */

.look-object-box {
    background-color: #000000 !important;
    max-width: 65% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* --- Flex layout: icons left, text right --- */
.look-object-layout {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.look-object-icons {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.look-object-text {
    flex: 1;
    min-width: 0;
}

/* --- Action buttons row --- */
.look-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #3d2b10;
}

.look-action-btn {
    font-family: 'IBMVGA8', monospace;
    font-size: 12px;
    color: #c9a84c;
    background: linear-gradient(180deg, #3d2b10 0%, #2a1a0a 100%);
    border: 2px outset #6b4e1a;
    padding: 3px 10px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.look-action-btn:hover {
    background: linear-gradient(180deg, #4a3520 0%, #3d2b10 100%);
    border-color: #8B6914;
    color: #fff;
}

.look-action-btn:active {
    border-style: inset;
}


/* =========================================================================
   SECTION: Info Bubble Override — centered, 50% width like look-object-box
   ========================================================================= */

.chat-bubble.info {
    max-width: 50% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* =========================================================================
   SECTION: Look Bubble Override
   ========================================================================= */

.chat-bubble.look {
    border: none !important;
    border-style: none !important;
    background: #2a1a0a !important;
    color: #fff !important;
    text-shadow: 1px 1px 2px #000, 0 0 4px rgba(0, 0, 0, 0.6) !important;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.7) !important;
    padding-right: 20px;
}

.chat-bubble.look .bubble-content,
.chat-bubble.look .bubble-line,
.chat-bubble.look .bubble-header {
    color: #fff !important;
    text-shadow: 1px 1px 2px #000, 0 0 4px rgba(0, 0, 0, 0.6) !important;
}

div.bubble-header.look {
    padding-right: 8px !important;
}


/* =========================================================================
   SECTION: Inventory & Equipment Bubble Override — Icon Grid
   ========================================================================= */

/* --- Shared panel frame --- */
.chat-bubble.inventory,
.chat-bubble.equip {
    border: 9px double #4a3520 !important;
    background: #000000 !important;
    padding: 0.5rem !important;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.7) !important;
    max-width: 75% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* --- Shared header: bordered box like info header --- */
.bubble-header.inventory,
.bubble-header.equip {
    float: none !important;
    position: relative !important;
    top: -50px !important;
    border: 9px double #4a3520 !important;
    background: #000000 !important;
    text-align: center !important;
    padding: 4px 0 6px !important;
    margin-bottom: -40px !important;
    color: #c9a84c !important;
    font-size: 18px !important;
    letter-spacing: 2px !important;
    text-transform: uppercase !important;
}

/* --- Hide header icons (Python sends them, mock doesn't show them) --- */
.bubble-header.inventory .chat-icon,
.bubble-header.equip .chat-icon {
    display: none !important;
}

/* --- Shared icon grid container --- */
.chat-bubble.inventory .bubble-content,
.chat-bubble.equip .bubble-content {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
    padding: 4px !important;
}

/* --- Shared item cell --- */
.chat-bubble.inventory .bubble-line,
.chat-bubble.equip .bubble-line {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 3px !important;
    background: #000000 !important;
    border: 3px outset #7e3220 !important;
    padding: 6px 4px !important;
    color: #ccc !important;
    font-size: 16px !important;
    line-height: 1.2 !important;
    word-break: break-word !important;
    cursor: default !important;
}

.chat-bubble.inventory .bubble-line:hover,
.chat-bubble.equip .bubble-line:hover {
    background: #000000 !important;
    border-color: #8B6914 !important;
    color: #fff !important;
}

/* --- Shared 48px icons, pixelated --- */
.chat-bubble.inventory .equip-icon,
.chat-bubble.equip .equip-icon {
    width: 64px !important;
    height: 64px !important;
    min-width: 64px !important;
    image-rendering: pixelated !important;
    flex-shrink: 0 !important;
}


/* =========================================================================
   SECTION: Responsive
   ========================================================================= */

/* Large screens: cap the game area so it doesn't over-stretch */
@media (min-width: 1600px) {
    #game-area {
        max-width: 1600px;
        margin: 0 auto;
    }
}

/* Medium screens: shrink left column */
@media (max-width: 1100px) {
    #game-area {
        grid-template-columns: minmax(160px, 220px) 1fr minmax(160px, 200px);
    }
}

/* Small screens: hide left column */
@media (max-width: 900px) {
    #game-area {
        grid-template-columns: 1fr 180px;
    }
    #col-left {
        display: none;
    }
}

/* Very small screens: single column */
@media (max-width: 600px) {
    #game-area {
        grid-template-columns: 1fr;
    }
    #col-right {
        display: none;
    }
    .frame-edge-left,
    .frame-edge-right {
        width: 8px;
        min-width: 8px;
    }
    .frame-corner {
        width: 20px;
        min-width: 20px;
    }
}
