/** General Styling **/
:root {
    font-size: var(--ig-font-size);
    /* --ig-font-size is controlled by the numeric user preference in Preference.js */
    --bs-badge-font-size: 0.85em;
}

body {
    color: var(--ig-text-color);
    background: var(--ig-background);
}

#main-container {
    height: calc(var(--ig-vh, 1vh) * 100);
    width: 100%;
}

#main-row {
    height: 100%;
    flex-wrap: nowrap;
}

#main-col {
    height: 100%;
    /* Position is set to relative so that the sub-window can be positioned absolutely
    *  This also allows the sub-window to be pushed properly when the ignition ai window is open
    */
    position: relative;
    flex: 1 1 0%;
    min-width: 0;
}

body.ig-login-page {
    background:
        radial-gradient(circle at 50% 0, color-mix(in srgb, var(--ig-accent) 10%, transparent), transparent 28rem),
        var(--ig-background);
}

body.ig-login-page #main-container {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: none;
    padding: 1.25rem;
}

body.ig-login-page #main-row {
    width: min(100%, 26rem);
    height: auto;
    flex: 0 1 26rem;
}

body.ig-login-page #main-col {
    height: auto;
    flex: 0 1 26rem;
}

body.ig-login-page ig-main-window.ig-login-window {
    width: 100%;
    height: auto !important;
    min-height: 0;
    padding: 0;
    background: var(--ig-surface);
    border: 1px solid color-mix(in srgb, var(--ig-border-color) 90%, transparent);
    border-radius: 0.5rem;
    box-shadow: var(--ig-card-shadow);
}

body.ig-login-page ig-main-window.ig-login-window [data-ig-main-window-element="content"] {
    height: auto !important;
    padding: 1.35rem !important;
}

body.ig-login-page .content-container {
    height: auto;
    overflow: visible;
}

.ig-login-form-holder {
    width: 100%;
}

.ig-login-heading {
    margin: 0 0 1rem 0;
    color: var(--ig-text-color);
    font-size: 1.35rem;
    line-height: 1.2;
    letter-spacing: 0;
}

.ig-login-form-holder form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    margin: 0 !important;
}

.ig-login-form-holder form > * {
    width: 100% !important;
    max-width: 100%;
    padding-right: 0 !important;
    padding-left: 0 !important;
}

.ig-login-form-holder .form-label {
    margin-bottom: 0.3rem;
    color: var(--ig-text-muted);
    font-size: 0.88rem;
}

.ig-login-form-holder .btn,
.ig-login-form-holder button,
.ig-login-form-holder input[type="submit"] {
    width: 100%;
}

.content-container {
    height: 100%;
    overflow: auto;
    flex: 1 1 auto;
}

/** Dashboard **/
.dashboard-shell {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 0.2rem;
}

.dashboard-player-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.5rem;
    align-items: center;
    min-width: 0;
}

.dashboard-player-hero-copy {
    min-width: 0;
}

.dashboard-verification-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0;
}

.dashboard-verification-notice > div {
    display: grid;
    gap: 0.2rem;
}

.dashboard-player-hero h1,
.dashboard-player-hero p,
.dashboard-character-copy h3,
.dashboard-character-copy p {
    margin: 0;
}

.dashboard-play-button,
.dashboard-play-icon,
.dashboard-character-play,
.dashboard-character-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dashboard-play-button {
    gap: 0.7rem;
}

.dashboard-play-button-copy {
    display: grid;
    line-height: 1.1;
}

