:root {
    --tc-navy-950: #061823;
    --tc-navy-900: #0a283d;
    --tc-navy-850: #0d3047;
    --tc-navy-800: #12495d;
    --tc-navy-700: #2a6f78;
    --tc-teal: #2a6f78;
    --tc-teal-bright: #58a6b8;
    --tc-gold: #9b7b3f;
    --tc-gold-bright: #d7bb77;
    --tc-wood: #3d3322;
    --tc-wood-light: #745d2d;
    --tc-cream: #eff7f3;
    --tc-muted: #b8c9ca;
    --tc-border: rgba(155, 123, 63, .28);
    --tc-danger: #b65f49;
    --tc-success: #2f8a55;
    --tc-font-body: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
    --tc-font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    --tc-text-base: 13px;
    --tc-text-small: 12px;
    --tc-text-label: 11px;
    --tc-icon-sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.42 1.42M17.65 17.65l1.42 1.42M2 12h2M20 12h2M4.93 19.07l1.42-1.42M17.65 6.35l1.42-1.42'/%3E%3C/svg%3E");
    --tc-icon-moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
    --tc-icon-rain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 13h1a4 4 0 1 0-.6-7.95A6 6 0 0 0 5 8a4 4 0 0 0 1 7h10'/%3E%3Cpath d='M8 19v2M12 17v2M16 19v2'/%3E%3C/svg%3E");
    --tc-icon-thunder: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 12h1a4 4 0 1 0-.6-7.95A6 6 0 0 0 5 7a4 4 0 0 0 1 7h4'/%3E%3Cpath d='m13 11-2 5h3l-2 5'/%3E%3C/svg%3E");
}

body.tc-map-active {
    font-family: var(--tc-font-body);
    font-size: var(--tc-text-base);
}

.tc-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.tc-icon {
    display: block;
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    pointer-events: none;
}

.tc-atmosphere-layer,
.tc-atmosphere-clouds,
.tc-atmosphere-tint {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.tc-atmosphere-layer {
    overflow: hidden;
    opacity: 1;
    transition: opacity 180ms ease;
}

.tc-atmosphere-layer.tc-atmosphere-disabled {
    opacity: 0;
    visibility: hidden;
}

.tc-atmosphere-layer.tc-atmosphere-zooming {
    opacity: 0;
    transition-duration: 70ms;
}

.tc-atmosphere-clouds {
    image-rendering: auto;
    transform-origin: 0 0;
    will-change: transform, opacity;
    transition: opacity 240ms ease;
}

.tc-atmosphere-tint {
    transition: background-color 1200ms linear, backdrop-filter 1200ms linear;
}

body.tc-squaremap .leaflet-tile-pane.tc-atmosphere-terrain {
    transition: filter 1200ms linear;
}

.tc-shell,
.tc-shell * {
    box-sizing: border-box;
}

.tc-sidebar {
    --tc-sidebar-bg: #103650;
    --tc-sidebar-bg-deep: #0a283e;
    --tc-sidebar-surface: #194b68;
    --tc-sidebar-surface-soft: #153e59;
    --tc-sidebar-surface-hover: #23617f;
    --tc-sidebar-text: #f3ead8;
    --tc-sidebar-title: #fff8e9;
    --tc-sidebar-muted: #c2ced5;
    --tc-sidebar-label: #e0cc99;
    --tc-sidebar-border: rgba(218, 181, 99, .56);
    --tc-sidebar-divider: rgba(198, 218, 226, .22);
    --tc-sidebar-teal: #58c1b6;
    --tc-sidebar-danger-surface: #402e34;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10020;
    width: 380px;
    color: var(--tc-sidebar-text);
    background:
        radial-gradient(circle at 8% 10%, rgba(88, 193, 182, .12), transparent 34%),
        linear-gradient(165deg, var(--tc-sidebar-surface), var(--tc-sidebar-bg) 24%, var(--tc-sidebar-bg-deep));
    border-right: 2px solid var(--tc-gold);
    box-shadow: 10px 0 28px rgba(0, 12, 22, .3) !important;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    overflow: hidden;
}

.tc-sidebar.tc-open {
    transform: translateX(0);
}

.tc-scroll {
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scroll-padding-block: 16px 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--tc-gold) var(--tc-sidebar-bg-deep);
}

.tc-sidebar [hidden] {
    display: none !important;
}

.tc-hero {
    position: relative;
    padding: 17px 18px 15px;
    color: var(--tc-sidebar-text);
    background:
        radial-gradient(circle at 12% 20%, rgba(88, 193, 182, .15), transparent 42%),
        linear-gradient(135deg, var(--tc-sidebar-surface), var(--tc-sidebar-bg));
    border-bottom: 1px solid var(--tc-sidebar-border);
    box-shadow: 0 5px 16px rgba(0, 16, 27, .18) !important;
}

.tc-hero::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--tc-sidebar-teal), var(--tc-gold), var(--tc-sidebar-teal));
}

.tc-hero::after {
    content: none;
}

.tc-hero-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding-right: 40px;
}

.tc-hero-simple .tc-hero-main {
    min-height: 44px;
}

.tc-hero-copy {
    min-width: 0;
}

.tc-emblem {
    position: relative;
    display: grid;
    flex: 0 0 54px;
    place-items: center;
    width: 54px;
    height: 54px;
    margin: 0;
    border: 2px solid var(--tc-gold-bright);
    border-radius: 50%;
    outline: 1px solid var(--tc-sidebar-bg-deep);
    color: #fff8e7;
    box-shadow: inset 0 1px rgba(255, 255, 255, .16), 0 3px 10px rgba(0, 12, 22, .28) !important;
}

.tc-emblem-image {
    width: 34px;
    height: 34px;
}

.tc-emblem:has(.tc-main-icon) {
    border: 0;
    outline: 0;
    background: transparent !important;
    box-shadow: none !important;
}

.tc-emblem .tc-main-icon {
    width: 54px;
    height: 54px;
}

.tc-emblem.tc-flag-frame {
    flex-basis: 82px;
    width: 82px;
    height: 54px;
    overflow: hidden;
    border: 0;
    border-radius: 3px;
    outline: 1px solid var(--tc-gold-bright);
    outline-offset: 0;
    background-color: #071a2a !important;
}

.tc-flag-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: auto !important;
    background: #071a2a;
}

.tc-flag-image.tc-invalid {
    display: none;
}

.tc-nation-color-icon {
    display: inline-grid;
    flex: 0 0 50px;
    width: 50px;
    height: 50px;
    place-items: center;
    color: var(--tc-nation-color);
    pointer-events: none;
}

.tc-nation-color-icon .tc-icon {
    width: 82%;
    height: 82%;
    stroke-width: 1.8;
}

.tc-emblem.tc-nation-fallback-frame {
    border: 0;
    outline: 0;
    background: transparent !important;
    box-shadow: none !important;
}

.tc-emblem .tc-nation-color-icon-hero {
    flex-basis: 54px;
    width: 54px;
    height: 54px;
}

.tc-nation-color-icon-mini {
    flex-basis: 24px;
    width: 24px;
    height: 24px;
}

.tc-nation-color-icon-list {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
}

.tc-title {
    min-width: 0;
    margin: 0;
    color: #fff4da;
    font-family: Constantia, Cambria, Georgia, serif;
    font-size: 22px;
    font-variant: small-caps;
    line-height: 1.1;
    letter-spacing: .055em;
    white-space: normal;
    overflow-wrap: anywhere;
}

.tc-subtitle {
    margin: 5px 0 0;
    color: var(--tc-sidebar-muted);
    font-size: 12px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.tc-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border: 1px solid var(--tc-sidebar-border);
    border-radius: 50%;
    color: #ead9b6;
    background: var(--tc-sidebar-bg-deep);
    cursor: pointer;
    font-size: 20px;
}

.tc-close:hover {
    color: #fff3d1;
    border-color: var(--tc-gold-bright);
    background: var(--tc-sidebar-surface-hover);
}

.tc-board {
    max-height: 5.2em;
    margin: 11px 0 0;
    padding: 8px 10px;
    overflow-y: auto;
    color: var(--tc-sidebar-muted);
    border: 1px solid var(--tc-sidebar-divider);
    border-left: 3px solid var(--tc-sidebar-teal);
    border-radius: 3px;
    background: var(--tc-sidebar-bg-deep);
    font-family: Constantia, Georgia, serif;
    font-size: 13px;
    font-style: italic;
}

.tc-content {
    padding: 16px 18px calc(24px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 180px);
}

.tc-affiliation {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.tc-mini-flag {
    position: relative;
    display: inline-block;
    flex: 0 0 28px;
    width: 28px;
    height: 18px;
    overflow: hidden;
    border: 1px solid var(--tc-sidebar-border);
    border-radius: 2px;
    vertical-align: middle;
}

.tc-section {
    padding: 0 0 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--tc-sidebar-divider);
}

.tc-section:last-child {
    border-bottom: 0;
}

.tc-kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    margin: 0 0 9px;
    padding: 0 0 6px;
    color: var(--tc-gold-bright);
    border: 0;
    background: transparent;
    font-family: Constantia, Georgia, serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.tc-section-heading-icon {
    display: grid;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    place-items: center;
    border: 1px solid rgba(218, 181, 99, .28);
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(38, 94, 120, .72), rgba(7, 32, 49, .68));
    box-shadow: inset 0 1px rgba(255, 255, 255, .1), 0 2px 5px rgba(0, 12, 22, .2) !important;
}

.tc-section-heading-icon .tc-icon {
    width: 20px;
    height: 20px;
}

.tc-section-heading-icon:has(.tc-main-icon) {
    border: 0;
    background: transparent;
    box-shadow: none !important;
}

.tc-section-heading-icon .tc-main-icon {
    width: 26px;
    height: 26px;
}

.tc-kicker::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--tc-sidebar-border), transparent);
}

