:root {
    /* Colors */
    --paper-bg: #ecece8;
    /* Xuan paper base */
    --paper-light: #f5f5f1;
    /* Lighter panel bg */
    --paper-white: #f8f8f5;
    /* Panel/card white */
    --wash-ink: rgba(17, 17, 17, 0.08);
    /* Light ink wash */
    --light-ink: #8a8a8a;
    /* Secondary text */
    --seal-red: #c53c3c;
    /* Alias for stamp red */
    --dark-ink: #2c2f33;
    /* Alias for body text */
    --ink-black: #111111;
    /* Deep black */
    --ink-dark: #2c2f33;
    /* Slightly lighter for text */
    --ink-grey: #6e6e6e;
    /* Muted text */
    --ink-light: #cccccc;
    /* Borders */
    --stamp-red: #c53c3c;
    /* Seal stamp red */
    --stamp-red-hover: #a12b2b;
    --highlight: rgba(30, 30, 30, 0.08);
    /* Hover bg */

    /* Item Qualities (Ink wash palette style) */
    --color-common: #6e6e6e;
    --color-rare: #3b6088;
    /* Indigo ink */
    --color-epic: #614068;
    /* Purple ink */
    --color-legend: #bd7330;
    /* Bronze/Gold ink */

    /* Typography */
    --font-heading-main: 'Zhi Mang Xing', cursive;
    /* For big titles/avatars */
    --font-heading-sub: 'Ma Shan Zheng', cursive;
    /* For subtitles/tabs */
    --font-body: 'Noto Serif SC', serif;
    /* Traditional songti for text */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    color: var(--ink-dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--paper-bg);
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

/* Background Textures & Splatters */
.paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Creating a subtle paper texture using gradients */
    background-image:
        repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.01) 0px, rgba(0, 0, 0, 0.01) 2px, transparent 2px, transparent 4px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.01) 0px, rgba(0, 0, 0, 0.01) 2px, transparent 2px, transparent 4px);
    z-index: -2;
    pointer-events: none;
}

