:root {
    --background-color: #202124;
    --background-color-transparent: rgba(32, 33, 36, 0.4);
    --background-color-transparent-15: rgba(32, 33, 36, 0.15);
    --background-color-transparent-40: rgba(32, 33, 36, 0.4);
    --background-color-transparent-80: rgba(32, 33, 36, 0.8);
    --second-background-color: #242529;
    --third-background-color: #292b2f;
    --third-background-color-transparent: rgba(32, 33, 36, 0.6);
    --primary-color: #ef7d00;
    --first-text-color: #d2d2d7;
    --second-text-color: #cbcbd1;
    --third-text-color: #9595a2;
    --fourth-text-color: #36363e;
    --default-text-color: #bebec6;
    --invert-text-color: #373d3f;
    --border-color: rgba(255, 255, 255, 0.08);
    --selection-color: #ff8b0b;
    --shadow-color-1: rgba(255, 255, 255, 0.08);
    --shadow-color-2: rgba(255, 255, 255, 0.05);
    --shadow-hover-color: rgba(69, 69, 69, 0.28);
    --scrollbar-color: #898989;
    --scrollbar-color-hover: #a1a1a1;
    --scroll-bar-bg-color: #2a2c30;
    --link-color: #c5c5cc;
    --copyright-info-color: #a30029;
    --avatar-background-color: #005cb8;
    --pjax-progress-bar-color: linear-gradient(
        45deg,
        #ea404a,
        #ea722f,
        #e9a71f,
        #67e559,
        #18ecec,
        #1b85f1,
        #ee1dee
    );
    --archive-timeline-last-child-color: linear-gradient(
            to bottom,
            #323232 60%,
            rgba(255, 255, 255, 0) 100%
        )
        1 100%;
    --note-blue-title-bg: #1e3e46;
    --note-red-title-bg: #4e1e1e;
    --note-cyan-title-bg: #1e4e4e;
    --note-green-title-bg: #1e4e1e;
    --note-yellow-title-bg: #4e4e1e;
    --note-gray-title-bg: #4e4e4e;
    --note-type-title-bg: #4e3a1e;
    --note-black-title-bg: #1e1e1e;
    --note-purple-title-bg: #4e1e4e;
    --home-banner-text-color: #fff;
    --home-banner-icons-container-border-color: rgba(197, 197, 197, 0.35);
    --home-banner-icons-container-background-color: rgba(197, 197, 197, 0.3);
    --redefine-box-shadow: var(--shadow-color-2) 0px 6px 24px 0px,
        var(--shadow-color-1) 0px 0px 0px 1px;
    --redefine-box-shadow-hover: var(--shadow-color-2) 0px 6px 24px 0px,
        var(--shadow-color-1) 0px 0px 0px 1px,
        var(--shadow-color-1) 0px 0px 0px 1px inset;
    --redefine-box-shadow-flat: var(--shadow-color-2) 0px 1px 4px 0px,
        var(--shadow-color-1) 0px 0px 0px 1px;
    --redefine-box-shadow-flat-hover: var(--shadow-color-2) 0px 1px 4px 0px,
        var(--shadow-color-1) 0px 0px 0px 1px,
        var(--shadow-color-1) 0px 0px 0px 1px inset;
    --mermaid-theme: $dark-mermaid-theme;

    --player-one: #aae41d;
    --player-two: #00eaff;
}
.light-mode {
    --background-color: #fff;
    --background-color-transparent: rgba(255, 255, 255, 0.6);
    --background-color-transparent-15: rgba(255, 255, 255, 0.15);
    --background-color-transparent-40: rgba(255, 255, 255, 0.4);
    --background-color-transparent-80: rgba(255, 255, 255, 0.8);
    --second-background-color: #fafafa;
    --third-background-color: #f7f7f7;
    --third-background-color-transparent: rgba(241, 241, 241, 0.6);
    --primary-color: #ef7d00;
    --first-text-color: #323739;
    --second-text-color: #343a3c;
    --third-text-color: #5c6669;
    --fourth-text-color: #eaeced;
    --default-text-color: #373d3f;
    --invert-text-color: #bebec6;
    --border-color: rgba(0, 0, 0, 0.08);
    --selection-color: #ff8b0b;
    --shadow-color-1: rgba(0, 0, 0, 0.08);
    --shadow-color-2: rgba(0, 0, 0, 0.05);
    --shadow-hover-color: rgba(0, 0, 0, 0.28);
    --scrollbar-color: #c1c1c1;
    --scrollbar-color-hover: #a1a1a1;
    --scroll-bar-bg-color: #fafafa;
    --link-color: #323739;
    --copyright-info-color: #c03;
    --avatar-background-color: #06c;
    --pjax-progress-bar-color: linear-gradient(
        45deg,
        #f10006,
        #ef5b00,
        #e59c01,
        #19ca05,
        #00cab5,
        #0264c8,
        #c303c3
    );
    --archive-timeline-last-child-color: linear-gradient(
            to bottom,
            #e8e8e8 60%,
            rgba(0, 0, 0, 0) 100%
        )
        1 100%;
    --note-blue-title-bg: #d6f7fb;
    --note-red-title-bg: #fde9e9;
    --note-cyan-title-bg: #e9fdf9;
    --note-green-title-bg: #e9fde9;
    --note-yellow-title-bg: #fdf9e9;
    --note-gray-title-bg: #f9f9f9;
    --note-type-title-bg: #fdf3e9;
    --note-black-title-bg: #e9e9e9;
    --note-purple-title-bg: #f9e9fd;
    --home-banner-text-color: #fff;
    --home-banner-icons-container-border-color: rgba(255, 255, 255, 0.35);
    --home-banner-icons-container-background-color: rgba(255, 255, 255, 0.3);
    --redefine-box-shadow: var(--shadow-color-2) 0px 6px 24px 0px,
        var(--shadow-color-1) 0px 0px 0px 1px;
    --redefine-box-shadow-hover: var(--shadow-color-2) 0px 6px 24px 0px,
        var(--shadow-color-1) 0px 0px 0px 1px,
        var(--shadow-color-1) 0px 0px 0px 1px inset;
    --redefine-box-shadow-flat: var(--shadow-color-2) 0px 1px 4px 0px,
        var(--shadow-color-1) 0px 0px 0px 1px;
    --redefine-box-shadow-flat-hover: var(--shadow-color-2) 0px 1px 4px 0px,
        var(--shadow-color-1) 0px 0px 0px 1px,
        var(--shadow-color-1) 0px 0px 0px 1px inset;
    --mermaid-theme: $mermaid-theme;
}
.dark-mode {
    --background-color: #202124;
    --background-color-transparent: rgba(32, 33, 36, 0.4);
    --background-color-transparent-15: rgba(32, 33, 36, 0.15);
    --background-color-transparent-40: rgba(32, 33, 36, 0.4);
    --background-color-transparent-80: rgba(32, 33, 36, 0.8);
    --second-background-color: #242529;
    --third-background-color: #292b2f;
    --third-background-color-transparent: rgba(32, 33, 36, 0.6);
    --primary-color: #ef7d00;
    --first-text-color: #d2d2d7;
    --second-text-color: #cbcbd1;
    --third-text-color: #9595a2;
    --fourth-text-color: #36363e;
    --default-text-color: #bebec6;
    --invert-text-color: #373d3f;
    --border-color: rgba(255, 255, 255, 0.08);
    --selection-color: #ff8b0b;
    --shadow-color-1: rgba(255, 255, 255, 0.08);
    --shadow-color-2: rgba(255, 255, 255, 0.05);
    --shadow-hover-color: rgba(69, 69, 69, 0.28);
    --scrollbar-color: #898989;
    --scrollbar-color-hover: #a1a1a1;
    --scroll-bar-bg-color: #2a2c30;
    --link-color: #c5c5cc;
    --copyright-info-color: #a30029;
    --avatar-background-color: #005cb8;
    --pjax-progress-bar-color: linear-gradient(
        45deg,
        #ea404a,
        #ea722f,
        #e9a71f,
        #67e559,
        #18ecec,
        #1b85f1,
        #ee1dee
    );
    --archive-timeline-last-child-color: linear-gradient(
            to bottom,
            #323232 60%,
            rgba(255, 255, 255, 0) 100%
        )
        1 100%;
    --note-blue-title-bg: #1e3e46;
    --note-red-title-bg: #4e1e1e;
    --note-cyan-title-bg: #1e4e4e;
    --note-green-title-bg: #1e4e1e;
    --note-yellow-title-bg: #4e4e1e;
    --note-gray-title-bg: #4e4e4e;
    --note-type-title-bg: #4e3a1e;
    --note-black-title-bg: #1e1e1e;
    --note-purple-title-bg: #4e1e4e;
    --home-banner-text-color: #fff;
    --home-banner-icons-container-border-color: rgba(197, 197, 197, 0.35);
    --home-banner-icons-container-background-color: rgba(197, 197, 197, 0.3);
    --redefine-box-shadow: var(--shadow-color-2) 0px 6px 24px 0px,
        var(--shadow-color-1) 0px 0px 0px 1px;
    --redefine-box-shadow-hover: var(--shadow-color-2) 0px 6px 24px 0px,
        var(--shadow-color-1) 0px 0px 0px 1px,
        var(--shadow-color-1) 0px 0px 0px 1px inset;
    --redefine-box-shadow-flat: var(--shadow-color-2) 0px 1px 4px 0px,
        var(--shadow-color-1) 0px 0px 0px 1px;
    --redefine-box-shadow-flat-hover: var(--shadow-color-2) 0px 1px 4px 0px,
        var(--shadow-color-1) 0px 0px 0px 1px,
        var(--shadow-color-1) 0px 0px 0px 1px inset;
    --mermaid-theme: $dark-mermaid-theme;
}
.redefine-box-shadow {
    box-shadow: var(--redefine-box-shadow);
}
.redefine-box-shadow-flat {
    box-shadow: var(--redefine-box-shadow-flat);
}
@media (min-width: 640px) {
    .redefine-box-shadow:hover {
        box-shadow: var(--redefine-box-shadow-hover);
    }
    .redefine-box-shadow-flat:hover {
        box-shadow: var(--redefine-box-shadow);
    }
}