.dashboard-character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(38rem, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.dashboard-character-card {
    min-width: 0;
}

.dashboard-character-summary {
    display: grid;
    grid-template-columns: 8.5rem minmax(0, 1fr) auto;
    gap: 1.15rem;
    align-items: stretch;
    min-width: 0;
}

.dashboard-character-copy {
    display: grid;
    align-content: center;
    gap: 0.35rem;
    min-width: 0;
}

.dashboard-character-copy h3,
.dashboard-character-copy p,
.dashboard-character-last-played {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-character-paper-doll {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 10.5rem;
    margin: 0;
    overflow: hidden;
}

.dashboard-character-paper-doll-image {
    width: min(100%, 8rem);
    height: min(100%, 9.5rem);
    object-fit: contain;
    image-rendering: pixelated;
}

.dashboard-character-heading,
.dashboard-character-location,
.dashboard-character-coordinates,
.dashboard-character-actions,
.dashboard-character-play {
    display: flex;
    align-items: center;
}

.dashboard-character-heading,
.dashboard-character-coordinates {
    flex-wrap: wrap;
}

.dashboard-character-heading {
    gap: 0.4rem 0.65rem;
}

.dashboard-character-location {
    gap: 0.35rem;
    min-width: 0;
}

.dashboard-character-location strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-character-coordinates {
    gap: 0.3rem;
}

.dashboard-character-play {
    align-self: center;
    gap: 0.35rem;
}

.dashboard-character-actions {
    flex-direction: column;
    gap: 0.5rem;
    justify-content: center;
}

.dashboard-character-profile {
    white-space: nowrap;
}

.dashboard-character-disclosure > summary,
.dashboard-character-disclosure-label,
.dashboard-character-item,
.dashboard-ilmari-card,
.dashboard-character-resource-line {
    display: flex;
    align-items: center;
}

.dashboard-character-disclosure > summary {
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-character-disclosure-label {
    gap: 0.45rem;
}

.dashboard-character-sheet {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.dashboard-character-saved-note {
    grid-column: 1 / -1;
}

.dashboard-character-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 0.45rem;
}

.dashboard-character-item,
.dashboard-ilmari-card {
    gap: 0.55rem;
    min-width: 0;
}

.dashboard-character-item-copy {
    display: grid;
    min-width: 0;
}

.dashboard-character-item-copy strong,
.dashboard-character-item-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-character-resource-line {
    justify-content: space-between;
}

.dashboard-run-history-list {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.8rem;
}

.dashboard-run-history-footer {
    display: flex;
    justify-content: center;
    padding: 0.75rem 1rem 1rem;
}

.dashboard-run-history-entry > summary,
.dashboard-run-history-heading,
.dashboard-run-history-death,
.dashboard-run-history-item {
    display: flex;
    align-items: center;
}

.dashboard-run-history-entry > summary,
.dashboard-run-history-death {
    justify-content: space-between;
    gap: 0.75rem;
}

.dashboard-run-history-heading {
    flex-wrap: wrap;
    gap: 0.3rem 0.6rem;
    min-width: 0;
}

.dashboard-run-history-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.dashboard-run-history-death {
    grid-column: 1 / -1;
}

.dashboard-run-history-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 0.4rem;
}

.dashboard-run-history-item {
    gap: 0.5rem;
    min-width: 0;
}

.dashboard-run-history-echo {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}

.dashboard-run-history-echo-icon {
    display: inline-flex;
    flex: 0 0 1rem;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    overflow: hidden;
}

.dashboard-run-history-echo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.dashboard-character-empty {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    grid-column: 1 / -1;
}

.dashboard-character-empty > div {
    display: grid;
}

.dashboard-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(20rem, auto);
    gap: 1.25rem;
    align-items: end;
    min-width: 0;
}

.dashboard-header-copy {
    min-width: 0;
}

.dashboard-header h1,
.dashboard-section-header h2,
.dashboard-overview-header h3 {
    margin: 0;
}

.dashboard-header-copy p,
.dashboard-section-header p,
.dashboard-overview-header p {
    margin: 0;
}

.dashboard-status-line {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
    min-width: 0;
}

.dashboard-work-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(22rem, 0.65fr);
    gap: 0.85rem;
    align-items: start;
}

.dashboard-side-rail {
    display: grid;
    gap: 0.85rem;
    min-width: 0;
}

.dashboard-main-column {
    display: grid;
    gap: 0.85rem;
    min-width: 0;
}

.dashboard-section,
.dashboard-panel {
    min-width: 0;
}

.dashboard-section-header {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.dashboard-recent-list,
.dashboard-shortcut-list,
.dashboard-overview-list {
    display: grid;
}

.dashboard-recent-list,
.dashboard-shortcut-list {
    margin-top: 0.85rem;
}

.dashboard-recent-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 0.7rem;
    align-items: center;
    min-width: 0;
    text-align: left;
}

.dashboard-row-icon,
.dashboard-row-arrow,
.dashboard-action-icon,
.dashboard-action-arrow,
.dashboard-section-icon,
.dashboard-system-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.dashboard-row-copy,
.dashboard-action-copy,
.dashboard-system-copy {
    display: grid;
    min-width: 0;
}

.dashboard-row-copy strong,
.dashboard-row-copy span,
.dashboard-action-copy strong,
.dashboard-action-copy span,
.dashboard-system-copy span,
.dashboard-system-copy strong,
.dashboard-system-copy small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-shortcut-list {
    gap: 0.35rem;
}