.tc-stat-label {
    color: var(--tc-sidebar-label);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.tc-fact-strip {
    display: flex;
    margin-bottom: 15px;
    padding: 11px 6px;
    border: 1px solid var(--tc-sidebar-divider);
    border-radius: 4px;
    background: linear-gradient(145deg, rgba(41, 103, 128, .32), rgba(9, 40, 59, .24));
    box-shadow: 0 3px 9px rgba(0, 12, 22, .14) !important;
}

.tc-fact-strip > span {
    display: grid;
    flex: 1 1 0;
    gap: 2px;
    min-width: 0;
    padding: 0 12px;
    text-align: center;
}

.tc-fact-strip > span + span {
    border-left: 1px solid var(--tc-sidebar-divider);
}

.tc-fact-strip strong {
    color: var(--tc-sidebar-title);
    font-family: var(--tc-font-display);
    font-size: 19px;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.tc-fact-strip small {
    color: var(--tc-sidebar-label);
    font-size: var(--tc-text-label);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.tc-info-list {
    margin: 0;
}

.tc-info-section,
.tc-government-section {
    padding: 11px 12px 12px;
    border: 1px solid var(--tc-sidebar-divider);
    border-left: 3px solid rgba(88, 193, 182, .68);
    border-radius: 4px;
    background: linear-gradient(145deg, rgba(36, 93, 119, .3), rgba(8, 37, 56, .22));
    box-shadow: 0 3px 10px rgba(0, 12, 22, .14) !important;
}

.tc-info-row {
    display: grid;
    grid-template-columns: minmax(96px, .8fr) minmax(0, 1.2fr);
    gap: 12px;
    padding: 7px 2px;
    border-bottom: 1px solid var(--tc-sidebar-divider);
}

.tc-info-row:last-child {
    border-bottom: 0;
}

.tc-info-row dt,
.tc-info-row dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.tc-info-row dt {
    color: var(--tc-sidebar-label);
}

.tc-info-row dd {
    color: var(--tc-sidebar-title);
    font-weight: 700;
    text-align: right;
}

.tc-section-note {
    margin: 0 0 8px;
    color: var(--tc-sidebar-muted);
    line-height: 1.5;
}

.tc-wealth {
    position: relative;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 11px;
    padding: 11px 0 0;
    border: 0;
    border-top: 1px solid var(--tc-gold);
    border-radius: 0;
    background: transparent;
}

.tc-wealth-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: var(--tc-gold-bright);
    border: 1px solid var(--tc-gold);
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(35, 91, 117, .78), rgba(8, 35, 53, .74));
    box-shadow: inset 0 1px rgba(255, 255, 255, .1), 0 2px 7px rgba(0, 12, 22, .22) !important;
}

.tc-wealth-icon .tc-icon {
    width: 22px;
    height: 22px;
}

.tc-wealth-copy {
    min-width: 0;
}

.tc-wealth .tc-stat-label,
.tc-treasury-detail > span {
    color: var(--tc-sidebar-label);
}

.tc-wealth strong {
    display: block;
    margin-top: 4px;
    color: #f0d681;
    font-family: var(--tc-font-display);
    font-size: 22px;
    line-height: 1;
    overflow-wrap: anywhere;
}

.tc-treasury-details {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    gap: 8px 12px;
    padding-top: 9px;
    border-top: 1px solid var(--tc-sidebar-divider);
}

.tc-treasury-detail {
    min-width: 0;
}

.tc-treasury-detail > span {
    display: block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1.25;
    text-transform: uppercase;
}

.tc-treasury-detail > strong {
    display: block;
    margin-top: 3px;
    color: var(--tc-sidebar-text);
    font-family: var(--tc-font-display);
    font-size: 14px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.tc-list {
    display: grid;
    gap: 6px;
}

.tc-card,
.tc-row-button {
    --tc-card-accent: var(--tc-sidebar-border);
    padding: 10px 12px;
    color: var(--tc-sidebar-text);
    border: 1px solid var(--tc-sidebar-divider);
    border-left: 3px solid var(--tc-card-accent);
    border-radius: 3px;
    background: linear-gradient(145deg, var(--tc-sidebar-surface), var(--tc-sidebar-surface-soft));
    box-shadow: 0 2px 7px rgba(0, 12, 22, .16) !important;
}

.tc-row-button,
.tc-result,
.tc-result small {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

.tc-card-title {
    color: var(--tc-sidebar-title);
    font-family: var(--tc-font-display);
    font-size: 13px;
    font-weight: 700;
}

.tc-card-meta,
.tc-empty {
    margin-top: 5px;
    color: var(--tc-sidebar-muted);
    font-size: 11px;
    line-height: 1.45;
}

.tc-government-section {
    padding-bottom: 15px;
}

.tc-office-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.tc-office-heading .tc-badge {
    flex: 0 0 auto;
    margin-left: 0;
}

.tc-offices-section .tc-list {
    gap: 6px;
}

.tc-directory-search {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    margin-bottom: 16px;
    overflow: hidden;
    color: var(--tc-sidebar-label);
    border: 1px solid var(--tc-sidebar-border);
    border-radius: 4px;
    background: linear-gradient(145deg, var(--tc-sidebar-bg), var(--tc-sidebar-bg-deep));
    box-shadow: inset 0 1px 4px rgba(0, 12, 22, .22), 0 2px 7px rgba(0, 12, 22, .14) !important;
}

.tc-directory-search:focus-within {
    border-color: var(--tc-gold-bright);
    outline: 1px solid rgba(242, 212, 129, .25);
}

.tc-directory-search-icon {
    display: grid;
    height: 34px;
    place-items: center;
    font-size: 15px;
}

.tc-directory-search input {
    width: 100%;
    height: 34px;
    padding: 0 9px 0 0;
    color: var(--tc-sidebar-text);
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
}

.tc-directory-search input::placeholder {
    color: var(--tc-sidebar-muted);
    opacity: .85;
}

.tc-directory-no-results {
    margin-top: 0;
}

.tc-office-card {
    --tc-card-accent: #528cad;
    padding: 9px 11px;
}

.tc-office-name {
    min-width: 0;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.tc-office-kind {
    color: #c9deea;
    border-color: rgba(100, 163, 194, .55);
    background: rgba(47, 108, 141, .28);
}

.tc-office-card[data-office-kind="executive"] {
    --tc-card-accent: var(--tc-gold);
}

.tc-office-card[data-office-kind="executive"] .tc-office-kind {
    color: #f1d89d;
    border-color: rgba(199, 164, 90, .52);
    background: rgba(134, 95, 32, .28);
}

.tc-office-card[data-office-kind="legislative"] {
    --tc-card-accent: var(--tc-sidebar-teal);
}

.tc-office-card[data-office-kind="legislative"] .tc-office-kind {
    color: #c8eeea;
    border-color: rgba(69, 182, 173, .48);
    background: rgba(31, 130, 127, .25);
}

.tc-office-card[data-office-kind="generic"] {
    --tc-card-accent: #7187b7;
}

.tc-office-holders {
    margin-top: 5px;
    color: var(--tc-sidebar-text);
    font-size: 11px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.tc-office-role {
    color: var(--tc-sidebar-label);
    font-weight: 700;
}

.tc-office-description {
    margin-top: 5px;
    color: var(--tc-sidebar-muted);
    font-size: 10px;
    line-height: 1.35;
}

.tc-diplomacy-legend {
    position: fixed;
    top: 190px;
    right: 16px;
    z-index: 10010;
    width: 180px;
    padding: 10px 11px 11px;
    color: #dbe9e9;
    border: 1px solid #b98a35;
    border-radius: 6px;
    background: linear-gradient(145deg, #174966, #0b2d45);
    box-shadow: 0 7px 18px rgba(0, 12, 22, .28) !important;
    font-family: var(--tc-font-body);
    font-size: var(--tc-text-small);
}

.tc-diplomacy-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(185, 138, 53, .48);
    color: #d5b667;
    font-family: var(--tc-font-display);
    font-size: var(--tc-text-base);
    letter-spacing: .055em;
    text-transform: uppercase;
}

.tc-diplomacy-heading strong {
    min-width: 0;
    color: #f8ebca;
    font-size: var(--tc-text-small);
    overflow-wrap: anywhere;
    text-align: right;
}

.tc-diplomacy-key {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.tc-diplomacy-key span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tc-diplomacy-key i {
    display: block;
    flex: 0 0 13px;
    width: 13px;
    height: 13px;
    border: 1px solid rgba(255, 255, 255, .78);
    border-radius: 2px;
    background: #d9dde5;
}

.tc-diplomacy-key i[data-relation="own"] { background: #75ef4e; }
.tc-diplomacy-key i[data-relation="war"] { background: #d9413b; }
.tc-diplomacy-key i[data-relation="enemy"] { background: #ee8a2e; }
.tc-diplomacy-key i[data-relation="ally"] { background: #35ced0; }
.tc-diplomacy-key i[data-relation="other"] { background: #d9dde5; }
.tc-diplomacy-key i[data-relation="claim"] { background: #315b43; }

.tc-row-button {
    width: 100%;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
}

.tc-row-button:hover {
    color: var(--tc-sidebar-title);
    border-color: var(--tc-gold-bright);
    background: var(--tc-sidebar-surface-hover);
}

.tc-row-button:focus-visible,
.tc-close:focus-visible,
.tc-tool:focus-visible,
.tc-result:focus-visible,
.tc-search:focus-visible {
    outline: 2px solid #f2d481;
    outline-offset: 2px;
}

.tc-conflict-card {
    --tc-card-accent: var(--tc-danger);
    background: var(--tc-sidebar-danger-surface);
}

.tc-conflict-card .tc-card-title {
    color: var(--tc-sidebar-title);
}

.tc-conflict-card .tc-card-meta {
    color: var(--tc-sidebar-muted);
}

.tc-battle-card {
    --tc-card-accent: #d69135;
}

.tc-battle-summary {
    width: 100%;
    padding: 13px 14px;
    color: var(--tc-sidebar-text);
    cursor: pointer;
    font-family: var(--tc-font-body);
    text-align: left;
}

.tc-battle-summary:hover {
    color: var(--tc-sidebar-title);
    border-color: var(--tc-gold-bright);
    background: var(--tc-sidebar-surface-hover);
}

.tc-battle-open {
    display: inline-block;
    margin-top: 9px;
    color: #f0d595;
    font-family: var(--tc-font-display);
    font-size: var(--tc-text-small);
    font-weight: 700;
    letter-spacing: .035em;
}

.tc-battle-scoreboard {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.tc-battle-score {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 13px;
    color: var(--tc-sidebar-text);
    border: 1px solid var(--tc-sidebar-divider);
    border-radius: 3px;
    background: var(--tc-sidebar-surface-soft);
}

.tc-battle-score > span {
    color: var(--tc-sidebar-label);
    font-family: var(--tc-font-display);
    font-size: var(--tc-text-small);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.tc-battle-score > strong {
    font-family: var(--tc-font-display);
    font-size: 30px;
    line-height: 1;
}

.tc-battle-score > small {
    color: var(--tc-sidebar-muted);
    font-size: var(--tc-text-small);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.tc-attacker-score {
    border-top: 4px solid #b84638;
}

.tc-defender-score {
    border-top: 4px solid #3f7ea6;
}

.tc-score-balance {
    height: 10px;
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid #6d573d;
    border-radius: 2px;
    background: #315f80;
}

.tc-score-balance > span {
    display: block;
    height: 100%;
    background: #a54136;
}

.tc-battle-timing {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 10px;
}

.tc-battle-timing > span {
    color: var(--tc-sidebar-muted);
    font-size: var(--tc-text-small);
    line-height: 1.45;
}

.tc-battle-timing strong {
    display: block;
    color: var(--tc-sidebar-label);
    font-family: var(--tc-font-display);
    font-size: var(--tc-text-small);
    letter-spacing: .06em;
    text-transform: uppercase;
}

.tc-objective-list {
    display: grid;
    gap: 10px;
}

.tc-objective-card {
    --tc-card-accent: var(--tc-gold);
    padding: 13px;
}

.tc-objective-card[data-control="attacker"] {
    --tc-card-accent: var(--tc-danger);
}

.tc-objective-card[data-control="defender"] {
    --tc-card-accent: #3f7ea6;
}

.tc-objective-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.tc-objective-heading > div {
    min-width: 0;
}

.tc-objective-meter {
    position: relative;
    height: 12px;
    margin-top: 11px;
    border: 1px solid #735b3e;
    border-radius: 2px;
    background: linear-gradient(90deg, #315f80 0 48%, #b9aa88 48% 52%, #a54136 52% 100%);
}

.tc-objective-meter::after {
    position: absolute;
    top: -3px;
    bottom: -3px;
    left: 50%;
    width: 1px;
    background: #f2dfb4;
    content: "";
}

.tc-objective-pointer {
    position: absolute;
    z-index: 1;
    top: 50%;
    width: 8px;
    height: 18px;
    border: 2px solid #f4e4bd;
    border-radius: 2px;
    background: #17222a;
    transform: translate(-50%, -50%);
}

.tc-objective-legend {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    color: var(--tc-sidebar-muted);
    font-size: 11px;
    font-weight: 700;
}

.tc-objective-focus {
    width: 100%;
    margin-top: 11px;
}

.tc-progress {
    height: 7px;
    margin-top: 9px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,.62);
    border-radius: 2px;
    background: #07131d;
}

.tc-progress > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #9b3529, #d36a48);
}

.tc-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    color: #eed9aa;
    border: 1px solid rgba(199,164,90,.38);
    border-radius: 12px;
    background: rgba(124,92,41,.24);
    font-family: "Segoe UI", sans-serif;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.tc-badge.tc-live {
    color: #ffd1c7;
    border-color: rgba(198,80,61,.62);
    background: rgba(134,45,35,.48);
}

.tc-badge.tc-safe {
    color: #d2f2ce;
    border-color: rgba(115,184,107,.46);
    background: rgba(58,112,54,.35);
}

.tc-commandbar {
    position: fixed;
    left: 50%;
    bottom: 18px;
    z-index: 10010;
    display: flex;
    align-items: stretch;
    gap: 7px;
    max-width: calc(100vw - 32px);
    padding: 6px 7px;
    border: 1px solid #d5a952;
    border-radius: 7px;
    background:
        linear-gradient(90deg, rgba(217,173,81,.15), transparent 12%, transparent 88%, rgba(217,173,81,.15)),
        linear-gradient(rgba(255,255,255,.10), transparent 22%),
        linear-gradient(#1d4d69, #0d2d45 70%);
    box-shadow: 0 8px 22px rgba(0, 12, 22, .32), inset 0 0 0 2px rgba(5, 27, 43, .78), inset 0 0 0 3px rgba(143, 100, 37, .52) !important;
    transform: translateX(-50%);
}

.tc-search-wrap {
    position: relative;
    flex: 0 0 clamp(215px, 23vw, 300px);
    width: clamp(215px, 23vw, 300px);
}

.tc-search {
    width: 100%;
    height: 100%;
    min-height: 43px;
    padding: 0 15px 0 39px;
    color: #e8e7dc;
    border: 1px solid #8d713b;
    border-radius: 5px;
    outline: 0;
    background: rgba(10, 40, 61, .86);
    box-shadow: inset 0 2px 6px rgba(0, 12, 22, .28) !important;
}

.tc-search::placeholder {
    color: #8fa9b7;
}

.tc-search:focus {
    border-color: var(--tc-gold-bright);
    box-shadow: inset 0 2px 6px rgba(0,0,0,.5), 0 0 0 1px rgba(199,164,90,.35);
}

.tc-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    z-index: 1;
    color: #b9d5dc;
    transform: translateY(-50%);
}

.tc-results {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    display: none;
    max-height: 330px;
    padding: 6px;
    overflow-y: auto;
    border: 2px ridge var(--tc-gold);
    border-radius: 4px;
    background: linear-gradient(#1a526f, #0b2c44);
    box-shadow: 0 10px 26px rgba(0, 12, 22, .34) !important;
}

.tc-results.tc-visible {
    display: grid;
    gap: 3px;
}

.tc-result {
    padding: 9px 10px;
    color: #eee3ca;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.tc-result:hover {
    border-color: rgba(60,159,165,.34);
    background: rgba(29,109,132,.35);
}

.tc-result small {
    display: block;
    margin-top: 2px;
    color: #a5b6c0;
}

.tc-toolbar {
    position: static;
    display: flex;
    gap: 5px;
    padding: 0;
    border: 0;
    background: transparent;
}

.tc-viewbar {
    position: fixed;
    top: 102px;
    left: 16px;
    z-index: 10010;
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 226px;
    padding: 6px;
    border: 1px solid #d5a952;
    border-radius: 7px;
    background: linear-gradient(#1d4d69, #0d2d45 70%);
    box-shadow: 0 7px 20px rgba(0, 12, 22, .3), inset 0 0 0 2px rgba(5, 27, 43, .78) !important;
    transition: width 160ms ease;
}

.tc-viewbar-toggle {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) 18px;
    align-items: center;
    min-height: 29px;
    width: 100%;
    padding: 4px 7px;
    color: #e9d7ae;
    border: 0;
    border-bottom: 1px solid rgba(201, 156, 78, .36);
    background: transparent;
    cursor: pointer;
    font-family: var(--tc-font-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-align: left;
    text-transform: uppercase;
}

.tc-viewbar-toggle:hover,
.tc-viewbar-toggle:focus-visible {
    color: #fff0c9;
    outline: 0;
    background: rgba(39, 115, 141, .24);
}

.tc-viewbar-toggle-icon,
.tc-viewbar-toggle-arrow {
    color: #f1d48b;
    font-size: 14px;
    line-height: 1;
    text-align: center;
}

.tc-viewbar-toggle-arrow {
    font-size: 18px;
}

.tc-viewbar-content {
    display: grid;
    gap: 4px;
}

.tc-viewbar-content .tc-tool {
    width: 100%;
    min-width: 0;
    min-height: 37px;
    padding: 6px 10px;
    flex: 1 1 auto;
}

.tc-viewbar.tc-collapsed {
    width: 48px;
    padding: 5px;
}

.tc-viewbar.tc-collapsed .tc-viewbar-toggle {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 36px;
    padding: 5px;
}

.tc-viewbar.tc-collapsed .tc-viewbar-toggle-label,
.tc-viewbar.tc-collapsed .tc-viewbar-toggle-arrow,
.tc-viewbar.tc-collapsed .tc-tool-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.tc-viewbar.tc-collapsed .tc-viewbar-content .tc-tool {
    width: 36px;
    min-height: 36px;
    padding: 5px;
    gap: 0;
}

.tc-viewbar.tc-collapsed .tc-tool-emblem {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
}

.tc-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 43px;
    padding: 8px 15px;
    color: #e9d7ae;
    border: 1px solid #a17b3e;
    border-radius: 5px;
    background: linear-gradient(#28647f, #113b56);
    box-shadow: inset 0 0 0 1px rgba(4, 27, 43, .5), inset 0 1px rgba(255, 255, 255, .13), 0 2px 5px rgba(0, 12, 22, .22) !important;
    cursor: pointer;
    font-family: Constantia, Cambria, Georgia, serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .012em;
    text-shadow: 0 1px 1px #000;
    white-space: nowrap;
}

.tc-tool:hover,
.tc-tool.tc-selected {
    color: #fff0c9;
    border-color: var(--tc-gold-bright);
    background: linear-gradient(#2b839f, #104b68);
    box-shadow: inset 0 0 0 1px rgba(255,233,174,.18), inset 0 1px rgba(255,255,255,.18), 0 0 0 1px rgba(222,178,79,.22), 0 3px 9px rgba(0,0,0,.38);
    transform: translateY(-1px);
}

.tc-commandbar .tc-tool:hover,
.tc-commandbar .tc-tool.tc-selected {
    color: #fff0c9;
    border-color: var(--tc-gold-bright);
    background: linear-gradient(#2b839f, #104b68);
    box-shadow: inset 0 0 0 1px rgba(255,233,174,.18), inset 0 1px rgba(255,255,255,.18), 0 0 0 1px rgba(222,178,79,.22), 0 3px 9px rgba(0,0,0,.38);
}

.tc-tool:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.tc-tool-emblem {
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    color: #f1d48b;
    border: 1px solid rgba(218,174,80,.72);
    border-radius: 50%;
    background: rgba(7, 35, 51, .58);
}

.tc-tool-emblem .tc-icon {
    width: 18px;
    height: 18px;
}

.tc-tool-emblem:has(.tc-main-icon) {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    border: 0;
    background: transparent;
}

.tc-tool-emblem .tc-main-icon {
    width: 24px;
    height: 24px;
}

/* Dynmap's own controls remain intact, but use the TownyCivics visual language. */
body.tc-map-active,
body.tc-map-active #mcmap {
    background: #000;
}

body.tc-map-active #mcmap.dynmap > .map {
    background: #000 !important;
}

.tc-world-frame-mask,
.tc-world-frame-shadow,
.tc-world-frame-base,
.tc-world-frame-gold,
.tc-world-frame-highlight,
.tc-world-frame-inner {
    pointer-events: none;
}

.tc-world-frame-shadow {
    filter: drop-shadow(0 5px 5px rgba(0,0,0,.72));
}

.tc-world-frame-base,
.tc-world-frame-gold,
.tc-world-frame-highlight,
.tc-world-frame-inner {
    stroke-linejoin: miter;
    vector-effect: non-scaling-stroke;
}

body.tc-map-active #mcmap.dynmap .leaflet-top.leaflet-left {
    top: 16px;
    left: 16px;
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom {
    overflow: hidden;
    margin: 0 0 8px;
    border: 1px solid #c99c4e;
    border-radius: 7px;
    background: linear-gradient(#1f5570, #0d3049);
    box-shadow: 0 5px 14px rgba(0, 12, 22, .3), inset 0 0 0 2px rgba(5, 27, 43, .76) !important;
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom a {
    width: 42px;
    height: 38px;
    color: #f0d28a;
    border-color: rgba(201,156,78,.58);
    background: transparent;
    font-family: Georgia, serif;
    font-size: 28px;
    line-height: 36px;
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom a:hover {
    color: #fff3c9;
    background: linear-gradient(90deg, rgba(42,124,151,.56), rgba(163,107,40,.32));
}

body.tc-map-active #mcmap.dynmap .leaflet-control-layers.tc-native-layer-control-hidden {
    display: none !important;
}

body.tc-map-active .leaflet-control-layers
        label.tc-native-layer-entry-mirrored {
    display: none !important;
}

body.tc-map-active #mcmap.dynmap .chat,
body.tc-map-active #mcmap.dynmap .dynmap-link {
    display: none !important;
}

.tc-navigation-panel {
    position: fixed;
    top: 16px;
    right: 18px;
    z-index: 10010;
    display: grid;
    grid-template-columns: 104px 150px;
    grid-template-rows: 104px 35px;
    align-items: center;
    column-gap: 12px;
    row-gap: 7px;
    width: 284px;
    height: 164px;
    padding: 8px;
    box-sizing: border-box;
    color: var(--tc-cream);
    border: 1px solid #d3a451;
    border-radius: 9px;
    background:
        radial-gradient(circle at 12% 16%, rgba(66, 151, 161, .13), transparent 42%),
        linear-gradient(145deg, #1a4b66, #0c2b43 78%);
    box-shadow: 0 8px 22px rgba(0, 12, 22, .3), inset 0 0 0 1px rgba(255, 255, 255, .05) !important;
}

.tc-navigation-panel::after {
    position: absolute;
    top: 14px;
    bottom: 51px;
    left: 122px;
    width: 1px;
    background: rgba(126, 166, 187, .28);
    content: "";
}

.tc-navigation-controls {
    position: relative;
    z-index: 1;
    display: grid;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(2, 30px);
    justify-content: flex-end;
    align-items: flex-end;
    gap: 6px;
    align-self: stretch;
    padding-top: 4px;
    border-top: 1px solid rgba(126, 166, 187, .28);
}

.tc-navigation-panel .tc-navigation-toggle {
    display: grid;
    width: 30px;
    min-width: 30px;
    min-height: 30px;
    padding: 4px;
    place-items: center;
    gap: 0;
    border-color: rgba(161, 123, 62, .72);
    border-radius: 4px;
    background: rgba(3, 20, 33, .68);
}

.tc-navigation-panel .tc-navigation-toggle .tc-tool-emblem {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border: 0;
    background: transparent;
    font-size: 14px;
}

.tc-navigation-panel .tc-navigation-toggle .tc-main-icon {
    width: 22px;
    height: 22px;
}

.tc-navigation-panel .tc-navigation-toggle.tc-selected {
    color: #eff9ed;
    border-color: #55b9b4;
    background: #12495d;
    box-shadow: inset 0 0 0 2px rgba(78, 190, 177, .12);
    transform: none;
}

.tc-navigation-panel .tc-navigation-toggle:hover {
    border-color: var(--tc-gold-bright);
    transform: translateY(-1px);
}

body.tc-map-active #mcmap.dynmap .largeclock.tc-native-clock {
    position: relative;
    inset: auto;
    z-index: auto;
    grid-column: 2;
    grid-row: 1;
    width: 150px;
    height: 104px;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
    transform: none;
}

body.tc-map-active #mcmap.dynmap .tc-native-clock::before {
    display: none;
}

body.tc-map-active #mcmap.dynmap .tc-native-clock > .timeofday.sun {
    position: absolute;
    top: 34px;
    left: 9px;
    right: auto;
    width: 34px;
    height: 34px;
    transform: none;
    background-image: none !important;
    background-position: center !important;
}

body.tc-map-active #mcmap.dynmap .tc-native-clock > .timeofday.sun .moon {
    display: none !important;
    background-image: none !important;
}

body.tc-map-active #mcmap.dynmap .tc-native-clock > .timeofday.sun::before {
    position: absolute;
    inset: 0;
    width: 34px;
    height: 34px;
    background-color: #f1d48b;
    content: "";
    transform: none;
    -webkit-mask: var(--tc-icon-sun) center / contain no-repeat;
    mask: var(--tc-icon-sun) center / contain no-repeat;
}

body.tc-map-active #mcmap.dynmap .tc-native-clock:has(.digitalclock.night) > .timeofday.sun::before {
    background-color: #c9deeb;
    -webkit-mask-image: var(--tc-icon-moon);
    mask-image: var(--tc-icon-moon);
}

body.tc-map-active #mcmap.dynmap .tc-native-clock .timeofday.digitalclock {
    position: absolute;
    top: 36px;
    right: auto;
    bottom: auto;
    left: 50px;
    z-index: 2;
    color: #f8e7b6;
    font-family: Constantia, Cambria, Georgia, serif;
    font-size: 30px;
    letter-spacing: .045em;
    line-height: 1;
    text-align: left;
    text-shadow: 0 2px 2px #000;
}

body.tc-map-active #mcmap.dynmap .tc-native-clock .timeofday.digitalclock.night {
    color: #d5e7f5;
}

body.tc-map-active #mcmap.dynmap .tc-native-clock .weather {
    position: absolute;
    top: 55px;
    right: auto;
    left: 32px;
    z-index: 4;
    display: block;
    width: 18px;
    height: 18px;
    background-image: none !important;
}

.tc-modebar .tc-mode {
    position: relative;
    padding-left: 12px;
}

.tc-layer-state {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    box-sizing: border-box;
    border: 1px solid #8295a0;
    border-radius: 50%;
    background: #061725;
}

.tc-commandbar .tc-modebar .tc-mode.tc-selected {
    color: #eef4e9;
    border-color: #48aeb2;
    background: linear-gradient(#174d63, #08293e);
    box-shadow: inset 0 0 0 1px rgba(74, 190, 181, .16);
    transform: none;
}

.tc-commandbar .tc-modebar .tc-mode.tc-selected .tc-layer-state {
    border-color: #b9f0d3;
    background: #56c59f;
}

.tc-commandbar .tc-modebar .tc-mode.tc-selected:hover {
    border-color: var(--tc-gold-bright);
    transform: translateY(-1px);
}

body.tc-map-active #mcmap.dynmap .tc-native-clock .weather::before {
    position: absolute;
    inset: 0;
    background-color: #c9deeb;
    content: "";
    -webkit-mask: var(--tc-icon-sun) center / contain no-repeat;
    mask: var(--tc-icon-sun) center / contain no-repeat;
}

body.tc-map-active #mcmap.dynmap .tc-native-clock .weather.sunny_night::before {
    -webkit-mask-image: var(--tc-icon-moon);
    mask-image: var(--tc-icon-moon);
}

body.tc-map-active #mcmap.dynmap .tc-native-clock .weather.stormy_day::before,
body.tc-map-active #mcmap.dynmap .tc-native-clock .weather.stormy_night::before {
    -webkit-mask-image: var(--tc-icon-rain);
    mask-image: var(--tc-icon-rain);
}

body.tc-map-active #mcmap.dynmap .tc-native-clock .weather.thunder_day::before,
body.tc-map-active #mcmap.dynmap .tc-native-clock .weather.thunder_night::before {
    background-color: #f1d48b;
    -webkit-mask-image: var(--tc-icon-thunder);
    mask-image: var(--tc-icon-thunder);
}

body.tc-map-active #mcmap.dynmap .tc-native-clock .weather.sunny_day,
body.tc-map-active #mcmap.dynmap .tc-native-clock .weather.sunny_night {
    display: none;
}

body.tc-map-active #mcmap.dynmap .tc-native-compass {
    position: relative;
    top: auto !important;
    right: auto !important;
    z-index: auto;
    grid-column: 1;
    grid-row: 1;
    width: 94px;
    height: 94px;
    padding: 4px;
    box-sizing: content-box;
    overflow: visible;
    background-position: center;
    background-size: 94px 94px;
    background-origin: content-box;
    background-clip: border-box;
    border: 2px solid #d1a452;
    border-radius: 50%;
    background-color: #0a2034 !important;
    box-shadow: inset 0 0 0 3px #071522, inset 0 0 0 4px rgba(114,75,28,.78);
}

body.tc-map-active #mcmap.dynmap .sidebar.tc-native-sidebar {
    display: none;
}

body.tc-map-active #mcmap.dynmap .coord-control,
body.tc-map-active #map.tc-squaremap-root .coord-control {
    position: fixed;
    top: 16px;
    left: 68px;
    z-index: 10010;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    column-gap: 9px;
    width: 174px;
    height: 58px;
    margin: 0;
    padding: 9px 11px;
    color: #e7dfc9;
    border: 1px solid #c99c4e;
    border-radius: 7px;
    background:
        radial-gradient(circle at 8% 20%, rgba(45, 140, 158, .18), transparent 48%),
        linear-gradient(145deg, rgba(24, 75, 101, .97), rgba(10, 40, 60, .97));
    box-shadow: 0 6px 16px rgba(0, 12, 22, .3), inset 0 0 0 1px rgba(5, 27, 43, .7) !important;
    box-sizing: border-box;
    pointer-events: none;
    transition: width 150ms ease, height 150ms ease, padding 150ms ease;
}

body.tc-map-active #mcmap.dynmap .coord-control .tc-location-icon,
body.tc-map-active #map.tc-squaremap-root .coord-control .tc-location-icon {
    display: grid;
    grid-column: 1;
    grid-row: 1 / 3;
    width: 26px;
    height: 26px;
    place-items: center;
    align-self: center;
    color: #f0d38e;
    border: 1px solid rgba(201, 156, 78, .58);
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(38, 101, 125, .78), rgba(8, 37, 55, .72));
    box-shadow: 0 2px 6px rgba(0, 12, 22, .2) !important;
}

