/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --accent: #e94560;
    --easy: #00b8a3;
    --medium: #ffc01e;
    --hard: #ff375f;
    --optimal-bg: rgba(0, 184, 163, 0.1);
    --optimal-border: #00b8a3;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
    padding: 2rem;
    text-align: center;
    border-bottom: 2px solid var(--accent);
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, var(--accent), #ff8a80);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
}

.search-container {
    flex: 1;
    min-width: 250px;
    position: relative;
}

#search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid var(--bg-card);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

#search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.filter-container {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--bg-card);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.filter-btn:hover {
    border-color: var(--text-secondary);
}

.filter-btn.active {
    border-color: var(--accent);
    background: var(--bg-card);
}

.filter-btn.easy.active {
    border-color: var(--easy);
    color: var(--easy);
}

.filter-btn.medium.active {
    border-color: var(--medium);
    color: var(--medium);
}

.filter-btn.hard.active {
    border-color: var(--hard);
    color: var(--hard);
}

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

/* Problem List */
.problem-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Problem Card Link */
.problem-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Problem Card */
.problem-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--bg-card);
    transition: var(--transition);
}

.problem-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.1);
}

.problem-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    gap: 1rem;
    user-select: none;
}

.problem-number {
    font-weight: 700;
    color: var(--accent);
    min-width: 30px;
}

.problem-id {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 40px;
}

.problem-title {
    flex: 1;
    font-weight: 600;
    font-size: 1.1rem;
}

.problem-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.problem-title a:hover {
    color: var(--accent);
}

.difficulty-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.difficulty-badge.easy {
    background: rgba(0, 184, 163, 0.2);
    color: var(--easy);
}

.difficulty-badge.medium {
    background: rgba(255, 192, 30, 0.2);
    color: var(--medium);
}

.difficulty-badge.hard {
    background: rgba(255, 55, 95, 0.2);
    color: var(--hard);
}

.open-icon {
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.problem-card:hover .open-icon {
    color: var(--accent);
}

/* Sections */
.section {
    margin-bottom: 1.5rem;
}

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

.section-header .section-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--bg-card);
}

/* Problem Navigation */
.problem-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
}

.problem-navigation.top {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--bg-card);
}

.problem-navigation.bottom {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--bg-card);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    flex: 1;
    max-width: 48%;
}

.nav-btn:hover:not(.disabled) {
    background: var(--bg-secondary);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.nav-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-btn.nav-prev {
    border: 1px solid var(--bg-secondary);
}

.nav-btn.nav-next {
    border: 1px solid var(--bg-secondary);
    justify-content: flex-end;
    text-align: right;
}

.nav-arrow {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--accent);
}

.nav-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.nav-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

@media (max-width: 768px) {
    .problem-navigation {
        flex-direction: column;
    }

    .nav-btn {
        max-width: 100%;
    }

    .nav-btn.nav-next {
        justify-content: flex-start;
        text-align: left;
    }

    .nav-title {
        max-width: 100%;
    }
}

.leetcode-link {
    background: linear-gradient(135deg, #ffa116, #ff8c00);
    color: #000;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
}

.leetcode-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 161, 22, 0.4);
}

