:root {
    --primary: #2b2d42;
    --secondary: #1a1b26;
    --accent: #ff4655;
    --accent-hover: #ff6b77;
    --text-primary: #e2e2e2;
    --text-secondary: #a0a0a0;
    --card-bg: #2d2f3d;
    --border-color: #3a3c4a;
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #ef4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;
}

body {
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--primary);
    color: var(--text-primary);
    line-height: 1.6;
}

html, body {
    min-height: 100vh;
    background: var(--primary);
}

.top-bar {
    background: var(--secondary);
    color: var(--text-primary);
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.messenger-container {
    display: flex;
    height: calc(100vh - 60px);
    background: var(--primary);
    position: relative;
}

.chat-area {
    flex: 1;
    background: var(--primary);
    padding: 0.7rem 2rem; /* top/bottom 0.7rem, left/right 2rem */
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    overflow-y: auto;
    min-width: 300px;
    position: relative;
}

.chat-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, var(--primary) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

#chatMessages {
    position: relative;
    z-index: 0;
}

.rightbar {
    width: 380px;
    min-width: 280px;
    max-width: 600px;
    background: var(--secondary);
    padding: 1.5rem;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    position: relative;
}

.resize-handle {
    position: fixed;
    left: unset; /* will be set by JS */
    top: unset;  /* will be set by JS */
    width: 4px;
    height: unset; /* will be set by JS */
    background: var(--border-color);
    cursor: col-resize;
    transition: background-color 0.2s;
    z-index: 2000;
}

.character-card.solo-leveling .resize-handle {
    height: 100%;
    top: 0;
    bottom: 0;
    background: var(--accent);
    opacity: 0.5;
    transition: opacity 0.2s, background-color 0.2s;
}

.character-card.solo-leveling .resize-handle:hover,
.character-card.solo-leveling .resize-handle.active {
    opacity: 1;
    background: var(--accent);
}

.resize-handle:hover,
.resize-handle.active {
    background: var(--accent);
}

.turn-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.3rem;
    margin-top: 0.3rem;
    justify-content: center;
}

.turn-nav button {
    background: rgba(255,255,255,0.04);
    border: none;
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s, transform 0.12s;
    box-shadow: none;
    outline: none;
    margin: 0 0.2rem;
    opacity: 0.7;
}
.turn-nav button:hover:not(:disabled), .turn-nav button:focus {
    background: rgba(255,255,255,0.12);
    color: var(--text-primary);
    opacity: 1;
    transform: scale(1.08);
}
.turn-nav button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#turnIndicator {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.chat-bubble {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease-out;
    position: relative;
}

/* Remove margin below the last .chat-bubble.story before the turn nav/location bar */
.chat-bubble.story:last-child {
    margin-bottom: 0;
}

.chat-bubble.loading {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-bubble.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-bubble.story {
    border-left: 4px solid var(--accent);
}

.chat-bubble.choices {
    background: rgba(255, 70, 85, 0.1);
    border-left: 4px solid var(--accent);
}

.choice {
    padding: 1rem;
    margin: 0.5rem 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.choice:hover {
    background: var(--accent);
    transform: translateX(5px);
}

.choice.selected {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 8px 0 var(--accent);
}

.choice.custom-input {
    cursor: default;
}

.choice-input {
    width: 100%;
    padding: 1rem;
    background: var(--secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.choice-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 70, 85, 0.2);
}

.choice-input::placeholder {
    color: var(--text-secondary);
}

.character-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.char-portrait-bg {
    width: 100%;
    height: 340px;
    background: var(--accent);
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 1rem;
    box-sizing: border-box;
}

.char-header {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 1rem 1rem 1rem;
    z-index: 2;
    min-height: 70px;
    background: linear-gradient(0deg, var(--card-bg) 0%, var(--card-bg) 30%, rgba(45,47,61,0.85) 60%, rgba(45,47,61,0) 100%);
    box-sizing: border-box;
}

.char-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.char-rank-big {
    font-size: 3.5rem;
    margin-left: 1rem;
    color: var(--accent);
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

@media (max-width: 600px) {
    .char-portrait-bg {
        height: 90px;
        padding: 0.7rem;
    }
    .char-header {
        padding: 0 0.7rem 0.7rem 0.7rem;
    }
    .char-name {
        font-size: 1rem;
    }
    .char-rank-big {
        font-size: 1.5rem;
    }
}

.char-portrait {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--secondary);
    border: 2px solid var(--accent);
    margin-right: 1rem;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 16px rgba(255, 70, 85, 0.2);
    flex-shrink: 0;
}

.char-portrait::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 70, 85, 0.1) 0%, transparent 100%);
    z-index: 1;
}

.char-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.char-header-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.char-player {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.char-meta, .char-guild, .char-rep {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-color);
}

.char-meta b, .char-guild b, .char-rep b {
    color: var(--text-primary);
    font-weight: 600;
    margin-left: 0.3rem;
}

.char-meta {
    margin-top: 0.5rem;
}

.char-guild b {
    cursor: help;
}

.bar-group {
    margin: 0.8rem 0;
}

.bar-label {
    margin-bottom: 0.3rem;
    color: var(--text-secondary);
}

.bar-outer, .enemy-hp-bar {
    width: 100%;
    height: 24px !important;
    background: var(--secondary);
    border-radius: 8px !important;
    overflow: hidden;
    position: relative;
    margin-top: 0.5rem !important;
}

.bar-inner, .enemy-hp-inner {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #ff6b6b);
    border-radius: 8px !important;
    transition: width 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem !important;
    font-weight: 600 !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
    letter-spacing: 0.5px !important;
    padding: 0 !important;
    white-space: nowrap !important;
}

.enemy-card.boss .enemy-hp-inner {
    background: linear-gradient(90deg, #ff4655, #ff6b6b);
}

.enemy-card.dead .enemy-hp-inner {
    background: #666;
}

.enemy-card.dead .enemy-hp-inner::after {
    content: 'ถูกกำจัด';
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
    text-align: center;
}

.stat-grid div {
    background: var(--secondary);
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    position: relative;
    cursor: help;
}

.stat-grid div:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: linear-gradient(135deg, var(--secondary) 0%, rgba(255, 70, 85, 0.1) 100%);
}

.stat-grid span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    transition: color 0.2s ease;
}

.stat-grid div:hover span {
    color: var(--text-primary);
}

.stat-grid b {
    color: var(--accent);
    transition: all 0.2s ease;
}

.stat-grid div:hover b {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: brightness(1.2);
}

.char-section {
    margin: 1rem 0;
}