.dashboard-action-button {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: center;
    min-width: 0;
    text-align: left;
}

.dashboard-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.65rem;
}

.dashboard-overview-header {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    min-width: 0;
}

.dashboard-overview-header > div {
    min-width: 0;
}

.dashboard-overview-list {
    margin-top: 0.8rem;
}

.dashboard-overview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
    text-align: left;
}

.dashboard-system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 0.65rem;
    margin-top: 0.65rem;
}

.dashboard-system-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.65rem;
    align-items: start;
    min-width: 0;
    text-align: left;
}

.dashboard-side-rail .dashboard-system-grid {
    grid-template-columns: 1fr;
}

/** Player-facing character, pet, and quest pages **/
.player-page-shell {
    gap: 1rem;
}

.player-breadcrumbs,
.player-breadcrumbs button,
.player-profile-actions,
.player-profile-meta,
.player-character-selector,
.player-bond-meter,
.player-quest-heading,
.player-quest-objectives li,
.player-stat-row,
.player-overview-list > div {
    display: flex;
    align-items: center;
}

.player-breadcrumbs {
    flex-wrap: wrap;
    gap: 0.45rem;
}

.player-breadcrumbs button {
    gap: 0.35rem;
}

.player-profile-hero {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr) auto;
    gap: clamp(1rem, 3vw, 2.25rem);
    align-items: center;
    min-width: 0;
}

.player-profile-hero-copy {
    min-width: 0;
}

.player-profile-hero-copy h1,
.player-profile-hero-copy p,
.player-journal-hero h1,
.player-journal-hero p,
.player-panel h3,
.player-quest-card p,
.player-bond-chapter p {
    margin: 0;
}

.player-profile-paper-doll {
    min-height: 14rem;
}

.player-profile-paper-doll .dashboard-character-paper-doll-image {
    width: min(100%, 10rem);
    height: 13rem;
}

.player-profile-actions,
.player-profile-meta,
.player-character-selector {
    flex-wrap: wrap;
    gap: 0.55rem;
}

.player-profile-actions {
    justify-content: flex-end;
}

.player-profile-actions form {
    margin: 0;
}

.player-page-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(16rem, 0.72fr);
    gap: 1rem;
    align-items: start;
}

.player-page-main,
.player-page-rail,
.player-pet-grid,
.player-inventory-groups,
.player-bond-timeline,
.player-stat-list,
.player-quest-list,
.player-quest-grid,
.player-overview-list {
    display: grid;
    gap: 0.75rem;
}