html,
body {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    color: var(--default-text-color);
    background: var(--background-color);
    font-family: var(--default-font-family);
    font-weight: var(--default-font-weight);
    font-size: var(--default-font-size);
    line-height: var(--default-line-height);
}

.navbar-shrink {
    --navbar-height: var(--navbar-shrink-height);
}

/* 滚动条 */
html::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 14px;
    height: 8px;
    transition: all 0.2s ease;
    display: block;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
    background: var(--scrollbar-color);
    border-radius: var(--redefine-border-radius-large);
    background-clip: content-box;
    border: 3px solid transparent;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
    background-color: var(--scroll-bar-bg-color);
    border: 1px solid var(--shadow-color-1);
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-color-hover);
    border-radius: var(--redefine-border-radius-large);
    background-clip: content-box;
    border: 3px solid transparent;
}

/* 媒体查询 - Tablet */
@media screen and (max-width: 960px) {
    html,
    body {
        font-size: calc(var(--default-font-size) * 0.96);
        line-height: calc(var(--default-line-height) * 0.96);
    }
}

/* 媒体查询 - Mobile */
@media screen and (max-width: 600px) {
    html,
    body {
        font-size: calc(var(--default-font-size) * 0.9);
        line-height: calc(var(--default-line-height) * 0.9);
    }
}

