@font-face {
        font-family: MTGFont;
        src: url("fonts/Planewalker.eot"); /* EOT file for IE */
        src: url("fonts/Planewalker.ttf"); /* TTF file for CSS3 browsers */
    }
    :root {
        /* Brand colors */
        --color-brand-red: #951A23;
        --color-brand-gold: #F9B554;
        --color-brand-gold-light: #ECCA36;
        --color-row-even: #C0C0C0;
        --color-row-odd: #FFFFFF;
        --color-header-gradient-start: #919191;
        --color-header-gradient-end: #000000;
        --color-nav-gradient-start: #E70004;
        --color-nav-gradient-end: #690002;
        --color-notification-time: #7D7D7D;
        --color-notification-hr: #B2B2B2;

        /* Layout */
        --layout-max-width: 1100px;
        --header-height: 75px;
        --header-height-mobile: 78px;

        /* Border radius */
        --radius-sm: 4px;
        --radius-md: 8px;
        --radius-lg: 10px;
    }

    html {
        height:100%;
        max-height: 100%;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
    }
    html.is-mobile {
        position:absolute;
        top:-8px;
        left:-8px;
    }
    body {
        width: 100%;
    }
    html.is-desktop body {
        overflow:hidden;
        height:100%;
        max-height: 100%;
        max-width: 100%;
        margin: 0;
        background: url(../images/background.jpg) no-repeat top center;
        background-size:cover;
        z-index:-1;
    }
    html.is-mobile table, html.is-mobile label, html.is-mobile i, html.is-mobile #label {
        font-size:75%;
    }

    tr:nth-child(even) {background: var(--color-row-even)}
    tr:nth-child(odd) {background: var(--color-row-odd)}

    .rowtransparant:nth-child(even) {background: initial}
    .rowtransparant:nth-child(odd) {background: initial}

    th {
        background-color: var(--color-brand-red); color: var(--color-brand-gold);
        font-family: MTGFont, Verdana, Arial, sans-serif; 
        font-size:110%; 
        padding-top: .25em;
        font-weight: 100;
    }
    th:hover, .helptooltip {cursor: pointer;}

    .thnosort {cursor: default; }

    tr.normalcolor {background: var(--color-row-odd);}

    tableheading, tableheadingnotaccordian {
        font-family: MTGFont, Verdana, Arial, sans-serif;
        font-size: xx-large;
    }
    html.is-mobile tableheading, html.is-mobile tableheadingnotaccordian {
        font-size: 100%;
    }

    h3 { 
        font-family: MTGFont, Verdana, Arial, sans-serif; 
        font-size: xx-large;
    }

    .cellpadright {
        padding-right: 5px;
    }

    .aligntexttop {
        vertical-align: text-top;
    }

    #preview {
        position:absolute;
        display:none;
        color:#fff;
    }

    .filterheading, .addcardheading, .sendnewmessageheading, .neweventheading {
        cursor:pointer;
        text-decoration:underline;
    }

    .page {
        overflow: hidden;
        height:100%;
        max-height:100%;
        width:100%;
    }
    html.is-desktop .page {
        margin:0 auto;
        width:100%;
        max-width: var(--layout-max-width);
    }
    html.is-desktop.is-fullscreen .page {
        max-width: none;
    }
    html.is-mobile .page {
        width: auto;
    }

    .header {
        overflow: hidden;
        position: static;
        width: 100%;
        vertical-align:text-top;
        top:0px;
        background: linear-gradient(to bottom, var(--color-header-gradient-start), var(--color-header-gradient-end));
    }
    html.is-desktop .header {
        height: var(--header-height);
        max-width: var(--layout-max-width);
    }
    html.is-desktop.is-fullscreen .header {
        max-width: none;
    }
    html.is-mobile .header {
        height: var(--header-height-mobile);
        left:0px;
    }

    .main {
        overflow: scroll;
        background-color: white;
        max-width: 100%;
        padding:.5em;
        box-sizing: border-box;
    }
    html.is-desktop .main {
        float: left;
        width:100%;
        overflow-y: scroll;
        height: calc(100% - var(--header-height));
        z-index:100;
    }
    html.is-desktop.is-fullscreen .main {
        width: auto;
        float: none;
    }
    html.is-mobile .main {
        position: static;
        width: 100%;
        max-width:600px;
    }
    @media (orientation: landscape) {
        html.is-mobile .main {
            max-width: 100%;
        }
        html.is-mobile .header {
            height: auto;
            min-height: var(--header-height-mobile);
        }
    }

    .footer {
        padding-top:3em;
    }



    .leftnav {
        /* Provide scrollbars if needed, position below header, and derive height from top/bottom */
        overflow: hidden;
        float:left;

        background-color: red;
        height:100%;
        max-width:150px;
            padding-top:.5em;
        vertical-align:text-top;
        text-align:center; 

        background: linear-gradient(to right, var(--color-nav-gradient-start), var(--color-nav-gradient-end));
    }

    .menucontent, menulogcontent {
        position:absolute;
        display:none;
        width:100%;
        z-index: 100;
        max-width: var(--layout-max-width);
        background: linear-gradient(to bottom, var(--color-header-gradient-end), var(--color-header-gradient-start));
    }
    html.is-fullscreen .menucontent, html.is-fullscreen menulogcontent {
        max-width: none;
    }

    .menulogbutton {
        cursor: pointer;
    }

    .button {
        text-decoration: none;
        display: inline-block;
        background: url(../images/button.png) top left no-repeat;
        text-align: center;
        line-height: 35px;
        width: 120px;
        height: 35px;
        color: var(--color-brand-gold-light);
    }
    html.is-desktop .button {
        font-size:100%;
        margin-left: 15px;
        margin-right: 15px;
    }
    html.is-mobile .button {
        padding-bottom: 5px;
    }
    .button.active-page {
        filter: drop-shadow(0 0 4px var(--color-brand-gold)) drop-shadow(0 0 8px var(--color-brand-gold));
    }

    .transparent { background-color: transparent; }

    .leftdiv {
        float:left;
        position: absolute;
        z-index: 1;
        background-color : transparent;
    }
    html.is-desktop .leftdiv {
        padding: .5em;
        max-width:200px;
    }
    html.is-mobile .leftdiv {
        width: auto;
    }
    .rightdiv {
        float:right;
        background-color : transparent;
        position: relative;
        z-index: 0;
        top:0px;
    }
    html.is-desktop .rightdiv {
        width:500px;
        word-wrap: normal;
        margin-right:1em;
        margin-bottom:1em;
    }

    .left {
        float:left;
        background-color : transparent;
    }

    .right {
        float:right;
        background-color : transparent;
    }
    .ui-accordion-content {
        font-size:85%;
    } 
    .ui-accordion, .ui-accordion-content {width:auto;}
        .ui-accordion .ui-accordion-content {padding: 1em 0;}