.section-title {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.skills-list, .equip-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.skill-card {
    background: var(--secondary);
    padding: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.skill-card.in-cooldown {
    opacity: 0.7;
    background: linear-gradient(135deg, var(--secondary) 0%, rgba(255, 70, 85, 0.1) 100%);
    border-color: rgba(255, 70, 85, 0.3);
}

.cooldown-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.1rem;
    color: var(--accent);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.skill-name {
    color: var(--accent);
    font-weight: 500;
    transition: all 0.2s ease;
}

.skill-name:hover {
    color: var(--success);
    transform: translateY(-1px);
}

.skill-name:active {
    transform: translateY(0);
}

.skill-meta {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

.skill-info {
    flex: 1;
}

.skill-value {
    background: linear-gradient(135deg, #ff4655 60%, #ff6b77 100%);
    color: #fff;
    padding: 0.35rem 1.1rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(255, 70, 85, 0.18), 0 1.5px 8px 0 #ff4655cc;
    border: 1.5px solid #ff4655;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.18);
    transition: all 0.18s;
    display: inline-block;
    margin-left: 0.5rem;
}
.skill-value:hover {
    filter: brightness(1.08) drop-shadow(0 2px 8px #ff6b77cc);
    transform: scale(1.06) translateY(-2px);
}

.equip-item {
    background: var(--secondary);
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    font-size: 0.9rem;
    display: inline-block;
    margin: 0.2rem;
    border: 1px solid var(--border-color);
}

.char-money {
    margin-top: 1rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--secondary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.char-money::before {
    content: none;
}

.char-money b {
    color: #fbbf24;
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    position: relative;
    z-index: 1;
}

.char-money:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: linear-gradient(135deg, var(--secondary) 0%, rgba(251, 191, 36, 0.1) 100%);
}

.char-money:hover b {
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: brightness(1.2);
}

/* Money change animation */
@keyframes moneyChange {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.char-money.changed b {
    animation: moneyChange 0.5s ease-out;
}

/* Money tooltip styles */
.money-tooltip {
    position: absolute;
    z-index: 9999;
    background: var(--secondary);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0.97;
    min-width: 280px;
    max-width: 100vw;
    border: 1.5px solid #fbbf24;
    transition: opacity 0.15s;
}

.money-tooltip h3 {
    color: #fbbf24;
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.money-graph {
    width: 100%;
    height: 120px;
    margin-top: 0.5rem;
    position: relative;
}

.money-graph-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    stroke: #fbbf24;
    stroke-width: 2;
    fill: none;
}

.money-graph-point {
    fill: #fbbf24;
    stroke: var(--secondary);
    stroke-width: 2;
}

.money-graph-axis {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.money-graph-axis line {
    stroke: var(--border-color);
    stroke-width: 1;
}

.money-graph-axis text {
    fill: var(--text-secondary);
    font-size: 0.7rem;
}

/* Money notification styles */
.money-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    font-weight: 600;
    animation: slideIn 0.3s ease-out, fadeOut 0.3s ease-in 2.7s;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

#characterSelect {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
}

#characterSelect option {
    background: var(--card-bg);
    color: var(--text-primary);
}

@media (max-width: 1200px) {
    .rightbar {
        width: 320px;
    }
    
    .chat-area {
        padding: 1.5rem;
    }
    
    .character-card {
        padding: 1.2rem;
    }
}

@media (max-width: 1024px) {
    .rightbar {
        width: 300px;
    }
    
    .stat-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .char-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 900px) {
    .messenger-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 60px);
    }
    
    .rightbar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding: 1rem;
    }
    
    .chat-area {
        padding: 1rem;
        min-height: 50vh;
    }
    
    .top-bar {
        padding: 0.8rem 1rem;
        font-size: 1rem;
    }
    
    .objective-btn {
        padding: 6px 12px;
        font-size: 13px;
        margin-right: 1rem;
    }
    
    .character-card {
        padding: 1rem;
    }
    
    .chat-bubble {
        padding: 1.2rem;
    }
    
    .choice {
        padding: 0.8rem;
    }
}

@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        gap: 0.8rem;
        padding: 0.8rem;
    }
    
    .topbar-right-group {
        width: 100%;
        justify-content: space-between;
    }
    
    #characterSelectContainer {
        flex: 1;
        margin-left: 1rem;
    }
    
    #characterSelect {
        width: 100%;
    }
    
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chat-bubble {
        font-size: 0.95rem;
    }
    
    .choice-input {
        font-size: 0.95rem;
        padding: 0.8rem;
    }
    
    .choice-send-btn {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }
    
    .objective-btn {
        width: auto;
        min-width: 80px;
        padding: 6px 14px;
        font-size: 13px;
        margin-right: 0.5rem;
    }

    .char-header {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
        text-align: center;
    }

    .char-portrait {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .char-header-content {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 0.6rem;
    }
    
    .topbar-right-group {
        flex-direction: column;
        gap: 0.6rem;
    }
    
    #characterSelectContainer {
        margin-left: 0;
        width: 100%;
    }
    
    .objective-btn {
        width: auto;
        min-width: 70px;
        padding: 5px 10px;
        font-size: 12px;
        margin-right: 0.3rem;
    }
    
    .chat-area {
        padding: 0.8rem;
    }
    
    .rightbar {
        padding: 0.8rem;
    }
    
    .character-card {
        padding: 0.8rem;
    }
    
    .char-header {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
        text-align: center;
    }
    
    .char-portrait {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .char-header-content {
        flex-direction: column;
        align-items: center;
    }
    
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }
    
    .stat-grid div {
        padding: 0.4rem;
    }
    
    .chat-bubble {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .choice {
        padding: 0.7rem;
        font-size: 0.9rem;
    }
    
    .choice-input {
        font-size: 0.9rem;
        padding: 0.7rem;
    }
    
    .choice-send-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .objective-content {
        width: 95%;
        margin: 1rem;
    }
    
    .objective-header h2 {
        font-size: 1.2rem;
    }
    
    .quest-name {
        font-size: 1.1rem;
    }
    
    .quest-description {
        font-size: 0.9rem;
    }
}

/* Fix for iOS Safari 100vh issue */
@supports (-webkit-touch-callout: none) {
    .messenger-container {
        height: -webkit-fill-available;
    }
}

/* Improve touch targets for mobile */
@media (hover: none) and (pointer: coarse) {
    .choice, 
    .choice-send-btn,
    .objective-btn,
    .close-btn,
    .turn-nav button {
        min-height: 44px;
    }
    
    .choice-input {
        min-height: 44px;
    }
    
    .stat-grid div {
        min-height: 44px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

/* Custom Scrollbar Styles */
.chat-area, .rightbar, body {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--secondary);
}

/* Chrome, Edge, Safari */
.chat-area::-webkit-scrollbar, .rightbar::-webkit-scrollbar, body::-webkit-scrollbar {
    width: 10px;
    background: var(--secondary);
    border-radius: 8px;
}

.chat-area::-webkit-scrollbar-thumb, .rightbar::-webkit-scrollbar-thumb, body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--accent) 60%, var(--accent-hover) 100%);
    border-radius: 8px;
    box-shadow: 0 2px 8px 0 rgba(255,70,85,0.15);
    min-height: 40px;
}

.chat-area::-webkit-scrollbar-thumb:hover, .rightbar::-webkit-scrollbar-thumb:hover, body::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

.chat-area::-webkit-scrollbar-track, .rightbar::-webkit-scrollbar-track, body::-webkit-scrollbar-track {
    background: var(--secondary);
    border-radius: 8px;
}

/* Hide scrollbar buttons */
.chat-area::-webkit-scrollbar-button, .rightbar::-webkit-scrollbar-button, body::-webkit-scrollbar-button {
    display: none;
}

/* Hide scrollbar corner */
.chat-area::-webkit-scrollbar-corner, .rightbar::-webkit-scrollbar-corner, body::-webkit-scrollbar-corner {
    background: transparent;
}