.ink-splatter {
    position: fixed;
    width: 400px;
    height: 400px;
    background-size: cover;
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

.splatter-top-left {
    top: -100px;
    left: -100px;
    background-image: radial-gradient(circle, var(--ink-black) 0%, transparent 60%);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    filter: blur(8px);
}

.splatter-bottom-right {
    bottom: -150px;
    right: -50px;
    width: 600px;
    height: 500px;
    background-image: radial-gradient(circle, var(--ink-black) 0%, transparent 70%);
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    filter: blur(12px);
}


/* Layout Container */
.game-container {
    display: grid;
    grid-template-columns: 20% 50% 30%;
    gap: 20px;
    width: 100%;
    max-width: 1800px;
    min-height: 90vh;
    padding: 20px;
}

@media (max-width: 1100px) {
    .game-container {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .battle-arena {
        grid-template-columns: 1fr;
    }

    .battle-versus {
        text-align: center;
    }
}

/* Panels */
.panel {
    background-color: var(--paper-light);
    border: 1.5px solid var(--ink-black);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 12px 12px 0px rgba(0, 0, 0, 0.05);
    /* Block shadow typical of printed cards */
    padding: 20px;
    overflow: hidden;
    /* For inner decor */
}

.left-panel {
    border-right: none;
}

.right-panel {
    border-left: none;
}

.middle-panel {
    z-index: 10;
    padding: 0;
}

/* Ornamental Corner Borders (Imitating brush frames) */
.panel-border-decor {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 4px solid var(--ink-black);
    opacity: 0.8;
    pointer-events: none;
    z-index: 5;
}

.top-left {
    top: 10px;
    left: 10px;
    border-right: none;
    border-bottom: none;
}

.bottom-right {
    bottom: 10px;
    right: 10px;
    border-left: none;
    border-top: none;
}

.top-right {
    top: 10px;
    right: 10px;
    border-left: none;
    border-bottom: none;
}

.bottom-left {
    bottom: 10px;
    left: 10px;
    border-right: none;
    border-top: none;
}


/* ===========================
   LEFT: Character Section
   =========================== */
.character-info {
    text-align: center;
    padding-bottom: 25px;
    border-bottom: 1px dashed var(--ink-grey);
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 10px auto 25px;
}

.avatar-ring {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid var(--ink-grey);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
}

.avatar-ring.rotate {
    animation: inkRotate 15s linear infinite;
    opacity: 0.6;
}

.avatar-ring.rotate-reverse {
    border: 1px dashed var(--ink-black);
    animation: inkRotateRev 20s linear infinite;
    opacity: 0.4;
}

.avatar {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    background: #fff;
    border-radius: 50%;
    border: 2px solid var(--ink-black);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    z-index: 3;
}

.avatar-img {
    font-family: var(--font-heading-main);
    font-size: 60px;
    color: var(--ink-black);
    transform: translateY(-5px);
    /* Optical alignment */
}

.char-name {
    font-family: var(--font-heading-main);
    font-size: 38px;
    margin-bottom: 15px;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.stamp-badge {
    font-family: var(--font-heading-sub);
    font-size: 14px;
    color: var(--stamp-red);
    border: 1.5px solid var(--stamp-red);
    padding: 2px 6px;
    transform: rotate(-10deg);
    border-radius: 2px;
    pointer-events: none;
    user-select: none;
}

.char-stats {
    padding: 0 15px;
    text-align: left;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 15px;
    font-size: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 5px;
}

.stat-label {
    font-weight: bold;
}

.sub-value {
    font-size: 12px;
    color: var(--ink-grey);
}

.mp-row {
    flex-direction: column;
    align-items: stretch;
    border: none;
    gap: 8px;
}

.brush-bar-bg {
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.brush-bar-fill {
    height: 100%;
    width: 60%;
    background: var(--ink-black);
    /* Ink fill */
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.brush-bar-fill::after {
    /* Brush tip effect */
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    background: linear-gradient(to right, var(--ink-black), transparent);
}


/* Left Navigation Tabs */
.left-tabs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 10px;
    z-index: 2;
}

.tab-btn {
    position: relative;
    background: transparent;
    border: 1px solid transparent;
    border-bottom: 1px solid var(--ink-light);
    padding: 18px 20px;
    text-align: left;
    font-family: var(--font-heading-sub);
    font-size: 22px;
    cursor: pointer;
    overflow: hidden;
    color: var(--ink-grey);
    transition: all 0.3s;
}

.tab-text {
    position: relative;
    z-index: 2;
    letter-spacing: 8px;
}

.ink-hover-effect {
    position: absolute;
    top: 50%;
    left: 0;
    width: 0;
    height: 100%;
    background: var(--highlight);
    transform: translateY(-50%);
    transition: width 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 1;
}

.tab-btn:hover {
    color: var(--ink-black);
    padding-left: 30px;
}

.tab-btn:hover .ink-hover-effect {
    width: 100%;
}

.tab-btn.active {
    color: var(--ink-black);
    font-weight: bold;
    border-color: var(--ink-black);
}

.tab-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 4px;
    background: var(--stamp-red);
    z-index: 2;
}

/* ===========================
   MIDDLE: Main Content
   =========================== */
.middle-panel {
    display: flex;
    flex-direction: column;
}

.content-section {
    display: none;
    flex-direction: column;
    height: 100%;
    padding: 30px;
    animation: fadeInScale 0.4s ease;
}

.content-section.active {
    display: flex;
}

.section-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 40px;
    position: relative;
}

/* Vertical text layout for headers */
.header-titles {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.vertical-title {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-family: var(--font-heading-main);
    font-size: 46px;
    letter-spacing: 8px;
    position: relative;
}

.seal-stamp {
    font-family: var(--font-heading-sub);
    font-size: 16px;
    color: var(--paper-bg);
    background: var(--stamp-red);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.8);
    opacity: 0.9;
}

.header-desc {
    font-size: 16px;
    color: var(--ink-grey);
    border-left: 1px solid var(--ink-light);
    padding-left: 20px;
    margin-top: 10px;
    line-height: 1.8;
}

/* Cultivation View (Taiji Animation) */
.cultivate-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.taiji-container {
    position: relative;
    width: 240px;
    height: 240px;
}

.taiji-circle {
    width: 100%;
    height: 100%;
    animation: slowRotate 20s linear infinite;
    filter: drop-shadow(5px 5px 0px rgba(0, 0, 0, 0.05));
}

.floating-text {
    position: absolute;
    font-family: var(--font-heading-sub);
    font-size: 28px;
    color: var(--ink-grey);
    top: 50%;
    left: -60px;
    transform: translateY(-50%);
    animation: floatUpDown 4s ease-in-out infinite;
}

.floating-text:last-child {
    left: auto;
    right: -60px;
}

/* Buttons */
.cultivate-controls {
    display: flex;
    gap: 20px;
}

.action-btn {
    position: relative;
    padding: 12px 35px;
    background: transparent;
    border: none;
    font-family: var(--font-heading-sub);
    font-size: 20px;
    cursor: pointer;
    cursor: pointer;
    color: var(--ink-black);
    outline: none;
}

.btn-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid var(--ink-black);
    transition: all 0.2s;
    z-index: 1;
}

.btn-text {
    position: relative;
    z-index: 2;
    letter-spacing: 2px;
}

.action-btn:hover .btn-border {
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-width: 2px;
}

.action-btn:active .btn-border {
    background: var(--ink-black);
}

.action-btn:active .btn-text {
    color: var(--paper-light);
}

.primary-btn .btn-border {
    border: 2px solid var(--stamp-red);
}

.primary-btn:hover .btn-border {
    border-color: var(--stamp-red-hover);
}

.primary-btn:active .btn-border {
    background: var(--stamp-red);
}

/* Log Box */
.log-box-container {
    width: 100%;
    padding-top: 20px;
    border-top: 1px dashed var(--ink-light);
    position: relative;
}

.middle-log-box-container {
    margin-top: auto;
    min-height: 220px;
    flex-shrink: 0;
}

.log-box-title {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--paper-light);
    padding: 0 15px;
    font-family: var(--font-heading-sub);
    font-size: 18px;
}