.problem-statement {
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* Examples */
.example {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.example-label {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.example-content {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
}

.example-content p {
    margin: 0.25rem 0;
}

.example-explanation {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Approaches */
.approach {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 2px solid transparent;
}

.approach.optimal {
    background: var(--optimal-bg);
    border-color: var(--optimal-border);
}

.approach-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.approach-name {
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.optimal-badge {
    background: var(--optimal-border);
    color: var(--bg-primary);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

.complexity-info {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
}

.complexity {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.complexity-label {
    color: var(--text-secondary);
}

.complexity-value {
    color: var(--easy);
    font-weight: 600;
    font-family: 'Fira Code', 'Consolas', monospace;
}

.memory-technique {
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.1), rgba(255, 138, 128, 0.1));
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.memory-label {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
}

.memory-text {
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.95rem;
}

.approach-explanation {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.approach-explanation p {
    margin: 0;
}

.explanation-list {
    margin: 0;
    padding-left: 1.5rem;
    list-style-type: disc;
}

.explanation-list li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.explanation-list li:last-child {
    margin-bottom: 0;
}

.approach-visualization {
    margin: 1rem 0;
    padding-top: 1rem;
    border-top: 1px solid var(--bg-secondary);
}

.viz-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-style: italic;
}

/* Code Blocks */
.code-block {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.code-block pre {
    margin: 0;
    border-radius: var(--border-radius);
}

.code-block pre code {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Visualization */
.visualization-container {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.viz-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.viz-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--accent);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.viz-btn:hover {
    background: var(--accent);
    color: #fff;
}

.viz-display {
    font-family: 'Fira Code', 'Consolas', monospace;
}

.viz-row {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.viz-label {
    min-width: 50px;
    color: var(--text-secondary);
    font-weight: 600;
}

.viz-chars {
    display: flex;
    gap: 2px;
}

.viz-char {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 2px solid var(--bg-primary);
    border-radius: 4px;
    font-size: 1rem;
    transition: var(--transition);
}

.viz-char.active {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.2);
    transform: scale(1.1);
}

.viz-char.matched {
    border-color: var(--easy);
    background: rgba(0, 184, 163, 0.3);
}

.viz-char.skipped {
    border-color: var(--medium);
    background: rgba(255, 192, 30, 0.2);
    opacity: 0.7;
}

.viz-status {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    text-align: center;
    font-size: 0.95rem;
}

.viz-status.success {
    background: rgba(0, 184, 163, 0.2);
    color: var(--easy);
}

.viz-status.failure {
    background: rgba(255, 55, 95, 0.2);
    color: var(--hard);
}

/* Array visualization */
.viz-array {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.viz-cell {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 2px solid var(--bg-primary);
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
}

.viz-cell.active {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.2);
    transform: scale(1.05);
}

.viz-cell.highlight {
    border-color: var(--medium);
    background: rgba(255, 192, 30, 0.2);
}

.viz-cell.success {
    border-color: var(--easy);
    background: rgba(0, 184, 163, 0.3);
}

.viz-cell.heap-top {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.15);
}

.viz-cell.pivot {
    border-color: var(--medium);
    background: rgba(255, 192, 30, 0.3);
}

.viz-cell.target {
    border-color: var(--easy);
    box-shadow: 0 0 8px var(--easy);
}

.viz-cell.search-range {
    background: rgba(255, 192, 30, 0.1);
}

.viz-cell.empty {
    color: var(--text-secondary);
    font-style: italic;
    font-weight: normal;
}

/* Two pointer visualization */
.viz-char.left-pointer {
    border-color: #4fc3f7;
    background: rgba(79, 195, 247, 0.2);
    position: relative;
}

.viz-char.left-pointer::after {
    content: 'L';
    position: absolute;
    bottom: -20px;
    font-size: 0.7rem;
    color: #4fc3f7;
    font-weight: bold;
}

.viz-char.right-pointer {
    border-color: #ba68c8;
    background: rgba(186, 104, 200, 0.2);
    position: relative;
}

.viz-char.right-pointer::after {
    content: 'R';
    position: absolute;
    bottom: -20px;
    font-size: 0.7rem;
    color: #ba68c8;
    font-weight: bold;
}

.viz-char.invalid {
    border-color: var(--hard);
    background: rgba(255, 55, 95, 0.3);
    text-decoration: line-through;
}

/* Values and maps */
.viz-value {
    color: var(--accent);
    font-weight: 600;
}

.viz-value.success {
    color: var(--easy);
}

.viz-map {
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.viz-stack {
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--medium);
}

.viz-invalid {
    color: var(--hard);
    font-weight: 600;
}

.viz-result {
    color: var(--easy);
    font-weight: 600;
}

.viz-step {
    padding: 0.5rem;
    color: var(--text-secondary);
}

.viz-placeholder {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

/* Loading & No Results */
.loading, .no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--bg-card);
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 1.8rem;
    }

    .controls {
        flex-direction: column;
    }

    .search-container {
        width: 100%;
    }

    .filter-container {
        width: 100%;
        justify-content: center;
    }

    .problem-header {
        flex-wrap: wrap;
    }

    .approach-header {
        flex-direction: column;
        align-items: flex-start;
    }

    main {
        padding: 1rem;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 4px;
}

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

/* Problem Detail Page */
.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
    display: inline-block;
    margin-bottom: 0.5rem;
}

.back-link:hover {
    color: var(--accent);
}

.problem-detail {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 2rem;
    border: 1px solid var(--bg-card);
}

.error-message {
    text-align: center;
    padding: 2rem;
}

.error-message p {
    margin-bottom: 1rem;
    color: var(--hard);
}

.back-btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    transition: var(--transition);
}

.back-btn:hover {
    background: var(--hard);
}

/* Visualization Trigger Button */
.viz-trigger {
    margin: 1rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.1), rgba(255, 138, 128, 0.05));
    border: 1px solid var(--accent);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.viz-open-btn {
    background: linear-gradient(135deg, var(--accent), #ff8a80);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.viz-open-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.viz-icon {
    font-size: 1.2rem;
}

.viz-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
}

/* Visualization Modal */
.viz-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.viz-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.viz-modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    width: 70vw;
    height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--bg-card);
    animation: slideUp 0.3s ease;
}

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

.viz-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary));
    border-bottom: 1px solid var(--bg-card);
}