[data-id].pinned .text-item::after {
    content: "\f08d"; /* Font Awesome thumbtack unicode */
    font-family: "Font Awesome 6 Free"; /* adjust depending on version */
    font-weight: 900; /* solid style */
    float: right;
    margin-left: 8px;
    color: #d97706; /* gold-ish, tweak as you like */
}

/* ---------- 基础元素 ---------- */

.list-container > .p1 {
    box-shadow: var(--player-one) 0px 0px 1px 2px;
    color: var(--player-one);
}

.list-container > .p2 {
    box-shadow: var(--player-two) 0px 0px 1px 2px;
    color: var(--player-two);
}

.hoverChips {
    background-color: var(--background-color);
    color: var(--default-text-color);
    padding: 4px 8px;
    text-align: center;
    user-select: none;
    cursor: grab;
}
.hoverChips:hover {
    /* background-color: var(--selection-color); */
    /* color: var(--background-color); */
    /* box-shadow: none ; */
    /* transform: scale(1.1); */
    opacity: 1 !important;
    transition: all 0.2s ease-in-out;
}
i {
    cursor: pointer;
}

/* ---------- 布局容器 ---------- */
#toolbar {
    height: 40px;
    display: flex;
    width: 100%;
    gap: 15px;
    align-items: center;
    justify-content: right;
}

