:root {
    --primary: #2d3e50;
    --secondary: #e74c3c;
    --accent: #3498db;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f7fa;
    color: var(--dark);
    transition: background-color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    flex: 1;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    padding: 1rem 0;
}

h1 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    margin-bottom: 0.5rem;
    font-weight: 700;
    line-height: 1.3;
}

h1 .highlight {
    color: var(--secondary);
    font-weight: 800;
}

.tagline {
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    color: #666;
    font-weight: 300;
    margin-top: 0.5rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr));
    gap: 1.5rem;
    width: 100%;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.card-header h2 {
    margin: 0;
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    font-weight: 600;
    color: var(--primary);
}

.card-header .icon {
    font-size: 1.4rem;
    color: var(--accent);
}

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.hero-card {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary), #34495e);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-card h2 {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    margin-bottom: 0.5rem;
}

.hero-card p {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    margin: 1rem 0;
}

.phonetic {
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: clamp(1.2rem, 3vw, 2rem);
    margin: 1rem 0;
    word-break: break-word;
    max-width: 100%;
}

.timer {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.timer i {
    margin-right: 0.5rem;
}

.badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.badge-primary {
    background-color: var(--accent);
    color: white;
}

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

.badge-warning {
    background-color: var(--warning);
    color: white;
}

.badge-danger {
    background-color: var(--danger);
    color: white;
}

.log-container {
    flex: 1;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    background: #2d3436;
    color: #dfe6e9;
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    flex: 1;
}

.metric-box {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.metric-value {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-weight: 700;
    color: var(--primary);
    margin: 0.5rem 0;
}

.metric-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin: 0;
}

.chart-container {
    position: relative;
    height: 300px;
    margin-top: 1rem;
    width: 100%;
}

.chart-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    margin: 0.2rem;
}

.color-box {
    width: 12px;
    height: 12px;
    margin-right: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.examples-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.examples-list li {
    padding: 0.75rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.examples-list li:last-child {
    border-bottom: none;
}

.examples-list .word {
    font-weight: 600;
    flex: 1;
    min-width: 100px;
}

.examples-list .transcription {
    font-family: 'Courier New', monospace;
    color: var(--accent);
    text-align: right;
    flex: 2;
    word-break: break-word;
}

.status-indicator {
    display: flex;
    align-items: center;
    margin-top: 1rem;
    justify-content: center;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.status-active {
    background-color: var(--success);
    box-shadow: 0 0 0 rgba(46, 204, 113, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

.status-inactive {
    background-color: var(--danger);
}

.status-text {
    font-size: 0.85rem;
    color: #666;
}

footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1.5rem;
    color: #7f8c8d;
    font-size: 0.9rem;
    border-top: 1px solid #eee;
    width: 100%;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--dark);
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s;
    z-index: 10;
}

.theme-toggle:hover {
    transform: rotate(30deg);
}

.dark-mode {
    --primary: #3d5a80;
    --light: #1a1a2e;
    --dark: #e0e0e0;
    background: #121212;
    color: #e0e0e0;
}

.dark-mode .card {
    background: #1e1e24;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.dark-mode .metric-box {
    background: #1e1e24;
}

.dark-mode .card-header {
    border-bottom-color: #333;
}

.dark-mode .examples-list li {
    border-bottom-color: #333;
}

.dark-mode .metric-value {
    color: var(--accent);
}

.dark-mode footer {
    border-top-color: #333;
}

.refresh-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s, background-color 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-left: 1rem;
    flex-shrink: 0;
}

.refresh-btn:hover {
    background: #2980b9;
    transform: rotate(180deg);
}

.refresh-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.refresh-btn i {
    font-size: 1rem;
}

.phonetic-details {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.syllable {
    position: relative;
    margin: 0 2px;
    padding: 0 2px;
}

.syllable.stressed {
    font-weight: bold;
}

.syllable.stressed::before {
    content: "'";
    position: absolute;
    top: -5px;
    left: 0;
    color: var(--secondary);
}

.rotating {
    animation: spin 1s linear infinite;
}

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

.examples-container {
    flex: 1;
    height: 100%;
    max-height: 350px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) #eee;
}

.examples-container::-webkit-scrollbar {
    width: 8px;
}

.examples-container::-webkit-scrollbar-track {
    background: #eee;
    border-radius: 4px;
}

.examples-container::-webkit-scrollbar-thumb {
    background-color: var(--accent);
    border-radius: 4px;
}

.dark-mode .examples-container::-webkit-scrollbar-track {
    background: #333;
}

.metrics-grid-2x2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
    height: 50%;
    min-height: 200px;
    flex: 1;
}

.metrics-grid-2x2 .metric-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 1rem;
}

.metrics-grid-2x2 .metric-value {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    margin: 0.5rem 0;
}

.metrics-grid-2x2 .metric-label {
    font-size: clamp(0.8rem, 2vw, 1rem);
}