.viz-modal-header h3 {
    color: var(--accent);
    font-size: 1.2rem;
    margin: 0;
}

.viz-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: var(--transition);
}

.viz-close-btn:hover {
    color: var(--accent);
    transform: scale(1.1);
}

.viz-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 300px;
}

.viz-main-display {
    flex: 2;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}

.viz-info-panel {
    flex: 1;
    padding: 1.5rem;
    background: var(--bg-card);
    border-left: 1px solid var(--bg-primary);
    overflow-y: auto;
    min-width: 250px;
}

.viz-info-content h4 {
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.viz-info-content p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    word-break: break-word;
}

.viz-info-content strong {
    color: var(--text-primary);
}

/* Modal Controls */
.viz-modal-controls {
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-top: 1px solid var(--bg-primary);
}

.viz-control-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.viz-ctrl-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--bg-primary);
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.viz-ctrl-btn:hover {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.1);
}

.viz-ctrl-btn.viz-play-btn {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    min-width: 100px;
}

.viz-ctrl-btn.viz-play-btn:hover {
    background: #ff8a80;
}

.viz-ctrl-btn.viz-play-btn.playing {
    background: var(--medium);
    border-color: var(--medium);
}

.viz-speed-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.viz-speed-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.viz-speed-slider {
    width: 150px;
    height: 6px;
    -webkit-appearance: none;
    background: var(--bg-primary);
    border-radius: 3px;
    outline: none;
}

.viz-speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

#viz-speed-value {
    color: var(--accent);
    font-weight: 600;
    min-width: 40px;
}

.viz-progress-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#viz-step-counter {
    color: var(--text-secondary);
    font-size: 0.85rem;
    min-width: 100px;
}

.viz-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.viz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--easy));
    transition: width 0.3s ease;
}

.viz-modal-status {
    padding: 1rem 1.5rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    text-align: center;
    font-size: 1rem;
    border-top: 1px solid var(--bg-card);
}

.viz-modal-status.success {
    background: rgba(0, 184, 163, 0.2);
    color: var(--easy);
}

.viz-modal-status.failure {
    background: rgba(255, 55, 95, 0.2);
    color: var(--hard);
}

/* Visualization Structures */
.viz-structure {
    width: 100%;
    margin-bottom: 1rem;
}

.viz-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

/* Array Structure */
.viz-array-structure {
    text-align: center;
}

.viz-array-label,
.viz-hashmap-label,
.viz-heap-label,
.viz-stack-label,
.viz-tree-label,
.viz-linkedlist-label,
.viz-grid-label,
.viz-intervals-label,
.viz-pass-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.viz-array-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.viz-array-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
    background: var(--bg-card);
    border: 2px solid var(--bg-primary);
    border-radius: 8px;
    padding: 8px;
    transition: var(--transition);
}