.player-pet-grid {
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.player-pet-card {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.7rem;
    align-items: center;
    width: 100%;
    min-width: 0;
    text-align: left;
}

.player-pet-card-copy {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.player-inventory-groups {
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.player-pet-hero {
    grid-template-columns: 10rem minmax(0, 1fr) auto;
}

.player-pet-portrait,
.player-pet-card-visual {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.player-pet-portrait {
    width: 10rem;
    height: 10rem;
}

.player-pet-card-visual {
    width: 3.5rem;
    height: 3.5rem;
}

.player-pet-portrait img,
.player-pet-card-visual img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.player-bond-meter {
    gap: 0.28rem;
}

.player-bond-chapter {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.85rem;
    align-items: center;
}

.player-overview-list {
    margin: 0;
}

.player-overview-list > div,
.player-stat-row,
.player-quest-heading,
.player-quest-objectives li {
    justify-content: space-between;
    gap: 1rem;
}

.player-overview-list dd {
    margin: 0;
    text-align: right;
}

.player-journal-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.5rem;
    align-items: center;
}

.player-journal-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(5.5rem, auto));
    gap: 0.6rem;
}

.player-journal-summary > span {
    display: grid;
    text-align: center;
}

.player-quest-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.player-quest-objectives {
    display: grid;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.player-panel-action {
    margin-top: 0.75rem;
}

@media (max-width: 72rem) {
    .dashboard-header,
    .dashboard-work-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-status-line {
        justify-content: flex-start;
    }

    .dashboard-overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 42rem) {
    .dashboard-shell {
        padding: 0;
    }

    .dashboard-overview-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-player-hero {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .dashboard-play-button {
        width: 100%;
    }

    .dashboard-verification-notice {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-character-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-character-card {
        padding: 0.75rem;
    }

    .dashboard-character-summary {
        grid-template-columns: 6.5rem minmax(0, 1fr);
    }

    .dashboard-character-paper-doll {
        min-height: 8.5rem;
    }

    .dashboard-character-actions {
        grid-column: 1 / -1;
    }

    .dashboard-character-play {
        width: 100%;
    }

    .dashboard-character-profile {
        width: 100%;
    }

    .dashboard-character-sheet {
        grid-template-columns: 1fr;
    }

    .dashboard-run-history-body {
        grid-template-columns: 1fr;
    }

    .dashboard-recent-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .dashboard-recent-row time {
        display: none;
    }

    .player-profile-hero,
    .player-pet-hero,
    .player-page-layout,
    .player-journal-hero,
    .player-quest-grid {
        grid-template-columns: 1fr;
    }

    .player-profile-paper-doll,
    .player-pet-portrait {
        justify-self: center;
    }

    .player-profile-actions {
        justify-content: stretch;
    }

    .player-profile-actions > *,
    .player-profile-actions button {
        width: 100%;
    }

    .player-bond-chapter {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .player-bond-chapter > button {
        grid-column: 1 / -1;
    }
}

/** Web Components **/
ig-main-window {
    /* Height is dynamically set inside the web component */
    background: var(--ig-background);
    display: flex;
    flex-direction: column;
    padding: 5px 5px 2px 5px;
}

ig-sub-window {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 24, 39, 0.18);
    backdrop-filter: blur(2px);
    padding: 5px 5px 2px 5px;
    z-index: 100;
}

ig-sub-window .sub-window-content {
    width: 80%;
    height: 80%;
    background: var(--ig-background);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* This is half the width of the navigation menu */
    margin-left: -6.25rem;
    padding: 0.5rem 0.85rem 0.85rem 0.85rem;
    border: 1px solid rgba(85, 85, 85, 0.75);
    border-radius: 0.85rem;
    box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.18);
    overflow: hidden;
    transition: inset 0.2s ease, width 0.2s ease, height 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

ig-sub-window .sub-window-shell {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

ig-sub-window .sub-window-chrome {
    min-height: 2.75rem;
    padding: 0.25rem 0 0.6rem 0;
    border-bottom: 1px solid rgba(128, 128, 128, 0.18);
}

ig-sub-window .sub-window-main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding-top: 0.4rem;
}

ig-sub-window .sub-window-view-mount-point-holder,
ig-sub-window .sub-window-tab-content-holder,
ig-sub-window .sub-window-tab-bar-holder {
    min-width: 0;
    min-height: 0;
}

ig-sub-window .sub-window-control-holder {
    flex-shrink: 0;
    gap: 0.3rem;
    font-size: 0.9rem;
}

.sub-window-tab-content-holder {
    flex: 1 1 auto;
    height: auto;
    overflow: auto;
}

ig-sub-window .content-container {
    overflow: hidden;
}

ig-sub-window .sub-window-control-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    color: var(--ig-text-color);
    opacity: 0.78;
    transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

ig-sub-window .sub-window-control-button:hover,
ig-sub-window .sub-window-control-button:focus-visible {
    background: rgba(127, 127, 127, 0.12);
    opacity: 1;
    outline: none;
}

ig-sub-window [data-ig-window-action="cancel"]:hover,
ig-sub-window [data-ig-window-action="cancel"]:focus-visible {
    background: rgba(220, 53, 69, 0.12);
    color: var(--bs-danger);
}

ig-sub-window[data-ig-window-size="maximized"] .sub-window-content {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: auto;
    margin-left: 0;
    transform: none;
    padding: 5px 5px 2px 5px;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

ig-sub-window[data-ig-window-size="maximized"] {
    top: var(--ig-main-window-top, 0px);
    height: var(--ig-main-window-height, 100%);
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
}

ig-sub-window[data-ig-window-size="maximized"] .sub-window-shell {
    background: var(--ig-background);
    border: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.175));
    border-radius: 0.375rem;
    box-shadow: var(--bs-box-shadow-sm, 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075));
    overflow: hidden;
}

ig-sub-window[data-ig-window-size="maximized"] .sub-window-chrome {
    padding: 0.5rem 0.75rem;
    background: var(--ig-background);
}

ig-sub-window[data-ig-window-size="maximized"] .sub-window-main {
    padding: 0 0.75rem 0.75rem 0.75rem;
}

#minimized-window-holder {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.tab-content-container {
    overflow: auto;
}

#main-row ig-navigation-menu {
    width: 15.5rem;
    height: 100%;
    overflow-y: auto;
}

