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

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

header h1 {
    color: #2d3748;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    color: #718096;
    font-size: 1.1rem;
    font-weight: 300;
}

.instruction-selector {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.selector-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 200px;
}

.selector-group label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    display: block;
    margin-bottom: 10px;
    align-self: flex-start;
}

#isa-type-select, #bit-width-select {
    width: 100%;
    padding: 0 16px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 250px;
    color: #2d3748;
    box-sizing: border-box;
    height: 46px !important;
    line-height: 46px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%232d3748' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

#isa-type-select:focus, #bit-width-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

#isa-type-select:hover, #bit-width-select:hover {
    border-color: #007bff;
}

@media (max-width: 768px) {
    .instruction-selector {
        flex-direction: column;
        gap: 1rem;
    }
    
    .selector-group {
        min-width: 100%;
    }
    
    #isa-type-select, #bit-width-select {
        min-width: 100%;
    }
}

.instruction-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-height: 500px;
}

.welcome-message {
    text-align: center;
    color: #2d3748;
}

.welcome-message h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #4a5568;
}

.welcome-message p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: #718096;
}

.overview {
    text-align: left;
    max-width: 800px;
    margin: 0 auto;
}

.overview h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #2d3748;
    border-bottom: 2px solid #a0aec0;
    padding-bottom: 10px;
}

.overview ul {
    list-style: none;
}

.overview li {
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 1rem;
}

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

/* ESP32风格的按钮和状态样式 */
.btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin: 5px;
    font-family: inherit;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background: #0056b3;
}

.btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.status-result {
    margin: 10px 0;
    padding: 10px;
    border-radius: 3px;
    font-weight: 500;
}

.status-pass {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.status-fail {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.status-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.isa-section {
    display: none;
}

.isa-section.active {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

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

.isa-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #a0aec0;
}

.isa-header h2 {
    font-size: 2.2rem;
    color: #2d3748;
    margin-bottom: 10px;
}

.isa-description {
    font-size: 1.1rem;
    color: #718096;
    margin-bottom: 20px;
}

.batch-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.batch-btn {
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    margin: 5px;
    transition: background-color 0.3s ease;
}

.batch-btn:hover {
    background: #0056b3;
}

.batch-btn.expand-all {
    background: #28a745;
}

.batch-btn.expand-all:hover {
    background: #1e7e34;
}

.instruction-grid {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.instruction-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.instruction-card:hover {
    border-color: #007bff;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.15);
}

.instruction-card.expanded {
    border-color: #007bff;
    box-shadow: 0 4px 20px rgba(0, 123, 255, 0.2);
}

.instruction-header {
    padding: 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.instruction-main-info {
    display: flex;
    align-items: baseline;
    flex: 1;
    gap: 15px;
}

.instruction-header:hover {
    background: rgba(0, 123, 255, 0.05);
}

.instruction-card.expanded .instruction-header {
    background: rgba(0, 123, 255, 0.08);
}

.expand-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #007bff;
    font-size: 0.9rem;
}

.expand-indicator::after {
    content: '展开';
}

.instruction-card.expanded .expand-indicator::after {
    content: '折叠';
}

.expand-arrow {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #007bff;
    transition: transform 0.3s ease;
    display: inline-block;
}

.instruction-card.expanded .expand-arrow {
    transform: rotate(180deg);
}

.instruction-details {
    padding: 0 20px 20px;
    background: #f8f9fa;
    max-height: 2000px;
    overflow: hidden;
    transition: all 0.5s ease;
}

.instruction-details.collapsed {
    max-height: 0;
    padding: 0 20px;
    opacity: 0;
}

.instruction-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2d3748;
    font-family: 'Courier New', monospace;
    min-width: 180px;
    flex-shrink: 0;
}

.instruction-format {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #2d3748;
    border-left: 4px solid #007bff;
}

.instruction-description {
    color: #4a5568;
    line-height: 1.7;
    flex: 1;
}

.instruction-format-section {
    padding: 0 20px 15px;
    border-bottom: 1px solid #e2e8f0;
}

.instruction-usage {
    margin-top: 15px;
}

.instruction-usage h4 {
    color: #2d3748;
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 600;
}

.instruction-usage ul {
    list-style: none;
}

.instruction-usage li {
    padding: 8px 0;
    color: #4a5568;
}

.note {
    background: #fff5e6;
    border: 1px solid #f6e05e;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    color: #744210;
}

.note strong {
    color: #744210;
    font-weight: 600;
}

.search-container {
    margin-top: 0;
    padding-top: 0;
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

#instruction-search {
    flex: 1;
    padding: 0 16px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    transition: all 0.3s ease;
    color: #2d3748;
    box-sizing: border-box;
    height: 46px !important;
    line-height: 46px;
}

#instruction-search:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

#search-btn, #clear-search {
    padding: 0 20px;
    font-size: 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin: 0;
    height: 46px !important;
    line-height: 46px;
    box-sizing: border-box;
}

#search-btn {
    background: #007bff;
    color: white;
}