.viz-cell-index {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.viz-cell-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.viz-array-cell.active {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.2);
    transform: scale(1.1);
}

.viz-array-cell.highlight {
    border-color: var(--medium);
    background: rgba(255, 192, 30, 0.2);
}

.viz-array-cell.success {
    border-color: var(--easy);
    background: rgba(0, 184, 163, 0.3);
}

.viz-array-cell.pivot {
    border-color: var(--medium);
    background: rgba(255, 192, 30, 0.3);
}

.viz-array-cell.target {
    border-color: var(--easy);
    box-shadow: 0 0 10px var(--easy);
}

.viz-array-cell.search-range {
    background: rgba(255, 192, 30, 0.1);
}

/* HashMap Structure */
.viz-hashmap-structure {
    margin-top: 1.5rem;
    text-align: center;
}

.viz-hashmap-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

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

.viz-hashmap-entry {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--bg-primary);
}

.viz-hashmap-key {
    color: var(--accent);
    font-weight: 600;
}

.viz-hashmap-arrow {
    color: var(--text-secondary);
}

.viz-hashmap-value {
    color: var(--easy);
    font-weight: 600;
}

/* Heap Structure */
.viz-heap-structure {
    text-align: center;
}

.viz-heap-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

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

.viz-heap-tree {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.viz-heap-node {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
    font-weight: 700;
}

.viz-heap-node.heap-top {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.2);
}

.viz-heap-array {
    color: var(--text-secondary);
    font-family: monospace;
}

/* String Structure */
.viz-string-structure,
.viz-twopointer-structure {
    text-align: center;
}

.viz-string-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 1rem;
}

.viz-string-char {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 40px;
    background: var(--bg-card);
    border: 2px solid var(--bg-primary);
    border-radius: 6px;
    padding: 6px;
    transition: var(--transition);
    position: relative;
}

.viz-char-index {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.viz-char-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.viz-string-char.active {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.2);
}

.viz-string-char.left-pointer {
    border-color: #4fc3f7;
    background: rgba(79, 195, 247, 0.2);
}

.viz-string-char.right-pointer {
    border-color: #ba68c8;
    background: rgba(186, 104, 200, 0.2);
}

.viz-string-char.matched {
    border-color: var(--easy);
    background: rgba(0, 184, 163, 0.3);
}

.viz-string-char.mismatch {
    border-color: var(--hard);
    background: rgba(255, 55, 95, 0.3);
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.viz-string-char.skipped {
    border-color: var(--medium);
    background: rgba(255, 192, 30, 0.3);
    opacity: 0.5;
    text-decoration: line-through;
}

.viz-string-char.checking {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.15);
}

.viz-skip-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-top: 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.viz-skip-action.valid {
    background: rgba(0, 184, 163, 0.2);
    border: 2px solid var(--easy);
    color: var(--easy);
}

.viz-skip-action.invalid {
    background: rgba(255, 55, 95, 0.2);
    border: 2px solid var(--hard);
    color: var(--hard);
}

.viz-skip-label {
    font-size: 0.9rem;
}

.viz-skip-result {
    font-size: 1.2rem;
}

.viz-string-char.invalid {
    border-color: var(--hard);
    background: rgba(255, 55, 95, 0.3);
    text-decoration: line-through;
}