body.tc-map-active #mcmap.dynmap .coord-control .tc-location-icon .tc-icon,
body.tc-map-active #map.tc-squaremap-root .coord-control .tc-location-icon .tc-icon {
    width: 19px;
    height: 19px;
}

body.tc-map-active #mcmap.dynmap .coord-control .coord-control-label,
body.tc-map-active #map.tc-squaremap-root .coord-control .coord-control-label {
    display: block;
    grid-column: 2;
    grid-row: 1;
    margin: 0 0 2px;
    color: #f0d38e;
    font-family: Constantia, Cambria, Georgia, serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

body.tc-map-active #mcmap.dynmap .coord-control .coord-control-value,
body.tc-map-active #map.tc-squaremap-root .coord-control .coord-control-value {
    grid-column: 2;
    grid-row: 2;
    color: #d8e6e7;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 12px;
    letter-spacing: .025em;
}

body.tc-map-active #mcmap.dynmap .coord-control.tc-location-empty,
body.tc-map-active #map.tc-squaremap-root .coord-control.tc-location-empty {
    grid-template-columns: 1fr;
    width: 42px;
    height: 42px;
    padding: 7px;
}

body.tc-map-active #mcmap.dynmap .coord-control.tc-location-empty .tc-location-icon,
body.tc-map-active #map.tc-squaremap-root .coord-control.tc-location-empty .tc-location-icon {
    grid-column: 1;
    grid-row: 1;
}

body.tc-map-active #mcmap.dynmap .coord-control.tc-location-empty .coord-control-label,
body.tc-map-active #mcmap.dynmap .coord-control.tc-location-empty .coord-control-value,
body.tc-map-active #map.tc-squaremap-root .coord-control.tc-location-empty .coord-control-label,
body.tc-map-active #map.tc-squaremap-root .coord-control.tc-location-empty .coord-control-value {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.tc-player-row {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) 9px;
    align-items: center;
    column-gap: 8px;
}

.tc-player-copy {
    display: grid;
    min-width: 0;
    gap: 0;
}

.tc-player-copy strong,
.tc-player-copy small {
    overflow-wrap: anywhere;
}

.tc-player-copy small {
    color: var(--tc-muted);
    font-size: 10px;
    font-weight: 400;
}

.tc-player-avatar {
    position: relative;
    display: grid;
    width: 26px;
    height: 26px;
    overflow: hidden;
    place-items: center;
    color: var(--tc-sidebar-title);
    border: 1px solid var(--tc-sidebar-border);
    border-radius: 3px;
    background: var(--tc-sidebar-bg-deep);
    font-family: var(--tc-font-display);
    font-size: 14px;
}

.tc-player-head {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

.tc-player-head.tc-invalid {
    display: none;
}

.tc-player-status {
    width: 9px;
    height: 9px;
    border: 1px solid rgba(186,235,175,.8);
    border-radius: 50%;
    background: var(--tc-success);
    box-shadow: 0 0 7px rgba(115,184,107,.58);
}

.tc-player-row.tc-player-hidden,
.tc-player-row:disabled {
    color: #71808a;
    border-color: rgba(111,130,140,.32);
    background: linear-gradient(90deg, rgba(22,45,61,.78), rgba(8,25,38,.78));
    cursor: not-allowed;
    filter: grayscale(1) !important;
    opacity: .58;
}

.tc-player-row.tc-player-hidden small { color: #687782; }
.tc-player-row.tc-player-hidden .tc-player-status { border-color: #687782; background: #53616a; box-shadow: none; }

.tc-ui-toggle {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 10030;
    display: grid;
    width: 31px;
    height: 31px;
    place-items: center;
    padding: 0;
    color: #f0d28a;
    border: 1px solid #c99c4e;
    border-radius: 5px;
    background: linear-gradient(#1f5570, #0d3049);
    box-shadow: 0 5px 14px rgba(0, 12, 22, .3), inset 0 0 0 1px rgba(5, 27, 43, .76) !important;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.tc-ui-toggle:hover,
.tc-ui-toggle:focus-visible {
    color: #fff3c9;
    border-color: var(--tc-gold-bright);
    background: linear-gradient(#2b839f, #104b68);
}

.tc-theme-toggle {
    left: 55px;
}

.tc-map-toast {
    position: fixed;
    bottom: 56px;
    left: 16px;
    z-index: 10030;
    padding: 8px 11px;
    color: #f5e5c2;
    border: 1px solid rgba(199,164,90,.72);
    border-radius: 4px;
    background: rgba(4,24,40,.94);
    box-shadow: 0 5px 14px rgba(0,0,0,.5);
    font-size: 11px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(5px);
    transition: opacity 140ms ease, transform 140ms ease;
}

.tc-map-toast.tc-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Keep text crisp while allowing restrained component depth. */
.tc-shell,
.tc-shell *,
body.tc-map-active #mcmap.dynmap .leaflet-control,
body.tc-map-active #mcmap.dynmap .largeclock,
body.tc-map-active #mcmap.dynmap .tc-native-compass,
body.tc-map-active #mcmap.dynmap .coord-control,
body.tc-map-active #map.tc-squaremap-root .coord-control,
body.tc-map-active #mcmap.dynmap .tc-navigation-panel,
body.tc-map-active #mcmap.dynmap .tc-navigation-panel *,
body.tc-map-active #map.tc-squaremap-root .tc-navigation-panel,
body.tc-map-active #map.tc-squaremap-root .tc-navigation-panel * {
    text-shadow: none !important;
}

/* Sidebar lists, actions, and disclosures share the same compact naval furniture. */
.tc-sidebar .tc-nation-row {
    display: flex;
    align-items: center;
    gap: 11px;
    text-align: left;
}

.tc-list-flag {
    position: relative;
    display: grid;
    flex: 0 0 48px;
    place-items: center;
    width: 48px;
    height: 30px;
    overflow: hidden;
    border-radius: 2px;
    outline: 1px solid var(--tc-gold);
}

.tc-nation-row-copy {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.tc-nation-row-copy .tc-card-meta {
    display: block;
    margin-top: 2px;
}

.tc-context-actions {
    position: sticky;
    top: 0;
    z-index: 3;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--tc-sidebar-border);
    background: linear-gradient(90deg, var(--tc-sidebar-bg), var(--tc-sidebar-bg-deep));
    box-shadow: 0 4px 12px rgba(0, 12, 22, .18) !important;
}

.tc-context-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 32px;
    padding: 5px 8px;
    color: var(--tc-sidebar-text);
    border: 1px solid var(--tc-sidebar-border);
    border-radius: 3px;
    background: linear-gradient(145deg, var(--tc-sidebar-surface), var(--tc-sidebar-surface-soft));
    box-shadow: inset 0 1px rgba(255, 255, 255, .08), 0 2px 6px rgba(0, 12, 22, .18) !important;
    cursor: pointer;
    font-family: var(--tc-font-display);
    font-size: var(--tc-text-small);
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
}

.tc-context-action > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.tc-context-action:hover {
    color: var(--tc-sidebar-title);
    border-color: var(--tc-gold-bright);
    background: var(--tc-sidebar-surface-hover);
}

.tc-context-action:focus-visible,
.tc-collapse-summary:focus-visible {
    outline: 2px solid var(--tc-gold-bright);
    outline-offset: 2px;
}

.tc-context-icon {
    display: grid;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    place-items: center;
    color: var(--tc-gold-bright);
}

.tc-context-icon .tc-icon {
    width: 19px;
    height: 19px;
}

.tc-text-box {
    padding: 11px 12px;
    color: var(--tc-sidebar-text);
    border: 1px solid var(--tc-sidebar-divider);
    border-left: 3px solid var(--tc-sidebar-teal);
    border-radius: 3px;
    background: var(--tc-sidebar-surface-soft);
    font-size: var(--tc-text-base);
    line-height: 1.55;
}

.tc-collapsible {
    display: block;
}

.tc-collapse-summary {
    position: relative;
    display: block;
    min-height: 34px;
    list-style: none;
    cursor: pointer;
}

.tc-collapse-summary::-webkit-details-marker {
    display: none;
}

.tc-collapse-summary .tc-kicker {
    margin-bottom: 0;
    padding-right: 34px;
}

.tc-collapse-summary::after {
    position: absolute;
    top: 1px;
    right: 1px;
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    color: var(--tc-gold-bright);
    border: 1px solid var(--tc-sidebar-border);
    border-radius: 50%;
    background: linear-gradient(145deg, var(--tc-sidebar-surface), var(--tc-sidebar-bg));
    box-shadow: 0 2px 6px rgba(0, 12, 22, .18) !important;
    content: "+";
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.tc-collapsible[open] > .tc-collapse-summary::after {
    content: "−";
}

.tc-collapse-summary:hover .tc-kicker {
    color: var(--tc-sidebar-title);
}

.tc-collapse-body {
    padding-top: 9px;
}

/* One body face and one display face, with a readable minimum scale. */
.tc-shell,
.tc-sidebar,
.tc-sidebar .tc-content,
.tc-sidebar .tc-card-meta,
.tc-sidebar .tc-empty,
.tc-sidebar .tc-office-description,
.tc-sidebar .tc-office-holders,
.tc-sidebar .tc-row-button,
.tc-search,
body.tc-map-active #mcmap.dynmap .coord-control,
body.tc-map-active #map.tc-squaremap-root .coord-control {
    font-family: var(--tc-font-body);
}

.tc-title,
.tc-kicker,
.tc-card-title,
.tc-wealth strong,
.tc-tool,
.tc-native-clock .digitalclock {
    font-family: var(--tc-font-display);
}

.tc-sidebar .tc-content,
.tc-sidebar .tc-board {
    font-size: var(--tc-text-base);
    line-height: 1.5;
}

.tc-sidebar .tc-card-title {
    font-size: 15px;
    line-height: 1.3;
}

.tc-sidebar .tc-card-meta,
.tc-sidebar .tc-empty,
.tc-sidebar .tc-office-description,
.tc-sidebar .tc-office-holders,
.tc-sidebar .tc-diplomacy-legend {
    font-size: var(--tc-text-small);
    line-height: 1.5;
}

.tc-sidebar .tc-stat-label {
    font-size: var(--tc-text-label);
    line-height: 1.25;
}

.tc-sidebar .tc-kicker {
    font-size: 12px;
}

.tc-sidebar .tc-row-button,
.tc-tool,
.tc-search {
    font-size: var(--tc-text-base);
}

.tc-sidebar .tc-badge {
    font-size: 10px;
}

.tc-sidebar .tc-player-row small {
    font-size: var(--tc-text-label);
}

body.tc-map-active #mcmap.dynmap .coord-control .coord-control-label,
body.tc-map-active #map.tc-squaremap-root .coord-control .coord-control-label {
    font-family: var(--tc-font-display);
    font-size: var(--tc-text-label);
}

body.tc-map-active #mcmap.dynmap .coord-control .coord-control-value,
body.tc-map-active #map.tc-squaremap-root .coord-control .coord-control-value {
    font-family: var(--tc-font-body);
    font-size: 14px;
}

/* Dark mode remains lower-contrast without collapsing into near-black surfaces. */
body.tc-dark-theme .tc-sidebar {
    --tc-sidebar-bg: #0a293f;
    --tc-sidebar-bg-deep: #061d2e;
    --tc-sidebar-surface: #123b55;
    --tc-sidebar-surface-soft: #103149;
    --tc-sidebar-surface-hover: #1a506b;
    --tc-sidebar-text: #eee5d3;
    --tc-sidebar-title: #fff3dc;
    --tc-sidebar-muted: #b7c5cc;
    --tc-sidebar-label: #d8c493;
    --tc-sidebar-border: rgba(207, 169, 87, .48);
    --tc-sidebar-divider: rgba(185, 207, 216, .18);
    --tc-sidebar-danger-surface: #33252c;
}

body.tc-dark-theme .tc-commandbar,
body.tc-dark-theme .tc-viewbar {
    border-color: #98733c;
    background:
        linear-gradient(90deg, rgba(170, 124, 51, .11), transparent 12%, transparent 88%, rgba(170, 124, 51, .11)),
        linear-gradient(rgba(255, 255, 255, .045), transparent 22%),
        linear-gradient(#173f56, #092840 70%);
}

body.tc-dark-theme .tc-tool {
    color: #e7d5ad;
    border-color: #80613b;
    background: linear-gradient(#1c4d66, #0c3048);
}

body.tc-dark-theme .tc-tool-emblem {
    color: #e4c677;
    border-color: rgba(194, 148, 66, .7);
    background: rgba(7, 31, 47, .76);
}

body.tc-dark-theme .tc-tool:hover,
body.tc-dark-theme .tc-tool.tc-selected,
body.tc-dark-theme .tc-commandbar .tc-tool:hover,
body.tc-dark-theme .tc-commandbar .tc-tool.tc-selected {
    border-color: #c89a4d;
    background: linear-gradient(#246a83, #104057);
}

body.tc-dark-theme .tc-search,
body.tc-dark-theme .tc-map-toast {
    border-color: #80613b;
    background: rgba(8, 36, 55, .96);
}

body.tc-dark-theme .tc-results {
    border-color: #a47b3e;
    background: linear-gradient(#153f56, #08263a);
}

body.tc-dark-theme .tc-ui-toggle {
    border-color: #80613b;
    background: linear-gradient(#174258, #09283d);
}

body.tc-dark-theme #mcmap.dynmap .leaflet-control-zoom {
    border-color: #98733c;
    background: linear-gradient(#174258, #09283d);
}

body.tc-map-active.tc-dark-theme #map.tc-squaremap-root .leaflet-control-zoom {
    border-color: #98733c;
    background: linear-gradient(#174258, #09283d);
}

body.tc-map-active.tc-dark-theme #map.tc-squaremap-root .leaflet-control-zoom a {
    color: #e7c979;
    border-color: rgba(152,115,60,.72);
    background: #09283d;
}

body.tc-dark-theme #mcmap.dynmap .leaflet-control-zoom a:hover,
body.tc-map-active.tc-dark-theme #map.tc-squaremap-root .leaflet-control-zoom a:hover {
    background: linear-gradient(90deg, rgba(30, 92, 112, .56), rgba(115, 69, 25, .3));
}

body.tc-dark-theme .tc-navigation-panel {
    border-color: #98733c;
    background:
        radial-gradient(circle at 12% 16%, rgba(55, 126, 138, .12), transparent 42%),
        linear-gradient(145deg, #153e54, #08263a 78%);
}

body.tc-dark-theme .tc-navigation-panel::after {
    background: rgba(125, 148, 151, .22);
}

body.tc-dark-theme #mcmap.dynmap .tc-native-compass {
    border-color: #a47b3e;
    background-color: #09283d !important;
}

body.tc-dark-theme #mcmap.dynmap .coord-control,
body.tc-dark-theme #map.tc-squaremap-root .coord-control {
    border-color: #98733c;
    background:
        radial-gradient(circle at 8% 20%, rgba(35, 105, 122, .14), transparent 48%),
        linear-gradient(145deg, rgba(18, 59, 81, .97), rgba(7, 31, 48, .97));
}

body.tc-dark-theme .tc-theme-toggle {
    color: #d7e6ef;
    border-color: #8fa9b7;
    background: linear-gradient(#28546b, #15364b);
}

body.tc-dark-theme .tc-theme-toggle:hover,
body.tc-dark-theme .tc-theme-toggle:focus-visible {
    color: #f5e6bc;
    border-color: var(--tc-gold-bright);
    background: linear-gradient(#2b647e, #17384f);
}

body.tc-ui-hidden .tc-commandbar,
body.tc-ui-hidden .tc-viewbar,
body.tc-ui-hidden .tc-sidebar,
body.tc-ui-hidden .tc-diplomacy-legend,
body.tc-ui-hidden .tc-map-toast,
body.tc-ui-hidden .tc-theme-control,
body.tc-ui-hidden #mcmap.dynmap .leaflet-control-container,
body.tc-ui-hidden #mcmap.dynmap .tc-navigation-panel,
body.tc-ui-hidden #map.tc-squaremap-root .leaflet-control-container,
body.tc-ui-hidden #map.tc-squaremap-root .tc-squaremap-location,
body.tc-ui-hidden #map.tc-squaremap-root .tc-navigation-panel {
    display: none !important;
}

.tc-map-active .leaflet-popup {
    z-index: 9990;
}

body.tc-map-active #mcmap.dynmap img.leaflet-marker-icon[src*="townycivics-capital-gold"] {
    image-rendering: auto !important;
}

body.tc-map-active #mcmap.dynmap .playerMarker .playerName,
body.tc-map-active #mcmap.dynmap .playerMarker .playerNameSm,
body.tc-map-active #mcmap.dynmap .playerMarker .playerNameLg {
    top: -21px;
    z-index: 22;
    padding: 4px 10px;
    color: #fff1ce;
    border: 1px solid #c39a48;
    border-left: 3px solid #35afb7;
    border-radius: 2px;
    background: #082b43;
    box-shadow: none;
    clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 0 100%);
    font-family: var(--tc-font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .035em;
    line-height: 1.15;
    text-shadow: none;
}

body.tc-map-active #mcmap.dynmap .playerMarker .playerNameSm { top: -18px; }

body.tc-map-active #mcmap.dynmap .playerMarker .playerNameNoHealth {
    top: -10px;
}

body.tc-map-active #mcmap.dynmap .playerMarker .healthContainer,
body.tc-map-active #mcmap.dynmap .playerMarker .healthContainerSm,
body.tc-map-active #mcmap.dynmap .playerMarker .healthContainerLg {
    padding: 3px;
    border: 1px solid #8f713d;
    border-radius: 2px;
    background: #071b2c;
    box-shadow: none;
}

body.tc-map-active #map.tc-squaremap-root .leaflet-nameplate-pane .leaflet-tooltip {
    padding: 0;
    color: #fff1ce;
    border: 1px solid #c39a48;
    border-left: 3px solid #35afb7;
    border-radius: 2px;
    background: #082b43;
    box-shadow: 0 3px 10px rgba(0,0,0,.48);
    font-family: var(--tc-font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .035em;
    line-height: 1.15;
    text-shadow: none;
    clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 0 100%);
}