ig-navigation-menu .nav-link {
    color: var(--ig-nav-item-color);
    text-decoration: none;
}

#main-row ig-navigation-menu.mobile-active-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: var(--ig-background);
}

/* PANEL */
ig-search-overlay .search-overlay-panel {
    position: fixed;
    top: 55px;
    /* Below nav icon */
    right: 20px;
    /* Align with right nav */
    width: 350px;
    background: white;
    border-radius: .5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    padding: .75rem;
    z-index: 5000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all .18s ease;
}

ig-search-overlay .search-overlay-panel.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

ig-search-overlay .search-overlay-panel.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

/* SEARCH BAR */
ig-search-overlay .search-bar {
    display: flex;
    gap: .35rem;
    margin-bottom: .5rem;
}

ig-search-overlay .search-bar input {
    border-radius: .4rem;
    font-size: .85rem;
}

ig-search-overlay .search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .25rem .6rem;
    font-size: .8rem;
}

/* RESULTS */
ig-search-overlay .search-results {
    max-height: 260px;
    overflow-y: auto;
}

ig-search-overlay .no-results {
    padding: .5rem;
    color: #6c757d;
    font-size: .85rem;
}

/* Result item */
ig-search-overlay .nav-search-result-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .5rem;
    border-radius: .35rem;
    cursor: pointer;
    transition: background-color .15s ease;
}

ig-search-overlay .nav-search-result-item:hover {
    background-color: #f8f9fa;
}

/* Badge */
ig-search-overlay .nav-search-result-badge {
    font-size: .65rem;
    text-transform: uppercase;
    background-color: #0d6efd;
    color: white;
    padding: .2rem .45rem;
    border-radius: .25rem;
    font-weight: 600;
    letter-spacing: .5px;
}

ig-record-list-table {
    width: 100%;
    height: 100%;
    overflow: auto;
}

ig-color-selector .color-selector-quick-display {
    background-color: #000000;
    height: 100%;
    /** rounded border **/
    border: 1px solid #000;
    border-radius: 5px;
}

ig-color-selector .hue-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 15px;
    background: linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, red);
    outline: none;
    opacity: 0.9;
    margin-top: 5px;
    position: relative;
    z-index: 1;
}

ig-color-selector .hue-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 15px;
    cursor: pointer;
    background: transparent;
    border: none;
}

ig-color-selector .hue-slider::-moz-range-track {
    width: 100%;
    height: 15px;
    cursor: pointer;
    background: transparent;
    border: none;
}

ig-color-selector .hue-slider::-ms-track {
    width: 100%;
    height: 15px;
    cursor: pointer;
    background: transparent;
    border: none;
    color: transparent;
}

ig-color-selector .hue-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    background: #fff;
    border: 2px solid #000;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    margin-top: -5px;
    /* Center the thumb */
    z-index: 2;
}

ig-color-selector .hue-slider::-moz-range-thumb {
    width: 25px;
    height: 25px;
    background: #fff;
    border: 2px solid #000;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    margin-top: -5px;
    /* Center the thumb */
    z-index: 2;
}

ig-color-selector .hue-slider::-ms-thumb {
    width: 25px;
    height: 25px;
    background: #fff;
    border: 2px solid #000;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    margin-top: -5px;
    /* Center the thumb */
    z-index: 2;
}

ig-color-selector .hue-slider::-ms-fill-lower {
    background: transparent;
}

ig-color-selector .hue-slider::-ms-fill-upper {
    background: transparent;
}

.color-selector-quick-display-wrapper {
    position: relative;
}

.color-selector-quick-display {
    position: relative;
    z-index: 1;
    /* Ensure input is above the span initially */
}

.color-selector-quick-display+span {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translate(0%, -50%);
    color: white;
    text-shadow:
        1px 1px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 0 0 #000,
        -1px 0 0 #000,
        0 1px 0 #000,
        0 -1px 0 #000;
    /* Black outline */
    z-index: 2;
    /* Ensure span is above the input */
    pointer-events: none;
    /* Ensure span does not block input interactions */
}

.list-box-holder,
.date-selector-holder,
.time-selector-holder {
    z-index: 50000;
}

.list-box-holder .table-responsive {
    overflow-x: hidden;
}

.list-box-holder .list-box-value-cell {
    word-break: break-word;
    overflow-wrap: anywhere;
}

ig-textarea {
    padding-left: 0!important;
}

/** Calendar Date Selector **/
ig-calendar-table td[data-event-date]:hover {
    background: #f0f0f0;
}