.viz-pointer-label {
    position: absolute;
    top: -22px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.viz-pointer-label.left {
    background: #4fc3f7;
    color: #000;
}

.viz-pointer-label.right {
    background: #ba68c8;
    color: #fff;
}

/* Stack Structure */
.viz-stack-structure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.viz-stack-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.viz-stack-visual {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 80px;
    border: 2px solid var(--bg-primary);
    border-radius: 6px;
    padding: 8px;
    background: var(--bg-card);
}

.viz-stack-empty {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

.viz-stack-item {
    background: var(--bg-secondary);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
    border: 1px solid var(--accent);
}

/* Recursion Structure */
.viz-recursion-call {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.viz-call-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.viz-call-code {
    color: var(--accent);
    font-size: 1rem;
    background: var(--bg-primary);
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.viz-deletions {
    text-align: center;
    margin-top: 1rem;
}

.viz-deletion-count {
    color: var(--medium);
    font-weight: 700;
    font-size: 1.2rem;
}

/* Two Pass Structure */
.viz-twopass-structure {
    text-align: center;
}

.viz-pass-result {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 6px;
}

.viz-result-label {
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.viz-result-value {
    color: var(--easy);
    font-weight: 600;
    font-family: monospace;
}

/* Tree Structure */
.viz-tree-structure {
    text-align: center;
}

.viz-tree-container {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 8px;
}

.viz-tree-current,
.viz-tree-level,
.viz-tree-nodes,
.viz-tree-result {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.viz-tree-result {
    color: var(--easy);
    font-weight: 600;
}

/* Linked List Structure */
.viz-linkedlist-structure {
    text-align: center;
}

.viz-linkedlist-container {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 8px;
}

.viz-ll-operation {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
}

.viz-ll-operation span {
    color: var(--text-primary);
}

.viz-ll-result {
    color: var(--easy);
    font-weight: 600;
    font-family: monospace;
}

/* Grid Structure */
.viz-grid-structure {
    text-align: center;
}

.viz-grid-container {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 8px;
}

.viz-grid-display {
    font-family: monospace;
    white-space: pre;
    color: var(--text-primary);
}

.viz-grid-pos {
    margin-top: 1rem;
    color: var(--accent);
}

/* Intervals Structure */
.viz-intervals-structure {
    text-align: center;
}

.viz-intervals-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.viz-interval {
    background: var(--bg-card);
    border: 2px solid var(--bg-primary);
    padding: 8px 16px;
    border-radius: 6px;
    font-family: monospace;
    font-weight: 600;
    transition: var(--transition);
}

.viz-interval.active {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.2);
}

/* Generic Structure */
.viz-generic-structure {
    text-align: center;
}

.viz-generic-content pre {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 8px;
    text-align: left;
    overflow-x: auto;
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* Responsive Modal */
@media (max-width: 768px) {
    .viz-modal-content {
        width: 95vw;
        height: 90vh;
    }

    .viz-modal-body {
        flex-direction: column;
    }

    .viz-info-panel {
        border-left: none;
        border-top: 1px solid var(--bg-primary);
        min-width: auto;
    }

    .viz-control-row {
        flex-wrap: wrap;
    }

    .viz-ctrl-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* ========================================
   VISUAL DIAGRAM STYLES
   ======================================== */

/* Tree Diagram SVG */
.viz-tree-diagram {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.viz-tree-svg {
    width: 100%;
    max-width: 500px;
    height: auto;
}

.viz-tree-edge {
    stroke: var(--text-secondary);
    stroke-width: 2;
    opacity: 0.6;
}

.viz-tree-node circle {
    fill: var(--bg-card);
    stroke: var(--accent);
    stroke-width: 3;
    transition: var(--transition);
}

.viz-tree-node text {
    fill: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    text-anchor: middle;
    font-family: 'Fira Code', monospace;
}

.viz-tree-node.active circle {
    fill: rgba(233, 69, 96, 0.3);
    stroke: var(--accent);
    stroke-width: 4;
}

.viz-tree-node.rightmost circle {
    fill: rgba(0, 184, 163, 0.3);
    stroke: var(--easy);
}

.viz-tree-node.highlight circle {
    fill: rgba(255, 192, 30, 0.3);
    stroke: var(--medium);
}

.viz-tree-info {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    text-align: left;
}

.viz-tree-info > div {
    margin: 0.5rem 0;
    font-family: monospace;
}

.viz-tree-current, .viz-tree-level {
    color: var(--accent);
}

.viz-tree-result, .viz-tree-diameter {
    color: var(--easy);
    font-weight: 600;
}

.viz-tree-empty {
    color: var(--text-secondary);
    padding: 2rem;
    text-align: center;
}

/* Heap Diagram SVG */
.viz-heap-svg {
    width: 100%;
    max-width: 400px;
    height: auto;
    display: block;
    margin: 0 auto 1rem;
}

.viz-heap-edge {
    stroke: var(--text-secondary);
    stroke-width: 2;
    opacity: 0.5;
}

.viz-heap-node circle {
    fill: var(--bg-card);
    stroke: var(--medium);
    stroke-width: 2;
    transition: var(--transition);
}

.viz-heap-node.heap-top circle {
    fill: rgba(0, 184, 163, 0.3);
    stroke: var(--easy);
    stroke-width: 3;
}

.viz-heap-node text {
    fill: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    text-anchor: middle;
    font-family: 'Fira Code', monospace;
}

.viz-heap-array-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.viz-heap-array-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.viz-heap-array {
    display: flex;
    gap: 4px;
}

.viz-heap-array-node {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 2px solid var(--bg-primary);
    border-radius: 4px;
    font-family: monospace;
    font-weight: 600;
}

.viz-heap-array-node.heap-top {
    border-color: var(--easy);
    background: rgba(0, 184, 163, 0.2);
}

.viz-heap-action {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-top: 1rem;
    color: var(--text-primary);
}

.viz-heap-empty {
    color: var(--text-secondary);
    padding: 2rem;
    text-align: center;
    font-style: italic;
}

/* Linked List Visual Diagram */
.viz-ll-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.viz-ll-row.result {
    background: rgba(0, 184, 163, 0.1);
    border: 2px solid var(--easy);
}

.viz-ll-label {
    min-width: 50px;
    font-weight: 700;
    color: var(--accent);
    font-family: monospace;
}

.viz-ll-nodes {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.viz-ll-node {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 3px solid var(--accent);
    border-radius: 8px;
    transition: var(--transition);
}

.viz-ll-node.active {
    background: rgba(233, 69, 96, 0.3);
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

.viz-ll-node.result {
    border-color: var(--easy);
    background: rgba(0, 184, 163, 0.2);
}

.viz-ll-value {
    font-weight: 700;
    font-size: 1.1rem;
    font-family: monospace;
    color: var(--text-primary);
}

.viz-ll-arrow {
    color: var(--text-secondary);
    font-size: 1.5rem;
    font-weight: 300;
}

.viz-ll-null {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.85rem;
    padding: 0 0.5rem;
}

.viz-ll-operation {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    text-align: center;
}

.viz-ll-calc {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: monospace;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.viz-ll-operand {
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 700;
}

.viz-ll-operator {
    color: var(--text-secondary);
    font-weight: 300;
}

.viz-ll-carry {
    background: rgba(255, 192, 30, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: var(--medium);
    font-weight: 600;
}

.viz-ll-sum {
    background: rgba(0, 184, 163, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: var(--easy);
    font-weight: 700;
}

.viz-ll-digit {
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* Grid Visual Diagram */
.viz-grid-visual {
    display: inline-block;
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.viz-grid-row {
    display: flex;
    gap: 4px;
    margin: 4px 0;
}

.viz-grid-cell {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-primary);
    border-radius: 4px;
    font-family: monospace;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.viz-grid-cell.wall {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.viz-grid-cell.land {
    background: rgba(0, 184, 163, 0.3);
    border-color: var(--easy);
    color: var(--text-primary);
}

.viz-grid-cell.current {
    background: rgba(233, 69, 96, 0.4);
    border-color: var(--accent);
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(233, 69, 96, 0.5);
}

.viz-grid-cell.visited {
    background: rgba(255, 192, 30, 0.2);
    border-color: var(--medium);
}

.viz-grid-cell.island-0 { background: rgba(102, 187, 106, 0.4); }
.viz-grid-cell.island-1 { background: rgba(66, 165, 245, 0.4); }
.viz-grid-cell.island-2 { background: rgba(171, 71, 188, 0.4); }
.viz-grid-cell.island-3 { background: rgba(255, 167, 38, 0.4); }
.viz-grid-cell.island-4 { background: rgba(236, 64, 122, 0.4); }

.viz-grid-info {
    text-align: left;
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.viz-grid-info > div {
    margin: 0.5rem 0;
    font-family: monospace;
    font-size: 0.9rem;
}

.viz-grid-action {
    color: var(--text-primary);
}

.viz-grid-sizes, .viz-grid-neighbors {
    color: var(--text-secondary);
}

.viz-grid-potential {
    color: var(--easy);
    font-weight: 600;
}

/* Intervals Timeline Diagram */
.viz-intervals-timeline {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.viz-intervals-axis {
    position: relative;
    height: 30px;
    border-bottom: 2px solid var(--text-secondary);
    margin-bottom: 1rem;
}

.viz-axis-mark {
    position: absolute;
    bottom: -5px;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.viz-axis-mark::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    width: 1px;
    height: 8px;
    background: var(--text-secondary);
}

.viz-intervals-bars {
    position: relative;
    min-height: 50px;
}

.viz-interval-bar {
    position: absolute;
    height: 30px;
    background: linear-gradient(135deg, var(--accent), #c0392b);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 5px 0;
    transition: var(--transition);
    opacity: 0.8;
}

.viz-interval-bar:nth-child(odd) {
    top: 0;
}

.viz-interval-bar:nth-child(even) {
    top: 35px;
}

.viz-interval-bar.active {
    opacity: 1;
    transform: scaleY(1.2);
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

.viz-interval-bar.merged {
    background: linear-gradient(135deg, var(--easy), #1e8449);
}

.viz-interval-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    padding: 0 4px;
}

.viz-intervals-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding-top: 1rem;
    border-top: 1px solid var(--bg-primary);
}

.viz-interval-item {
    background: var(--bg-card);
    border: 2px solid var(--bg-primary);
    padding: 6px 12px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    transition: var(--transition);
}

.viz-interval-item.active {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.2);
}

/* Word Abbreviation Visualization */
.viz-wordabbr-structure {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
}

.viz-wa-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
}

.viz-wa-label {
    min-width: 60px;
    font-weight: 700;
    color: var(--accent);
    font-family: monospace;
    font-size: 1rem;
}

.viz-wa-chars {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.viz-wa-char {
    position: relative;
    width: 36px;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    background: var(--bg-card);
    border: 2px solid var(--bg-primary);
    border-radius: 6px;
    transition: var(--transition);
    padding-bottom: 4px;
}

.viz-wa-pointer {
    position: absolute;
    top: -24px;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--accent);
    color: white;
}

.viz-wa-char.pointer-i .viz-wa-pointer {
    background: var(--accent);
}

.viz-wa-char.pointer-j .viz-wa-pointer {
    background: #9b59b6;
}

.viz-wa-index {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.viz-wa-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: monospace;
    color: var(--text-primary);
}

.viz-wa-char.pointer-i,
.viz-wa-char.pointer-j {
    transform: scale(1.1);
    z-index: 2;
}

.viz-wa-char.pointer-i {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.15);
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.3);
}

.viz-wa-char.pointer-j {
    border-color: #9b59b6;
    background: rgba(155, 89, 182, 0.15);
    box-shadow: 0 0 10px rgba(155, 89, 182, 0.3);
}

.viz-wa-char.matched {
    border-color: var(--easy);
    background: rgba(0, 184, 163, 0.3);
}

.viz-wa-char.skipped {
    background: rgba(255, 192, 30, 0.2);
    border-color: var(--medium);
    opacity: 0.7;
}

.viz-wa-char.digit {
    background: rgba(52, 152, 219, 0.15);
    border-color: #3498db;
}

.viz-wa-char.digit .viz-wa-value {
    color: #3498db;
}

.viz-wa-char.skipping {
    animation: pulse 0.5s ease-in-out;
}

.viz-wa-char.end-marker {
    background: var(--bg-primary);
    border-style: dashed;
    width: 50px;
}

.viz-wa-char.end-marker .viz-wa-value {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

@keyframes pulse {
    0%, 100% { transform: scale(1.1); }
    50% { transform: scale(1.2); }
}

.viz-wa-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: monospace;
}

.viz-wa-action.match {
    background: rgba(0, 184, 163, 0.2);
    border: 2px solid var(--easy);
    color: var(--easy);
}

.viz-wa-action.skip {
    background: rgba(255, 192, 30, 0.2);
    border: 2px solid var(--medium);
    color: var(--medium);
}

.viz-wa-action.end {
    background: rgba(233, 69, 96, 0.2);
    border: 2px solid var(--accent);
    color: var(--accent);
}

.viz-wa-icon {
    font-size: 1.3rem;
}

.viz-wa-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 8px;
}

.viz-wa-compare-char {
    font-size: 2rem;
    font-weight: 700;
    font-family: monospace;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 2px solid var(--easy);
    color: var(--text-primary);
}

.viz-wa-compare-op {
    font-size: 1.5rem;
    color: var(--easy);
    font-weight: 700;
}

/* ========================================
   PATTERN TAGS & FILTERING
   ======================================== */

/* Pattern Filter Section on Index Page */
.pattern-filter-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
}

.pattern-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.pattern-filter-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.clear-patterns-btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.clear-patterns-btn:hover {
    background: var(--accent);
    color: white;
}

.pattern-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pattern-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-primary);
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.pattern-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.pattern-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.pattern-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.7rem;
}

.pattern-btn.active .pattern-count {
    background: rgba(255, 255, 255, 0.3);
}

/* Pattern Tags on Problem Cards */
.problem-patterns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--bg-secondary);
}

.pattern-tag {
    display: inline-block;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.pattern-tag.shared {
    background: rgba(233, 69, 96, 0.2);
    color: var(--accent);
}

/* Pattern Tags on Problem Detail Page */
.problem-pattern-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pattern-tag-link {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), #c0392b);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.pattern-tag-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.4);
}

/* Related Problems Section */
.related-problems-section {
    margin-top: 2rem;
}

.related-problems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.related-problem-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-decoration: none;
    transition: var(--transition);
}

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

.related-problem-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.related-problem-number {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
}

.related-problem-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
}

.related-problem-patterns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

@media (max-width: 768px) {
    .pattern-filters {
        max-height: 150px;
        overflow-y: auto;
    }

    .related-problems-grid {
        grid-template-columns: 1fr;
    }
}

/* Audio Player Styles */
.audio-section {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    border: 1px solid var(--accent);
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
}

.audio-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.audio-section .section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.audio-icon {
    font-size: 1.2rem;
}

.audio-playlist-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.audio-playlist-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.audio-player-container {
    padding: 1rem 0 0;
}

.audio-player-container audio {
    display: none;
}

.audio-player-custom {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: var(--border-radius);
}

.audio-play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.audio-play-btn:hover {
    background: #ff6b81;
    transform: scale(1.05);
}

.audio-progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.audio-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 45px;
    text-align: center;
    font-family: monospace;
}

.audio-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.audio-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.audio-progress-handle {
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    left: 0%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s ease;
}

.audio-progress-bar:hover .audio-progress-handle {
    transform: translate(-50%, -50%) scale(1.2);
}

.audio-volume-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.audio-volume-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
}

.audio-volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    background: var(--bg-secondary);
    border-radius: 2px;
    outline: none;
}

.audio-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.audio-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.audio-speed-container {
    flex-shrink: 0;
}

.audio-speed-select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--bg-card);
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.audio-speed-select:focus {
    outline: none;
    border-color: var(--accent);
}

.audio-description {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--bg-secondary);
}

.audio-description p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* Responsive audio player */
@media (max-width: 768px) {
    .audio-player-custom {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .audio-progress-container {
        order: 2;
        width: 100%;
    }

    .audio-volume-container {
        order: 3;
    }

    .audio-volume-slider {
        width: 60px;
    }

    .audio-speed-container {
        order: 4;
    }
}

/* Audio Navigation Link in Header */
.audio-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.audio-nav-link:hover {
    background: #ff6b81;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}