body.tc-map-active #map.tc-squaremap-root .leaflet-nameplate-pane .leaflet-tooltip::before {
    display: none;
}

body.tc-map-active #map.tc-squaremap-root .leaflet-nameplate-pane .leaflet-tooltip ul {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px 5px 5px;
}

body.tc-map-active #map.tc-squaremap-root .leaflet-nameplate-pane .leaflet-tooltip li {
    display: flex;
    margin: 0;
    padding: 0;
}

body.tc-map-active #map.tc-squaremap-root .leaflet-nameplate-pane .leaflet-tooltip li:last-child {
    flex-direction: column;
    gap: 1px;
}

body.tc-map-active #map.tc-squaremap-root .leaflet-nameplate-pane .leaflet-tooltip img.head {
    width: 24px;
    height: 24px;
    margin: 0;
    border: 1px solid #c39a48;
    border-radius: 2px;
    image-rendering: pixelated;
}

body.tc-map-active #map.tc-squaremap-root .leaflet-nameplate-pane .leaflet-tooltip img.health,
body.tc-map-active #map.tc-squaremap-root .leaflet-nameplate-pane .leaflet-tooltip img.armor {
    display: block;
    width: 81px;
    height: 9px;
    margin: 0;
    image-rendering: pixelated;
}

@media (max-width: 720px) {
    body.tc-map-active #mcmap.dynmap .leaflet-top.leaflet-left {
        top: 10px;
        left: 10px;
    }

    body.tc-map-active:not(.tc-squaremap) .tc-navigation-panel {
        top: 10px;
        right: 10px;
        transform: scale(.86);
        transform-origin: top right;
    }

    .tc-sidebar {
        width: min(100vw, 380px);
    }

    .tc-hero-main {
        gap: 12px;
    }

    .tc-emblem {
        flex-basis: 54px;
        width: 54px;
        height: 54px;
    }

    .tc-commandbar {
        left: 10px;
        right: 10px;
        bottom: 10px;
        flex-direction: column;
        max-width: none;
        transform: none;
    }

    .tc-search-wrap {
        flex: 0 0 43px;
        width: 100%;
    }

    .tc-modebar {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
    }

    .tc-modebar .tc-mode {
        width: 100%;
        min-width: 0;
        padding: 5px;
        gap: 4px;
    }

    .tc-modebar .tc-tool-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .tc-viewbar {
        top: 120px;
        left: 10px;
    }

    .tc-ui-toggle {
        bottom: 120px;
        left: 10px;
    }

    .tc-theme-toggle {
        left: 49px;
    }

    .tc-map-toast {
        bottom: 160px;
        left: 10px;
    }

    .tc-diplomacy-legend {
        top: 160px;
        right: 10px;
        transform: scale(.86);
        transform-origin: top right;
    }
}

@media (max-width: 480px) {
    .tc-sidebar {
        width: 100vw;
        border-right-width: 1px;
    }

    .tc-close {
        width: 44px;
        height: 44px;
    }

    .tc-context-actions,
    .tc-battle-scoreboard,
    .tc-battle-timing {
        grid-template-columns: 1fr;
    }

    .tc-context-action,
    .tc-collapse-summary {
        min-height: 44px;
    }

    .tc-collapse-summary::after {
        top: 5px;
        width: 34px;
        height: 34px;
    }

    body.tc-map-active:not(.tc-squaremap) .tc-navigation-panel {
        transform: scale(.72);
    }

    .tc-diplomacy-legend {
        top: 140px;
        transform: scale(.72);
    }

    body.tc-map-active #mcmap.dynmap .coord-control,
    body.tc-map-active #map.tc-squaremap-root .coord-control {
        top: 10px;
        left: 62px;
    }

    .tc-content {
        padding-inline: 14px;
    }

    .tc-government-heading,
    .tc-office-heading {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .tc-government-heading .tc-badge,
    .tc-office-heading .tc-badge {
        max-width: 100%;
        white-space: normal;
    }
}

.tc-marker-token {
    display: none !important;
}

body.tc-map-active #mcmap.dynmap .leaflet-tooltip.tc-town-area-tooltip {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    color: inherit;
    white-space: nowrap;
    box-shadow: none;
}

body.tc-map-active #mcmap.dynmap .leaflet-tooltip.tc-town-area-tooltip::before {
    display: none;
}

body.tc-map-active #map.tc-squaremap-root .leaflet-tooltip.tc-town-area-tooltip,
body.tc-map-active #map.tc-squaremap-root .leaflet-tooltip:has(.tc-town-hover) {
    padding: 0;
    color: inherit;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

body.tc-map-active #map.tc-squaremap-root .leaflet-tooltip.tc-town-area-tooltip::before,
body.tc-map-active #map.tc-squaremap-root .leaflet-tooltip:has(.tc-town-hover)::before {
    display: none;
}

body.tc-map-active.tc-town-marker-hover-active #mcmap.dynmap
        .leaflet-tooltip.tc-town-area-tooltip,
body.tc-map-active:has(#mcmap.dynmap .mapMarker:hover .tc-town-hover)
        #mcmap.dynmap .leaflet-tooltip.tc-town-area-tooltip {
    display: none;
}

body.tc-map-active #mcmap.dynmap .mapMarker .markerName:has(.tc-town-hover),
body.tc-map-active #mcmap.dynmap .mapMarker .markerName-show:has(.tc-town-hover) {
    padding: 0;
    background: transparent;
    border-radius: 0;
    color: inherit;
    white-space: normal;
    box-shadow: none;
}

.tc-town-area-hover {
    padding: 6px 9px;
    color: #fff7e7;
    background: var(--tc-navy-900);
    border: 1px solid var(--tc-gold);
    border-left: 3px solid var(--tc-teal-bright);
    border-radius: 3px;
    font-family: var(--tc-font-display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .025em;
    line-height: 1.15;
    text-align: left;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    box-shadow: none;
}

.tc-town-hover {
    display: grid;
    min-width: 168px;
    max-width: 260px;
    gap: 3px;
    padding: 9px 11px 10px;
    overflow-wrap: anywhere;
    color: var(--tc-cream);
    background: var(--tc-navy-900);
    border: 1px solid var(--tc-gold);
    border-left: 3px solid var(--tc-teal-bright);
    border-radius: 4px;
    font-family: var(--tc-font-body);
    font-size: var(--tc-text-small);
    line-height: 1.3;
    text-align: left;
    box-shadow: none;
}

.tc-town-hover-kicker {
    color: var(--tc-gold-bright);
    font-family: var(--tc-font-display);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .14em;
    line-height: 1;
    text-transform: uppercase;
}

.tc-town-hover strong {
    color: #fff7e7;
    font-family: var(--tc-font-display);
    font-size: 15px;
    line-height: 1.15;
    letter-spacing: .035em;
}

.tc-town-hover > span:not(.tc-town-hover-kicker):not(.tc-town-hover-occupied) {
    color: var(--tc-muted);
}

.tc-town-hover-occupied {
    margin-top: 3px;
    padding-top: 5px;
    color: #f2a48e;
    border-top: 1px solid rgba(198, 80, 61, .48);
    font-weight: 700;
}

@media (max-height: 700px) {
    .tc-hero {
        padding-top: 14px;
        padding-bottom: 12px;
    }

    .tc-content {
        padding-top: 12px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    .tc-section {
        margin-bottom: 13px;
        padding-bottom: 12px;
    }
}

/* Squaremap adapter: retain its map canvas while supplying TownyCivics chrome. */
body.tc-map-active.tc-squaremap,
body.tc-map-active.tc-squaremap #map {
    background: #000;
}

body.tc-map-active.tc-squaremap #sidebar {
    display: none !important;
    pointer-events: none !important;
}

body.tc-map-active #map.tc-squaremap-root .leaflet-top.leaflet-left {
    top: 16px;
    left: 16px;
}

body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom {
    overflow: hidden;
    margin: 0 0 8px;
    border: 1px solid #c99c4e;
    border-radius: 7px;
    background: linear-gradient(#1f5570, #0d3049);
    box-shadow: 0 5px 14px rgba(0, 12, 22, .3), inset 0 0 0 2px rgba(5, 27, 43, .76) !important;
}

body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom a {
    width: 42px;
    height: 38px;
    color: #f0d28a;
    border-color: rgba(201,156,78,.58);
    background: transparent;
    font-family: Georgia, serif;
    font-size: 28px;
    line-height: 36px;
}

body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom a:hover {
    color: #fff3c9;
    background: linear-gradient(90deg, rgba(42,124,151,.56), rgba(163,107,40,.32));
}

body.tc-map-active #map.tc-squaremap-root .leaflet-control-layers.tc-native-layer-control-hidden {
    display: none !important;
}

body.tc-map-active #map.tc-squaremap-root .tc-squaremap-native-coordinates {
    display: none !important;
}