.qty {
        width:3em;
    }
    .badge-container {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }
    .badge-icon-champion,
    .badge-icon {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        pointer-events: auto;
    }
    .badge-icon-champion {
        height: 77px;
        vertical-align: middle;
        border-radius: var(--radius-lg);
    }
    html.is-mobile .badge-icon-champion {
        height: 55px;
    }
    .badge-item {
        position: relative;
        display: inline-block;
    }
    .badge-count {
        position: absolute;
        bottom: -2px;
        right: -4px;
        background: var(--color-brand-red);
        color: var(--color-brand-gold);
        font-size: 10px;
        font-weight: bold;
        padding: 1px 3px;
        border-radius: var(--radius-md);
        border: 1px solid var(--color-brand-gold);
        line-height: 1;
    }
    .badge-icon {
        height: 44px;
        vertical-align: middle;
        border-radius: var(--radius-lg);
    }
    html.is-mobile .badge-icon {
        height: 31px;
    }

    .manasymbol {
        height:15px;
    }
    html.is-mobile .manasymbol {
        height:10px;
    }
    .manasymbol_larger {
        height:20px;
    }
    html.is-mobile .manasymbol_larger {
        height:16px;
    }

    .decktrailer {
        height: 200px;
    }
    html.is-mobile .decktrailer {
        height: 150px;
    }

    .stretch {
        display:inline-block;
        transform:scale(2,1);
    }

    .menubutton {
        font-family: MTGFont, Verdana, Arial, sans-serif;
        cursor: pointer;
        display: inline-block;
        text-decoration: none;
        text-align: center;
        width: 108px;
        height: 50px;
        line-height: 50px;
        font-size:200%;
    }

    #menubuttonmenu {
        background: url(../images/MTGclose.png) top left no-repeat;
        color: var(--color-brand-gold-light);
    }

    #menubuttonclose {
        background: url(../images/MTGmenu.png) top left no-repeat;
        color: var(--color-brand-red);
    }

    .buttonmenu, .buttonclose{
        text-decoration: none;
        display: inline-block;
        text-align: center;
        line-height: 35px;
        width: 120px;
        height: 35px;
        color: var(--color-brand-gold-light);
    }

    .buttonmenu { background: url(../images/MTGmenu.png) top left no-repeat; }
    .buttonclose { background: url(../images/MTGclose.png) top left no-repeat; }

    .subscript {
        vertical-align: sub;
        display: inline;
        font-size: 68%;
        color: white;
        line-height:0em;
    }

    img { border:0px; }


    .buttonfortooltip {
        background-color: var(--color-brand-red);
        background-clip: padding-box;
        border-radius: var(--radius-md);
        color: var(--color-brand-gold);
        font-family: MTGFont, Verdana, Arial, sans-serif;
        font-size:110%;
        padding-top: 5px;
        padding-right: 5px;
        padding-left: 5px;
        cursor:pointer;
        font-weight: 100;
        border:medium solid transparent;
    }
    .buttonfortooltipdefault {
        border:medium solid var(--color-brand-gold);
    }

    .addcardtooltip {
          cursor:pointer;
    }
    .grid-move-bar {
        display: none;
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        background: rgba(0,0,0,0.75);
        text-align: center;
        z-index: 20;
        padding: 4px 0;
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }
    .grid-card-container:hover .grid-move-bar {
        display: block;
    }
    .grid-move-bar.active {
        display: block;
    }
    .grid-move-btn {
        color: #fff;
        background: rgba(255,255,255,0.2);
        border: 1px solid rgba(255,255,255,0.4);
        border-radius: var(--radius-sm);
        padding: 2px 10px;
        margin: 0 4px;
        cursor: pointer;
        font-size: 14px;
        font-weight: bold;
    }
    .grid-move-btn:hover {
        background: rgba(255,255,255,0.4);
    }
    .ui-autocomplete {
        max-height: 250px;
        overflow-y: auto;
        /* prevent horizontal scrollbar */
        overflow-x: hidden;
    }

    .ui-autocomplete-loading {
        background: white url("../images/ui-anim_basic_16x16.gif") right center no-repeat;
    }

    .eventholder {
        background: var(--color-brand-gold);
        width: 355px;
        height: 120px;
        margin: 10px;
    }

    .eventleft {
        float:left;
        height: 110px;
        width: 95px;
        background-color: var(--color-brand-red);
        color: var(--color-brand-gold);
        background-size: cover;
        background-repeat: no-repeat;
        background-position: center; 
        margin-left:5px;
        margin-top:5px;
    }

    .eventright {
        position: relative;
        float:left;
        height: 110px;
        width: 240px; 
        margin-left: 5px; 
        background-color: var(--color-brand-red);
        color: var(--color-brand-gold);
        margin-right:5px;
        margin-top:5px;
        padding-left:5px;
    }

    .eventdateleftholder {
        color:white;
        padding:5px; 
        width:50px;
        height: 50px;
        font-size:10pt;


        background: linear-gradient(to bottom right, black, rgba(0,0,0,0), rgba(0,0,0,0));
    }
    
    .eventdaterightbottomholder {
        position:absolute;
        right:0;
        bottom:0;
        color:white;
        padding-right:3px;
         
        width:50px;
        height:45px;
        font-size:10pt;
        text-align:right;

        background: linear-gradient(to top left, black, rgba(0,0,0,0), rgba(0,0,0,0));
    }

    img.eventimageheader { 
        display: block;
        margin-left: auto;
        margin-right: auto;

        max-width:100%;
    }

    .maineventpage {
        margin-left: auto;
        margin-right: auto;
        padding-top: 5px;
        max-width:75%;
    }
    html.is-mobile .maineventpage {
        max-width:90%;
    }

    .eventtooltip {
        cursor: pointer;
    }
    tr:target {
        background-color: var(--color-brand-gold);
        transition: all 1s linear;
    }
    
    .graph {
        width: 360px;
        height: 208px;
        padding-bottom:4px;
        
        background-color: #eaeaea;
        ?>
    }
    
    
    .barcreature {
        width: 25px;
        margin-bottom: 1px;
        display: inline-block;
        position: relative;
        background-color: var(--color-brand-gold-light);
        color: var(--color-brand-red);
        vertical-align: bottom;
        text-align:center;
    }
    .barother {
        width: 25px;
        margin-top: 1px;
        display: inline-block;
        position: relative;
        color: var(--color-brand-gold-light);
        background-color: var(--color-brand-red);
        vertical-align: bottom;
        text-align:center;
    }
    .barcontainer {
        width: 30px;
        margin: 1px;
        display: inline-block;
        position: relative;
        vertical-align: bottom;
        text-align:center;
    }
    
    .chartcontainer {
        float:left;
        background-color : transparent;
        border-color: var(--color-brand-red);
        margin:5px;
        padding:2px;
        border-style: solid;
        border-width:2px;
        max-width: 360px;   /* Already exists – you can adjust this as needed */
        word-wrap: break-word;  /* Ensures long text doesn't overflow */
        overflow-wrap: break-word;
        white-space: normal;
    }
    
    .notificationpopupcontainer {
        max-width: 350px;
        max-height: 350px;
        overflow: auto;
    }
    .readnotification {
        color: var(--color-brand-gold-light);
        padding:2px;
    }
    .unreadnotification {
        background-color: var(--color-brand-gold-light);
        color: var(--color-brand-red);
        padding:2px;
    }
    .plainhref {
        text-decoration: none;
    }
    .notifiacationhr {
        border: none;
        height: 1px;
        background-color: var(--color-notification-hr);
    }
    .notificationtimepassed {
        color: var(--color-notification-time);
        font-size:80%;
    }
    
    .admin-section {
        display:none;
    }
    .admin-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 2px;
        margin-bottom: 1em;
    }
    .admin-tab {
        padding: 8px 14px;
        cursor: pointer;
        font-family: MTGFont, Verdana, Arial, sans-serif;
        font-size: 100%;
        font-weight: 100;
        color: var(--color-brand-gold);
        background-color: var(--color-brand-red);
        border-radius: var(--radius-sm);
    }
    .admin-tab:hover {
        background-color: #7a1520;
    }
    .admin-tab.active {
        background-color: white;
        color: var(--color-brand-red);
        border: 2px solid var(--color-brand-red);
    }
    html.is-mobile .admin-tab {
        font-size: 75%;
        padding: 6px 8px;
    }
    
    .broadcastalert {
        background-color: var(--color-brand-gold-light);
        color: var(--color-brand-red);
        width:90%;
        padding:.5em;
        border-radius: var(--radius-lg);
        margin-bottom:.5em;
    }

    .button:focus-visible,
    .buttonfortooltip:focus-visible,
    .menubutton:focus-visible {
        outline: 2px solid var(--color-brand-gold);
        outline-offset: 2px;
    }

    /* Dark mode — triggered by .dark-mode class on <html>
       Class is added by: manual toggle (?darkmode=TRUE) or JS auto-detect from OS preference */
    html.dark-mode {
        --color-row-even: #2a2a2a;
        --color-row-odd: #1e1e1e;
        --color-notification-hr: #444;
    }
    html.dark-mode body {
        color: #e0e0e0;
        background-color: #121212;
    }
    html.dark-mode .main {
        background-color: #1e1e1e;
        color: #e0e0e0;
        border-left: none;
        border-right: none;
    }
    html.dark-mode .page {
        background-color: #1e1e1e;
    }
    html.dark-mode a {
        color: var(--color-brand-gold);
    }
    html.dark-mode a:visited {
        color: var(--color-brand-gold-light);
    }
    html.dark-mode th {
        color: var(--color-brand-gold);
    }
    html.dark-mode input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
    html.dark-mode select, html.dark-mode textarea {
        background-color: #2a2a2a;
        color: #e0e0e0;
        border: 1px solid #555 !important;
    }
    html.dark-mode input[type="submit"] {
        background-color: var(--color-brand-red);
        color: var(--color-brand-gold);
        border: 1px solid var(--color-brand-red) !important;
        cursor: pointer;
    }
    html.dark-mode .broadcastalert {
        color: #1e1e1e;
    }
    html.dark-mode tr.normalcolor {
        background: var(--color-row-odd);
    }
    html.dark-mode .admin-tab.active {
        background-color: #1e1e1e;
    }
    html.dark-mode .graph {
        background-color: #2a2a2a;
    }
    /* Inline style overrides for dark mode */
    html.dark-mode td[style*="background: #C0C0C0"],
    html.dark-mode td[style*="background-color: #C0C0C0"] {
        background: #3a3a3a !important;
    }
    html.dark-mode td[style*="background: #FFFFFF"],
    html.dark-mode td[style*="background-color: #FFFFFF"] {
        background: #1e1e1e !important;
    }
    /* jQuery UI accordion (help page FAQ) */
    html.dark-mode .ui-widget-content {
        background: #1e1e1e;
        color: #e0e0e0;
        border-color: #555;
    }
    html.dark-mode .ui-widget-header {
        background: #2a2a2a;
        color: #e0e0e0;
        border-color: #555;
    }
    html.dark-mode .ui-state-default,
    html.dark-mode .ui-widget-content .ui-state-default {
        background: #2a2a2a;
        color: #e0e0e0;
        border-color: #555;
    }
    html.dark-mode .ui-state-active,
    html.dark-mode .ui-widget-content .ui-state-active {
        background: var(--color-brand-red);
        color: var(--color-brand-gold);
        border-color: var(--color-brand-red);
    }
    /* Inbox dark mode fixes */
    html.dark-mode div[style*="background-color:darkgray"] {
        background-color: #555 !important;
    }
    html.dark-mode div[style*="background-color:lightgray"] {
        background-color: #333 !important;
    }
    /* Message board dark mode fixes */
    html.dark-mode div[style*="border-color: lightgrey"] {
        border-color: #555 !important;
    }
    html.dark-mode div[style*="color:grey"] {
        color: #aaa !important;
    }
    html.dark-mode div[style*="background-color:GhostWhite"] {
        background-color: #2a2a2a !important;
    }