.log-box {
    margin-top: 15px;
    height: 160px;
    overflow-y: auto;
    padding: 10px;
}

.log-box p {
    margin-bottom: 12px;
    line-height: 1.6;
    font-size: 15px;
    border-left: 2px solid transparent;
    padding-left: 10px;
}

.log-box p:last-child {
    color: var(--ink-black);
    font-weight: bold;
    border-left-color: var(--ink-black);
}

.log-box p .time {
    font-family: var(--font-heading-sub);
    color: var(--stamp-red);
    margin-right: 8px;
}

.log-box p.highlight {
    color: var(--stamp-red);
    border-left-color: var(--stamp-red);
}

/* Sect Cards (List) */
.scrollable-content {
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
}

.sect-card {
    margin-bottom: 30px;
}

.card-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-family: var(--font-heading-sub);
    font-size: 24px;
}

.ink-dot {
    width: 8px;
    height: 8px;
    background: var(--ink-black);
    border-radius: 50%;
}

.task-list {
    list-style: none;
}

.task-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid var(--ink-light);
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.02);
    transition: transform 0.2s, background 0.2s;
}

.task-list li:hover {
    background: #fff;
    transform: translateX(5px);
    border-color: var(--ink-black);
}

.task-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-name {
    font-weight: bold;
    font-size: 18px;
}

.task-desc {
    font-size: 14px;
    color: var(--ink-grey);
}

.task-action {
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress {
    font-family: var(--font-heading-sub);
    font-size: 18px;
}

.rect-btn {
    padding: 6px 18px;
    background: transparent;
    border: 1px solid var(--ink-black);
    cursor: pointer;
    font-family: var(--font-heading-sub);
    font-size: 16px;
}

.rect-btn:hover {
    background: var(--ink-black);
    color: #fff;
}

.facility-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.facility-item {
    padding: 20px;
    border: 1px solid var(--ink-light);
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.facility-item:hover {
    border-color: var(--ink-black);
    background: rgba(0, 0, 0, 0.03);
}

.fac-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1px dashed var(--ink-black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading-main);
    font-size: 26px;
}

.facility-item.locked {
    opacity: 0.5;
    filter: grayscale(1);
    cursor: not-allowed;
}

.facility-item.locked .fac-icon {
    border-style: solid;
    color: var(--stamp-red);
    border-color: var(--stamp-red);
}


/* ===========================
   Battle Panel
   =========================== */
.battle-panel {
    margin-top: 24px;
    padding: 18px;
    border: 1px solid var(--ink-black);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(240, 238, 232, 0.95)),
        radial-gradient(circle at top left, rgba(197, 60, 60, 0.08), transparent 35%);
    box-shadow: inset 0 0 0 1px rgba(17, 17, 17, 0.08);
}