/* Make specific cards full width on all screen sizes */
.full-width {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .timer {
        position: relative;
        bottom: auto;
        right: auto;
        margin: 1rem auto 0;
        display: inline-flex;
    }
    
    .hero-card {
        padding: 1.5rem 1rem;
    }
    
    .metrics-grid-2x2 {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }
    
    .metrics-grid-2x2 .metric-box {
        padding: 0.75rem;
    }
}

@media (max-width: 500px) {
    .examples-list li {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .examples-list .transcription {
        text-align: left;
        width: 100%;
    }
}
  .network-container {
    display: flex;
    flex-direction: column;
    height: 400px;
    width: 100%;
    position: relative;
}

.network-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.layers-toggle {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.toggle-label input {
    margin-right: 5px;
}

.layer-name {
    font-size: 0.9rem;
    font-weight: 500;
}

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

.neural-network-viz {
    flex: 1;
    width: 100%;
    position: relative;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
    overflow: hidden;
}

.layer-group {
    position: absolute;
    z-index: 2;
}

.layer-label {
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    transform: translateX(-50%);
    text-align: center;
}

.neuron {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #3498db;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s, background-color 0.2s;
}

.neuron.active {
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.7);
    z-index: 10;
}

.neuron.encoder {
    background-color: #3498db;
}

.neuron.syllable {
    background-color: #e74c3c;
}

.neuron.phoneme {
    background-color: #2ecc71;
}

.neuron.stress {
    background-color: #f39c12;
}

.neuron-connection {
    position: absolute;
    background: rgba(200, 200, 200, 0.2);
    transform-origin: 0 0;
    z-index: 0;
    pointer-events: none;
}

.dark-mode .neural-network-viz {
    background: rgba(255,255,255,0.05);
}

.dark-mode .neuron-connection {
    background: rgba(255, 255, 255, 0.15);
}

.transformation-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 400px;
}
      
.transformation-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 10px;
}

.word-info {
    font-size: 1.2rem;
    font-weight: 600;
}

.word-value {
    color: var(--accent);
}

.transformation-buttons {
    display: flex;
    gap: 10px;
}

.step-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.step-btn:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.step-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.step-info {
    font-size: 0.9rem;
    color: #666;
}

.transformation-display {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex: 1;
    overflow-x: auto;
    padding: 10px 0;
    gap: 5px;
}

.transformation-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 150px;
    max-width: 250px;
    height: 100%;
    padding: 10px;
    border-radius: 8px;
    background: rgba(0,0,0,0.03);
    flex: 1;
}

.transformation-stage h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    text-align: center;
    color: var(--primary);
}

.transformation-stage h4 {
    font-size: 0.9rem;
    margin: 5px 0;
    color: var(--primary);
}

.transformation-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 50px;
    height: 50px;
}

.flow-arrow {
    font-size: 2rem;
    color: var(--accent);
}

.char-container, .encoding-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.decoding-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    gap: 10px;
    overflow-y: auto;
}

.decoder-output {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.output-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 5px;
    min-height: 30px;
}

.transcription-result {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    padding: 15px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--accent);
    word-break: break-word;
}

.char-item, .encoded-item {
    display: flex;
    padding: 5px;
    border-radius: 4px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 5px;
    transition: background-color 0.3s, transform 0.3s;
    cursor: default;
}

.char-item {
    justify-content: center;
    font-weight: bold;
}

.encoded-item {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    flex-direction: column;
}

.char-item.active, .encoded-item.active {
    background: rgba(52, 152, 219, 0.2);
    transform: scale(1.05);
}

.token-item {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 4px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 2px;
    font-family: 'Courier New', monospace;
    transition: opacity 0.3s, transform 0.3s;
}