#search-btn:hover {
    background: #0056b3;
}

#clear-search {
    background: #6c757d;
    color: white;
}

#clear-search:hover {
    background: #545b62;
}

.isa-badge {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.search-results h2 {
    text-align: center;
    color: #2d3748;
    margin-bottom: 20px;
}

.search-results p {
    text-align: center;
    color: #718096;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 2rem;
    }

    .instruction-card {
        margin-bottom: 15px;
    }

    .instruction-main-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .instruction-name {
        min-width: auto;
        margin-bottom: 5px;
    }

    .search-container {
        flex-direction: column;
        gap: 15px;
    }

    #instruction-search {
        width: 100%;
    }

    #search-btn, #clear-search {
        width: 100%;
    }
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #a0aec0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

.floating-toc {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 300px;
    max-height: 70vh;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-50%) translateX(20px);
}

.floating-toc.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.toc-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toc-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #2d3748;
    font-weight: 600;
}

.toc-content {
    max-height: calc(70vh - 140px);
    overflow-y: auto;
    padding: 10px 0;
}

.toc-content::-webkit-scrollbar {
    width: 6px;
}

.toc-content::-webkit-scrollbar-track {
    background: transparent;
}

.toc-content::-webkit-scrollbar-thumb {
    background: #a0aec0;
    border-radius: 3px;
}

.toc-content::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

.toc-search {
    padding: 0 15px 10px;
    border-bottom: 1px solid #e2e8f0;
}

.toc-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    background: white;
    color: #2d3748;
}

.toc-search input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.toc-section {
    border-bottom: 1px solid #f1f5f9;
}

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

.toc-section-title {
    padding: 12px 20px;
    background: rgba(74, 85, 104, 0.03);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: #2d3748;
    transition: all 0.2s ease;
    border: none;
    width: 100%;
    text-align: left;
}

.toc-section-title:hover {
    background: rgba(74, 85, 104, 0.08);
}

.toc-section-arrow {
    transform: rotate(90deg);
    transition: transform 0.2s ease;
}

.toc-section.collapsed .toc-section-arrow {
    transform: rotate(0deg);
}

.toc-instructions {
    max-height: 200px;
    overflow-y: auto;
    background: white;
    transition: all 0.3s ease;
}

.toc-instructions::-webkit-scrollbar {
    width: 4px;
}

.toc-instructions::-webkit-scrollbar-track {
    background: transparent;
}

.toc-instructions::-webkit-scrollbar-thumb {
    background: #a0aec0;
    border-radius: 2px;
}

.toc-instructions::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

.toc-section.collapsed .toc-instructions {
    max-height: 0;
}

.toc-instruction {
    padding: 6px 20px 6px 40px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #4a5568;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    background: white;
}

.toc-instruction:hover {
    background: rgba(0, 123, 255, 0.05);
    border-left-color: #007bff;
    color: #2d3748;
}

.toc-instruction.active {
    background: rgba(0, 123, 255, 0.1);
    border-left-color: #007bff;
    color: #2d3748;
    font-weight: 600;
}

.toc-instruction-name {
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.toc-instruction-desc {
    font-size: 0.75rem;
    color: #718096;
    margin-top: 2px;
    line-height: 1.3;
}

@media (max-width: 1200px) {
    .floating-toc {
        right: 15px;
        width: 280px;
    }
}

@media (max-width: 768px) {
    .floating-toc {
        position: fixed;
        top: auto;
        right: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 60vh;
        border-radius: 12px 12px 0 0;
        transform: translateY(100%);
    }

    .floating-toc.show {
        transform: translateY(0);
    }
}

.toc-fab {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    opacity: 0;
    transform: scale(0.8);
}

.toc-fab:hover {
    background: #0056b3;
    transform: scale(1.1);
}

.toc-fab.show {
    opacity: 1;
    transform: scale(1);
}

.toc-fab.active {
    background: #28a745;
}

@media (max-width: 768px) {
    .toc-fab {
        top: 15px;
        right: 15px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

.page-footer {
    background: white;
    border-top: 1px solid #ddd;
    margin-top: 50px;
    padding: 30px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.copyright {
    text-align: center;
}

.copyright p {
    color: #718096;
    margin: 5px 0;
}

.copyright a {
    color: #4a5568;
    text-decoration: none;
    font-weight: 600;
}

.copyright a:hover {
    color: #2d3748;
    text-decoration: underline;
}

.footer-links {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
}

.footer-links a {
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #2d3748;
}

.footer-links span {
    color: #a0aec0;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .footer-content {
        gap: 15px;
    }

    .footer-links {
        justify-content: center;
        flex-wrap: wrap;
    }
}