ig-toast {
    position: fixed;
    z-index: 100000;
    right: 5%;
    /* This will be the final position after animation */
    top: 25px;
}

ig-toast .toast-notification {
    background-color: #559;
    text-align: center;
    color: white;
    padding: 1rem;
    margin-bottom: 1rem;
    animation: slide-in-right 0.5s ease-out forwards;
    position: relative;
    /* Make sure this is positioned relative to the toast-holder */
    right: 0%;
    /* Start position for the animation */
}

@keyframes slide-in-right {
    from {
        right: -10%;
        /* Start from the edge of the toast-holder */
        opacity: 0;
    }

    to {
        right: 0%;
        /* Move towards the final position, inside the toast-holder */
        opacity: 1;
    }
}


/** Calendar Styling **/
table .calendar-selected-cell {
    background: #badce3;
}

/** Generic Helper Classes **/
.hide-element {
    display: none !important;
}

.cursor-pointer {
    cursor: pointer;
}

.user-selection-none {
    user-select: none;
    -webkit-user-select: none;
}

.no-text-selection {
    user-select: none;
    -webkit-user-select: none;
}

/** Bootstrap overrides **/

:root {
    --bs-body-font-size: var(--ig-font-size);
}

.badge {
    --bs-badge-font-size: 0.85em;
}

.btn {
    font-size: .925rem;
}

.dropdown-menu {
    font-size: .925rem;
}

.offcanvas.offcanvas-end {
    --bs-offcanvas-width: 450px;
}

/** Mobile layout tweaks **/
@media (max-width: 991.98px) {
    #main-container {
        width: 100%;
    }

    ig-sub-window .sub-window-content {
        width: 95%;
        height: 90%;
        margin-left: 0;
    }

    ig-search-overlay .search-overlay-panel {
        width: min(350px, calc(100vw - 2rem));
        right: 1rem;
    }

    #main-row ig-navigation-menu.mobile-active-menu {
        padding: 0.5rem 0.75rem;
    }

    #main-row ig-navigation-menu .row.text-nowrap {
        white-space: normal;
    }

    #main-row ig-navigation-menu .nav-link {
        white-space: normal;
        word-break: break-word;
    }
}

