        /* Viking font for medieval theme */
        @font-face {
            font-family: 'vikingregular';
            src: url('fonts/vikingn-webfont.eot');
            src: url('fonts/vikingn-webfont.eot?') format('embedded-opentype'),
                 url('fonts/vikingn-webfont.woff') format('woff'),
                 url('fonts/vikingn-webfont.ttf') format('truetype'),
                 url('fonts/vikingn-webfont.svg') format('svg');
            font-weight: normal;
            font-style: normal;
        }

        /* ============ THEME VARIABLES ============== */
        /* These can be overridden by theme files */
        :root {
            /* Main text area */
            --ui-bg-main: #000;
            --ui-text-main: rgb(192,192,192);

            /* Side panels (center area) */
            --ui-bg-panel: #1a1508;
            --ui-text-panel: #e0e0e0;
            --ui-border-panel: #4a3825;

            /* Chrome/toolbar areas */
            --ui-bg-chrome: #d5c5a0;
            --ui-text-chrome: #4a4839;
            --ui-border-chrome: #8b7355;

            /* Buttons */
            --btn-bg-top: #8b7355;
            --btn-bg-bottom: #6b5335;
            --btn-hover-top: #9b8365;
            --btn-hover-bottom: #7b6345;
            --btn-active-top: #6b5335;
            --btn-active-bottom: #5b4325;
            --btn-text: #fff;
            --btn-border: #4a3825;

            /* Input fields */
            --input-bg: rgba(255, 255, 255, 0.7);
            --input-bg-focus: rgba(255, 255, 255, 0.9);
            --input-text: #4a4839;
            --input-border: #8b7355;
            --input-border-focus: #714D0F;

            /* Modal */
            --modal-bg: #1a1a1a;
            --modal-header-top: #2a2a2a;
            --modal-header-bottom: #1a1a1a;
            --modal-header-text: #e0e0e0;
            --modal-content-bg: #000;
            --modal-border: #444;

            /* Progress bars */
            --progress-bg: #0a0a0a;
            --progress-border: #444;

            /* Exit direction buttons */
            --exit-btn-top: #2a2a2a;
            --exit-btn-bottom: #1a1a1a;
            --exit-btn-text: #e0e0e0;
            --exit-btn-border: #444;
            --exit-btn-hover-top: #3a3a3a;
            --exit-btn-hover-bottom: #2a2a2a;

            /* Scrollbar */
            --scrollbar-track: #0a0a0a;
            --scrollbar-thumb: #333;
            --scrollbar-thumb-hover: #444;

            /* Secondary/dim text */
            --ui-text-dim: rgba(192, 192, 192, 0.7);

            /* Misc */
            --timestamp-color: #666;
            --divider-color: #333;
            --label-color: #714D0F;
            --close-btn-color: #999;
            --close-btn-hover: #e0e0e0;
        }

        /* ============ BASE STYLES ============== */
        html {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }

        body {
            margin: 0;
            padding: 0;
            width: 100vw;
            height: 100vh;
            overflow: hidden;
            position: fixed;
            top: 0;
            left: 0;
        }

        /* ============ ACCESSIBILITY ============== */
        /* Screen reader only content - visually hidden but accessible */
        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border-width: 0;
        }

        /* Skip link - visible only when focused */
        .skip-link {
            position: absolute;
            top: -40px;
            left: 0;
            background: #000;
            color: #fff;
            padding: 8px;
            text-decoration: none;
            z-index: 10000;
        }

        .skip-link:focus {
            top: 0;
        }

        /* ============ STRUCTURE ============== */
        .c_container {
            width: 100%;
            height: 100%;
            display: flex;
            flex-wrap: nowrap;
            overflow: hidden;
        }
        
        .flex-direction {
            flex-direction: row;
        }
        
        .c_left {
            width: 70%;
            height: 100vh;
            background-color: #727272;
            display: flex;
            flex-direction: column;
        }
        
        .c_center {
            width: 25%;
            height: 100vh;
            background-color: #bbb;
        }
        
        .c_right {
            width: 5%;
            height: 100vh;
            background-color: #666;
        }
        
        /* ============ LEFT AREA ============== */

        #al_text {
            width: 100%;
            flex: 1; /* Take remaining space */
            background-color: var(--ui-bg-main);
            color: var(--ui-text-main);
            overflow-y: auto;
            font-family: "Courier New", Courier, "Lucida Console", Monaco, monospace;
            font-size: 14px;
            line-height: 1.2;
            padding: 0;
            box-sizing: border-box;
            white-space: pre-wrap; /* Preserve all whitespace (spaces, newlines) but wrap long lines */
            display: flex;
            flex-direction: column;
        }

        #converse {
            margin: 0;
            padding: 12px 16px 6px 16px; /* top right bottom left - small bottom padding */
            flex-shrink: 0; /* Don't shrink, take exactly the space needed */
        }

        /* Timestamps - hidden by default */
        .timestamp {
            display: none;
            color: var(--timestamp-color);
            font-size: 0.9em;
        }

        /* Show timestamps when toggled */
        #al_text.show-timestamps .timestamp {
            display: inline;
        }

        /* Inverted display mode for accessibility */
        #al_text.inverted-display {
            background: white !important;
        }

        #al_text.inverted-display #converse {
            filter: invert(1) brightness(0.7);
        }

        #al_cmd {
            width: 100%;
            background-image: url('../img/content-bg.jpg');
            background-color: var(--ui-bg-chrome);
            height: 50px;
            border-top: 2px solid var(--ui-border-chrome);
            display: flex;
            align-items: center;
            padding: 0 12px;
            box-sizing: border-box;
        }
        
        /* ============ CENTER AREA ============== */

        #ac_map {
            width: 100%;
            height: 25%;
            background-color: var(--ui-bg-panel);
            color: white;
            background-image: url('../img/defaultmap.png');
            background-repeat: no-repeat;
            background-position: center;
            background-size: cover;
            border: 2px solid var(--ui-border-panel);
            border-bottom: 1px solid var(--ui-border-panel);
            box-sizing: border-box;
            position: relative;
        }

        #mymap {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }

        .mymap-layer {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            transition: opacity 120ms ease-in-out;
        }

        #ac_paged {
            width: 100%;
            height: 54%;
            background-color: var(--ui-bg-panel);
            color: var(--ui-text-main);
            overflow-y: auto;
            overflow-x: auto;
            font-family: "Courier New", Courier, "Lucida Console", Monaco, monospace;
            font-size: 13px;
            line-height: 1.5;
            padding: 12px;
            box-sizing: border-box;
            white-space: pre-wrap; /* Preserve all whitespace (spaces, newlines) but wrap long lines */
            border-left: 2px solid var(--ui-border-panel);
            border-right: 2px solid var(--ui-border-panel);
            border-bottom: 1px solid var(--ui-border-panel);
        }

        #acp_text {
            white-space: pre; /* Don't wrap - allow horizontal scroll */
            display: block;
        }

        #ac_progress {
            width: 100%;
            height: 11%;
            background-color: var(--ui-bg-panel);
            color: white;
            padding: 8px 12px;
            box-sizing: border-box;
            border-left: 2px solid var(--ui-border-panel);
            border-right: 2px solid var(--ui-border-panel);
            border-bottom: 1px solid var(--ui-border-panel);
        }

        #ac_exits {
            width: 100%;
            height: 10%;
            background-color: var(--ui-bg-panel);
            color: var(--ui-text-panel);
            padding: 8px 12px;
            box-sizing: border-box;
            border-left: 2px solid var(--ui-border-panel);
            border-right: 2px solid var(--ui-border-panel);
            border-bottom: 2px solid var(--ui-border-panel);
        }

        #ace_text {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            align-items: center;
        }

        #ace_text a {
            display: inline-block;
            padding: 4px 10px;
            background: linear-gradient(to bottom, var(--exit-btn-top), var(--exit-btn-bottom));
            color: var(--exit-btn-text);
            border: 1px solid var(--exit-btn-border);
            border-radius: 4px;
            text-decoration: none;
            font-size: 12px;
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            transition: all 0.2s ease;
            cursor: pointer;
        }

        #ace_text a:hover {
            background: linear-gradient(to bottom, var(--exit-btn-hover-top), var(--exit-btn-hover-bottom));
            border-color: #666;
            transform: translateY(-1px);
        }

        #ace_text a:active {
            background: linear-gradient(to bottom, var(--exit-btn-bottom), var(--progress-bg));
            transform: translateY(0);
        }
        #hp-progress {
            width: 100%;
            background-color: var(--progress-bg);
            border: 1px solid var(--progress-border);
            border-radius: 4px;
            overflow: hidden;
            margin-bottom: 6px;
            height: 20px;
        }
        #mp-progress {
            width: 100%;
            background-color: var(--progress-bg);
            border: 1px solid var(--progress-border);
            border-radius: 4px;
            overflow: hidden;
            margin-bottom: 0;
            height: 20px;
        }
        #ep-progress {
            width: 100%;
            background-color: var(--progress-bg);
            border: 1px solid var(--progress-border);
            border-radius: 4px;
            overflow: hidden;
            margin-bottom: 6px;
            height: 20px;
        }
        #hp-bar {
            width: 10%;
            height: 100%;
            background: linear-gradient(to bottom, #ff4444, #cc0000);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 11px;
            font-weight: bold;
            text-shadow: 0 1px 2px rgba(0,0,0,0.5);
            transition: width 0.3s ease;
        }
        #mp-bar {
            width: 10%;
            height: 100%;
            background: linear-gradient(to bottom, #4444ff, #0000cc);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 11px;
            font-weight: bold;
            text-shadow: 0 1px 2px rgba(0,0,0,0.5);
            transition: width 0.3s ease;
        }
        #ep-bar {
            width: 10%;
            height: 100%;
            background: linear-gradient(to bottom, #44ff44, #00cc00);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 11px;
            font-weight: bold;
            text-shadow: 0 1px 2px rgba(0,0,0,0.5);
            transition: width 0.3s ease;
        }
        
        /* ============ RIGHT AREA ============== */

        #ac_right {
            height: 100%;
            width: 100%;
            margin: 0;
            padding: 12px 8px;
            background-image: url('../img/content-bg.jpg');
            background-color: var(--ui-bg-chrome);
            color: var(--ui-text-chrome);
            box-sizing: border-box;
            border-left: 20px solid transparent;
            border-image: url('../img/content-border-left.png') 0 0 0 32 repeat;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        /* Icon buttons (Settings, History) */
        .icon-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 8px;
            background: linear-gradient(to bottom, var(--btn-bg-top), var(--btn-bg-bottom));
            color: var(--btn-text) !important;
            border: 2px solid var(--btn-border);
            border-radius: 4px;
            transition: all 0.2s ease;
            text-decoration: none;
            cursor: pointer;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }

        .icon-btn:hover {
            background: linear-gradient(to bottom, var(--btn-hover-top), var(--btn-hover-bottom));
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
            color: var(--btn-text) !important;
        }

        .icon-btn:active {
            background: linear-gradient(to bottom, var(--btn-active-top), var(--btn-active-bottom));
            transform: translateY(0);
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
            color: var(--btn-text) !important;
        }

        .icon-btn img {
            width: 28px;
            height: 28px;
            opacity: 0.9;
            transition: opacity 0.2s ease;
            filter: brightness(1.2);
        }

        .icon-btn:hover img {
            opacity: 1;
        }

        /* Text buttons (Help, Score, etc) */
        .text-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 8px 12px;
            background: linear-gradient(to bottom, var(--btn-bg-top), var(--btn-bg-bottom));
            color: var(--btn-text) !important;
            border: 2px solid var(--btn-border);
            border-radius: 4px;
            text-decoration: none;
            font-size: 12px;
            font-weight: 600;
            text-transform: capitalize;
            transition: all 0.2s ease;
            cursor: pointer;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }

        .text-btn:hover {
            background: linear-gradient(to bottom, var(--btn-hover-top), var(--btn-hover-bottom));
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
            color: var(--btn-text) !important;
        }

        .text-btn:active {
            background: linear-gradient(to bottom, var(--btn-active-top), var(--btn-active-bottom));
            transform: translateY(0);
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
            color: var(--btn-text) !important;
        }

        /* Menu divider */
        .menu-divider {
            height: 1px;
            background-color: var(--divider-color);
            margin: 4px 0;
        }
        
        
        /* ============ MEDIA ============== */
        
        @media screen and (max-width: 1200px) {
        /*  .flex-direction {
            flex-direction: column;
          }*/

          .c_left {
            width: 100%;
            height: 100vh;
            background-color: #bbb;
            overflow: hidden;
          }

          .c_center {
            display: none;
            position: fixed;
            right: 0;
            top: 0;
            width: 50%;
            height: 100vh;
            background-color: #bbb;
            overflow: auto;
            z-index: 9998;
            box-shadow: -4px 0 8px rgba(0, 0, 0, 0.3);
          }

          .c_right {
            display: none;
            position: fixed;
            right: 0;
            top: 0;
            width: 80px;
            height: 100vh;
            background-color: #bbb;
            overflow: auto;
            z-index: 9997;
          }
        }
        
        @media screen and (max-width: 800px) {
        /*  .flex-direction {
            flex-direction: column;
          }*/

          .c_left {
            width: 100%;
            height: 100vh;
            background-color: #bbb;
            overflow: hidden;
          }

          #al_text {
            white-space: pre; /* No wrapping on mobile - allow horizontal scroll */
            overflow-x: auto;
          }

          .c_center {
            display: none;
            position: fixed;
            right: 0;
            top: 0;
            width: 70%;
            height: 100vh;
            background-color: #bbb;
            overflow: auto;
            z-index: 9998;
            box-shadow: -4px 0 8px rgba(0, 0, 0, 0.3);
          }

          .c_right {
            display: none;
            position: fixed;
            right: 0;
            top: 0;
            width: 60px;
            height: 100vh;
            background-color: #bbb;
            overflow: auto;
            z-index: 9997;
          }
        }
        
        /* ============ MAIN ============== */
        html,body {
            height: 100%; margin: 0px; padding: 0px;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            font-size: 14px;
        }

        /* Custom scrollbar styling */
        ::-webkit-scrollbar {
            width: 10px;
            height: 10px;
        }

        ::-webkit-scrollbar-track {
            background: var(--scrollbar-track);
        }

        ::-webkit-scrollbar-thumb {
            background: var(--scrollbar-thumb);
            border-radius: 5px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--scrollbar-thumb-hover);
        }

        /* Firefox scrollbar */
        * {
            scrollbar-width: thin;
            scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
        }

        pre { white-space: pre-wrap; }

        /* Remove underlines from links in game output */
        a:link {
            color: currentColor;
            text-decoration: none;
        }
        a:visited {
            color: currentColor;
            text-decoration: none;
        }

        .center {
            display: block;
            margin-left: auto;
            margin-right: auto;
            width: 50%;
        }

        /* ============ STYLES ============== */
        h1              { font-size: medium; font-weight: normal; } /* Used for screen readers, room title */

        /* Buttons */
        #btnConnect, #btnDisconnect, #btnSend {
            padding: 8px 16px;
            background: linear-gradient(to bottom, var(--btn-bg-top), var(--btn-bg-bottom));
            color: var(--btn-text);
            border: 2px solid var(--btn-border);
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.2s ease;
            min-width: 60px;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }

        #btnConnect:hover, #btnDisconnect:hover, #btnSend:hover {
            background: linear-gradient(to bottom, var(--btn-hover-top), var(--btn-hover-bottom));
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
        }

        #btnConnect:active, #btnDisconnect:active, #btnSend:active {
            background: linear-gradient(to bottom, var(--btn-active-top), var(--btn-active-bottom));
            transform: translateY(0);
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
        }

        #btnSend:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        /* Input field */
        #message {
            font-family: "Courier New", Courier, "Lucida Console", Monaco, monospace;
            font-size: 14px;
            padding: 8px 12px;
            background-color: var(--input-bg);
            color: var(--input-text);
            border: 2px solid var(--input-border);
            border-radius: 4px;
            outline: none;
            transition: all 0.2s ease;
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        #message:focus {
            border-color: var(--input-border-focus);
            background-color: var(--input-bg-focus);
            box-shadow: 0 0 0 3px rgba(113, 77, 15, 0.1);
        }

        /* Input label */
        #input-label {
            color: var(--label-color);
            margin-right: 12px;
            white-space: nowrap;
            font-size: 12px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            font-weight: 600;
        }

        /* Settings dropdown */
        #theme {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            font-size: 14px;
            padding: 8px 12px;
            background-color: var(--input-bg);
            color: var(--input-text);
            border: 2px solid var(--input-border);
            border-radius: 4px;
            cursor: pointer;
            min-width: 200px;
            margin-top: 8px;
            margin-bottom: 16px;
        }

        #theme:focus {
            border-color: var(--input-border-focus);
            outline: none;
        }

        .command       { display: inline; }
        .echo          { display: inline; color:gold; }

        /* MUD Output Colors */
        .death          { display: inline; color: rgb(0,128,128); background-color: rgb(0,0,0); }
        .default        { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .exit           { display: inline; color: rgb(0,255,255); background-color: rgb(0,0,0); }
        .gain           { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .group          { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }

        /* Combat */
        .hit_me         { display: inline; color: rgb(255,255,0); background-color: rgb(0,0,0); }
        .hit_opponent   { display: inline; color: rgb(255,0,0); background-color: rgb(0,0,0); }
        .hit_other      { display: inline; color: rgb(0,255,255); background-color: rgb(0,0,0); }
        .miss_me        { display: inline; color: rgb(0,0,255); background-color: rgb(0,0,0); }
        .miss_opponent  { display: inline; color: rgb(0,0,255); background-color: rgb(0,0,0); }
        .miss_other     { display: inline; color: rgb(0,0,255); background-color: rgb(0,0,0); }
        .nodam_me       { display: inline; color: rgb(0,255,0); background-color: rgb(0,0,0); }
        .nodam_opponent { display: inline; color: rgb(0,128,0); background-color: rgb(0,0,0); }
        .nodam_other    { display: inline; color: rgb(0,128,0); background-color: rgb(0,0,0); }
        .shield_me      { display: inline; color: rgb(128,128,0); background-color: rgb(0,0,0); }
        .shield_opponent { display: inline; color: rgb(255,255,255); background-color: rgb(0,0,0); }
        .shield_other   { display: inline; color: rgb(255,255,255); background-color: rgb(0,0,0); }

        /* Communication */
        .ask_self       { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .ask_other      { display: inline; color: rgb(255,255,255); background-color: rgb(0,0,0); }
        .say_self       { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .say_other      { display: inline; color: rgb(255,255,255); background-color: rgb(0,0,0); }
        .shout_self     { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .shout_other    { display: inline; color: rgb(255,255,255); background-color: rgb(0,0,0); }
        .whisper        { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .tell_self      { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .tell_other     { display: inline; color: rgb(255,255,255); background-color: rgb(0,0,0); }
        .tell_group     { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .tell_imm       { display: inline; color: rgb(255,0,0); background-color: rgb(0,0,0); }
        .respond        { display: inline; color: rgb(255,255,255); background-color: rgb(0,0,0); }
        .comm_say       { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .comm_emote     { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .comm_join      { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .comm_leave     { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }

        /* Entities */
        .pc_title       { display: inline; color: rgb(0,128,128); background-color: rgb(0,0,0); }
        .pc_descr       { display: inline; color: rgb(0,128,128); background-color: rgb(0,0,0); }
        .npc_title      { display: inline; color: rgb(0,128,128); background-color: rgb(0,0,0); }
        .npc_descr      { display: inline; color: rgb(0,128,128); background-color: rgb(0,0,0); }
        .obj_title      { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .obj_descr      { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .immort_title   { display: inline; color: rgb(0,128,128); background-color: rgb(0,0,0); }
        .immort_descr   { display: inline; color: rgb(0,128,128); background-color: rgb(0,0,0); }

        /* Environment */
        .room_title     { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .room_descr     { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); width: 600px; }

        /* Game Info */
        .prompt         { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .log            { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .spells         { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .spell          { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .score          { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .worn           { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .social_self    { display: inline; color: rgb(255,0,255); background-color: rgb(0,0,0); }
        .social_other   { display: inline; color: rgb(255,0,255); background-color: rgb(0,0,0); }
        .xpgain         { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .time           { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }
        .weather        { display: inline; color: rgb(192,192,192); background-color: rgb(0,0,0); }

        /* Who List */
        .who            { display: inline; color: rgb(0,128,128); background-color: rgb(0,0,0); }
        .who_name       { display: inline; color: rgb(0,128,128); background-color: rgb(0,0,0); }
        .who_title      { display: inline; color: rgb(0,128,128); background-color: rgb(0,0,0); }
        .who_guild      { display: inline; color: rgb(255,255,255); background-color: rgb(0,0,0); }
        .who_inv        { display: inline; color: rgb(255,255,255); background-color: rgb(0,0,0); }

        /* Mail */
        .mail           { display: inline; color: rgb(255,0,0); background-color: rgb(192,192,192); }
        .mail_header    { display: inline; color: rgb(255,255,255); background-color: rgb(0,0,0); }

        /* Immortal/Admin */
        .wiz            { display: inline; color: rgb(255,255,255); background-color: rgb(0,0,0); }

        /* Other */
        .hint           { display: inline; color: lime; }
        .paging         { display: inline; color: rgb(128,0,0); background-color: rgb(0,0,0); }

        .converse    { list-style: none; } 
        .colh2       { border: 0px solid black; margin:0; } /* Table class */
        .colh3       { border: 0px solid black; margin:0; } /* Table class */

        /* ============================================ */
        /* ANSI 16 Color Classes (for control codes) */
        /* ============================================ */
        /* Normal foreground colors (control codes \x1Ba through \x1Bh) */
        .ansi_fg_black   { display: inline; color: rgb(0,0,0); }
        .ansi_fg_red     { display: inline; color: rgb(128,0,0); }
        .ansi_fg_green   { display: inline; color: rgb(0,128,0); }
        .ansi_fg_yellow  { display: inline; color: rgb(128,128,0); }
        .ansi_fg_blue    { display: inline; color: rgb(0,0,128); }
        .ansi_fg_magenta { display: inline; color: rgb(128,0,128); }
        .ansi_fg_cyan    { display: inline; color: rgb(0,128,128); }
        .ansi_fg_white   { display: inline; color: rgb(192,192,192); }

        /* Bright foreground colors (control codes \x1Bi through \x1Bp) */
        .ansi_fgb_black   { display: inline; color: rgb(128,128,128); }
        .ansi_fgb_red     { display: inline; color: rgb(255,0,0); }
        .ansi_fgb_green   { display: inline; color: rgb(0,255,0); }
        .ansi_fgb_yellow  { display: inline; color: rgb(255,255,0); }
        .ansi_fgb_blue    { display: inline; color: rgb(0,0,255); }
        .ansi_fgb_magenta { display: inline; color: rgb(255,0,255); }
        .ansi_fgb_cyan    { display: inline; color: rgb(0,255,255); }
        .ansi_fgb_white   { display: inline; color: rgb(255,255,255); }

        /* Background colors (control codes \x1Bq through \x1Bx) */
        .ansi_bg_black   { display: inline; background-color: rgb(0,0,0); }
        .ansi_bg_red     { display: inline; background-color: rgb(128,0,0); }
        .ansi_bg_green   { display: inline; background-color: rgb(0,128,0); }
        .ansi_bg_yellow  { display: inline; background-color: rgb(128,128,0); }
        .ansi_bg_blue    { display: inline; background-color: rgb(0,0,128); }
        .ansi_bg_magenta { display: inline; background-color: rgb(128,0,128); }
        .ansi_bg_cyan    { display: inline; background-color: rgb(0,128,128); }
        .ansi_bg_white   { display: inline; background-color: rgb(192,192,192); }

        .fourcol
        {
            -webkit-column-count: 4;
            -webkit-column-gap: 20px;
            column-count:4;
            column-gap:20px;
        }
        .threecol
        {
            -webkit-column-count: 3;
            -webkit-column-gap: 20px;
            column-count:3;
            column-gap:20px;
        }
        .twocol  {
            -webkit-column-count: 2;
            -webkit-column-gap: 20px;
            column-count:2;
            column-gap:20px;
        }
        .row {
            /* Clear floats after the columns */
            clear: both;
        }


/* The Modal (background) */
.modal {
    z-index: 1000;
    position: absolute;
    display: none; /* Hidden by default, becomes flex when shown */
    flex-direction: column;
    top: 100px;
    left: 100px;
    background-color: var(--modal-bg);
    width: 60%; /* Default size, resizable */
    max-width: 90%;
    height: 60vh; /* Default height */
    max-height: 85vh; /* Use vh for reliable viewport-based sizing */
    resize: both;
    overflow: hidden;
    border: 1px solid var(--modal-border);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.modal-header {
  width: 100%;
  height: 44px;
  flex-shrink: 0; /* Don't shrink the header */
  cursor: move;
  z-index: 3;
  background: linear-gradient(to bottom, var(--modal-header-top), var(--modal-header-bottom));
  color: var(--modal-header-text);
  border-bottom: 1px solid var(--divider-color);
  display: flex;
  align-items: center;
  padding: 0 12px;
  box-sizing: border-box;
}

/* Modal Content/Box */
.modal-content {
    width: 100%;
    flex: 1; /* Fill remaining space after header */
    min-height: 0; /* Required for flex children to allow scrolling */
    z-index: 2;
    overflow-y: auto; /* Enable scroll if needed */
    background-color: var(--modal-content-bg);
    color: var(--ui-text-main);
    font-family: "Courier New", Courier, "Lucida Console", Monaco, monospace;
    font-size: 14px;
    line-height: 1.2;
    padding: 16px;
    box-sizing: border-box;
    white-space: pre-wrap; /* Preserve all whitespace (spaces, newlines) but wrap long lines */
}

/* The Close Button */
.close {
  color: var(--close-btn-color);
  margin-left: auto;
  font-size: 28px;
  font-weight: normal;
  line-height: 1;
  transition: color 0.2s ease;
}

.close:hover,
.close:focus {
  color: var(--close-btn-hover);
  text-decoration: none;
  cursor: pointer;
}

/* ============ PARCHMENT MODAL (Settings & Login) ============== */
/* Medieval parchment theme matching index.html */

/* Backdrop for parchment modals */
.parchment-modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1999;
}

.parchment-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    min-width: 340px;
    max-width: 420px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(74, 56, 37, 0.3);
    border-radius: 12px;
    animation: parchmentFadeIn 0.2s ease-out;
}

@keyframes parchmentFadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.parchment-modal-inner {
    background-image: url('img/content-bg.jpg');
    background-color: #d5c5a0;
    border-radius: 12px;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.parchment-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 2px solid rgba(139, 115, 85, 0.3);
}

.parchment-modal-header h2 {
    margin: 0;
    font-family: 'vikingregular', Georgia, serif;
    font-size: 24px;
    font-weight: normal;
    color: #0d2b37;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

.parchment-modal-header .close {
    color: #714D0F;
    font-size: 28px;
    font-weight: normal;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

.parchment-modal-header .close:hover {
    color: #4a3825;
}

.parchment-modal-content {
    padding: 20px;
}

/* Form elements in parchment modal */
.parchment-modal .form-group {
    margin-bottom: 16px;
}

.parchment-modal .form-group > label {
    display: block;
    margin-bottom: 6px;
    color: #4a3825;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.parchment-modal input[type="text"],
.parchment-modal input[type="password"],
.parchment-modal select {
    width: 100%;
    padding: 10px 12px;
    background-color: rgba(255, 255, 255, 0.7);
    color: #4a4839;
    border: 2px solid #8b7355;
    border-radius: 4px;
    font-size: 14px;
    font-family: "Courier New", Courier, monospace;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.parchment-modal input[type="text"]:focus,
.parchment-modal input[type="password"]:focus,
.parchment-modal select:focus {
    border-color: #714D0F;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 3px rgba(113, 77, 15, 0.1);
}

.parchment-modal button {
    padding: 10px 16px;
    background: linear-gradient(to bottom, #8b7355, #6b5335);
    color: #fff;
    border: 2px solid #4a3825;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.parchment-modal button:hover {
    background: linear-gradient(to bottom, #9b8365, #7b6345);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

.parchment-modal button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.parchment-modal button.secondary {
    background: rgba(255, 255, 255, 0.5);
    color: #4a4839;
    border: 2px solid #8b7355;
    text-shadow: none;
}

.parchment-modal button.secondary:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: #714D0F;
}

/* Checkbox styling for parchment modal */
.parchment-modal .checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 0;
}

.parchment-modal .checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #714D0F;
    cursor: pointer;
}

.parchment-modal .checkbox-row label {
    margin: 0;
    color: #4a4839;
    font-size: 14px;
    font-weight: normal;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}

/* Section dividers */
.parchment-modal .section-divider {
    height: 2px;
    background: linear-gradient(to right, transparent, rgba(139, 115, 85, 0.4), transparent);
    margin: 20px 0;
}

.parchment-modal .section-title {
    font-size: 11px;
    color: #714D0F;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

/* Info/status text */
.parchment-modal .info-text {
    color: #5a4a39;
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

.parchment-modal .info-text strong {
    color: #0d2b37;
}

.parchment-modal .hint-text {
    color: #8b7355;
    font-size: 12px;
    margin-top: 4px;
}

/* Button row */
.parchment-modal .button-row {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.parchment-modal .button-row button {
    flex: 1;
}

/* Error/warning states */
.parchment-modal .error-text {
    color: #a03030;
    font-weight: 600;
}

.parchment-modal .warning-box {
    background: rgba(160, 48, 48, 0.1);
    border: 1px solid rgba(160, 48, 48, 0.3);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 12px;
}

/* ============ SETTINGS MODAL SPECIFIC ============== */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-section {
    padding: 4px 0;
}

.settings-section:first-child {
    padding-top: 0;
}

/* ============ LOGIN MODAL SPECIFIC ============== */
.login-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-welcome {
    text-align: center;
    padding-bottom: 4px;
}

.login-welcome .char-name {
    font-family: 'vikingregular', Georgia, serif;
    font-size: 20px;
    color: #0d2b37;
}

.login-error {
    color: #a03030;
    font-weight: bold;
    text-align: center;
}

/* ============ RECONNECT LINK ============== */
.reconnect-link {
  text-decoration: underline;
  font-weight: bold;
  cursor: pointer;
}

.reconnect-link:hover {
  text-decoration: underline;
  opacity: 0.8;
}

/* ============ MOBILE TOGGLE BUTTON ============== */
#mobile-toggle {
  display: none; /* Hidden by default on desktop */
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9999;
  background-color: var(--btn-bg-bottom);
  color: var(--btn-text);
  border: 2px solid var(--ui-border-chrome);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#mobile-toggle:hover {
  background-color: var(--btn-hover-bottom);
}

/* Show toggle button only on mobile */
@media screen and (max-width: 1200px) {
  #mobile-toggle {
    display: block;
  }
}

/* ============ CUSTOM TOOLTIPS ============== */
/* Custom tooltip styling for faster, themed tooltips */
.custom-tooltip {
    position: fixed;
    display: none;
    background: linear-gradient(to bottom, #6b5335, #4a3825);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    border: 1px solid #8b7355;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.custom-tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #6b5335;
}

.custom-tooltip.show {
    display: block;
    animation: tooltipFadeIn 0.15s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ END OF STYLES ============== */