.token-item.syllable {
    background-color: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.token-item.phoneme {
    background-color: rgba(46, 204, 113, 0.1);
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.token-item.stress {
    background-color: rgba(243, 156, 18, 0.1);
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.token-item.active {
    transform: scale(1.1);
    font-weight: bold;
}

.token-item.fade {
    opacity: 0.5;
}

.encoded-preview {
    font-size: 0.75rem;
    color: #666;
    margin-top: 3px;
}

/* Dark mode adjustments */
.dark-mode .transformation-stage {
    background: rgba(255,255,255,0.05);
}

.dark-mode .char-item, 
.dark-mode .encoded-item,
.dark-mode .token-item {
    background: #1e1e24;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.dark-mode .char-item.active, 
.dark-mode .encoded-item.active {
    background: rgba(52, 152, 219, 0.3);
}

.dark-mode .token-item.syllable {
    background-color: rgba(231, 76, 60, 0.2);
}

.dark-mode .token-item.phoneme {
    background-color: rgba(46, 204, 113, 0.2);
}

.dark-mode .token-item.stress {
    background-color: rgba(243, 156, 18, 0.2);
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .transformation-display {
        flex-direction: column;
        align-items: stretch;
        overflow-y: auto;
        overflow-x: hidden;
        gap: 10px;
    }
    
    .transformation-stage {
        max-width: none;
        min-height: 100px;
    }
    
    .transformation-flow {
        width: 100%;
        height: 30px;
    }
    
    .flow-arrow {
        transform: rotate(90deg);
    }



}

.latent-space-card {
    height: auto;
    min-height: 500px;
}

.latent-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.viz-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.control-label {
    font-weight: 500;
    color: var(--primary);
    font-size: 0.9rem;
}

.viz-mode-select {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
}

.pattern-info {
    font-size: 0.9rem;
    color: #666;
}

.experiment-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
}

.word-input {
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #ddd;
    min-width: 200px;
}

.run-btn {
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.run-btn:hover {
    background: #2980b9;
}

.run-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.results-display {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
    min-width: 150px;
}

.result-label {
    font-size: 0.9rem;
    color: #666;
}

.result-value {
    font-family: 'Courier New', monospace;
    padding: 0.5rem;
    background: rgba(255,255,255,0.5);
    border-radius: 4px;
    border: 1px solid #eee;
    font-size: 1.1rem;
}

.latent-viz-container {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    height: 350px;
}

.pattern-viz {
    flex: 3;
    background: rgba(255,255,255,0.5);
    border-radius: 8px;
    border: 1px solid #eee;
    height: 100%;
    min-height: 300px;
    position: relative;
    overflow: hidden;
}

.pattern-details {
    flex: 1;
    min-width: 200px;
    background: rgba(255,255,255,0.5);
    border-radius: 8px;
    border: 1px solid #eee;
    padding: 1rem;
    height: 100%;
    overflow: auto;
}

.pattern-details h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--primary);
}

.pattern-details h4 {
    margin: 1rem 0 0.5rem;
    font-size: 0.9rem;
    color: var(--primary);
}

.pattern-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.stat-label {
    color: #666;
}

.stat-value {
    font-family: 'Courier New', monospace;
    color: var(--accent);
}

.experiment-hint {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

.latent-tooltip {
    position: fixed;
    background: white;
    border-radius: 4px;
    padding: 0.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    pointer-events: none;
    z-index: 1000;
    max-width: 200px;
    font-size: 0.9rem;
}

.tooltip-header {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.3rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #eee;
}

.tooltip-content {
    font-size: 0.8rem;
    color: #666;
}

.error-message {
    padding: 1rem;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #c0392b;
    text-align: center;
}

/* Dark mode adjustments */
.dark-mode .viz-mode-select,
.dark-mode .word-input {
    background: #1e1e24;
    border-color: #333;
    color: #e0e0e0;
}

.dark-mode .experiment-controls {
    background: rgba(255,255,255,0.05);
}

.dark-mode .pattern-viz,
.dark-mode .pattern-details,
.dark-mode .result-value {
    background: rgba(0,0,0,0.2);
    border-color: #333;
}

.dark-mode .latent-tooltip {
    background: #1e1e24;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.dark-mode .tooltip-header {
    border-bottom-color: #333;
    color: var(--accent);
}

.dark-mode .tooltip-content {
    color: #ccc;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .latent-viz-container {
        flex-direction: column;
        height: auto;
    }

    .pattern-viz {
        height: 300px;
    }
    
    .pattern-details {
        min-height: 200px;
    }
    
    .viz-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Animation for selection */
@keyframes pulse-selection {
    0% {
        stroke-width: 2;
        stroke-opacity: 0.8;
    }
    50% {
        stroke-width: 4;
        stroke-opacity: 1;
    }
    100% {
        stroke-width: 2;
        stroke-opacity: 0.8;
    }
}

.selected-pattern {
    animation: pulse-selection 2s infinite;
}

/*--*/

/* Stacked dialects list */
#dialects-list .phonetic {
    display: block;
    border-bottom: 1px solid var(--rule, #2C2C30);
    padding: 6px 0;
    margin-bottom: 0;
}
#dialects-list .phonetic:last-child {
    border-bottom: none;
}

/* Dialect button and controls - append to the end of style.css */
.transcription-controls {
    display: flex;
    align-items: center;
    position: absolute;
    left: 1rem;
    bottom: 1rem;
}

.dialect-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s, background-color 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.dialect-btn:hover {
    background: #2980b9;
    transform: rotate(180deg);
}

.dialect-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.dialect-counter {
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 10px;
    margin-left: 0.5rem;
}

/* Multi-transcription styling for example list */
.examples-list .transcription-item {
    display: block;
    padding: 0.2rem 0;
    border-radius: 4px;
}

.examples-list .transcription-item:nth-child(odd) {
    background: rgba(52, 152, 219, 0.05);
}

.examples-list .transcription-item:nth-child(even) {
    background: rgba(52, 152, 219, 0.1);
}

/* Dark mode adjustments */
.dark-mode .transcription-item:nth-child(odd) {
    background: rgba(52, 152, 219, 0.1);
}

.dark-mode .transcription-item:nth-child(even) {
    background: rgba(52, 152, 219, 0.15);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .transcription-controls {
        position: static;
        margin-bottom: 1rem;
    }
}