.tc-squaremap-compass {
    position: relative;
    z-index: 1;
    grid-column: 1;
    grid-row: 1;
    width: 94px;
    height: 94px;
    box-sizing: border-box;
    color: #f1d48b;
    border: 2px solid #d1a452;
    border-radius: 50%;
    background:
        radial-gradient(circle, #0e3148 0 7%, #061827 8% 50%, #b9883f 51% 52%, #071522 53% 61%, #153f57 62% 100%);
    box-shadow: inset 0 0 0 3px #071522, inset 0 0 0 5px rgba(178, 127, 53, .76);
    font-family: Constantia, Cambria, Georgia, serif;
    font-size: 10px;
    font-weight: 700;
}

.tc-squaremap-compass::before,
.tc-squaremap-compass::after {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    content: "";
}

.tc-squaremap-compass::before {
    inset: 10px;
    border: 1px solid rgba(224, 185, 104, .52);
}

.tc-squaremap-compass::after {
    inset: 16px;
    border: 1px dashed rgba(118, 177, 185, .36);
}

.tc-squaremap-compass .tc-compass-rose {
    position: absolute;
    inset: 22px;
    z-index: 1;
    background: conic-gradient(
        from 45deg,
        #3e91a0 0 12.5%, #d8a84f 12.5% 25%,
        #3e91a0 25% 37.5%, #d8a84f 37.5% 50%,
        #3e91a0 50% 62.5%, #d8a84f 62.5% 75%,
        #3e91a0 75% 87.5%, #d8a84f 87.5% 100%);
    clip-path: polygon(50% 0, 59% 39%, 100% 50%, 59% 61%, 50% 100%, 41% 61%, 0 50%, 41% 39%);
    opacity: .78;
}

.tc-squaremap-compass .tc-compass-point {
    position: absolute;
    z-index: 4;
    line-height: 1;
    text-shadow: 0 1px 2px #000;
}

.tc-squaremap-compass .tc-compass-north {
    top: 7px;
    left: 50%;
    color: #f5a36f;
    transform: translateX(-50%);
}

.tc-squaremap-compass .tc-compass-east {
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
}

.tc-squaremap-compass .tc-compass-south {
    bottom: 7px;
    left: 50%;
    transform: translateX(-50%);
}

.tc-squaremap-compass .tc-compass-west {
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
}

.tc-squaremap-compass .tc-compass-needle {
    position: absolute;
    top: 20px;
    bottom: 20px;
    left: calc(50% - 2px);
    z-index: 2;
    width: 4px;
    background: linear-gradient(to bottom, #d55a3d 0 50%, #d9dde5 50% 100%);
    clip-path: polygon(50% 0, 100% 50%, 60% 50%, 60% 100%, 40% 100%, 40% 50%, 0 50%);
    filter: drop-shadow(0 1px 2px #000);
}

.tc-squaremap-compass .tc-compass-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 3;
    width: 10px;
    height: 10px;
    border: 2px solid #d9aa54;
    border-radius: 50%;
    background: #0f4154;
    transform: translate(-50%, -50%);
}

.tc-squaremap-clock {
    position: relative;
    z-index: 1;
    display: grid;
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: 43px minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
    width: 140px;
    height: 94px;
    color: #f8e7b6;
    font-family: Constantia, Cambria, Georgia, serif;
}

.tc-squaremap-time-icon {
    position: relative;
    display: grid;
    grid-column: 1;
    width: 40px;
    height: 40px;
    place-items: center;
    color: #f1d48b;
    border: 1px solid rgba(201, 156, 78, .42);
    border-radius: 50%;
    background: rgba(4, 24, 40, .5);
    font-size: 28px;
    line-height: 1;
    text-shadow: 0 2px 2px #000;
}

.tc-squaremap-time-copy {
    display: grid;
    grid-column: 2;
    align-content: center;
    gap: 0;
    min-width: 0;
}

.tc-squaremap-weather-icon {
    position: absolute;
    right: -5px;
    bottom: -4px;
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    color: #f1d48b;
    border: 1px solid rgba(201, 156, 78, .5);
    border-radius: 50%;
    background: #0b2a3e;
    font-size: 13px;
    line-height: 1;
}

.tc-squaremap-weather-icon[hidden] {
    display: none;
}

.tc-squaremap-time {
    color: inherit;
    font-size: 30px;
    letter-spacing: .045em;
    line-height: 1;
    text-align: left;
    text-shadow: 0 2px 2px #000;
}

.tc-squaremap-clock.tc-night {
    color: #d5e7f5;
}

body.tc-map-active.tc-squaremap .tc-navigation-panel {
    grid-template-columns: 94px 140px;
    grid-template-rows: 94px 32px;
    column-gap: 10px;
    row-gap: 6px;
    width: 260px;
    height: 148px;
}

body.tc-map-active.tc-squaremap .tc-navigation-panel::after {
    top: 12px;
    bottom: 46px;
    left: 107px;
}

body.tc-dark-theme .tc-commandbar .tc-modebar .tc-mode.tc-selected {
    color: #e8f0e6;
    border-color: #428f94;
    background: linear-gradient(#123f52, #061f31);
}

@media (max-width: 720px) {
    body.tc-map-active.tc-squaremap .tc-navigation-panel {
        top: 10px;
        right: 10px;
        grid-template-columns: 60px 108px;
        grid-template-rows: 60px 28px;
        column-gap: 6px;
        row-gap: 5px;
        width: 184px;
        height: 103px;
        padding: 5px;
    }

    body.tc-map-active.tc-squaremap .tc-navigation-panel::after {
        top: 8px;
        bottom: 36px;
        left: 68px;
    }

    body.tc-map-active.tc-squaremap .tc-navigation-controls {
        grid-template-columns: repeat(2, 28px);
        justify-content: center;
        gap: 5px;
        padding-top: 2px;
    }

    body.tc-map-active.tc-squaremap .tc-navigation-toggle {
        width: 28px;
        min-width: 28px;
        min-height: 28px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-compass {
        width: 60px;
        height: 60px;
        font-size: 8px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-compass .tc-compass-north {
        top: 4px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-compass .tc-compass-east {
        right: 5px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-compass .tc-compass-south {
        bottom: 4px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-compass .tc-compass-west {
        left: 5px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-compass .tc-compass-needle {
        top: 14px;
        bottom: 14px;
        left: calc(50% - 1.5px);
        width: 3px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-compass .tc-compass-rose {
        inset: 15px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-compass .tc-compass-hub {
        width: 8px;
        height: 8px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-compass::before {
        inset: 7px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-compass::after {
        inset: 11px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-clock {
        grid-template-columns: 32px minmax(0, 1fr);
        column-gap: 5px;
        width: 108px;
        height: 60px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-time-icon {
        width: 30px;
        height: 30px;
        font-size: 21px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-time-copy {
        gap: 3px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-time {
        font-size: 21px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-weather-icon {
        right: -4px;
        bottom: -4px;
        width: 16px;
        height: 16px;
        font-size: 11px;
    }
}

/* Cartographic day/night theme */
body.tc-map-active {
    --tc-paper: #f8faf9;
    --tc-paper-raised: #ffffff;
    --tc-paper-deep: #eef3f2;
    --tc-ink: #18333d;
    --tc-ink-soft: #5b6f76;
    --tc-ink-faint: #60747b;
    --tc-rule: #dce4e3;
    --tc-rule-strong: #bccaca;
    --tc-accent: #2a6f78;
    --tc-accent-hover: #205a63;
    --tc-accent-soft: #e8f1f0;
    --tc-focus: #267a84;
    --tc-focus-ring: rgba(38, 122, 132, .24);
    --tc-gold: #d7bb77;
    --tc-gold-bright: #f0d991;
    --tc-accent-gold: #d7bb77;
    --tc-accent-gold-light: #f0d991;
    --tc-slate: #0a283d;
    --tc-slate-panel: #0d3047;
    --tc-slate-raised: #12495d;
    --tc-slate-text: #eff7f3;
    --tc-slate-muted: #b8c9ca;
    --tc-header-rule: rgba(239, 247, 243, .14);
    --tc-elevation-shadow: rgba(7, 29, 45, .11);
    color-scheme: light;
    color: var(--tc-ink);
    font-family: var(--tc-font-body);
}

body.tc-map-active.tc-dark-theme {
    --tc-paper: #0d1117;
    --tc-paper-raised: #161b22;
    --tc-paper-deep: #21262d;
    --tc-ink: #f0f6fc;
    --tc-ink-soft: #c9d1d9;
    --tc-ink-faint: #8b949e;
    --tc-rule: #30363d;
    --tc-rule-strong: #484f58;
    --tc-accent: #58a6b8;
    --tc-accent-hover: #79c0c8;
    --tc-accent-soft: #122c36;
    --tc-focus: #58a6ff;
    --tc-focus-ring: rgba(88, 166, 255, .28);
    --tc-gold: #9b7b3f;
    --tc-gold-bright: #d7bb77;
    --tc-accent-gold: #c7a867;
    --tc-accent-gold-light: #e6cc88;
    --tc-slate: #101d2a;
    --tc-slate-panel: #111d2a;
    --tc-slate-raised: #16293a;
    --tc-slate-text: #f0f6fc;
    --tc-slate-muted: #a9b4c0;
    --tc-header-rule: rgba(199, 168, 103, .24);
    --tc-elevation-shadow: rgba(0, 0, 0, .45);
    color-scheme: dark;
}

.tc-sidebar {
    --tc-sidebar-bg: var(--tc-paper);
    --tc-sidebar-bg-deep: var(--tc-paper-deep);
    --tc-sidebar-surface: var(--tc-paper-raised);
    --tc-sidebar-surface-soft: var(--tc-paper-deep);
    --tc-sidebar-surface-hover: var(--tc-accent-soft);
    --tc-sidebar-text: var(--tc-ink);
    --tc-sidebar-title: var(--tc-ink);
    --tc-sidebar-muted: var(--tc-ink-soft);
    --tc-sidebar-label: var(--tc-accent);
    --tc-sidebar-border: color-mix(in srgb, var(--tc-accent-gold) 42%, transparent);
    --tc-sidebar-divider: var(--tc-rule);
    --tc-sidebar-teal: var(--tc-accent);
    --tc-sidebar-danger-surface: color-mix(in srgb, var(--tc-danger) 13%, var(--tc-paper-raised));
    color: var(--tc-ink);
    background: var(--tc-paper);
    border-right: 1px solid var(--tc-accent-gold);
    box-shadow: 8px 0 24px var(--tc-elevation-shadow) !important;
}

body.tc-dark-theme .tc-sidebar {
    --tc-sidebar-bg: var(--tc-paper);
    --tc-sidebar-bg-deep: var(--tc-paper-deep);
    --tc-sidebar-surface: var(--tc-paper-raised);
    --tc-sidebar-surface-soft: var(--tc-paper-deep);
    --tc-sidebar-surface-hover: var(--tc-accent-soft);
    --tc-sidebar-text: var(--tc-ink);
    --tc-sidebar-title: var(--tc-ink);
    --tc-sidebar-muted: var(--tc-ink-soft);
    --tc-sidebar-label: var(--tc-accent);
    --tc-sidebar-border: color-mix(in srgb, var(--tc-accent-gold) 42%, transparent);
    --tc-sidebar-divider: var(--tc-rule);
    --tc-sidebar-teal: var(--tc-accent);
    --tc-sidebar-danger-surface: color-mix(in srgb, var(--tc-danger) 13%, var(--tc-paper-raised));
}

.tc-scroll {
    scrollbar-color: var(--tc-accent-gold) var(--tc-paper-deep);
}

.tc-hero {
    color: var(--tc-slate-text);
    background: var(--tc-slate);
    border-bottom-color: var(--tc-header-rule);
    box-shadow: none !important;
}

.tc-hero::before {
    height: 2px;
    background: linear-gradient(
        90deg,
        var(--tc-accent),
        var(--tc-accent-gold-light),
        var(--tc-accent));
}

.tc-title {
    color: var(--tc-slate-text);
    font-family: var(--tc-font-display);
    font-size: 24px;
    font-variant: normal;
    font-weight: 500;
    letter-spacing: -.02em;
}

.tc-subtitle,
.tc-board {
    color: var(--tc-slate-muted);
}

.tc-board {
    border-color: var(--tc-header-rule);
    border-left-color: var(--tc-accent);
    background: var(--tc-slate-panel);
}

.tc-close {
    display: grid;
    place-items: center;
    color: var(--tc-slate-muted);
    border: 1px solid var(--tc-header-rule);
    border-radius: 4px;
    background: rgba(255, 255, 255, .04);
    font-size: 0;
}

.tc-close .tc-icon {
    width: 19px;
    height: 19px;
}

.tc-close:hover {
    color: var(--tc-slate-text);
    border-color: var(--tc-accent-gold-light);
    background: rgba(255, 255, 255, .08);
}

.tc-content {
    background: transparent;
}

.tc-section,
.tc-info-row,
.tc-treasury-details {
    border-color: var(--tc-rule);
}

.tc-kicker {
    color: var(--tc-accent-gold);
    font-family: var(--tc-font-body);
    letter-spacing: .12em;
}

.tc-kicker::after {
    background: linear-gradient(90deg, var(--tc-rule-strong), transparent);
}

.tc-section-heading-icon,
.tc-wealth-icon,
.tc-location-icon {
    color: var(--tc-accent);
    border: 0;
    border-radius: 4px;
    background: var(--tc-accent-soft);
    box-shadow: none !important;
}

.tc-fact-strip,
.tc-info-section,
.tc-government-section,
.tc-card,
.tc-row-button,
.tc-text-box {
    color: var(--tc-ink);
    border-color: var(--tc-rule);
    border-left-color: var(--tc-accent);
    border-radius: 4px;
    background: var(--tc-paper-raised);
    box-shadow: 0 2px 8px var(--tc-elevation-shadow) !important;
}

.tc-fact-strip strong,
.tc-info-row dd,
.tc-card-title,
.tc-office-holders,
.tc-treasury-detail > strong {
    color: var(--tc-ink);
}

.tc-fact-strip small,
.tc-info-row dt,
.tc-stat-label,
.tc-treasury-detail > span,
.tc-office-role {
    color: var(--tc-accent);
}

.tc-card-meta,
.tc-empty,
.tc-section-note,
.tc-office-description {
    color: var(--tc-ink-soft);
}

.tc-wealth {
    border-top-color: var(--tc-accent-gold);
}

.tc-wealth strong {
    color: var(--tc-accent-gold);
}

.tc-directory-search {
    color: var(--tc-ink-faint);
    border-color: var(--tc-rule-strong);
    border-radius: 4px;
    background: var(--tc-paper-raised);
    box-shadow: none !important;
}

.tc-directory-search:focus-within {
    border-color: var(--tc-focus);
    outline: 3px solid var(--tc-focus-ring);
}

.tc-directory-search input {
    color: var(--tc-ink);
}

.tc-directory-search input::placeholder {
    color: var(--tc-ink-faint);
}

.tc-directory-search-icon .tc-icon,
.tc-search-icon .tc-icon {
    width: 17px;
    height: 17px;
}

.tc-row-button:hover,
.tc-context-action:hover {
    color: var(--tc-ink);
    border-color: var(--tc-accent);
    background: var(--tc-accent-soft);
}

.tc-commandbar,
.tc-viewbar,
body.tc-dark-theme .tc-commandbar,
body.tc-dark-theme .tc-viewbar {
    color: var(--tc-ink);
    border: 1px solid var(--tc-rule-strong);
    border-radius: 8px;
    background: var(--tc-paper-raised);
    box-shadow: 0 8px 24px var(--tc-elevation-shadow) !important;
}

.tc-search,
body.tc-dark-theme .tc-search {
    color: var(--tc-ink);
    border-color: var(--tc-rule-strong);
    border-radius: 4px;
    background: var(--tc-paper);
    box-shadow: none !important;
}

.tc-search::placeholder {
    color: var(--tc-ink-faint);
}

.tc-search:focus {
    border-color: var(--tc-focus);
    box-shadow: 0 0 0 3px var(--tc-focus-ring) !important;
}

.tc-search-icon {
    color: var(--tc-ink-faint);
}

.tc-results,
body.tc-dark-theme .tc-results {
    border: 1px solid var(--tc-rule-strong);
    border-radius: 4px;
    background: var(--tc-paper-raised);
    box-shadow: 0 10px 26px var(--tc-elevation-shadow) !important;
}

.tc-result {
    color: var(--tc-ink);
    border-radius: 4px;
}

.tc-result:hover {
    border-color: var(--tc-accent);
    background: var(--tc-accent-soft);
}

.tc-result small {
    color: var(--tc-ink-soft);
}

.tc-viewbar-toggle {
    color: var(--tc-accent-gold);
    border-bottom-color: var(--tc-rule);
    font-family: var(--tc-font-body);
}

.tc-viewbar-toggle:hover,
.tc-viewbar-toggle:focus-visible {
    color: var(--tc-accent);
    background: var(--tc-accent-soft);
}

.tc-viewbar-toggle-icon,
.tc-viewbar-toggle-arrow {
    color: currentColor;
}

.tc-viewbar-toggle-icon .tc-icon,
.tc-viewbar-toggle-arrow .tc-icon {
    width: 16px;
    height: 16px;
}

.tc-tool,
body.tc-dark-theme .tc-tool {
    color: var(--tc-ink);
    border: 1px solid var(--tc-rule-strong);
    border-radius: 4px;
    background: var(--tc-paper);
    box-shadow: none !important;
    font-family: var(--tc-font-body);
    font-weight: 700;
    text-shadow: none;
}

.tc-tool-emblem,
body.tc-dark-theme .tc-tool-emblem {
    color: var(--tc-accent);
    border: 0;
    border-radius: 4px;
    background: var(--tc-accent-soft);
}

.tc-tool:hover,
.tc-tool.tc-selected,
.tc-commandbar .tc-tool:hover,
.tc-commandbar .tc-tool.tc-selected,
body.tc-dark-theme .tc-tool:hover,
body.tc-dark-theme .tc-tool.tc-selected,
body.tc-dark-theme .tc-commandbar .tc-tool:hover,
body.tc-dark-theme .tc-commandbar .tc-tool.tc-selected {
    color: var(--tc-ink);
    border-color: var(--tc-accent);
    background: var(--tc-accent-soft);
    box-shadow: none !important;
}

.tc-commandbar .tc-modebar .tc-mode.tc-selected,
body.tc-dark-theme .tc-commandbar .tc-modebar .tc-mode.tc-selected {
    color: var(--tc-ink);
    border-color: var(--tc-accent);
    background: var(--tc-accent-soft);
}

.tc-commandbar .tc-modebar .tc-mode.tc-selected .tc-layer-state {
    border-color: var(--tc-accent-hover);
    background: var(--tc-accent);
}

.tc-layer-state {
    border-color: var(--tc-rule-strong);
    background: var(--tc-paper-deep);
}

.tc-ui-toggle,
body.tc-dark-theme .tc-ui-toggle {
    color: var(--tc-ink);
    border: 1px solid var(--tc-rule-strong);
    border-radius: 4px;
    background: var(--tc-paper-raised);
    box-shadow: 0 4px 12px var(--tc-elevation-shadow) !important;
}

.tc-ui-toggle:hover,
.tc-ui-toggle:focus-visible,
body.tc-dark-theme .tc-theme-toggle:hover,
body.tc-dark-theme .tc-theme-toggle:focus-visible {
    color: var(--tc-accent);
    border-color: var(--tc-accent);
    background: var(--tc-accent-soft);
}

.tc-ui-toggle .tc-icon {
    width: 17px;
    height: 17px;
}

.tc-theme-control {
    position: fixed;
    bottom: 16px;
    left: 55px;
    z-index: 10031;
}

.tc-theme-control .tc-theme-toggle {
    position: static;
}

.tc-theme-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    display: grid;
    width: 224px;
    padding: 7px;
    color: var(--tc-ink);
    border: 1px solid var(--tc-rule-strong);
    border-radius: 8px;
    background: var(--tc-paper-raised);
    box-shadow: 0 12px 30px var(--tc-elevation-shadow) !important;
}

.tc-theme-menu[hidden] {
    display: none;
}

.tc-theme-menu-heading {
    margin: 0;
    padding: 7px 9px 8px;
    color: var(--tc-accent-gold);
    border-bottom: 1px solid var(--tc-rule);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.tc-theme-option {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    padding: 7px 8px;
    color: var(--tc-ink);
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    font-family: var(--tc-font-body);
    text-align: left;
}

.tc-theme-option:hover,
.tc-theme-option:focus-visible,
.tc-theme-option.tc-selected {
    border-color: var(--tc-rule);
    outline: 0;
    background: var(--tc-accent-soft);
}

.tc-theme-option.tc-selected {
    border-color: var(--tc-accent);
}

.tc-theme-option-icon {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: var(--tc-accent);
    border-radius: 4px;
    background: var(--tc-paper-deep);
}

.tc-theme-option-icon .tc-icon {
    width: 17px;
    height: 17px;
}

.tc-theme-option-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.tc-theme-option-copy strong {
    font-size: 12px;
}

.tc-theme-option-copy small {
    color: var(--tc-ink-faint);
    font-size: 10px;
}

.tc-theme-option-check {
    color: var(--tc-accent);
    opacity: 0;
}

.tc-theme-option.tc-selected .tc-theme-option-check {
    opacity: 1;
}

.tc-theme-option-check .tc-icon {
    width: 16px;
    height: 16px;
}

.tc-map-toast,
body.tc-dark-theme .tc-map-toast {
    color: var(--tc-ink);
    border-color: var(--tc-rule-strong);
    border-radius: 4px;
    background: var(--tc-paper-raised);
    box-shadow: 0 5px 16px var(--tc-elevation-shadow);
}

.tc-navigation-panel,
body.tc-dark-theme .tc-navigation-panel {
    color: var(--tc-ink);
    border: 1px solid var(--tc-rule-strong);
    border-radius: 8px;
    background: var(--tc-paper-raised);
    box-shadow: 0 8px 24px var(--tc-elevation-shadow) !important;
}

.tc-navigation-panel::after,
body.tc-dark-theme .tc-navigation-panel::after,
.tc-navigation-controls {
    border-color: var(--tc-rule);
    background-color: var(--tc-rule);
}

.tc-navigation-controls {
    background: transparent;
}

.tc-navigation-panel .tc-navigation-toggle {
    border-color: var(--tc-rule-strong);
    background: var(--tc-paper);
}

.tc-navigation-panel .tc-navigation-toggle.tc-selected {
    color: var(--tc-ink);
    border-color: var(--tc-accent);
    background: var(--tc-accent-soft);
    box-shadow: none;
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom,
body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom,
body.tc-dark-theme #mcmap.dynmap .leaflet-control-zoom,
body.tc-map-active.tc-dark-theme #map.tc-squaremap-root .leaflet-control-zoom {
    border: 1px solid var(--tc-rule-strong);
    border-radius: 4px;
    background: var(--tc-paper-raised);
    box-shadow: 0 5px 14px var(--tc-elevation-shadow) !important;
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom a,
body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom a,
body.tc-map-active.tc-dark-theme #map.tc-squaremap-root .leaflet-control-zoom a {
    color: var(--tc-ink);
    border-color: var(--tc-rule);
    background: var(--tc-paper-raised);
    font-family: var(--tc-font-body);
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom a:hover,
body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom a:hover,
body.tc-dark-theme #mcmap.dynmap .leaflet-control-zoom a:hover,
body.tc-map-active.tc-dark-theme #map.tc-squaremap-root .leaflet-control-zoom a:hover {
    color: var(--tc-accent);
    background: var(--tc-accent-soft);
}

body.tc-map-active #mcmap.dynmap .coord-control,
body.tc-map-active #map.tc-squaremap-root .coord-control,
body.tc-dark-theme #mcmap.dynmap .coord-control,
body.tc-dark-theme #map.tc-squaremap-root .coord-control {
    color: var(--tc-ink);
    border: 1px solid var(--tc-rule-strong);
    border-radius: 4px;
    background: var(--tc-paper-raised);
    box-shadow: 0 6px 16px var(--tc-elevation-shadow) !important;
}

body.tc-map-active #mcmap.dynmap .coord-control .tc-location-icon,
body.tc-map-active #map.tc-squaremap-root .coord-control .tc-location-icon {
    color: var(--tc-accent);
    border: 0;
    border-radius: 4px;
    background: var(--tc-accent-soft);
    box-shadow: none !important;
}

body.tc-map-active #mcmap.dynmap .coord-control .coord-control-label,
body.tc-map-active #map.tc-squaremap-root .coord-control .coord-control-label {
    color: var(--tc-accent-gold);
    font-family: var(--tc-font-body);
}

body.tc-map-active #mcmap.dynmap .coord-control .coord-control-value,
body.tc-map-active #map.tc-squaremap-root .coord-control .coord-control-value {
    color: var(--tc-ink);
}

.tc-diplomacy-legend {
    color: var(--tc-ink);
    border: 1px solid var(--tc-rule-strong);
    border-radius: 8px;
    background: var(--tc-paper-raised);
    box-shadow: 0 7px 18px var(--tc-elevation-shadow) !important;
}

.tc-diplomacy-heading {
    color: var(--tc-accent-gold);
    border-bottom-color: var(--tc-rule);
}

.tc-diplomacy-heading strong {
    color: var(--tc-ink);
}

.tc-context-actions {
    border-bottom-color: var(--tc-rule);
    background: var(--tc-paper);
    box-shadow: 0 4px 12px var(--tc-elevation-shadow) !important;
}

.tc-context-action {
    color: var(--tc-ink);
    border-color: var(--tc-rule-strong);
    border-radius: 4px;
    background: var(--tc-paper-raised);
    box-shadow: none !important;
    font-family: var(--tc-font-body);
}

.tc-context-icon {
    color: var(--tc-accent);
}

.tc-collapse-summary::after {
    top: 7px;
    right: 9px;
    width: 8px;
    height: 8px;
    border: 0;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    border-radius: 0;
    background: none;
    box-shadow: none !important;
    content: "";
    transform: rotate(45deg);
}

.tc-collapsible[open] > .tc-collapse-summary::after {
    content: "";
    transform: rotate(225deg);
}

.tc-town-area-hover,
.tc-town-hover {
    color: var(--tc-slate-text);
    border-color: var(--tc-accent-gold-light);
    border-left-color: var(--tc-accent);
    border-radius: 4px;
    background: var(--tc-slate);
}

.tc-town-hover strong {
    color: var(--tc-slate-text);
}

.tc-town-hover > span:not(.tc-town-hover-kicker):not(.tc-town-hover-occupied) {
    color: var(--tc-slate-muted);
}

.tc-town-hover-kicker {
    color: var(--tc-accent-gold-light);
}

.tc-squaremap-time-icon,
.tc-squaremap-weather-icon {
    color: var(--tc-accent);
    border-color: var(--tc-rule-strong);
    border-radius: 4px;
    background: var(--tc-accent-soft);
    text-shadow: none;
}

.tc-squaremap-time-icon > [data-tc-time-icon],
.tc-squaremap-weather-icon {
    display: grid;
    place-items: center;
}

.tc-squaremap-time-icon .tc-icon {
    width: 25px;
    height: 25px;
}

.tc-squaremap-weather-icon .tc-icon {
    width: 13px;
    height: 13px;
}

.tc-squaremap-time,
.tc-squaremap-clock.tc-night {
    color: var(--tc-ink);
    font-family: var(--tc-font-display);
    text-shadow: none;
}

.tc-nation-color-icon {
    color: var(--tc-nation-color);
}

.tc-nation-color-icon .tc-icon {
    filter: drop-shadow(0 1px 1px var(--tc-elevation-shadow));
}

.tc-emblem.tc-nation-fallback-frame {
    color: var(--tc-nation-color);
    border: 1px solid var(--tc-header-rule);
    border-radius: 4px;
    background: rgba(255, 255, 255, .04) !important;
}

.tc-row-button:focus-visible,
.tc-close:focus-visible,
.tc-tool:focus-visible,
.tc-ui-toggle:focus-visible,
.tc-context-action:focus-visible,
.tc-collapse-summary:focus-visible {
    outline: 3px solid var(--tc-focus-ring);
    outline-offset: 1px;
}

@media (max-width: 720px) {
    .tc-theme-control {
        bottom: 120px;
        left: 49px;
    }

    .tc-theme-menu {
        width: min(224px, calc(100vw - 59px));
    }
}

/* Post-theme QA refinements */
body.tc-map-active {
    --tc-paper: #f8faf9;
    --tc-paper-raised: #ffffff;
    --tc-paper-deep: #eef3f2;
    --tc-rule: #dce4e3;
    --tc-rule-strong: #bccaca;
    --tc-money: #4f7a4d;
    --tc-money-strong: #356638;
    --tc-money-soft: #e7f0e3;
    --tc-money-rule: #c3d7bb;
}

body.tc-map-active.tc-dark-theme {
    --tc-money: #8fbc8f;
    --tc-money-strong: #b8d99e;
    --tc-money-soft: #18271d;
    --tc-money-rule: #3a5942;
}

.tc-content {
    padding: 12px 16px calc(22px + env(safe-area-inset-bottom));
}

.tc-hero {
    padding: 13px 16px 12px;
    background: var(--tc-slate-panel);
}

.tc-hero::before {
    height: 1px;
    background: var(--tc-accent-gold);
}

.tc-hero-main,
.tc-hero-simple .tc-hero-main {
    min-height: 42px;
    gap: 10px;
    padding-right: 38px;
}

.tc-emblem {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    color: var(--tc-accent);
    border: 1px solid var(--tc-header-rule);
    border-radius: 6px;
    outline: 0;
    background: rgba(255, 255, 255, .045) !important;
    box-shadow: none !important;
}

.tc-emblem-image,
.tc-emblem .tc-main-icon {
    width: 25px;
    height: 25px;
}

.tc-emblem:has(.tc-main-icon) {
    border: 1px solid var(--tc-header-rule);
    background: rgba(255, 255, 255, .045) !important;
}

.tc-emblem .lucide-star {
    color: var(--tc-accent-gold-light);
}

.tc-emblem.tc-flag-frame {
    flex-basis: 64px;
    width: 64px;
    height: 42px;
    border: 1px solid var(--tc-header-rule);
    border-radius: 5px;
    outline: 0;
    background: rgba(255, 255, 255, .035) !important;
}

.tc-emblem.tc-nation-fallback-frame,
.tc-emblem.tc-nation-fallback-frame .tc-nation-color-icon-hero {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
}

.tc-title {
    font-size: 21px;
    line-height: 1.05;
    letter-spacing: -.015em;
}

.tc-subtitle {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.35;
}

.tc-close {
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 5px;
}

.tc-close .tc-icon {
    width: 17px;
    height: 17px;
}

.tc-board {
    margin-top: 9px;
    padding: 8px 9px;
    border-left-width: 1px;
    border-radius: 5px;
    font-family: var(--tc-font-body);
    font-size: 12px;
}

.tc-section {
    margin-bottom: 12px;
    padding-bottom: 12px;
}

.tc-kicker {
    min-height: 27px;
    margin-bottom: 9px;
    padding-bottom: 7px;
    color: var(--tc-ink);
    border-bottom: 1px solid var(--tc-rule);
    font-size: 10px;
    letter-spacing: .09em;
}

.tc-kicker::after {
    display: none;
}

.tc-section-heading-icon {
    flex-basis: 24px;
    width: 24px;
    height: 24px;
    color: var(--tc-accent);
    border-radius: 5px;
}

.tc-section-heading-icon .tc-icon,
.tc-section-heading-icon .tc-main-icon {
    width: 16px;
    height: 16px;
}

.tc-fact-strip,
.tc-info-section,
.tc-government-section,
.tc-card,
.tc-row-button,
.tc-text-box {
    border: 1px solid var(--tc-rule);
    border-left: 1px solid var(--tc-rule);
    border-radius: 6px;
    background: var(--tc-paper-raised);
    box-shadow: 0 1px 3px var(--tc-elevation-shadow) !important;
}

.tc-info-section,
.tc-government-section {
    padding: 11px 12px 12px;
}

.tc-fact-strip {
    margin-bottom: 12px;
}

.tc-card,
.tc-row-button {
    padding: 10px 11px;
}

.tc-row-button:hover,
.tc-row-button:focus-visible,
.tc-context-action:hover,
.tc-context-action:focus-visible {
    border-color: var(--tc-accent);
    background: var(--tc-accent-soft);
}

.tc-town-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tc-capital-mark {
    display: inline-grid;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    place-items: center;
    color: var(--tc-accent-gold);
    border-radius: 5px;
    background: color-mix(in srgb, var(--tc-accent-gold) 12%, transparent);
}

.tc-capital-mark .tc-icon {
    width: 15px;
    height: 15px;
}

.tc-treasury-section {
    border-bottom: 0;
}

.tc-wealth {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    padding: 13px;
    border: 1px solid var(--tc-money-rule);
    border-top: 1px solid var(--tc-money-rule);
    border-radius: 8px;
    background:
        linear-gradient(
            135deg,
            color-mix(in srgb, var(--tc-money-soft) 92%, transparent),
            color-mix(in srgb, var(--tc-paper-raised) 84%, transparent));
    box-shadow: 0 2px 7px color-mix(in srgb, var(--tc-money) 13%, transparent) !important;
}

.tc-wealth-icon {
    width: 38px;
    height: 38px;
    color: var(--tc-money);
    border: 1px solid var(--tc-money-rule);
    border-radius: 7px;
    background: color-mix(in srgb, var(--tc-money-soft) 78%, var(--tc-paper-raised));
}

.tc-wealth-icon .tc-icon {
    width: 21px;
    height: 21px;
}

.tc-wealth .tc-stat-label,
.tc-treasury-detail > span {
    color: var(--tc-money);
}

.tc-wealth strong {
    margin-top: 3px;
    color: var(--tc-money-strong);
    font-size: 23px;
}

.tc-treasury-details {
    gap: 8px;
    margin: 1px -2px -2px;
    padding: 10px 2px 2px;
    border-color: var(--tc-money-rule);
}

.tc-town-area-hover,
.tc-town-hover {
    color: var(--tc-ink);
    border: 1px solid var(--tc-rule-strong);
    border-left: 1px solid var(--tc-rule-strong);
    border-radius: 6px;
    background: var(--tc-paper-raised);
    box-shadow: 0 7px 18px var(--tc-elevation-shadow) !important;
}

.tc-town-area-hover {
    padding: 6px 9px;
    color: var(--tc-ink);
    font-family: var(--tc-font-body);
    font-size: 12px;
    letter-spacing: 0;
}

.tc-town-hover {
    min-width: 154px;
    gap: 2px;
    padding: 9px 10px;
}

.tc-town-hover-kicker {
    color: var(--tc-accent);
    font-family: var(--tc-font-body);
    font-size: 9px;
    letter-spacing: .1em;
}

.tc-town-hover strong {
    color: var(--tc-ink);
    font-family: var(--tc-font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
}

.tc-town-hover > span:not(.tc-town-hover-kicker):not(.tc-town-hover-occupied) {
    color: var(--tc-ink-soft);
}

.tc-town-hover-occupied {
    border-color: color-mix(in srgb, var(--tc-danger) 35%, transparent);
}

body.tc-map-active #mcmap.dynmap .playerMarker .playerName,
body.tc-map-active #mcmap.dynmap .playerMarker .playerNameSm,
body.tc-map-active #mcmap.dynmap .playerMarker .playerNameLg,
body.tc-map-active #map.tc-squaremap-root .leaflet-nameplate-pane .leaflet-tooltip {
    color: var(--tc-ink);
    border: 1px solid var(--tc-rule-strong);
    border-left: 1px solid var(--tc-rule-strong);
    border-radius: 5px;
    background: var(--tc-paper-raised);
    box-shadow: 0 4px 12px var(--tc-elevation-shadow) !important;
    clip-path: none;
    font-family: var(--tc-font-body);
    font-size: 11px;
    letter-spacing: 0;
}

body.tc-map-active #map.tc-squaremap-root
        .leaflet-nameplate-pane .leaflet-tooltip img.head {
    border-color: var(--tc-rule-strong);
    border-radius: 4px;
}

body.tc-map-active .leaflet-popup-content-wrapper,
body.tc-map-active .leaflet-popup-tip {
    color: var(--tc-ink);
    border: 1px solid var(--tc-rule-strong);
    background: var(--tc-paper-raised);
    box-shadow: 0 8px 22px var(--tc-elevation-shadow) !important;
}

body.tc-map-active .leaflet-popup-content-wrapper {
    border-radius: 7px;
}

.tc-diplomacy-legend {
    width: 190px;
    border-radius: 7px;
}

.tc-diplomacy-heading {
    display: grid;
    justify-content: stretch;
    gap: 2px;
}

.tc-diplomacy-heading strong {
    color: var(--tc-ink);
    font-size: 12px;
    text-align: left;
}

.tc-diplomacy-key i {
    border-color: color-mix(in srgb, var(--tc-ink) 35%, transparent);
}

.tc-sidebar.tc-open ~ #tc-ui-toggle,
.tc-sidebar.tc-open ~ .tc-theme-control {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
}

#tc-ui-toggle,
.tc-theme-control {
    transition:
        opacity 140ms ease,
        transform 140ms ease;
}

body.tc-ui-toggle-idle #tc-ui-toggle {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
}

.tc-squaremap-compass {
    color: var(--tc-ink-soft);
    border: 1px solid var(--tc-rule-strong);
    background: var(--tc-paper-deep);
    box-shadow: inset 0 0 0 6px var(--tc-paper-raised) !important;
    font-family: var(--tc-font-body);
    font-size: 9px;
    font-weight: 800;
}

.tc-squaremap-compass::before {
    inset: 10px;
    border-color: var(--tc-rule-strong);
}

.tc-squaremap-compass::after {
    display: none;
}

.tc-squaremap-compass .tc-compass-rose {
    inset: 24px;
    background: var(--tc-accent);
    clip-path: polygon(
        50% 0,
        62% 41%,
        100% 50%,
        62% 59%,
        50% 100%,
        38% 59%,
        0 50%,
        38% 41%);
    opacity: .18;
}

.tc-squaremap-compass .tc-compass-point {
    text-shadow: none;
}

.tc-squaremap-compass .tc-compass-north {
    color: var(--tc-accent);
}

.tc-squaremap-compass .tc-compass-needle {
    top: 15px;
    bottom: 15px;
    left: calc(50% - 1px);
    width: 2px;
    background: linear-gradient(
        to bottom,
        var(--tc-accent-gold) 0 50%,
        var(--tc-ink-faint) 50% 100%);
    filter: none;
}

.tc-squaremap-compass .tc-compass-hub {
    width: 8px;
    height: 8px;
    border-color: var(--tc-accent);
    background: var(--tc-paper-raised);
}

@media (min-width: 721px) {
    body.tc-map-active.tc-squaremap .tc-navigation-panel {
        grid-template-columns: 76px 126px;
        grid-template-rows: 76px 30px;
        column-gap: 9px;
        row-gap: 6px;
        width: 229px;
        height: 128px;
    }

    body.tc-map-active.tc-squaremap .tc-navigation-panel::after {
        top: 13px;
        bottom: 42px;
        left: 93px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-compass {
        width: 76px;
        height: 76px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-clock {
        grid-template-columns: 38px minmax(0, 1fr);
        width: 126px;
        height: 76px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-time-icon {
        width: 36px;
        height: 36px;
    }

    body.tc-map-active.tc-squaremap .tc-squaremap-time {
        font-size: 27px;
    }
}

/* Cartographic identity */
body.tc-map-active {
    --tc-header: #0a283d;
    --tc-section-navy: #0a283d;
    --tc-footer: #061823;
    --tc-logo-red: #c6503d;
    --tc-logo-orange: #e6812d;
    --tc-cartographic-grid: rgba(42, 111, 120, .055);
    --tc-cartographic-dot: rgba(155, 123, 63, .11);
    --tc-cartographic-contour: rgba(155, 123, 63, .065);
    --tc-navy-rule: rgba(215, 187, 119, .3);
    --tc-navy-grid: rgba(88, 166, 184, .075);
}

body.tc-map-active.tc-dark-theme {
    --tc-header: #0d1117;
    --tc-section-navy: #101d2a;
    --tc-footer: #070b10;
    --tc-cartographic-grid: rgba(88, 166, 184, .045);
    --tc-cartographic-dot: rgba(230, 204, 136, .08);
    --tc-cartographic-contour: rgba(230, 204, 136, .045);
    --tc-navy-rule: rgba(230, 204, 136, .28);
    --tc-navy-grid: rgba(88, 166, 184, .065);
}

.tc-sidebar {
    background:
        radial-gradient(
            circle at 1px 1px,
            var(--tc-cartographic-dot) 1px,
            transparent 1.25px) 0 0 / 24px 24px,
        repeating-radial-gradient(
            ellipse at -8% 18%,
            transparent 0 24px,
            var(--tc-cartographic-contour) 25px 26px),
        var(--tc-paper);
    border-right-color: var(--tc-accent-gold);
}

.tc-hero {
    color: var(--tc-slate-text);
    border-bottom-color: var(--tc-navy-rule);
    background:
        linear-gradient(
            var(--tc-navy-grid) 1px,
            transparent 1px) 0 0 / 28px 28px,
        linear-gradient(
            90deg,
            var(--tc-navy-grid) 1px,
            transparent 1px) 0 0 / 28px 28px,
        radial-gradient(
            circle at 12% 16%,
            rgba(88, 166, 184, .16),
            transparent 38%),
        var(--tc-header);
}

.tc-hero::before {
    height: 2px;
    background:
        linear-gradient(
            90deg,
            var(--tc-logo-red),
            var(--tc-logo-orange) 18%,
            var(--tc-accent-gold-light) 50%,
            var(--tc-accent) 82%,
            transparent);
}

.tc-hero::after {
    position: absolute;
    right: 16px;
    bottom: 0;
    left: 16px;
    height: 1px;
    background:
        linear-gradient(
            90deg,
            transparent,
            var(--tc-accent-gold-light),
            transparent);
    content: "";
    opacity: .45;
}

.tc-emblem,
.tc-emblem:has(.tc-main-icon),
.tc-emblem.tc-flag-frame {
    border-color: var(--tc-navy-rule);
    background: color-mix(in srgb, var(--tc-section-navy) 82%, transparent) !important;
}

.tc-title,
.tc-card-title,
.tc-fact-strip strong,
.tc-wealth strong,
.tc-town-hover strong,
.tc-squaremap-time {
    font-family: var(--tc-font-display);
}

.tc-title {
    color: var(--tc-slate-text);
}

.tc-board {
    border-color: var(--tc-navy-rule);
    border-left-color: var(--tc-accent-gold-light);
    background:
        linear-gradient(
            90deg,
            rgba(88, 166, 184, .055) 1px,
            transparent 1px) 0 0 / 18px 18px,
        color-mix(in srgb, var(--tc-section-navy) 82%, transparent);
}

.tc-kicker {
    color: var(--tc-ink);
    border-bottom-color:
        color-mix(in srgb, var(--tc-accent-gold) 42%, var(--tc-rule));
    font-family: var(--tc-font-display);
    letter-spacing: .075em;
}

.tc-section-heading-icon,
.tc-capital-mark {
    border: 1px solid
        color-mix(in srgb, var(--tc-accent-gold) 34%, transparent);
}

.tc-fact-strip,
.tc-info-section,
.tc-government-section,
.tc-card,
.tc-row-button,
.tc-text-box {
    border-color: var(--tc-rule);
    border-top-color:
        color-mix(in srgb, var(--tc-accent-gold) 42%, var(--tc-rule));
    background:
        linear-gradient(
            135deg,
            transparent 0 78%,
            var(--tc-cartographic-grid) 78% 79%,
            transparent 79%),
        var(--tc-paper-raised);
}

.tc-commandbar,
.tc-viewbar,
body.tc-dark-theme .tc-commandbar,
body.tc-dark-theme .tc-viewbar {
    color: var(--tc-slate-text);
    border-color: var(--tc-accent-gold);
    background:
        radial-gradient(
            circle at 1px 1px,
            rgba(215, 187, 119, .12) 1px,
            transparent 1.2px) 0 0 / 22px 22px,
        linear-gradient(
            var(--tc-navy-grid) 1px,
            transparent 1px) 0 0 / 30px 30px,
        var(--tc-footer);
    box-shadow:
        0 8px 24px var(--tc-elevation-shadow),
        inset 0 1px rgba(255, 255, 255, .035) !important;
}

.tc-search,
body.tc-dark-theme .tc-search {
    color: var(--tc-slate-text);
    border-color: var(--tc-navy-rule);
    background: var(--tc-section-navy);
}

.tc-search::placeholder {
    color: var(--tc-slate-muted);
}

.tc-search-icon {
    color: var(--tc-accent);
}

.tc-results,
body.tc-dark-theme .tc-results {
    color: var(--tc-ink);
    border-color:
        color-mix(in srgb, var(--tc-accent-gold) 58%, var(--tc-rule));
    background:
        radial-gradient(
            circle at 1px 1px,
            var(--tc-cartographic-dot) 1px,
            transparent 1.2px) 0 0 / 22px 22px,
        var(--tc-paper-raised);
}

.tc-tool,
body.tc-dark-theme .tc-tool {
    color: var(--tc-slate-text);
    border-color: var(--tc-navy-rule);
    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, .035),
            transparent),
        var(--tc-section-navy);
}

.tc-tool-emblem,
body.tc-dark-theme .tc-tool-emblem {
    color: var(--tc-accent);
    background: rgba(88, 166, 184, .105);
}

.tc-tool:hover,
.tc-tool.tc-selected,
.tc-commandbar .tc-tool:hover,
.tc-commandbar .tc-tool.tc-selected,
body.tc-dark-theme .tc-tool:hover,
body.tc-dark-theme .tc-tool.tc-selected,
body.tc-dark-theme .tc-commandbar .tc-tool:hover,
body.tc-dark-theme .tc-commandbar .tc-tool.tc-selected {
    color: var(--tc-slate-text);
    border-color: var(--tc-accent-gold-light);
    background:
        linear-gradient(
            180deg,
            rgba(88, 166, 184, .16),
            rgba(88, 166, 184, .07)),
        var(--tc-section-navy);
}

.tc-commandbar .tc-modebar .tc-mode.tc-selected,
body.tc-dark-theme .tc-commandbar .tc-modebar .tc-mode.tc-selected {
    color: var(--tc-slate-text);
    border-color: var(--tc-accent);
    background:
        linear-gradient(
            180deg,
            rgba(88, 166, 184, .18),
            rgba(88, 166, 184, .08)),
        var(--tc-section-navy);
}

.tc-layer-state {
    border-color: var(--tc-navy-rule);
    background: var(--tc-footer);
}

.tc-viewbar-toggle {
    color: var(--tc-accent-gold-light);
    border-bottom-color: var(--tc-navy-rule);
    font-family: var(--tc-font-display);
}

.tc-viewbar-toggle:hover,
.tc-viewbar-toggle:focus-visible {
    color: var(--tc-slate-text);
    background: rgba(88, 166, 184, .12);
}

.tc-tool[data-mode="wars"] .tc-tool-emblem,
.tc-tool[data-view="wars"] .tc-tool-emblem,
.tc-section-heading-icon:has(.lucide-shield-alert),
.tc-emblem:has(.lucide-shield-alert) {
    color: var(--tc-logo-red);
}

.tc-tool[data-mode="battles"] .tc-tool-emblem,
.tc-section-heading-icon:has(.lucide-swords),
.tc-emblem:has(.lucide-swords) {
    color: var(--tc-logo-orange);
}

.tc-ui-toggle,
body.tc-dark-theme .tc-ui-toggle {
    color: var(--tc-slate-text);
    border-color: var(--tc-accent-gold);
    background:
        radial-gradient(
            circle at 1px 1px,
            rgba(215, 187, 119, .1) 1px,
            transparent 1.2px) 0 0 / 16px 16px,
        var(--tc-footer);
}

.tc-ui-toggle:hover,
.tc-ui-toggle:focus-visible,
body.tc-dark-theme .tc-theme-toggle:hover,
body.tc-dark-theme .tc-theme-toggle:focus-visible {
    color: var(--tc-accent-gold-light);
    border-color: var(--tc-accent);
    background: var(--tc-section-navy);
}

.tc-theme-menu {
    color: var(--tc-ink);
    border-color:
        color-mix(in srgb, var(--tc-accent-gold) 58%, var(--tc-rule));
    background:
        radial-gradient(
            circle at 1px 1px,
            var(--tc-cartographic-dot) 1px,
            transparent 1.2px) 0 0 / 22px 22px,
        var(--tc-paper-raised);
}

.tc-theme-menu-heading {
    color: var(--tc-accent-gold);
    font-family: var(--tc-font-display);
}

.tc-theme-option-icon {
    color: var(--tc-accent);
    border: 1px solid
        color-mix(in srgb, var(--tc-accent-gold) 28%, transparent);
}

.tc-navigation-panel,
body.tc-dark-theme .tc-navigation-panel {
    color: var(--tc-slate-text);
    border-color: var(--tc-accent-gold);
    background:
        linear-gradient(
            var(--tc-navy-grid) 1px,
            transparent 1px) 0 0 / 24px 24px,
        linear-gradient(
            90deg,
            var(--tc-navy-grid) 1px,
            transparent 1px) 0 0 / 24px 24px,
        radial-gradient(
            circle at 18% 16%,
            rgba(88, 166, 184, .15),
            transparent 38%),
        var(--tc-section-navy);
}

.tc-navigation-panel::after,
body.tc-dark-theme .tc-navigation-panel::after,
.tc-navigation-controls {
    border-color: var(--tc-navy-rule);
    background-color: var(--tc-navy-rule);
}

.tc-navigation-controls {
    background: transparent;
}

.tc-navigation-panel .tc-navigation-toggle {
    color: var(--tc-slate-muted);
    border-color: var(--tc-navy-rule);
    background: var(--tc-footer);
}

.tc-navigation-panel .tc-navigation-toggle.tc-selected {
    color: var(--tc-slate-text);
    border-color: var(--tc-accent);
    background: color-mix(
        in srgb,
        var(--tc-accent) 18%,
        var(--tc-section-navy));
}

.tc-squaremap-compass {
    color: var(--tc-slate-muted);
    border: 1px solid var(--tc-accent-gold-light);
    background:
        radial-gradient(
            circle,
            transparent 0 34%,
            rgba(215, 187, 119, .34) 35% 36%,
            transparent 37% 55%,
            rgba(88, 166, 184, .2) 56% 57%,
            transparent 58%),
        linear-gradient(
            90deg,
            transparent 49.2%,
            rgba(215, 187, 119, .16) 49.2% 50.8%,
            transparent 50.8%),
        linear-gradient(
            transparent 49.2%,
            rgba(215, 187, 119, .16) 49.2% 50.8%,
            transparent 50.8%),
        var(--tc-footer);
    box-shadow:
        inset 0 0 0 5px var(--tc-section-navy),
        inset 0 0 0 6px rgba(215, 187, 119, .2) !important;
    font-family: var(--tc-font-display);
}

.tc-squaremap-compass::before {
    inset: 8px;
    border-color: rgba(215, 187, 119, .42);
}

.tc-squaremap-compass .tc-compass-rose {
    inset: 19px;
    background:
        conic-gradient(
            from 45deg,
            var(--tc-accent) 0 12.5%,
            var(--tc-accent-gold-light) 12.5% 25%,
            var(--tc-accent) 25% 37.5%,
            var(--tc-accent-gold-light) 37.5% 50%,
            var(--tc-accent) 50% 62.5%,
            var(--tc-accent-gold-light) 62.5% 75%,
            var(--tc-accent) 75% 87.5%,
            var(--tc-accent-gold-light) 87.5% 100%);
    clip-path: polygon(
        50% 0,
        59% 39%,
        100% 50%,
        59% 61%,
        50% 100%,
        41% 61%,
        0 50%,
        41% 39%);
    opacity: .55;
}

.tc-squaremap-compass .tc-compass-north {
    color: var(--tc-logo-orange);
}

.tc-squaremap-compass .tc-compass-needle {
    top: 13px;
    bottom: 13px;
    background:
        linear-gradient(
            to bottom,
            var(--tc-logo-red) 0 50%,
            var(--tc-slate-muted) 50% 100%);
}

.tc-squaremap-compass .tc-compass-hub {
    border-color: var(--tc-accent-gold-light);
    background: var(--tc-section-navy);
}

.tc-squaremap-time,
.tc-squaremap-clock.tc-night {
    color: var(--tc-slate-text);
}

.tc-squaremap-time-icon,
.tc-squaremap-weather-icon {
    color: var(--tc-accent);
    border-color: var(--tc-navy-rule);
    background: var(--tc-footer);
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom,
body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom,
body.tc-dark-theme #mcmap.dynmap .leaflet-control-zoom,
body.tc-map-active.tc-dark-theme #map.tc-squaremap-root .leaflet-control-zoom {
    border-color: var(--tc-accent-gold);
    background: var(--tc-footer);
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom a,
body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom a,
body.tc-map-active.tc-dark-theme #map.tc-squaremap-root .leaflet-control-zoom a {
    color: var(--tc-slate-text);
    border-color: var(--tc-navy-rule);
    background: var(--tc-section-navy);
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom a:hover,
body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom a:hover,
body.tc-dark-theme #mcmap.dynmap .leaflet-control-zoom a:hover,
body.tc-map-active.tc-dark-theme #map.tc-squaremap-root .leaflet-control-zoom a:hover {
    color: var(--tc-accent-gold-light);
    background: color-mix(
        in srgb,
        var(--tc-accent) 18%,
        var(--tc-section-navy));
}

.tc-town-area-hover,
.tc-town-hover,
.tc-diplomacy-legend {
    color: var(--tc-slate-text);
    border: 1px solid var(--tc-accent-gold);
    border-radius: 2px;
    background: var(--tc-section-navy);
}

.tc-town-area-hover {
    color: var(--tc-slate-text);
    font-family: var(--tc-font-display);
}

.tc-town-hover-kicker,
.tc-diplomacy-heading {
    color: var(--tc-accent-gold-light);
}

.tc-town-hover strong,
.tc-diplomacy-heading strong {
    color: var(--tc-slate-text);
}

.tc-town-hover > span:not(.tc-town-hover-kicker):not(.tc-town-hover-occupied),
.tc-diplomacy-key {
    color: var(--tc-slate-muted);
}

.tc-diplomacy-heading {
    padding: 9px 10px 8px;
    border-bottom-color: var(--tc-navy-rule);
    background: var(--tc-footer);
}

.tc-diplomacy-legend {
    padding: 0;
    overflow: hidden;
}

.tc-diplomacy-key {
    gap: 0;
    margin-top: 0;
}

.tc-diplomacy-key span {
    min-height: 30px;
    padding: 6px 10px;
}

.tc-diplomacy-key span + span {
    border-top: 1px solid var(--tc-navy-rule);
}

.tc-diplomacy-key i {
    border-color: color-mix(
        in srgb,
        var(--tc-accent-gold-light) 55%,
        transparent);
}

/* Flat map panels and supplied topography texture */
.tc-sidebar {
    background: var(--tc-paper);
    box-shadow: none !important;
}

.tc-hero {
    background-color: var(--tc-header);
    background-image:
        linear-gradient(
            color-mix(in srgb, var(--tc-header) 84%, transparent),
            color-mix(in srgb, var(--tc-header) 84%, transparent)),
        url("./topography.png");
    background-repeat: no-repeat, repeat;
    background-size: auto, 500px 462px;
}

.tc-kicker {
    background: transparent;
}

.tc-content {
    padding: 0;
    background: transparent;
}

.tc-content > .tc-directory-search {
    width: calc(100% - 32px);
    margin: 14px 16px;
}

.tc-content > .tc-fact-strip,
.tc-content > .tc-section,
.tc-content > .tc-empty {
    margin: 0;
    padding: 14px 16px;
    border: 0;
    border-bottom: 1px solid var(--tc-rule);
    border-radius: 0;
    box-shadow: none !important;
}

.tc-content > .tc-fact-strip,
.tc-content > .tc-section:nth-of-type(even) {
    background: var(--tc-paper-raised);
}

.tc-content > .tc-section:nth-of-type(odd),
.tc-content > .tc-empty {
    background: var(--tc-paper-deep);
}

.tc-context-actions {
    padding: 9px 12px;
    border-bottom: 1px solid var(--tc-rule);
    background: var(--tc-paper-deep);
    box-shadow: none !important;
}

.tc-context-action {
    border-color:
        color-mix(in srgb, var(--tc-accent-gold) 42%, var(--tc-rule));
    border-radius: 2px;
    background: transparent;
}

.tc-list {
    gap: 0;
}

.tc-card,
.tc-row-button,
.tc-text-box {
    padding: 10px 0;
    border: 0;
    border-bottom: 1px solid var(--tc-rule);
    border-radius: 0;
    background: transparent;
    box-shadow: none !important;
}

.tc-player-row {
    padding-block: 6px;
}

.tc-list > :last-child {
    border-bottom: 0;
}

.tc-row-button:hover,
.tc-row-button:focus-visible,
.tc-card:hover {
    background: color-mix(in srgb, var(--tc-accent) 8%, transparent);
}

.tc-fact-strip {
    border-radius: 0;
}

.tc-info-section,
.tc-government-section {
    border-radius: 0;
}

.tc-kicker {
    margin-bottom: 8px;
}

.tc-wealth {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none !important;
}

.tc-treasury-details {
    margin-inline: 0;
}

.tc-board {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: none !important;
}

.tc-emblem,
.tc-emblem:has(.tc-main-icon),
.tc-emblem.tc-nation-fallback-frame,
.tc-section-heading-icon,
.tc-wealth-icon,
.tc-location-icon,
.tc-tool-emblem,
body.tc-dark-theme .tc-tool-emblem,
.tc-theme-option-icon,
.tc-capital-mark {
    color: var(--tc-accent-gold);
    border: 0;
    outline: 0;
    background: transparent !important;
    box-shadow: none !important;
}

.tc-emblem.tc-flag-frame {
    border: 1px solid var(--tc-navy-rule);
    background: transparent !important;
}

.tc-context-icon,
.tc-search-icon,
.tc-directory-search-icon,
.tc-viewbar-toggle-icon,
.tc-viewbar-toggle-arrow,
.tc-squaremap-time-icon,
.tc-squaremap-weather-icon {
    color: var(--tc-accent-gold);
}

.tc-tool[data-mode="wars"] .tc-tool-emblem,
.tc-tool[data-view="wars"] .tc-tool-emblem,
.tc-tool[data-mode="battles"] .tc-tool-emblem,
.tc-section-heading-icon:has(.lucide-shield-alert),
.tc-section-heading-icon:has(.lucide-swords),
.tc-emblem:has(.lucide-shield-alert),
.tc-emblem:has(.lucide-swords) {
    color: var(--tc-accent-gold);
}

.tc-directory-search,
.tc-search,
.tc-results,
.tc-commandbar,
.tc-viewbar,
.tc-navigation-panel,
.tc-theme-menu,
.tc-theme-option,
.tc-ui-toggle,
.tc-map-toast,
.tc-diplomacy-legend,
.tc-town-area-hover,
.tc-town-hover,
.tc-fact-strip,
.tc-info-section,
.tc-government-section,
.tc-card,
.tc-row-button,
.tc-text-box,
.tc-wealth,
.tc-context-action,
body.tc-dark-theme .tc-commandbar,
body.tc-dark-theme .tc-viewbar,
body.tc-dark-theme .tc-ui-toggle,
body.tc-dark-theme .tc-navigation-panel {
    box-shadow: none !important;
    text-shadow: none;
}

.tc-nation-color-icon .tc-icon,
.tc-squaremap-compass .tc-compass-needle {
    filter: none;
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom,
body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom,
body.tc-map-active #mcmap.dynmap .coord-control,
body.tc-map-active #map.tc-squaremap-root .coord-control,
body.tc-map-active #map.tc-squaremap-root .leaflet-nameplate-pane .leaflet-tooltip,
body.tc-map-active .leaflet-popup-content-wrapper,
body.tc-map-active .leaflet-popup-tip {
    box-shadow: none !important;
    text-shadow: none;
}

.tc-hero::before,
.tc-hero::after {
    right: 0;
    left: 0;
    z-index: 2;
    height: 2px;
    background-color: var(--tc-accent-gold-light);
    background-image: none;
    opacity: 1;
    pointer-events: none;
}

.tc-hero::after {
    bottom: 0;
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom,
body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom,
body.tc-dark-theme #mcmap.dynmap .leaflet-control-zoom,
body.tc-map-active.tc-dark-theme #map.tc-squaremap-root .leaflet-control-zoom {
    overflow: hidden;
    border: 1px solid var(--tc-accent-gold);
    border-radius: 2px;
    background: var(--tc-footer);
    box-shadow: none !important;
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom a,
body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom a,
body.tc-dark-theme #mcmap.dynmap .leaflet-control-zoom a,
body.tc-map-active.tc-dark-theme #map.tc-squaremap-root .leaflet-control-zoom a {
    color: var(--tc-accent-gold-light);
    border-color: var(--tc-navy-rule);
    background: var(--tc-section-navy);
    font-family: var(--tc-font-display);
    font-weight: 500;
    text-shadow: none;
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom a:hover,
body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom a:hover,
body.tc-dark-theme #mcmap.dynmap .leaflet-control-zoom a:hover,
body.tc-map-active.tc-dark-theme #map.tc-squaremap-root .leaflet-control-zoom a:hover {
    color: var(--tc-accent-gold-light);
    background: color-mix(
        in srgb,
        var(--tc-accent) 12%,
        var(--tc-section-navy));
}

body.tc-map-active #mcmap.dynmap .coord-control,
body.tc-map-active #map.tc-squaremap-root .coord-control,
body.tc-dark-theme #mcmap.dynmap .coord-control,
body.tc-dark-theme #map.tc-squaremap-root .coord-control {
    color: var(--tc-slate-text);
    border: 1px solid var(--tc-accent-gold);
    border-radius: 2px;
    background: var(--tc-section-navy);
    box-shadow: none !important;
}

body.tc-map-active #mcmap.dynmap .coord-control .tc-location-icon,
body.tc-map-active #map.tc-squaremap-root .coord-control .tc-location-icon {
    color: var(--tc-accent-gold-light);
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
}

body.tc-map-active #mcmap.dynmap .coord-control .coord-control-label,
body.tc-map-active #map.tc-squaremap-root .coord-control .coord-control-label {
    color: var(--tc-accent-gold-light);
    font-family: var(--tc-font-display);
}

body.tc-map-active #mcmap.dynmap .coord-control .coord-control-value,
body.tc-map-active #map.tc-squaremap-root .coord-control .coord-control-value {
    color: var(--tc-slate-text);
    font-family: var(--tc-font-body);
}

/* Layered civic information panels */
.tc-content > .tc-fact-strip,
.tc-content > .tc-section,
.tc-content > .tc-empty,
.tc-context-actions {
    border-bottom-color:
        color-mix(in srgb, var(--tc-accent-gold) 48%, var(--tc-rule));
}

.tc-content > .tc-section:last-child {
    border-bottom: 1px solid
        color-mix(in srgb, var(--tc-accent-gold) 48%, var(--tc-rule));
}

.tc-fact-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    padding: 0 !important;
}

.tc-fact-item {
    position: relative;
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 72px;
    place-content: center;
    gap: 3px;
    padding: 13px 12px;
    color: inherit;
    border: 0;
    border-radius: 0;
    background: transparent;
    font: inherit;
    text-align: center;
}

.tc-fact-item + .tc-fact-item {
    border-left: 1px solid var(--tc-rule);
}

.tc-fact-item > strong {
    color: var(--tc-ink);
    font-family: var(--tc-font-display);
    font-size: 19px;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.tc-fact-item > small {
    color: var(--tc-accent);
    font-size: var(--tc-text-label);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.tc-wealth-summary::-webkit-details-marker {
    display: none;
}

.tc-fact-trigger {
    cursor: pointer;
}

.tc-fact-trigger:hover,
.tc-fact-trigger:focus-visible,
.tc-info-disclosure:hover,
.tc-info-disclosure:focus-visible,
.tc-wealth-summary:hover,
.tc-wealth-summary:focus-visible {
    background: color-mix(in srgb, var(--tc-accent) 8%, transparent);
}

.tc-fact-trigger:focus-visible,
.tc-info-disclosure:focus-visible,
.tc-wealth-summary:focus-visible {
    outline: 2px solid var(--tc-accent);
    outline-offset: -2px;
}

.tc-disclosure-icon {
    display: inline-grid;
    place-items: center;
    color: var(--tc-accent-gold);
    transition: transform 150ms ease;
}

.tc-disclosure-icon .tc-icon {
    width: 16px;
    height: 16px;
}

.tc-fact-item > .tc-disclosure-icon {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
}

.tc-info-disclosure {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 20px;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 39px;
    padding: 7px 2px;
    color: var(--tc-accent);
    border: 0;
    border-top: 1px solid var(--tc-rule);
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.tc-info-disclosure > strong {
    color: var(--tc-ink);
}

.tc-wealth-disclosure[open] > summary .tc-disclosure-icon {
    transform: rotate(90deg);
}

.tc-treasury-section {
    padding: 0 !important;
}

.tc-wealth {
    display: block;
}

.tc-wealth-summary {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 11px;
    min-height: 84px;
    padding: 14px 16px;
    list-style: none;
}

.tc-wealth:not(.tc-wealth-disclosure) .tc-wealth-summary {
    grid-template-columns: 36px minmax(0, 1fr);
}

.tc-wealth-copy {
    display: block;
}

.tc-wealth .tc-stat-label {
    color: color-mix(in srgb, var(--tc-money) 72%, var(--tc-ink-soft));
}

.tc-wealth strong {
    color: var(--tc-money-strong);
}

.tc-treasury-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0;
    margin: 0;
    padding: 0 16px 14px;
    border-top: 1px solid var(--tc-money-rule);
}

.tc-treasury-detail {
    padding: 11px 0 0;
}

.tc-treasury-detail + .tc-treasury-detail {
    padding-left: 14px;
    border-left: 1px solid var(--tc-money-rule);
}

.tc-treasury-detail > span {
    color: color-mix(in srgb, var(--tc-money) 72%, var(--tc-ink-soft));
}

/* Sidebar header trim and opaque controls */
.tc-hero {
    overflow: hidden;
    border-bottom: 0;
}

.tc-hero::after {
    bottom: 0;
}

.tc-close,
.tc-detail-close {
    color: var(--tc-accent-gold-light);
    border: 1px solid var(--tc-navy-rule);
    border-radius: 2px;
    background-color: var(--tc-section-navy) !important;
    background-image: none !important;
    box-shadow: none !important;
}

.tc-close:hover,
.tc-close:focus-visible,
.tc-detail-close:hover,
.tc-detail-close:focus-visible {
    color: var(--tc-accent-gold-light);
    border-color: var(--tc-accent-gold-light);
    background-color:
        color-mix(in srgb, var(--tc-accent) 12%, var(--tc-section-navy)) !important;
}

/* Sidebar detail panels */
.tc-detail-dialog {
    position: fixed;
    inset: var(--tc-detail-top, 16px) auto auto 396px;
    z-index: 10019;
    width: min(280px, calc(100vw - 412px));
    min-width: 0;
    height: min(320px, calc(100dvh - 32px));
    max-width: 280px;
    max-height: 320px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: var(--tc-ink);
    border: 2px solid var(--tc-accent-gold);
    border-radius: 2px;
    background: var(--tc-paper-raised);
    box-shadow: 0 14px 34px
        color-mix(in srgb, var(--tc-footer) 36%, transparent);
}

.tc-detail-dialog[open] {
    display: flex;
    flex-direction: column;
}

.tc-detail-dialog::backdrop {
    background: transparent;
}

.tc-detail-header {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 32px;
    align-items: center;
    flex: 0 0 60px;
    gap: 9px;
    min-height: 60px;
    padding: 9px 9px 9px 12px;
    color: var(--tc-slate-text);
    border-bottom: 2px solid var(--tc-accent-gold-light);
    background: var(--tc-header);
}

.tc-detail-icon {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: var(--tc-accent-gold-light);
}

.tc-detail-icon .tc-icon {
    width: 22px;
    height: 22px;
}

.tc-detail-heading {
    min-width: 0;
}

.tc-detail-heading h2 {
    margin: 0;
    color: var(--tc-slate-text);
    font-family: var(--tc-font-display);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.15;
}

.tc-detail-heading p {
    margin: 3px 0 0;
    color: var(--tc-slate-muted);
    font-size: 11px;
}

.tc-detail-close {
    position: static;
    display: grid;
    width: 32px;
    height: 32px;
    padding: 0;
    place-items: center;
    cursor: pointer;
}

.tc-detail-close .tc-icon {
    width: 18px;
    height: 18px;
}

.tc-detail-content {
    min-height: 0;
    max-height: none;
    padding: 15px;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.tc-comma-list,
.tc-detail-empty {
    margin: 0;
    color: var(--tc-ink);
    font-size: 14px;
    line-height: 1.75;
}

.tc-comma-separator {
    color: var(--tc-ink-faint);
}

.tc-comma-link {
    display: inline;
    margin: 0;
    padding: 0;
    color: var(--tc-accent);
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.tc-comma-link:hover,
.tc-comma-link:focus-visible {
    color: var(--tc-ink);
    text-decoration: underline;
    text-decoration-color: var(--tc-accent-gold);
    text-underline-offset: 3px;
}

.tc-rank-list,
.tc-detail-card-list {
    display: grid;
    gap: 0;
}

.tc-rank-group {
    padding: 13px 0;
    border-bottom: 1px solid
        color-mix(in srgb, var(--tc-accent-gold) 42%, var(--tc-rule));
}

.tc-rank-group:first-child {
    padding-top: 0;
}

.tc-rank-group:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.tc-rank-group h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 6px;
    color: var(--tc-ink);
    font-family: var(--tc-font-display);
    font-size: 14px;
}

.tc-rank-group h3 span {
    color: var(--tc-accent-gold);
    font-family: var(--tc-font-body);
    font-size: 11px;
}

.tc-detail-card-list .tc-card {
    padding: 13px 0;
    border: 0;
    border-bottom: 1px solid
        color-mix(in srgb, var(--tc-accent-gold) 42%, var(--tc-rule));
    border-radius: 0;
    background: transparent;
}

.tc-detail-card-list .tc-card:last-child {
    border-bottom: 0;
}

/* One cartographic control language */
.tc-tool-emblem,
body.tc-dark-theme .tc-tool-emblem,
.tc-viewbar-toggle-icon,
.tc-viewbar-toggle-arrow,
.tc-context-icon,
.tc-search-icon,
.tc-directory-search-icon,
.tc-ui-toggle,
.tc-theme-option-icon,
.tc-squaremap-time-icon,
.tc-squaremap-weather-icon,
body.tc-map-active #mcmap.dynmap .coord-control .tc-location-icon,
body.tc-map-active #map.tc-squaremap-root .coord-control .tc-location-icon,
body.tc-map-active #mcmap.dynmap .leaflet-control-zoom a,
body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom a {
    color: var(--tc-accent-gold-light) !important;
}

.tc-viewbar,
body.tc-dark-theme .tc-viewbar {
    overflow: hidden;
    border: 1px solid var(--tc-accent-gold);
    border-radius: 2px;
    background: var(--tc-footer);
}

.tc-viewbar.tc-collapsed {
    width: 44px;
    padding: 0;
    gap: 0;
}

.tc-viewbar.tc-collapsed .tc-viewbar-toggle,
.tc-viewbar.tc-collapsed .tc-viewbar-content .tc-tool {
    display: grid;
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 8px;
    place-items: center;
    gap: 0;
    color: var(--tc-accent-gold-light);
    border: 0;
    border-radius: 0;
    background: var(--tc-section-navy);
    box-shadow: none !important;
    transform: none;
}

.tc-viewbar.tc-collapsed .tc-viewbar-content {
    gap: 0;
}

.tc-viewbar.tc-collapsed .tc-viewbar-content .tc-tool {
    border-top: 1px solid var(--tc-navy-rule);
}

.tc-viewbar.tc-collapsed .tc-viewbar-toggle:hover,
.tc-viewbar.tc-collapsed .tc-viewbar-toggle:focus-visible,
.tc-viewbar.tc-collapsed .tc-viewbar-content .tc-tool:hover,
.tc-viewbar.tc-collapsed .tc-viewbar-content .tc-tool:focus-visible {
    color: var(--tc-accent-gold-light);
    background:
        color-mix(in srgb, var(--tc-accent) 12%, var(--tc-section-navy));
    transform: none;
}

.tc-viewbar.tc-collapsed .tc-viewbar-toggle-icon,
.tc-viewbar.tc-collapsed .tc-tool-emblem {
    display: grid;
    width: 24px;
    height: 24px;
    margin: 0;
    place-items: center;
}

.tc-viewbar.tc-collapsed .tc-viewbar-toggle-icon .tc-icon {
    width: 20px;
    height: 20px;
}

body.tc-map-active #mcmap.dynmap .leaflet-control-zoom,
body.tc-map-active #map.tc-squaremap-root .leaflet-control-zoom,
body.tc-map-active #mcmap.dynmap .coord-control,
body.tc-map-active #map.tc-squaremap-root .coord-control {
    box-sizing: border-box;
    margin: 0;
    border-width: 1px;
    border-color: var(--tc-accent-gold);
    border-radius: 2px;
}

body.tc-map-active #mcmap.dynmap .coord-control,
body.tc-map-active #map.tc-squaremap-root .coord-control {
    top: 16px;
    left: 68px;
    width: 174px;
    height: 79px;
    background: var(--tc-section-navy);
}

/* Expanded Browse follows the same 44px + 8px + 174px control grid. */
.tc-viewbar,
body.tc-dark-theme .tc-viewbar {
    top: 103px;
    left: 16px;
    height: 170px;
}

.tc-viewbar:not(.tc-collapsed) {
    width: 226px;
    padding: 0;
    gap: 0;
}

.tc-viewbar:not(.tc-collapsed) .tc-viewbar-toggle {
    height: 42px;
    min-height: 42px;
    padding: 8px 10px;
    color: var(--tc-accent-gold-light);
    border: 0;
    border-bottom: 1px solid var(--tc-navy-rule);
    border-radius: 0;
    background: var(--tc-section-navy);
}

.tc-viewbar:not(.tc-collapsed) .tc-viewbar-content {
    gap: 0;
}

.tc-viewbar:not(.tc-collapsed) .tc-viewbar-content .tc-tool {
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    color: var(--tc-slate-text);
    border: 0;
    border-radius: 0;
    background: var(--tc-section-navy);
    box-shadow: none !important;
    transform: none;
}

.tc-viewbar:not(.tc-collapsed) .tc-viewbar-content .tc-tool + .tc-tool {
    border-top: 1px solid var(--tc-navy-rule);
}

.tc-viewbar:not(.tc-collapsed) .tc-viewbar-toggle:hover,
.tc-viewbar:not(.tc-collapsed) .tc-viewbar-toggle:focus-visible,
.tc-viewbar:not(.tc-collapsed) .tc-viewbar-content .tc-tool:hover,
.tc-viewbar:not(.tc-collapsed) .tc-viewbar-content .tc-tool:focus-visible {
    color: var(--tc-accent-gold-light);
    background:
        color-mix(in srgb, var(--tc-accent) 12%, var(--tc-section-navy));
    transform: none;
}

/* Active layers remain prominent; inactive layers recede instead of glowing. */
.tc-commandbar .tc-mode:not(.tc-selected):not(:hover):not(:focus-visible) {
    color: var(--tc-slate-muted);
    border-color: var(--tc-navy-rule);
    background: var(--tc-section-navy);
}

.tc-commandbar .tc-mode:not(.tc-selected):not(:hover):not(:focus-visible)
    .tc-tool-emblem {
    color: var(--tc-slate-muted) !important;
    opacity: .68;
}

.tc-commandbar .tc-mode.tc-selected .tc-tool-emblem {
    color: var(--tc-accent-gold-light) !important;
    opacity: 1;
}

.tc-commandbar .tc-mode:not(.tc-selected):not(:hover):not(:focus-visible)
    .tc-layer-state {
    border-color: color-mix(
        in srgb,
        var(--tc-slate-muted) 46%,
        var(--tc-section-navy));
    background: var(--tc-footer);
}

.tc-modebar {
    min-width: 0;
    max-width: calc(100vw - clamp(215px, 23vw, 300px) - 64px);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--tc-accent-gold) var(--tc-footer);
}

.tc-modebar .tc-mode {
    flex: 0 0 auto;
}

/* The information widget shares the same flat navy and gold control language. */
.tc-navigation-panel,
body.tc-dark-theme .tc-navigation-panel {
    overflow: hidden;
    color: var(--tc-slate-text);
    border: 1px solid var(--tc-accent-gold);
    border-radius: 2px;
    background-color: var(--tc-section-navy);
    background-image: none;
}

.tc-navigation-panel::after,
body.tc-dark-theme .tc-navigation-panel::after {
    background: var(--tc-navy-rule);
}

.tc-squaremap-clock,
.tc-navigation-controls {
    background: var(--tc-section-navy);
}

.tc-navigation-controls {
    border-top-color: var(--tc-navy-rule);
}

.tc-squaremap-time,
.tc-squaremap-clock.tc-night {
    color: var(--tc-slate-text);
}

.tc-squaremap-time-icon,
.tc-squaremap-weather-icon {
    color: var(--tc-accent-gold-light) !important;
    border-color: var(--tc-navy-rule);
    background: var(--tc-footer);
}

.tc-navigation-panel .tc-navigation-toggle:not(.tc-selected)
    .tc-tool-emblem {
    color: var(--tc-slate-muted) !important;
    opacity: .68;
}

.tc-navigation-panel .tc-navigation-toggle.tc-selected
    .tc-tool-emblem {
    color: var(--tc-accent-gold-light) !important;
    opacity: 1;
}

@media (max-width: 720px) {
    .tc-modebar {
        display: flex;
        max-width: 100%;
    }

    .tc-modebar .tc-mode {
        flex-basis: 44px;
    }

    .tc-viewbar,
    body.tc-dark-theme .tc-viewbar {
        top: 97px;
        left: 10px;
    }
}

@media (max-width: 620px) {
    .tc-detail-dialog {
        inset: 0;
        z-index: 10040;
        width: 100vw;
        min-width: 0;
        height: 100dvh;
        max-width: none;
        max-height: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .tc-detail-dialog::backdrop {
        background: color-mix(in srgb, var(--tc-footer) 72%, transparent);
    }

    .tc-detail-content {
        padding: 15px;
    }
}

/* UI motion */
.tc-sidebar {
    opacity: 0;
    visibility: hidden;
    will-change: transform, opacity;
    transition:
        transform 260ms cubic-bezier(.2, .8, .2, 1),
        opacity 180ms ease-out,
        visibility 0s linear 260ms;
}

.tc-sidebar.tc-open {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.tc-scroll.tc-content-enter {
    animation: tc-sidebar-content-enter 220ms
        cubic-bezier(.2, .8, .2, 1) both;
}

.tc-detail-dialog {
    transform-origin: left center;
    will-change: transform, opacity;
}

.tc-detail-dialog[open]:not(.tc-closing) {
    animation: tc-detail-enter 220ms
        cubic-bezier(.16, 1, .3, 1) both;
}

.tc-detail-dialog.tc-closing {
    pointer-events: none;
    animation: tc-detail-exit 160ms
        cubic-bezier(.4, 0, 1, 1) both;
}

.tc-detail-dialog[open]::backdrop {
    animation: tc-backdrop-enter 180ms ease-out both;
}

.tc-detail-dialog.tc-closing::backdrop {
    animation: tc-backdrop-exit 160ms ease-in both;
}

.tc-results {
    display: grid;
    gap: 3px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px) scale(.985);
    transform-origin: bottom center;
    transition:
        opacity 150ms ease,
        transform 190ms cubic-bezier(.2, .8, .2, 1),
        visibility 0s linear 190ms;
}

.tc-results.tc-visible {
    display: grid;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition-delay: 0s;
}

.tc-theme-menu {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(7px) scale(.985);
    transform-origin: bottom left;
    transition:
        opacity 140ms ease,
        transform 180ms cubic-bezier(.2, .8, .2, 1),
        visibility 0s linear 180ms;
}

.tc-theme-menu.tc-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition-delay: 0s;
}

.tc-diplomacy-legend {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(10px) scale(.985);
    transform-origin: top right;
    transition:
        opacity 150ms ease,
        transform 190ms cubic-bezier(.2, .8, .2, 1),
        visibility 0s linear 190ms;
}

.tc-diplomacy-legend.tc-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0) scale(1);
    transition-delay: 0s;
}

.tc-viewbar,
body.tc-dark-theme .tc-viewbar {
    will-change: width;
    transition:
        width 220ms cubic-bezier(.2, .8, .2, 1),
        padding 220ms cubic-bezier(.2, .8, .2, 1);
}

.tc-viewbar:not(.tc-collapsed) .tc-viewbar-toggle-label,
.tc-viewbar:not(.tc-collapsed) .tc-viewbar-toggle-arrow,
.tc-viewbar:not(.tc-collapsed) .tc-tool-label {
    animation: tc-control-copy-enter 150ms 70ms ease-out both;
}

.tc-collapse-summary::after,
.tc-disclosure-icon {
    transition:
        transform 180ms cubic-bezier(.2, .8, .2, 1),
        color 140ms ease;
}

.tc-collapsible.tc-closing > .tc-collapse-summary::after {
    transform: rotate(45deg);
}

.tc-wealth-disclosure.tc-closing > summary .tc-disclosure-icon {
    transform: rotate(0);
}

.tc-result,
.tc-theme-option,
.tc-tool,
.tc-ui-toggle,
.tc-close,
.tc-detail-close,
.tc-context-action,
.tc-fact-trigger,
.tc-info-disclosure,
.tc-wealth-summary,
.tc-row-button,
.tc-comma-link {
    transition:
        color 140ms ease,
        border-color 140ms ease,
        background-color 140ms ease,
        opacity 140ms ease,
        transform 140ms ease;
}

.tc-result:active,
.tc-theme-option:active,
.tc-tool:active,
.tc-ui-toggle:active,
.tc-close:active,
.tc-detail-close:active,
.tc-context-action:active,
.tc-fact-trigger:active,
.tc-info-disclosure:active,
.tc-wealth-summary:active,
.tc-row-button:active {
    transform: translateY(1px);
}

@keyframes tc-sidebar-content-enter {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes tc-detail-enter {
    from {
        opacity: 0;
        transform: translateX(-12px) scale(.97);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes tc-detail-exit {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(-8px) scale(.985);
    }
}

@keyframes tc-backdrop-enter {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes tc-backdrop-exit {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes tc-control-copy-enter {
    from {
        opacity: 0;
        transform: translateX(-4px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tc-shell,
    .tc-shell *,
    .tc-shell *::before,
    .tc-shell *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        transition-delay: 0s !important;
    }
}