@media (max-width: 767.98px) {
    ig-sub-window {
        top: var(--ig-main-window-top, 0px);
        height: var(--ig-main-window-height, 100%);
        padding: 0;
        background: rgba(0, 0, 0, 0.35);
    }

    ig-sub-window .sub-window-content {
        top: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
        left: 0.75rem;
        width: auto;
        height: auto;
        margin-left: 0;
        transform: none;
        border: 1px solid rgba(0, 0, 0, 0.2);
        border-radius: 0.75rem;
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    ig-sub-window[data-ig-window-size="maximized"] {
        top: var(--ig-main-window-top, 0px);
        height: var(--ig-main-window-height, 100%);
        padding: 0;
        background: transparent;
    }

    ig-sub-window[data-ig-window-size="maximized"] .sub-window-content {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        margin-left: 0;
        transform: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    ig-sub-window .sub-window-shell {
        height: auto;
        min-height: 100%;
    }

    ig-sub-window .content-container {
        height: auto;
        overflow: visible;
    }

    ig-sub-window .sub-window-tab-content-holder {
        height: auto;
    }

    ig-page-header .container-fluid > .d-flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    ig-page-header [data-ig-nav-group="left"],
    ig-page-header [data-ig-nav-group="center"],
    ig-page-header [data-ig-nav-group="right"] {
        flex-wrap: wrap;
    }

    ig-page-header [data-ig-nav-group="center"] {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    ig-page-header [data-ig-nav-group="right"] {
        margin-left: auto;
    }

    ig-page-header [data-ig-nav-group="left"] {
        margin-right: auto;
    }

    .ig-page-header-label--mobile-hidden {
        display: none;
    }

    ig-page-header .ig-page-header-link--profile .me-2 {
        margin-right: 0.25rem;
    }

    ig-page-header .nav-link {
        padding: 0.25rem 0.5rem;
    }

    ig-search-overlay .search-bar input {
        font-size: 16px;
    }

    .ig-record-table__controls {
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .ig-record-table__controls .btn-group {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.5rem;
    }

    .ig-record-table__controls .btn-group > .btn {
        margin-left: 0;
        border-radius: 0.375rem;
    }

    .ig-record-table__controls .js-selected-count,
    .ig-record-table__controls .js-edit-mode-hint {
        width: 100%;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    .list-box-holder .table-responsive {
        overflow-x: auto;
    }
}

.ig-edit-mode td.ig-cell-edited {
    background-color: #fff3cd;
    box-shadow: inset 0 0 0 1px #ffe69c;
}

.ig-record-table__row-action {
    min-width: 2rem;
}

.ig-record-table__row--deleted td:not([data-ig-action-cell="true"]):not([data-ig-status-cell="true"]) {
    opacity: 0.7;
    text-decoration: line-through;
}

.ig-record-table__viewport tbody > .ig-record-table__row {
    content-visibility: auto;
    contain-intrinsic-size: 44px;
}

/** Issue Tracker Conversation **/
ig-issue-tracker-conversation .issue-conversation-inline-link {
    color: var(--ig-accent);
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
    opacity: 0.88;
    cursor: pointer;
    transition: border-color 0.15s ease, opacity 0.15s ease, color 0.15s ease;
}

ig-issue-tracker-conversation .issue-conversation-inline-link:visited {
    color: var(--ig-accent);
}

ig-issue-tracker-conversation .issue-conversation-inline-link:hover,
ig-issue-tracker-conversation .issue-conversation-inline-link:focus-visible {
    color: var(--ig-accent);
    text-decoration: none;
    border-bottom-color: currentColor;
    opacity: 1;
}

/* Native article markup, shared by the editor and published pages. */
.wiki-content {
    color: var(--ig-text-color);
    font-size: 1rem;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.wiki-content > * {
    margin: 0 0 0.85rem;
}

.wiki-content > :last-child { margin-bottom: 0; }
.wiki-content [data-wiki-field] { white-space: pre-wrap; min-height: 1.65em; }
.wiki-content h2, .wiki-content h3, .wiki-content h4 {
    color: var(--ig-heading-color);
    font-weight: 650;
    line-height: 1.4;
    margin-top: 1.35rem;
}
.wiki-content > :first-child { margin-top: 0; }
.wiki-content h2 { font-size: 1.5em; }
.wiki-content h3 { font-size: 1.25em; }
.wiki-content h4 { font-size: 1.08em; }
.wiki-content .lead { font-size: 1.15em; font-weight: 400; }
.wiki-content ul, .wiki-content ol { padding-left: 1.5rem; }
.wiki-content li + li { margin-top: 0.2rem; }
.wiki-content blockquote {
    padding: 0.25rem 0 0.25rem 1rem;
    border-left: 3px solid var(--ig-accent);
    color: var(--ig-text-muted);
}
.wiki-content > a { display: block; color: var(--ig-accent); text-decoration: underline; }
.wiki-content pre {
    padding: 0.8rem 1rem;
    background: var(--ig-surface-subtle);
    border-radius: 0.25rem;
    font-size: 0.9em;
}
.wiki-content code { display: block; color: inherit; font: inherit; }
.wiki-content table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.wiki-content td { padding: 0.45rem 0.65rem; border: 1px solid var(--ig-border-color); vertical-align: top; }
.wiki-content .wiki-striped tr:nth-child(even) { background: var(--ig-surface-subtle); }
.wiki-content hr { margin: 1.25rem 0; border: 0; border-top: 1px solid var(--ig-border-color); opacity: 1; }

/* One set of controls outside the article; no per-block editor chrome. */
ig-wiki-editor { display: block; min-width: 0; }
ig-wiki-editor [hidden] { display: none !important; }
.wiki-editor-shell {
    position: relative;
    border: 1px solid var(--ig-border-color);
    border-radius: 0.35rem;
    background: var(--ig-surface);
}
.wiki-editor-shell > .wiki-content { padding: 1.15rem 1.25rem; min-height: 12rem; }
.wiki-editor-toolbar, .wiki-editor-tools {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.3rem;
    background: var(--ig-surface-subtle);
}
.wiki-editor-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--ig-border-color);
    border-radius: 0.35rem 0.35rem 0 0;
}
.wiki-editor-shell button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 2rem;
    height: 2rem;
    padding: 0.35rem;
    border: 0;
    border-radius: 0.25rem;
    background: transparent;
    color: var(--ig-text-muted);
    cursor: pointer;
}
.wiki-editor-shell button:hover:not(:disabled), .wiki-editor-shell button[aria-pressed="true"] {
    background: var(--ig-surface-strong);
    color: var(--ig-heading-color);
}
.wiki-editor-shell button:disabled { opacity: 0.3; cursor: default; }
.wiki-editor-shell button:focus-visible { outline: 2px solid var(--ig-accent); outline-offset: 1px; }
.wiki-editor-shell button[data-action="delete"]:hover { color: var(--bs-danger); }
.wiki-editor-preview { margin-left: auto; }
.wiki-editor-tools {
    position: absolute;
    z-index: 3;
    border: 1px solid var(--ig-border-color);
    border-radius: 0.35rem;
    box-shadow: 0 3px 10px #0002;
}
.wiki-editor-tools button { width: 1.65rem; height: 1.65rem; }
.wiki-editor-shell.is-editing .wiki-block-active { outline: 1px solid var(--ig-border-color); outline-offset: 4px; }
.wiki-editor-shell [contenteditable]:focus { outline: 1px solid var(--ig-accent); outline-offset: 4px; }
.wiki-editor-shell [contenteditable]:empty::before {
    content: attr(data-placeholder);
    color: var(--ig-text-muted);
    opacity: 0.65;
    pointer-events: none;
}
.wiki-editor-settings {
    position: absolute;
    z-index: 4;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 16rem;
    max-width: calc(100% - 8px);
    padding: 0.8rem;
    background: var(--ig-surface);
    border: 1px solid var(--ig-border-color);
    border-radius: 0.35rem;
    box-shadow: 0 6px 22px #0003;
    font-size: 0.85rem;
}
.wiki-editor-settings-heading { display: flex; justify-content: space-between; align-items: center; }
.wiki-editor-settings label { display: flex; flex-direction: column; gap: 0.25rem; }
.wiki-editor-settings input:not([type="checkbox"]), .wiki-editor-settings select {
    width: 100%;
    padding: 0.35rem 0.5rem;
    color: var(--ig-text-color);
    background: var(--ig-surface-subtle);
    border: 1px solid var(--ig-border-color);
    border-radius: 0.25rem;
}
.wiki-editor-settings .wiki-editor-checkbox { flex-direction: row; align-items: center; gap: 0.5rem; }
.wiki-editor-settings > button { width: auto; justify-content: flex-start; }
.wiki-editor-settings small { color: var(--ig-text-muted); }
.wiki-editor-shell.is-invalid { border-color: var(--bs-danger); }
.wiki-editor-feedback { margin-top: 0.35rem; color: var(--bs-danger); font-size: 0.85rem; }
@media (max-width: 575.98px) {
    .wiki-editor-shell > .wiki-content { padding: 1rem 0.75rem; }
}

.player-achievement-grid,
.player-discovery-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}
.player-achievement-card,
.player-achievement-reward,
.player-discovery-card {
    padding: 0.85rem;
    border: 1px solid var(--ig-border-color);
    border-radius: 0.65rem;
    background: var(--ig-surface-subtle);
}
.player-achievement-card[data-earned="false"] { opacity: 0.68; }
.player-achievement-card h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.player-achievement-card p { margin: 0 0 0.55rem; color: var(--ig-text-muted); }
.player-achievement-points { float: right; color: var(--ig-accent); }
.player-achievement-rewards { display: grid; gap: 0.55rem; margin-top: 1rem; }
.player-achievement-reward,
.player-discovery-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.7rem; }
.player-achievement-reward-visual,
.player-discovery-visual { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; }
.player-achievement-reward-visual img,
.player-discovery-visual img { width: 2.5rem; height: 2.5rem; object-fit: contain; }
.player-achievement-reward > span:nth-child(2),
.player-discovery-card > span:nth-child(2) { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.player-achievement-reward[data-state="ready"] > b { color: var(--bs-success); }
.player-achievement-reward[data-state="locked"] > b { color: var(--ig-text-muted); }
.player-discovery-card p { margin: 0.25rem 0 0; color: var(--ig-text-muted); font-size: 0.88rem; }
.player-discovery-category { align-self: start; }
.player-progress-links { display: grid; gap: 0.55rem; margin-top: 0.75rem; }
.player-progress-link { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.65rem; align-items: center; width: 100%; min-width: 0; padding: 0.7rem; text-align: left; }
.player-progress-link > span:nth-child(2) { display: grid; min-width: 0; }
.player-progress-link-icon { display: inline-flex; align-items: center; justify-content: center; }
.player-pagination { display: block; margin-top: 0.85rem; }

@media (max-width: 42rem) {
    .player-discovery-card { grid-template-columns: auto minmax(0, 1fr); }
    .player-discovery-category { grid-column: 2; justify-self: start; }
}