#editor-container {
    display: flex;
    width: 100%;
    gap: 10px;
    user-select: none;
}
#editor-container section {
    padding: 8px;
    border-radius: 8px;
    flex: 1;
}
#editor-container aside {
    min-width: 200px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 8px;
    border-radius: 8px;
    row-gap: 10px;
    height: calc(100dvh - 200px);
}

/* ---------- 左右区块 pool ---------- */
#customPool,
#pool {
    min-height: 80px;
    overflow-y: auto;
    padding: 0.25rem;
    background-color: var(--background-color);
}
#pool {
    flex: 2;
}
#customPool {
    flex: 0.5;
}

/* ---------- 模式切换：文字 / 图片 / 混合 ---------- */
.list-container .text-item,
.list-container .image-item,
#pool .text-item,
#pool .image-item {
    display: none;
}

/* 文字模式 */
.list-container[data-mode="text"] .text-item,
#pool[data-mode="text"] .text-item {
    display: block;
}

/* 图片模式 */
.list-container[data-mode="image"] .image-item,
#pool[data-mode="image"] .image-item {
    display: block;
}
.list-container[data-mode="image"] > div:has(div.image-item) {
    border: none;
    padding: 0;
}

/* 混合模式 */
.list-container[data-mode="both"] {
    grid-template-columns: repeat(auto-fill, minmax(80px, 120px));
}
.list-container[data-mode="both"] > div.hoverChips:has(> div.image-item) {
    height: 100%;
}
.list-container[data-mode="both"] .text-item,
#pool[data-mode="both"] .text-item {
    display: block;
    font-size: small;
}
.list-container[data-mode="both"] .image-item,
#pool[data-mode="both"] .image-item {
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 3px;
}

/* ---------- 列表容器 ---------- */
.list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, 64px);
    gap: 10px;
    padding: 0.5rem;
    margin: 5px 0;
    border-radius: 5px;
    font-weight: bolder;
    box-shadow: 0 0 1px var(--default-text-color);
    min-height: 64px;
    align-items: center;
}
.list-container[data-mode="text"] {
    grid-column: span 1;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}
.list-container[data-mode="both"] {
    grid-column: span 1;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}
.list-container > div {
    margin: 0 !important;
}

/* 高亮规则 */
.list-container.showlastOnly > div:not(:last-child) {
    opacity: 0.5;
}
.list-container.showFirstOnly > div:not(:first-child) {
    opacity: 0.5;
}

/* ---------- Chain & Resolve ---------- */
#chain {
    align-content: start;
}
#chain[data-mode="both"],
#chain[data-mode="image"] {
    min-height: 250px;
}