.choice-send-btn {
    background: linear-gradient(135deg, #22c55e 60%, #4ade80 100%);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    padding: 0.7rem 1.2rem;
    margin-left: 0.2rem;
    cursor: pointer;
    box-shadow: 0 0 8px 0 #22c55e80, 0 2px 8px 0 #0002;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    outline: none;
    display: inline-block;
}

.choice-send-btn:hover, .choice-send-btn:focus {
    background: linear-gradient(135deg, #4ade80 60%, #22c55e 100%);
    box-shadow: 0 0 16px 2px #4ade80cc, 0 2px 8px 0 #0002;
    transform: translateY(-2px) scale(1.04);
}

.choice-send-btn.loading {
    background: #4ade80;
    cursor: wait;
    position: relative;
    color: transparent;
}

.choice-send-btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: button-loading-spinner 0.8s linear infinite;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0turn);
    }
    to {
        transform: rotate(1turn);
    }
}

.consolelog-container {
    max-width: 900px;
    margin: 40px auto 0 auto;
    background: var(--secondary);
    padding: 32px 24px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

#consoleLog {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.console-entry {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(255,70,85,0.08);
    padding: 18px 20px;
    border: 1px solid var(--border-color);
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.console-action {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.console-char-card {
    background: var(--secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 14px 16px;
    margin-bottom: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    color: var(--text-primary);
    font-size: 0.98rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.console-char-header {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 2px;
}

.console-char-player {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.console-char-meta, .console-char-rep, .console-char-stats, .console-char-attr, .console-char-section, .console-char-money {
    font-size: 0.97rem;
    color: var(--text-secondary);
}

.console-char-section b {
    color: var(--text-primary);
}

.console-skill {
    background: var(--card-bg);
    color: var(--accent);
    border-radius: 4px;
    padding: 2px 7px;
    margin-right: 4px;
    font-weight: 500;
    font-size: 0.97rem;
}

.console-skill-meta {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.console-equip {
    background: var(--secondary);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 2px 7px;
    margin-right: 4px;
    font-size: 0.97rem;
    border: 1px solid var(--border-color);
}

.console-char-money {
    color: var(--success);
    font-weight: 600;
    margin-top: 4px;
}

.console-empty {
    color: var(--text-secondary);
    font-style: italic;
    padding: 18px 0 0 0;
    text-align: center;
}

.backend-flex-container {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    height: 100vh;
    background: var(--primary);
}

.backend-left, .backend-right {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
}

.inputjson-container {
    height: 100vh;
    box-sizing: border-box;
    border-radius: 0 0 10px 0;
    box-shadow: none;
    max-width: 100%;
    padding: 40px 32px 32px 32px;
    background: var(--secondary);
    gap: 18px;
    padding-top: 0;
    margin-top: 0;
}

.inputjson-container h2 {
    margin-bottom: 18px;
}

.inputjson-container textarea {
    width: 100%;
    min-height: 180px;
    font-size: 1.05rem;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    margin-bottom: 16px;
    resize: vertical;
}

.inputjson-container button {
    padding: 10px 24px;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 600;
    transition: background 0.2s;
    margin-bottom: 10px;
}

.inputjson-container button:hover {
    background-color: var(--accent-hover);
}

.consolelog-container {
    height: 100vh;
    box-sizing: border-box;
    border-radius: 0 0 0 10px;
    max-width: 100%;
    padding: 40px 32px 32px 32px;
    background: var(--secondary);
    gap: 18px;
    overflow-x: auto;
    padding-top: 0;
    margin-top: 0;
}

.console-copy-btn {
    margin-bottom: 10px;
    width: 100%;
    background: var(--card-bg);
    color: var(--success);
    font-weight: 700;
    border: none;
    border-radius: 6px;
    padding: 8px 0;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(34,197,94,0.08);
    transition: background 0.2s, color 0.2s;
}
.console-copy-btn:hover {
    background: var(--success);
    color: #fff;
}

.console-json {
    background: var(--primary);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 18px 16px;
    font-size: 1.02rem;
    line-height: 1.5;
    overflow-x: auto;
    min-height: 300px;
    max-height: 70vh;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

@media (max-width: 900px) {
    .backend-flex-container {
        flex-direction: column;
    }
    .inputjson-container, .consolelog-container {
        height: auto;
        padding: 24px 8px 24px 8px;
        border-radius: 0;
    }
    .console-json {
        min-height: 180px;
        max-height: 40vh;
    }
}

/* Objective Button */
.objective-btn, .party-btn, .enemy-btn, .equipment-btn, .relationships-btn {
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 1.08rem;
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    margin-right: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.18s, box-shadow 0.18s, border 0.18s, color 0.18s, transform 0.12s;
    outline: none;
    letter-spacing: 0.5px;
    min-width: 90px;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
}
.objective-btn:last-child, .party-btn:last-child, .enemy-btn:last-child, .equipment-btn:last-child, .relationships-btn:last-child {
    margin-right: 0;
}
.objective-btn:hover, .party-btn:hover, .enemy-btn:hover, .equipment-btn:hover, .relationships-btn:hover,
.objective-btn:focus, .party-btn:focus, .enemy-btn:focus, .equipment-btn:focus, .relationships-btn:focus {
    background: var(--secondary);
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 4px 16px 0 var(--accent);
}

.objective-btn .notification-dot {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background-color: #ff4655;
    border-radius: 50%;
    border: 2px solid var(--secondary);
    display: none;
    animation: pulse 1.5s infinite;
    z-index: 1000;
    box-shadow: 0 0 12px rgba(255, 70, 85, 0.7);
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 70, 85, 0.7);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(255, 70, 85, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 70, 85, 0);
    }
}

.objective-btn:last-child {
    margin-right: 0;
}
.objective-btn:hover, .objective-btn:focus {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: #fff;
    border-color: var(--accent-hover);
    transform: translateY(-2px) scale(1.04);
}

/* Objective Modal */
.objective-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.objective-content {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    width: 95%;
    max-width: 1000px; /* Increased from 600px */
    max-height: 90vh; /* Increased from 80vh */
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.objective-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.objective-header h2 {
    margin: 0;
    color: #fff;
    font-size: 24px;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.objective-body {
    padding: 20px;
    min-width: 900px; /* Add minimum width */
    margin: 0 auto; /* Center content */
}

.quest-info {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.quest-name {
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--border-color);
}

.quest-description {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.quest-details {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.quest-detail {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 80px;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 600;
    flex: 1;
}

.quest-detail:nth-child(1) .detail-value {
    color: #ff4655;
}

.quest-detail:nth-child(2) .detail-value {
    color: #4ade80;
}

.quest-detail:nth-child(3) .detail-value {
    color: #3b82f6;
}

@media (max-width: 768px) {
    .quest-info {
        padding: 1rem;
    }
    
    .quest-name {
        font-size: 1.2rem;
    }
    
    .quest-description {
        font-size: 0.95rem;
        padding: 0.8rem;
    }
    
    .quest-details {
        padding: 0.8rem;
    }
    
    .detail-label {
        min-width: 70px;
        font-size: 0.9rem;
    }
    
    .detail-value {
        font-size: 0.9rem;
    }
}

.topbar-right-group {
    display: flex;
    align-items: center;
    gap: 0;
    float: right;
    height: 100%;
}

#characterSelectContainer {
    margin-left: 0;
}

.skill-note-input {
    display: none;
}

.custom-tooltip {
    position: absolute;
    z-index: 9999;
    background: var(--secondary);
    color: var(--text-primary);
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    box-shadow: 0 4px 16px 0 rgba(0,0,0,0.25), 0 1.5px 8px 0 var(--accent);
    font-size: 1rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0.97;
    max-width: 320px;
    word-break: break-word;
    border: 1.5px solid var(--accent);
    transition: opacity 0.15s;
}

/* Enemy Card Styles */
.enemy-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.enemy-card.boss {
    background: linear-gradient(135deg, var(--card-bg) 0%, #2a1a2a 100%);
    border: 1px solid #ff4655;
    box-shadow: 0 0 10px rgba(255, 70, 85, 0.2);
}

.enemy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.enemy-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.enemy-card.boss .enemy-name {
    color: #ff4655;
    text-shadow: 0 0 10px rgba(255, 70, 85, 0.3);
}

.enemy-type {
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.enemy-status {
    margin-top: 0.8rem;
}

.enemy-hp-bar {
    width: 100%;
    height: 8px;
    background: var(--secondary);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-top: 0.3rem;
}

.enemy-hp-inner {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #ff6b6b);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    padding: 0 0.5rem;
    white-space: nowrap;
}

.enemy-card.boss .enemy-hp-inner {
    background: linear-gradient(90deg, #ff4655, #ff6b6b);
}

.enemy-card.dead .enemy-hp-inner {
    background: #666;
}

.enemy-card.dead .enemy-hp-inner::after {
    content: 'ถูกกำจัด';
}

/* Add status label for enemies */
.enemy-status-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.enemy-status-text {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.enemy-status-value {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.enemy-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.enemy-card.boss:hover {
    box-shadow: 0 4px 12px rgba(255, 70, 85, 0.3);
}

#pasteJsonBtn {
    margin-bottom: 10px;
    width: 100%;
    background: var(--card-bg);
    color: var(--success);
    font-weight: 700;
    border: none;
    border-radius: 6px;
    padding: 8px 0;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(34,197,94,0.08);
    transition: background 0.2s, color 0.2s;
}
#pasteJsonBtn:hover {
    background: var(--success);
    color: #fff;
}

/* Fix background alignment for backend-flex-container and its children */
.backend-flex-container {
    background: var(--primary);
}
.inputjson-container, .consolelog-container {
    background: var(--secondary);
    border-radius: 0;
    height: auto;
    padding-top: 0;
    margin-top: 0;
}

.char-rank-big {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
    letter-spacing: 0.05em;
    margin-left: 1.5rem;
    text-shadow: 0 0 16px rgba(255,70,85,0.35), 0 2px 12px 0 rgba(255,70,85,0.15);
    font-family: inherit;
    filter: drop-shadow(0 0 8px #ff4655aa);
    position: relative;
    z-index: 1;
}

.char-rank-big::before {
    content: attr(data-rank);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(180deg, 
        rgba(255, 70, 85, 0.8) 0%,
        rgba(255, 45, 63, 0.6) 25%,
        rgba(255, 20, 41, 0.4) 50%,
        rgba(255, 0, 20, 0.2) 75%,
        transparent 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: blur(8px);
    animation: fire-flicker 2s infinite alternate;
}

.char-rank-big::after {
    content: attr(data-rank);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background: linear-gradient(180deg,
        rgba(255, 70, 85, 0.4) 0%,
        rgba(255, 45, 63, 0.3) 25%,
        rgba(255, 20, 41, 0.2) 50%,
        rgba(255, 0, 20, 0.1) 75%,
        transparent 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: blur(12px);
    animation: fire-flicker 3s infinite alternate-reverse;
}

@keyframes fire-flicker {
    0% {
        opacity: 0.8;
        transform: translateY(0) scale(1);
        filter: blur(8px) brightness(1);
    }
    25% {
        opacity: 0.9;
        transform: translateY(-1px) scale(1.02);
        filter: blur(8px) brightness(1.2);
    }
    50% {
        opacity: 0.7;
        transform: translateY(1px) scale(0.98);
        filter: blur(8px) brightness(0.9);
    }
    75% {
        opacity: 0.8;
        transform: translateY(-2px) scale(1.01);
        filter: blur(8px) brightness(1.1);
    }
    100% {
        opacity: 0.9;
        transform: translateY(0) scale(1);
        filter: blur(8px) brightness(1);
    }
}

.character-card.solo-leveling {
    border: 2.5px solid var(--accent);
    box-shadow: 0 0 24px 0 rgba(255,70,85,0.18), 0 4px 24px 0 #0003;
    background: linear-gradient(120deg, var(--card-bg) 80%, rgba(255,70,85,0.07) 100%);
    position: relative;
    z-index: 1;
}

#deleteTurnBtn, #pasteTurnBtn {
    font-size: 1.08rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    padding: 10px 28px;
    margin-left: 1rem;
    box-shadow: 0 2px 12px 0 rgba(0,0,0,0.10), 0 1.5px 8px 0 var(--accent);
    transition: background 0.18s, box-shadow 0.18s, color 0.18s, transform 0.12s;
    outline: none;
    cursor: pointer;
    letter-spacing: 0.5px;
    min-width: 90px;
    display: inline-block;
}
#deleteTurnBtn {
    background: linear-gradient(135deg, #ff4655 60%, #ff6b77 100%);
    color: #fff;
}
#deleteTurnBtn:hover, #deleteTurnBtn:focus {
    background: linear-gradient(135deg, #ff6b77 60%, #ff4655 100%);
    color: #fff;
    box-shadow: 0 0 16px 2px #ff4655cc, 0 2px 8px 0 #0002;
    transform: translateY(-2px) scale(1.04);
}
#pasteTurnBtn {
    background: linear-gradient(135deg, #22c55e 60%, #4ade80 100%);
    color: #fff;
}
#pasteTurnBtn:hover, #pasteTurnBtn:focus {
    background: linear-gradient(135deg, #4ade80 60%, #22c55e 100%);
    color: #fff;
    box-shadow: 0 0 16px 2px #22c55ecc, 0 2px 8px 0 #0002;
    transform: translateY(-2px) scale(1.04);
}

.skill-description {
    display: none;
    transition: opacity 0.18s;
}
.skill-card:hover .skill-description,
.skill-name:focus + .skill-description {
    display: block;
    opacity: 1;
}

/* Stat Tooltip and Graph Styles */
.stat-tooltip {
    position: fixed !important;
    z-index: 9999;
    background: var(--secondary);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 16px 0 rgba(0,0,0,0.25), 0 1.5px 8px 0 var(--accent);
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0.97;
    min-width: 280px;
    max-width: 100vw;
    border: 1.5px solid var(--accent);
    transition: opacity 0.15s;
}

.stat-tooltip h3 {
    color: var(--accent);
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.stat-graph {
    width: 100%;
    height: 120px;
    margin-top: 0.5rem;
    position: relative;
}

.stat-graph-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    stroke: var(--accent);
    stroke-width: 2;
    fill: none;
}

.stat-graph-point {
    fill: var(--accent);
    stroke: var(--secondary);
    stroke-width: 2;
}

.stat-graph-axis {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.stat-graph-axis line {
    stroke: var(--border-color);
    stroke-width: 1;
}

.stat-graph-axis text {
    fill: var(--text-secondary);
    font-size: 0.7rem;
}

.stat-grid div {
    position: relative;
    cursor: help;
}

/* Relationship Card Styles */
.relationship-card {
    width: 200px;
    min-height: 120px; /* Changed from fixed height to min-height */
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
    overflow: hidden; /* Prevent text overflow */
}

.relationship-card .enemy-header {
    font-weight: bold;
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.relationship-card .enemy-name {
    word-break: break-word; /* Allow long names to wrap */
    flex: 1;
    margin-right: 0.5rem;
}

.relationship-card .enemy-type {
    white-space: nowrap; /* Keep score on one line */
}

.relationship-card .enemy-status {
    font-size: 0.9rem;
    color: var(--text-secondary);
    word-wrap: break-word; /* Allow long text to wrap */
}

.relationship-list-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 8px;
    margin-bottom: 0.8rem;
    transition: all 0.2s ease;
}

.relationship-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.relationship-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.relationship-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.relationship-score {
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    background: var(--secondary);
}

.relationship-relation {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

/* New Relationship Bar Styles */
.relationship-bar-container {
    position: relative;
    height: 24px;
    background: var(--secondary);
    border-radius: 12px;
    margin: 0.8rem 0;
    overflow: hidden;
}

.relationship-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, 
        #ff4655 0%,    /* Enemy (-100) */
        #ff6b6b 25%,   /* Hostile (-50) */
        #fbbf24 50%,   /* Neutral (0) */
        #4ade80 75%,   /* Friendly (50) */
        #22c55e 100%   /* True Friend (100) */
    );
    opacity: 0.3;
}

.relationship-pointer {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 16px;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    z-index: 2;
}

.relationship-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
}

.relationship-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.relationship-label-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Relationship score colors */
.relationship-score.enemy {
    color: #ff4655;
    background: rgba(255, 70, 85, 0.1);
}

.relationship-score.hostile {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.relationship-score.neutral {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}

.relationship-score.friendly {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.relationship-score.true-friend {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

@media (max-width: 1024px) {
    .objective-content {
        width: 98%;
    }
    
    .objective-body {
        min-width: auto;
        width: 100%;
    }
    
    .columnsContainer {
        width: 100% !important;
    }
}

.equipment-card {
    background: var(--secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.equipment-header {
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.equipment-category {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
}

.equipment-rank {
    font-size: 0.85em;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    background: #ff4655;
    color: white;
    margin-left: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 2px 4px rgba(255, 70, 85, 0.3);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.equipment-rank[data-rank="S"] {
    background: linear-gradient(135deg, #ff4655, #ff2d3f);
    box-shadow: 0 2px 8px rgba(255, 70, 85, 0.4), 0 2px 16px 4px #ff4655cc, 0 2px 12px 2px #ff2d3fcc;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    animation: s-rank-glow 2s infinite;
}

.equipment-rank[data-rank="A"] {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.equipment-rank[data-rank="B"] {
    background: linear-gradient(135deg, #ff8f8f, #ff7575);
    box-shadow: 0 2px 4px rgba(255, 143, 143, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.equipment-rank[data-rank="C"] {
    background: linear-gradient(135deg, #ffb3b3, #ff9e9e);
    box-shadow: 0 2px 4px rgba(255, 179, 179, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Special styling for Legendary items */
.equipment-rank[data-rank*="Legendary"] {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #000;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: legendary-glow 2s infinite;
}

.equipment-rank[data-rank*="Mythical"] {
    background: linear-gradient(135deg, #a700bd, #a700bd);
    color: #000;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(199, 1, 182, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: mythical-glow 2s infinite;
}

@keyframes legendary-glow {
    0% {
        box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    }
    50% {
        box-shadow: 0 2px 12px rgba(255, 215, 0, 0.6);
    }
    100% {
        box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    }
}

@keyframes mythical-glow {
    0% {
        box-shadow: 0 2px 8px rgba(199, 1, 182, 0.4);
    }
    50% {
        box-shadow: 0 2px 12px rgba(199, 1, 182, 0.6);
    }
    100% {
        box-shadow: 0 2px 8px rgba(199, 1, 182, 0.4);
    }
}

.other-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.other-item .equipment-name {
    color: var(--accent);
    font-size: 1rem;
    font-weight: 600;
}

.other-item .equipment-rank {
    font-size: 0.85rem;
}

.equipment-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.equipment-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.equipment-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.stat-badge {
    background: var(--card-bg);
    color: var(--accent);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
}

.empty-slot {
    color: var(--text-secondary);
    font-style: italic;
}

.other-item {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.other-item:last-child {
    border-bottom: none;
}

.other-item .equipment-name {
    color: var(--accent);
}

.other-item .equipment-description {
    font-size: 0.85rem;
}

/* Equipment Modal Styles */
.equipment-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem;
}

.equipment-card {
    background: var(--secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.2rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.equipment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: var(--accent);
}

.equipment-card.empty {
    background: var(--card-bg);
    border-style: dashed;
}

.equipment-header {
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.equipment-category {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.equipment-category::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
}

.equipment-content {
    color: var(--text-primary);
}

.equipment-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.equipment-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.equipment-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.stat-badge {
    background: var(--card-bg);
    color: var(--accent);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s ease;
}

.stat-badge:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-1px);
}

.stat-badge::before {
    content: '+';
    font-weight: 700;
}

.empty-slot {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 1rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    transition: all 0.2s ease;
}

.empty-slot:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.other-equipment {
    grid-column: 1 / -1;
    margin-top: 1rem;
}

.other-item {
    background: var(--secondary);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.other-item.quest-item {
    background: linear-gradient(135deg, var(--secondary) 0%, rgba(74, 222, 128, 0.1) 100%);
    border: 1px solid var(--success);
    position: relative;
}

.other-item.quest-item::before {
    content: '📜';
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--success);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(74, 222, 128, 0.3);
}

.other-item.quest-item .equipment-name {
    color: var(--success);
}

.other-item.quest-item:hover {
    transform: translateX(4px);
    border-color: var(--success);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.2);
}

@media (max-width: 1024px) {
    .equipment-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .equipment-grid {
        grid-template-columns: 1fr;
    }
    
    .equipment-card {
        padding: 1rem;
    }
    
    .equipment-name {
        font-size: 1rem;
    }
    
    .stat-badge {
        padding: 0.3rem 0.6rem;
        font-size: 0.85rem;
    }
}

/* Party Modal Styles */
.party-member-card {
    background: var(--secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.2rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.party-member-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: var(--accent);
}

.party-member-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.party-member-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.party-member-type {
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: var(--card-bg);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.party-member-rank {
    font-size: 0.85em;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    color: white;
    margin-left: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 2px 4px rgba(255, 70, 85, 0.3);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Rank-specific styles */
.party-member-rank[data-rank="S"] {
    background: linear-gradient(135deg, #ff4655, #ff2d3f);
    box-shadow: 0 2px 8px rgba(255, 70, 85, 0.4), 0 2px 16px 4px #ff4655cc, 0 2px 12px 2px #ff2d3fcc;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    animation: s-rank-glow 2s infinite;
}

.party-member-rank[data-rank="A"] {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.party-member-rank[data-rank="B"] {
    background: linear-gradient(135deg, #ff8f8f, #ff7575);
    box-shadow: 0 2px 4px rgba(255, 143, 143, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.party-member-rank[data-rank="C"] {
    background: linear-gradient(135deg, #ffb3b3, #ff9e9e);
    box-shadow: 0 2px 4px rgba(255, 179, 179, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Special styling for Legendary rank */
.party-member-rank[data-rank*="Legendary"] {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #000;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: legendary-glow 2s infinite;
}

@keyframes legendary-glow {
    0% {
        box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    }
    50% {
        box-shadow: 0 2px 12px rgba(255, 215, 0, 0.6);
    }
    100% {
        box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    }
}

.party-member-status {
    margin-top: 1rem;
}

.party-status-bar {
    background: var(--card-bg);
    border-radius: 8px;
    height: 24px;
    overflow: hidden;
    margin-top: 0.5rem;
    position: relative;
}

.party-status-inner {
    height: 100%;
    border-radius: 8px;
    transition: width 0.3s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.party-status-inner.hp {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.party-status-inner.mp {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.party-status-inner.mp.mp-na {
    background: repeating-linear-gradient(135deg, #444 0 10px, #555 10px 20px);
    color: #bbb;
    opacity: 0.7;
}

.party-status-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.party-status-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.party-status-value {
    color: var(--text-primary);
    font-weight: 600;
}

.party-member-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.8rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.party-stat-item {
    background: var(--card-bg);
    padding: 0.8rem;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s ease;
}

.party-stat-item:hover {
    transform: translateY(-2px);
    background: var(--accent);
}

.party-stat-item:hover .party-stat-value {
    color: #fff;
}

.party-stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.party-stat-value {
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 600;
}

.party-member-skills {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.party-skills-title {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.party-skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.party-skill-item {
    background: var(--card-bg);
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.party-skill-item:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .party-member-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .party-member-card {
        padding: 1rem;
    }
    
    .party-member-name {
        font-size: 1.1rem;
    }
    
    .party-stat-item {
        padding: 0.6rem;
    }
}

.party-member-card.dead {
    opacity: 0.6;
    filter: grayscale(0.7);
    position: relative;
    background: repeating-linear-gradient(135deg, #222 0 10px, #333 10px 20px);
    border: 1.5px solid #ff4655 !important;
}

.party-member-card.dead .party-member-name {
    text-decoration: line-through;
    color: #ff4655;
    opacity: 0.8;
}

.party-member-card.dead .party-member-rank {
    background: rgba(255, 70, 85, 0.08) !important;
    border: 1.5px solid #ff4655 !important;
    color: #ff4655 !important;
}

.party-status-inner.hp.dead {
    background: repeating-linear-gradient(135deg, #444 0 10px, #222 10px 20px);
    color: #ff4655;
    opacity: 0.8;
}

.party-status-inner.hp.dead::after {
    content: none;
}

.enemy-card.dead {
    opacity: 0.6;
    filter: grayscale(0.7);
    position: relative;
    background: repeating-linear-gradient(135deg, #222 0 10px, #333 10px 20px);
    border: 1.5px solid #ff4655 !important;
}

.enemy-card.dead .enemy-name {
    text-decoration: line-through;
    color: #ff4655;
    opacity: 0.8;
}

.enemy-card.dead .enemy-rank {
    color: #ff4655;
    background: rgba(255, 70, 85, 0.1);
    border: 1.5px solid #ff4655 !important;
}

.enemy-card.dead .enemy-hp-inner {
    background: repeating-linear-gradient(135deg, #444 0 10px, #222 10px 20px);
    color: #ff4655;
    opacity: 0.8;
}

.enemy-card.dead .enemy-hp-inner::after {
    content: none;
}

.enemy-rank {
    font-weight: 700;
    font-size: 0.85em;
    padding: 3px 10px;
    border-radius: 6px;
    color: white;
    margin-right: 0.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 2px 4px rgba(255, 70, 85, 0.3);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.enemy-card.dead .enemy-rank {
    background: linear-gradient(135deg, #666, #444);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #999;
    animation: none !important;
}

/* Only alive S-rank enemies have glowing red */
.enemy-card:not(.dead) .enemy-rank[data-rank="S"] {
    background: linear-gradient(135deg, #ff4655, #ff2d3f);
    box-shadow: 0 2px 8px rgba(255, 70, 85, 0.4), 0 2px 16px 4px #ff4655cc, 0 2px 12px 2px #ff2d3fcc;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    animation: s-rank-glow 2s infinite;
}

.equipment-card.disabled-offhand {
    opacity: 0.5;
    filter: grayscale(0.7);
    pointer-events: none;
    background: repeating-linear-gradient(135deg, #222 0 10px, #333 10px 20px);
    border: 2px dashed var(--danger);
}
.empty-slot.offhand-disabled {
    color: var(--danger);
    font-weight: bold;
    text-align: center;
}

/* Skill Filter Checkbox Styles */
.skill-filters {
    display: flex;
    gap: 1rem;
    margin-left: auto;
}

.skill-filters label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.skill-filters label:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.skill-filters input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.skill-filters input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.skill-filters input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 12px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.skill-filters input[type="checkbox"]:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255,70,85,0.2);
}

.skill-filters span {
    font-size: 0.9rem;
    font-weight: 500;
    user-select: none;
}

/* Update selectors to match new IDs */
label[for="passive-filter"] span {
    color: #22c55e;
}

label[for="active-filter"] span {
    color: #3b82f6;
}

/* Add hover effect for the entire label */
.skill-filters label:hover input[type="checkbox"] {
    border-color: var(--accent);
}

/* Add focus styles for accessibility */
.skill-filters input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255,70,85,0.3);
}

/* Add active state for the label */
.skill-filters label:active {
    transform: translateY(0);
}

@keyframes s-rank-glow {
    0% {
        box-shadow: 0 2px 8px rgba(255, 70, 85, 0.4);
    }
    50% {
        box-shadow: 0 2px 16px 4px #ff4655cc, 0 2px 12px 2px #ff2d3fcc;
    }
    100% {
        box-shadow: 0 2px 8px rgba(255, 70, 85, 0.4);
    }
}

/* Relationship Filter Styles */
.relationship-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.relationship-filters label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: var(--secondary);
    border: 1px solid var(--border-color);
}

.relationship-filters label:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.relationship-filters input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.relationship-filters input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.relationship-filters input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 12px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.relationship-filters input[type="checkbox"]:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255,70,85,0.2);
}

.relationship-filters span {
    font-size: 0.9rem;
    font-weight: 500;
    user-select: none;
}

/* Relationship filter label colors */
.relationship-filters label[for="enemy-filter"] span {
    color: #ff4655;
}

.relationship-filters label[for="hostile-filter"] span {
    color: #ff6b6b;
}

.relationship-filters label[for="neutral-filter"] span {
    color: #fbbf24;
}

.relationship-filters label[for="friendly-filter"] span {
    color: #4ade80;
}

.relationship-filters label[for="true-friend-filter"] span {
    color: #22c55e;
}

/* Add focus styles for accessibility */
.relationship-filters input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255,70,85,0.3);
}

/* Add active state for the label */
.relationship-filters label:active {
    transform: translateY(0);
}

.enemy-btn {
    position: relative;
}

.enemy-btn .notification-dot {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background-color: #ff4655;
    border-radius: 50%;
    border: 2px solid var(--secondary);
    display: none;
    animation: pulse 1.5s infinite;
    z-index: 1000;
    box-shadow: 0 0 12px rgba(255, 70, 85, 0.7);
}

.enemy-btn:hover .notification-dot {
    animation: none;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 70, 85, 0.9);
}

.party-btn {
    position: relative;
}

.party-btn .notification-dot {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background-color: #ff4655;
    border-radius: 50%;
    border: 2px solid var(--secondary);
    display: none;
    animation: pulse 1.5s infinite;
    z-index: 1000;
    box-shadow: 0 0 12px rgba(255, 70, 85, 0.7);
}

.party-btn:hover .notification-dot {
    animation: none;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 70, 85, 0.9);
}

.equipment-btn {
    position: relative;
}

.equipment-btn .notification-dot {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background-color: #ff4655;
    border-radius: 50%;
    border: 2px solid var(--secondary);
    display: none;
    animation: pulse 1.5s infinite;
    z-index: 1000;
    box-shadow: 0 0 12px rgba(255, 70, 85, 0.7);
}

.equipment-btn:hover .notification-dot {
    animation: none;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 70, 85, 0.9);
}

.relationships-btn {
    position: relative;
}

.relationships-btn .notification-dot {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background-color: #ff4655;
    border-radius: 50%;
    border: 2px solid var(--secondary);
    display: none;
    animation: pulse 1.5s infinite;
    z-index: 1000;
    box-shadow: 0 0 12px rgba(255, 70, 85, 0.7);
}

.relationships-btn:hover .notification-dot {
    animation: none;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 70, 85, 0.9);
}

.cooldown-badge.bottom-right {
    top: auto;
    right: 0.7rem;
    bottom: 0.5rem;
    left: auto;
}

.enemy-rank[data-rank="S"] {
    background: linear-gradient(135deg, #ff4655, #ff2d3f);
    box-shadow: 0 2px 8px rgba(255, 70, 85, 0.4), 0 2px 16px 4px #ff4655cc, 0 2px 12px 2px #ff2d3fcc;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    animation: s-rank-glow 2s infinite;
}
.enemy-rank[data-rank="A"] {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.enemy-rank[data-rank="B"] {
    background: linear-gradient(135deg, #ff8f8f, #ff7575);
    box-shadow: 0 2px 4px rgba(255, 143, 143, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.enemy-rank[data-rank="C"] {
    background: linear-gradient(135deg, #ffb3b3, #ff9e9e);
    box-shadow: 0 2px 4px rgba(255, 179, 179, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.skill-type-badge {
    background: var(--accent);
    color: #fff;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.85em;
    margin-right: 8px;
    vertical-align: middle;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.skill-type-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.equipment-en {
    color: var(--text-secondary);
    font-size: 0.95em;
    font-style: italic;
    display: block;
    margin-top: 2px;
}

/* Notification styles */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 6px;
    color: white;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease-out, fadeOut 0.3s ease-out 1.7s;
}

.notification.success {
    background-color: var(--success);
}

.notification.error {
    background-color: var(--danger);
}

/* Improved paste button styles */
#pasteTurnBtn {
    background: #4ade80;
    color: #fff;
    font-weight: 700;
    border-radius: 6px;
    padding: 0.5rem 1.2rem;
    border: none;
    cursor: pointer;
    margin-left: 0.5rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

#pasteTurnBtn:hover, #pasteTurnBtn:focus {
    background: #22c55e;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#pasteTurnBtn.ready-to-paste {
    animation: pulse 1s infinite;
}

#pasteTurnBtn.ready-to-paste::after {
    content: 'Ready to paste!';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(74, 222, 128, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
    }
}

.delete-confirm-message {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.delete-confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.delete-confirm-cancel,
.delete-confirm-delete {
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.delete-confirm-cancel {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.delete-confirm-cancel:hover {
    background: var(--secondary);
    transform: translateY(-2px);
}

.delete-confirm-delete {
    background: linear-gradient(135deg, #ff4655 60%, #ff6b77 100%);
    color: white;
}

.delete-confirm-delete:hover {
    background: linear-gradient(135deg, #ff6b77 60%, #ff4655 100%);
    transform: translateY(-2px);
    box-shadow: 0 0 16px 2px #ff4655cc;
}

.delete-all-option {
    margin: 1rem 0;
    text-align: center;
}

.delete-all-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.delete-all-checkbox:hover {
    background: var(--secondary);
}

.delete-all-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.delete-all-checkbox input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.delete-all-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.delete-all-checkbox input[type="checkbox"]:hover {
    border-color: var(--accent);
}

.checkbox-label {
    color: var(--text-primary);
    font-size: 0.95rem;
    user-select: none;
}

.delete-all-checkbox:hover .checkbox-label {
    color: var(--accent);
}

/* Story Action Buttons */
.story-action-buttons {
    position: absolute;
    top: -18px;
    right: -18px;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}
.story-action-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2.5px solid var(--accent);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.18s, color 0.18s, transform 0.12s;
    outline: none;
    position: relative;
}
.story-action-btn.delete {
    background: linear-gradient(135deg, #ff4655 60%, #ff6b77 100%);
}
@keyframes pasteBtnGlow {
    0% {
        box-shadow: 0 2px 8px rgba(0,0,0,0.18), 0 0 8px 2px #22c55e80;
    }
    50% {
        box-shadow: 0 2px 8px rgba(0,0,0,0.18), 0 0 16px 4px #22c55ecc;
    }
    100% {
        box-shadow: 0 2px 8px rgba(0,0,0,0.18), 0 0 8px 2px #22c55e80;
    }
}
.story-action-btn.paste {
    background: linear-gradient(135deg, #22c55e 60%, #4ade80 100%);
    border: 2.5px solid transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18), 0 0 16px 4px #22c55e80;
    z-index: 11;
    animation: pasteBtnGlow 1.5s infinite;
}
.story-action-btn:hover, .story-action-btn:focus {
    filter: brightness(1.1);
    box-shadow: 0 4px 16px 0 var(--accent);
    transform: scale(1.08) translateY(-2px);
}
.story-action-btn:active {
    filter: brightness(0.95);
    transform: scale(0.97);
}
.story-action-btn svg {
    width: 1.3em;
    height: 1.3em;
    pointer-events: none;
}

.location-time-display {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    padding: 0.5rem 1.2rem;
    font-size: 1.08rem;
    font-weight: 500;
    gap: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 0.5rem;
    width: fit-content;
    max-width: 100%;
}
.location-label, .time-label {
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 0.3rem;
}
.location-value, .time-value {
    color: var(--text-primary);
    font-weight: 700;
}
.divider {
    width: 1.5px;
    height: 1.5em;
    background: var(--border-color);
    border-radius: 1px;
    margin: 0 1.2rem;
    display: inline-block;
}

/* Legendary Equipment Card */
.equipment-card.legendary {
    border: 2.5px solid #ffd700;
    box-shadow:
        0 0 0 2px #23232b, /* subtle inner border to blend with card */
        0 0 16px 2px #ffd70066, /* softer, less saturated glow */
        0 4px 24px 0 #0003;
    background: linear-gradient(120deg, #23232b 80%, #fffbe60a 100%);
    position: relative;
    animation: legendary-card-glow 2s infinite alternate;
}
@keyframes legendary-card-glow {
    0% { box-shadow: 0 0 0 2px #23232b, 0 0 16px 2px #ffd70066, 0 4px 24px 0 #0003; }
    100% { box-shadow: 0 0 0 2px #23232b, 0 0 24px 6px #ffd70099, 0 4px 32px 0 #0003; }
}

.equipment-card.mythical {
    border: 2.5px solid #a700bd;
    box-shadow:
        0 0 0 2px #23232b,
        0 0 16px 2px #a700bd66,
        0 4px 24px 0 #0003;
    background: linear-gradient(120deg, #23232b 80%, #f3e6ff0a 100%);
    position: relative;
    animation: mythical-card-glow 2s infinite alternate;
}
@keyframes mythical-card-glow {
    0% { box-shadow: 0 0 0 2px #23232b, 0 0 16px 2px #a700bd66, 0 4px 24px 0 #0003; }
    100% { box-shadow: 0 0 0 2px #23232b, 0 0 24px 6px #a700bd99, 0 4px 32px 0 #0003; }
}

.equipment-card.s-rank {
    border: 2.5px solid #ff4655;
    box-shadow:
        0 0 0 2px #23232b,
        0 0 16px 2px #ff465566,
        0 4px 24px 0 #0003;
    background: linear-gradient(120deg, #23232b 80%, #ffe6ec0a 100%);
    position: relative;
    animation: s-card-glow 2s infinite alternate;
}
@keyframes s-card-glow {
    0% { box-shadow: 0 0 0 2px #23232b, 0 0 16px 2px #ff465566, 0 4px 24px 0 #0003; }
    100% { box-shadow: 0 0 0 2px #23232b, 0 0 24px 6px #ff465599, 0 4px 32px 0 #0003; }
}

.world-map-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.world-map-btn .notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #ff4655;
    border-radius: 50%;
    display: none;
    animation: pulse 2s infinite;
}

.world-map-btn:hover .notification-dot {
    animation: pulse 1s infinite;
}

/* World Map Styles */
.world-map-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
}

.world-map-visual {
    flex: 1;
    min-height: 300px;
    position: relative;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.map-background {
    width: 100%;
    height: 100%;
    position: relative;
    background: 
        radial-gradient(circle at 20% 50%, #4a90e2 0%, #357abd 20%, transparent 30%),
        radial-gradient(circle at 80% 30%, #4a90e2 0%, #357abd 20%, transparent 30%),
        linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.continent.asia {
    position: absolute;
    top: 50%;
    left: 70%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 80px;
    background: linear-gradient(135deg, #8bc34a 0%, #689f38 100%);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.country.korea {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 40px;
    background: linear-gradient(135deg, #ffcdd2 0%, #ef9a9a 100%);
    border-radius: 6px;
    border: 2px solid #d32f2f;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}

.city.seoul {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: #ff5722;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(255, 87, 34, 0.6);
    animation: cityPulse 2s infinite;
}

@keyframes cityPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 87, 34, 0.6); }
    50% { box-shadow: 0 0 20px rgba(255, 87, 34, 0.8); }
}

.location-marker {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    opacity: 0;
    animation: markerFadeIn 0.5s ease-in-out 0.5s forwards;
}

@keyframes markerFadeIn {
    to { opacity: 1; }
}

.marker-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.marker-label {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    text-align: center;
    font-weight: 500;
}

.world-map-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    min-height: 200px;
    max-width: 600px;
    margin: 0 auto;
}

.world-map-list-item {
    background: var(--secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 1.2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
}
.world-map-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    border-color: var(--accent);
}
.world-map-list-item .place-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.2rem;
}
.world-map-list-item .place-details {
    font-size: 1rem;
    color: var(--text-secondary);
}

.world-map-add-controls {
    display: flex;
    gap: 0.7rem;
    justify-content: center;
    margin-bottom: 1.5rem;
    background: none;
    padding: 0;
}
.world-map-add-controls input {
    background: var(--secondary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
    border-radius: 7px;
    font-size: 1rem;
    padding: 0.7rem 1rem;
    min-width: 180px;
    outline: none;
    transition: border 0.18s, box-shadow 0.18s;
    height: 44px;
    box-shadow: none;
}
.world-map-add-controls input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255,70,85,0.10);
}
.world-map-add-controls button {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    border-radius: 7px;
    border: none;
    padding: 0 1.5rem;
    font-size: 1rem;
    height: 44px;
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.18s;
    box-shadow: none;
    outline: none;
    letter-spacing: 0.5px;
}
.world-map-add-controls button:hover, .world-map-add-controls button:focus {
    background: var(--accent-hover);
    box-shadow: 0 2px 8px 0 #ff465533;
}

.world-map-list-item .world-map-remove-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.world-map-list-item .world-map-remove-btn:hover, .world-map-list-item .world-map-remove-btn:focus {
    background: var(--accent);
    color: #fff;
}

.location-time-display {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    padding: 0.5rem 1.2rem;
    font-size: 1.08rem;
    font-weight: 500;
    gap: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 0.5rem;
    width: fit-content;
    max-width: 100%;
}
.location-value {
    color: var(--text-primary);
    font-weight: 700;
    max-width: 320px;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
    display: inline-block;
}
@media (max-width: 600px) {
  .location-value {
    max-width: 120px;
  }
}

/* Equipment Image Mode Styles */
.equipment-header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.equipment-image-mode-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: var(--text-secondary);
}

.equipment-image-mode-checkbox:hover {
    color: var(--text-primary);
}

.equipment-image-mode-checkbox input[type="checkbox"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.equipment-image-mode-checkbox input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.equipment-image-mode-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.equipment-image-mode-checkbox input[type="checkbox"]:hover {
    border-color: var(--accent);
}

.equipment-image-mode-checkbox .checkbox-label {
    font-weight: 500;
}

.equipment-image-container {
    width: 100%;
    height: 250px;
    min-height: 250px;
    max-height: 250px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.8rem;
    overflow: hidden;
    position: relative;
    background: var(--secondary);
}

.equipment-image-container:hover {
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.equipment-image-container.empty {
    height: 80px;
}

.equipment-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.equipment-image-placeholder {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
}

.equipment-content {
    display: flex;
    flex-direction: column;
    position: relative;
}
.equipment-copy-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--secondary);
    border: 2px solid var(--accent);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    cursor: pointer;
    z-index: 2;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.equipment-copy-btn:hover, .equipment-copy-btn:focus {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px 0 var(--accent);
}
.equipment-copy-btn::before {
    content: '\2398'; /* Unicode for copy icon (⎘) */
    font-size: 1.2em;
    display: block;
    line-height: 1;
}