.battle-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}

.battle-eyebrow {
    font-size: 12px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--ink-grey);
    margin-bottom: 6px;
}

.battle-status {
    min-width: 72px;
    text-align: center;
    padding: 6px 12px;
    border: 1px solid var(--ink-black);
    background: rgba(0, 0, 0, 0.04);
    font-family: var(--font-heading-sub);
}

.battle-arena {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
}

.battle-card {
    position: relative;
    padding: 14px;
    border: 1px solid var(--ink-light);
    background: rgba(255, 255, 255, 0.88);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.battle-card-player {
    box-shadow: -8px 8px 0 rgba(59, 96, 136, 0.08);
}

.battle-card-monster {
    box-shadow: 8px 8px 0 rgba(197, 60, 60, 0.08);
}

.battle-card.impact {
    animation: battleImpact 0.45s ease;
}

.battle-role {
    font-size: 12px;
    color: var(--ink-grey);
    margin-bottom: 8px;
}

.battle-name {
    font-family: var(--font-heading-sub);
    font-size: 26px;
    margin-bottom: 10px;
}

.battle-versus {
    font-family: var(--font-heading-main);
    font-size: 40px;
    color: var(--stamp-red);
}

.battle-bar-group {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.battle-bar {
    height: 10px;
    border: 1px solid var(--ink-light);
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.battle-bar-fill {
    height: 100%;
    width: 0;
    transition: width 0.45s ease;
}

.battle-bar-fill.hp {
    background: linear-gradient(90deg, #b43c34, #d96d57);
}

.battle-bar-fill.mp {
    background: linear-gradient(90deg, #3b6088, #69a0d8);
}

.battle-statline {
    margin-top: 10px;
    color: var(--ink-grey);
    font-size: 13px;
}

.battle-round-pill {
    display: inline-flex;
    margin: 14px 0 12px;
    padding: 5px 12px;
    border: 1px dashed var(--ink-black);
    font-family: var(--font-heading-sub);
}

.battle-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 6px;
}

.battle-feed-empty,
.battle-feed-item {
    padding: 10px 12px;
    border-left: 3px solid var(--ink-light);
    background: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

.battle-feed-item.round {
    border-left-color: var(--ink-black);
    font-family: var(--font-heading-sub);
}

.battle-feed-item.player {
    border-left-color: #3b6088;
}

.battle-feed-item.monster,
.battle-feed-item.defeat {
    border-left-color: #b43c34;
}

.battle-feed-item.victory,
.battle-feed-item.reward,
.battle-feed-item.finisher {
    border-left-color: #bd7330;
}

@keyframes battleImpact {
    0% { transform: scale(1); }
    30% { transform: scale(1.03) translateY(-2px); }
    100% { transform: scale(1); }
}

/* ===========================
   RIGHT: Auxiliary Nav
   =========================== */
.right-panel {
    padding: 0;
}

.right-tabs {
    display: flex;
    border-bottom: 1px solid var(--ink-black);
    background: rgba(0, 0, 0, 0.02);
}

.head-tab {
    flex: 1;
    py-padding: 15px 0;
    background: transparent;
    border: none;
    font-family: var(--font-heading-sub);
    font-size: 20px;
    color: var(--ink-grey);
    padding: 20px 0;
    cursor: pointer;
    border-right: 1px solid var(--ink-light);
    transition: all 0.2s;
}

.head-tab:last-child {
    border-right: none;
}

.head-tab:hover {
    color: var(--ink-black);
    background: var(--paper-light);
}

.head-tab.active {
    color: var(--ink-black);
    background: var(--paper-light);
    border-bottom: 3px solid var(--stamp-red);
    font-weight: bold;
}

.right-content {
    padding: 20px;
    flex: 1;
}

.side-section {
    display: none;
    animation: fadeInBlock 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.side-section.active {
    display: block;
}

/* Grid (Backpack) */
.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.item-slot {
    aspect-ratio: 1;
    position: relative;
    border: 1px solid var(--ink-light);
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}

.item-slot.empty {
    background: rgba(0, 0, 0, 0.02);
    border-style: dashed;
}

.item-slot:not(.empty):hover {
    border-color: var(--ink-black);
}

.item-bg-ink {
    position: absolute;
    inset: 0;
    opacity: 0.1;
    transition: opacity 0.3s;
}

.item-slot:hover .item-bg-ink {
    opacity: 0.2;
    transform: scale(1.1);
}

.item-icon {
    font-family: var(--font-heading-main);
    font-size: 28px;
    z-index: 2;
    margin-bottom: 2px;
    line-height: 1;
}

.item-name {
    font-size: 11px;
    z-index: 2;
    /* truncated visually via zoom/width if needed */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

.item-count {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 10px;
    font-family: var(--font-heading-sub);
    z-index: 2;
}

/* Color classes for item qualities using ink tints */
.quality-common {
    color: var(--color-common);
}

.quality-common .item-bg-ink {
    background: var(--color-common);
}

.quality-rare {
    color: var(--color-rare);
}

.quality-rare .item-bg-ink {
    background: var(--color-rare);
}

.quality-epic {
    color: var(--color-epic);
}

.quality-epic .item-bg-ink {
    background: var(--color-epic);
}

.quality-legendary {
    color: var(--color-legend);
}

.quality-legendary .item-bg-ink {
    background: radial-gradient(circle, var(--color-legend) 0%, transparent 80%);
}

/* Equip Layout */
.equip-layout {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.equip-slot {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border: 1px solid var(--ink-light);
    background: #fff;
    cursor: pointer;
    transition: transform 0.2s;
}

.equip-slot:hover {
    transform: translateX(-5px);
    border-color: var(--ink-black);
}

.equip-slot.empty {
    opacity: 0.6;
    border-style: dashed;
}

.slot-marker {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--ink-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading-sub);
    font-size: 20px;
}

.equip-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.equip-name {
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
}

.small-stamp {
    font-size: 10px;
    color: var(--stamp-red);
    border: 1px solid var(--stamp-red);
    padding: 1px 3px;
    font-weight: normal;
}

.equip-stats {
    font-size: 13px;
    color: var(--ink-grey);
}

.text-muted {
    color: var(--ink-light);
    font-weight: normal;
}

/* Techniques List */
.tech-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    list-style: none;
}

.tech-list li {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 1px solid var(--ink-light);
    background: rgba(0, 0, 0, 0.01);
    cursor: pointer;
    transition: all 0.2s;
}

.tech-list li:hover {
    background: #fff;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.05);
}

.tech-list li.active-tech {
    border-color: var(--ink-black);
    background: #fff;
    box-shadow: -4px 4px 0px rgba(0, 0, 0, 0.1);
}

.tech-icon {
    font-family: var(--font-heading-main);
    font-size: 30px;
    color: var(--ink-dark);
    width: 45px;
    text-align: center;
    border-right: 1px solid var(--ink-light);
    padding-right: 15px;
}

.tech-list li.active-tech .tech-icon {
    color: var(--stamp-red);
    border-right-color: var(--stamp-red);
}

.tech-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tech-name {
    font-size: 16px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.realm {
    font-family: var(--font-heading-sub);
    font-size: 15px;
    color: var(--ink-black);
    font-weight: normal;
}

.tech-type {
    font-size: 13px;
    color: var(--ink-grey);
}



/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--ink-light);
    border-radius: 3px;
}

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

/* Animations */
@keyframes inkRotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes inkRotateRev {
    0% {
        transform: rotate(360deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

@keyframes slowRotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes floatUpDown {

    0%,
    100% {
        transform: translateY(-50%);
    }

    50% {
        transform: translateY(calc(-50% - 10px));
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

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

@keyframes fadeInBlock {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@keyframes inkFadeIn {
    from {
        opacity: 0;
        filter: blur(4px);
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }
}

.fade-in {
    animation: inkFadeIn 0.8s ease forwards;
}
/* ====== 通用模态框 ====== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ====== 登录/注册模态框 ====== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background: var(--paper-light);
    border: 2px solid var(--ink-black);
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 20px 20px 0px rgba(0, 0, 0, 0.1);
    position: relative;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.modal-title {
    font-family: var(--font-heading-main);
    font-size: 36px;
    color: var(--ink-black);
}

.auth-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--ink-light);
}

.auth-tab {
    font-family: var(--font-heading-sub);
    font-size: 18px;
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--ink-grey);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.auth-tab.active {
    color: var(--ink-black);
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--stamp-red);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-family: var(--font-heading-sub);
    font-size: 16px;
    color: var(--ink-dark);
}

.form-group input {
    font-family: var(--font-body);
    font-size: 16px;
    padding: 12px;
    border: 1.5px solid var(--ink-light);
    background: #fff;
    color: var(--ink-dark);
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--ink-black);
}

.auth-msg {
    font-size: 14px;
    color: var(--stamp-red);
    min-height: 20px;
}

/* ====== 设置面板 ====== */
.settings-view {
    padding: 20px;
}

.settings-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--ink-light);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h4 {
    font-family: var(--font-heading-sub);
    font-size: 20px;
    margin-bottom: 15px;
    color: var(--ink-black);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.setting-item label {
    font-size: 16px;
    color: var(--ink-dark);
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* ====== 降世模态框 ====== */
.descent-modal {
    max-width: 700px;
}

.descent-content {
    min-height: 400px;
}

.descent-hint {
    font-size: 16px;
    color: var(--ink-grey);
    margin-bottom: 20px;
    line-height: 1.8;
}

.character-setting-input {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    font-family: var(--font-body);
    font-size: 16px;
    border: 1.5px solid var(--ink-light);
    background: #fff;
    color: var(--ink-dark);
    resize: vertical;
    margin-bottom: 20px;
    line-height: 1.8;
}

.character-setting-input:focus {
    outline: none;
    border-color: var(--ink-black);
}

.descent-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 60px 0;
}

.taiji-loading {
    width: 120px;
    height: 120px;
    animation: slowRotate 3s linear infinite;
}

.loading-text {
    font-family: var(--font-heading-sub);
    font-size: 20px;
    color: var(--ink-grey);
}

.character-result {
    padding: 20px 0;
}

.result-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--ink-light);
}

.result-section:last-of-type {
    border-bottom: none;
}

.result-section h4 {
    font-family: var(--font-heading-sub);
    font-size: 18px;
    color: var(--ink-black);
    margin-bottom: 10px;
}

.result-value {
    font-family: var(--font-heading-main);
    font-size: 28px;
    color: var(--stamp-red);
    margin-bottom: 8px;
}

.result-desc {
    font-size: 15px;
    color: var(--ink-grey);
    line-height: 1.6;
    margin-bottom: 15px;
}

/* 元素点数显示 */
.elements-container {
    margin-top: 15px;
}

.element-bar {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.element-name {
    font-family: var(--font-heading-sub);
    font-size: 14px;
    color: var(--ink-dark);
    min-width: 30px;
}

.element-progress {
    flex: 1;
    height: 20px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--ink-light);
    position: relative;
    overflow: hidden;
}

.element-fill {
    height: 100%;
    transition: width 0.5s ease;
    opacity: 0.8;
}

.element-value {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--ink-dark);
    min-width: 30px;
    text-align: right;
}

.narrative-section {
    background: rgba(0, 0, 0, 0.02);
    padding: 20px;
    border: 1px solid var(--ink-light);
}

.result-narrative {
    font-size: 16px;
    color: var(--ink-dark);
    line-height: 2;
    text-indent: 2em;
}

.error-msg {
    font-size: 14px;
    color: var(--stamp-red);
    min-height: 20px;
    margin-top: 15px;
    text-align: center;
}

/* 六维属性网格 */
.attributes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.attr-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--paper-white);
  border: 1px solid var(--wash-ink);
  font-family: 'Noto Serif SC', serif;
}

.attr-name {
  color: var(--light-ink);
  font-size: 14px;
}

.attr-value {
  color: var(--ink-black);
  font-weight: bold;
  font-size: 16px;
}

/* 特质和功法标签 */
.trait-tag, .skill-tag {
  display: inline-block;
  padding: 6px 12px;
  margin: 5px 5px 5px 0;
  background: var(--paper-white);
  border: 1px solid var(--wash-ink);
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 14px;
  color: var(--ink-black);
}

.skill-tag {
  border-color: var(--seal-red);
  color: var(--seal-red);
}

/* Tooltip */
.tooltip {
  position: fixed;
  background: var(--paper-white);
  border: 2px solid var(--ink-black);
  padding: 12px 16px;
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-black);
  max-width: 300px;
  z-index: 10000;
  pointer-events: none;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
  opacity: 0.98;
  backdrop-filter: blur(2px);
}

.tooltip-title {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 6px;
  color: var(--seal-red);
}

.tooltip-grade {
  display: inline-block;
  padding: 2px 8px;
  background: var(--wash-ink);
  font-size: 12px;
  margin-bottom: 6px;
}

.tooltip-desc {
  margin-bottom: 6px;
  color: var(--dark-ink);
}

.tooltip-effects {
  color: var(--light-ink);
  font-size: 13px;
}

/* Hover 效果 */
.trait-tag:hover, .skill-tag:hover {
  cursor: help;
  background: var(--wash-ink);
  transform: translateY(-2px);
  transition: all 0.2s ease;
}

/* 体质标签 hover */
.constitution-tag {
  cursor: help;
  display: inline-block;
  padding: 4px 8px;
  border-bottom: 2px dashed var(--wash-ink);
  transition: all 0.2s ease;
}

.constitution-tag:hover {
  background: var(--wash-ink);
  transform: translateY(-2px);
}

/* 对话式修改区域 */
.character-chat {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid var(--wash-ink);
}

.chat-history {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 15px;
  padding: 10px;
  background: var(--paper-white);
  border: 1px solid var(--wash-ink);
}

.chat-message {
  margin-bottom: 15px;
  padding: 10px 15px;
  border-left: 3px solid var(--wash-ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  line-height: 1.6;
}

.chat-message.user {
  border-left-color: var(--seal-red);
  background: rgba(197, 60, 60, 0.05);
}

.chat-message.ai {
  border-left-color: var(--ink-black);
  background: rgba(0, 0, 0, 0.02);
}

.chat-message .message-label {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 12px;
  color: var(--light-ink);
  margin-bottom: 5px;
}

.chat-message .message-content {
  color: var(--ink-black);
}

.chat-input-container {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--wash-ink);
  background: var(--paper-white);
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  min-height: 60px;
  transition: border-color 0.3s ease;
}

.chat-input:focus {
  outline: none;
  border-color: var(--ink-black);
}

.chat-input::placeholder {
  color: var(--light-ink);
  font-size: 13px;
}

#chat-send-btn {
  flex-shrink: 0;
}


/* 新增交互控件，沿用原有水墨古风 */
.monster-picker-wrap {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.monster-picker-wrap .action-btn {
    flex: 1;
}

.monster-select {
    min-width: 140px;
    padding: 0 12px;
    border: 2px solid var(--ink-black);
    background: var(--paper-white);
    color: var(--ink-dark);
    font-family: var(--font-body);
    font-size: 14px;
    border-radius: 0;
}

.monster-select:focus {
    outline: none;
    border-color: var(--stamp-red);
}

.status-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(16px);
    min-width: 240px;
    max-width: 520px;
    padding: 12px 18px;
    border: 2px solid var(--ink-black);
    background: var(--paper-white);
    color: var(--ink-dark);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.12);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 11000;
}

.status-toast.visible {
    opacity: 0.98;
    transform: translateX(-50%) translateY(0);
}

.status-toast.success,
.status-toast.info {
    border-left: 6px solid var(--ink-black);
}

.status-toast.error {
    border-left: 6px solid var(--stamp-red);
    color: var(--stamp-red);
}