#resolve {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}
#resolve .hoverChips {
    height: min-content;
    width: 100%;
}
#resolve .hoverChips > div.image-item {
    margin: 0 auto;
    width: 150px !important;
}
#resolve[data-mode="both"],
#resolve[data-mode="image"] {
    min-height: 250px;
}
#resolve[data-mode="both"]:not(:empty),
#resolve[data-mode="image"]:not(:empty) {
    border: none;
    box-shadow: none;
    padding: 0;
}
#resolve[data-mode="both"] > div.hoverChips:has(> div.image-item),
#resolve[data-mode="image"] > div.hoverChips:has(> div.image-item) {
    border: none;
    box-shadow: none;
}
#resolve[data-mode="both"] > div.hoverChips:has(> div.image-item):hover,
#resolve[data-mode="image"] > div.hoverChips:has(> div.image-item):hover {
    background-color: unset;
    color: unset;
    opacity: 1 !important;
    transition: all 0.2s ease-in-out;
}

/* ---------- Header ---------- */
.two-side-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* popup */
button {
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}
/* popup */
#popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
}
.modal {
    background: var(--background-color);
    padding: 14px;
    border-radius: 8px;
    min-width: 320px;
}
table {
    border-collapse: collapse;
    width: 100%;
    text-align: center;
}
th,
td {
    padding: 8px 6px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}
th:first-child,
td:first-child {
    text-align: left;
    padding-left: 12px;
}
/* hide native radio, show small square */
input[type="radio"] {
    display: none;
}
.box {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 1px solid #999;
    border-radius: 4px;
    vertical-align: middle;
}
/* show tick when checked */
input[type="radio"]:checked + label.box {
    background: var(--selection-color);
    border-color: var(--selection-color);
    color: var(--background-color);
    line-height: 18px;
    font-weight: 700;
}
input[type="radio"]:checked + label.box::after {
    content: "✓";
    display: block;
    text-align: center;
}
.row-label {
    font-weight: 600;
}
.controls {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 10px;
}

.player-row {
    display: flex;
    justify-content: flex-start;
    gap: 5px;
    align-items: center;
}

input[type="radio"]#player1:checked + label.box {
    background: var(--player-one);
    border-color: var(--player-one);
}

input[type="radio"]#player2:checked + label.box {
    background: var(--player-two);
    border-color: var(--player-two);
}

.player-selection-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, 80px);
}

.player-tag {
    padding: 2px 5px;
    border-radius: 15px;
    font-size: small;
    border: 1px solid var(--border-color);
    user-select: none;
    font-weight: bolder;
    margin-right: 8px;
}

.player-tag.p1 {
    color: #1e1e1e;
    background: var(--player-one);
}

.player-tag.p2 {
    color: #1e1e1e;
    background: var(--player-two);
}

.player-resolving {
    width: 16px;
    border-radius: 50%;
    height: 16px;
}

.two-side-header:has(+ #resolve > .p1) .player-resolving {
    background: var(--player-one);
}

.two-side-header:has(+ #resolve > .p2) .player-resolving {
    background: var(--player-two);
}

.check-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: var(--background-color);
    color: var(--first-text-color);
    padding: 10px;
    border-radius: 6px;
    max-width: 700px;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.589);
}

.check-tooltip div {
    display: flex;
}

.check-tooltip p {
    padding: 0 10px;
    font-size: 16px;
    font-weight: 700;
}

.check-tooltip img {
    max-width: 300px;
    display: block;
    border-radius: 4px;
}

#ctrl-hint {
  position: fixed;
  bottom: 20px;
  left: 20px;
  padding: 6px 12px;
  color: var(--first-text-color);
  border-radius: 6px;
  font-size: 14px;
  pointer-events: none;   /* 不阻挡点击 */
  opacity: 0.7;
  transition: opacity 0.2s;
}

#ctrl-hint.hidden {
  opacity: 0;
}
