:root {
    --app-bg: #f5f7fb;
    --app-card: #ffffff;
    --app-border: #dfe5ef;
    --app-text: #1f2937;
    --app-muted: #6b7280;
    --app-primary: #3546f0;
    --app-radius: 12px;
}

html {
    font-size: 14px;
}

body {
    background: var(--app-bg);
    color: var(--app-text);
}

.app-container {
    max-width: 1180px;
}

.app-navbar {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--app-border);
    min-height: 48px;
}

.navbar-brand {
    font-size: .95rem;
}

.nav-link {
    padding-top: .35rem;
    padding-bottom: .35rem;
}

.compact-toggler {
    padding: .25rem .45rem;
    font-size: .85rem;
}

.app-hero {
    background: linear-gradient(135deg, #2739e8, #6d5dfc);
    color: white;
    border-radius: var(--app-radius);
    padding: 1rem 1.2rem;
}

.app-hero h1 {
    font-size: 1.35rem;
    margin-bottom: .25rem;
}

.app-hero p {
    font-size: .9rem;
    margin-bottom: 0;
    opacity: .9;
}

.app-card {
    background: var(--app-card);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}

.app-card-header {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--app-border);
    background: #fbfcff;
}

.app-card-header h2 {
    font-size: 1rem;
    margin: 0;
}

.app-card-body {
    padding: 1rem;
}

.form-label {
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: .25rem;
}

.form-control,
.btn,
.badge {
    border-radius: 8px;
}

.form-control-sm,
.btn-sm {
    font-size: .82rem;
    padding: .35rem .55rem;
}

.step-item {
    display: flex;
    gap: .75rem;
    padding: .75rem 0;
    border-bottom: 1px dashed var(--app-border);
}

.step-item:last-child {
    border-bottom: 0;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e9ecf5;
    color: var(--app-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step-item.active .step-number {
    background: var(--app-primary);
    color: white;
}

.step-content h3 {
    font-size: .92rem;
    margin-bottom: .15rem;
}

.step-content p {
    font-size: .8rem;
    color: var(--app-muted);
    margin-bottom: .45rem;
}

.bit-box {
    background: #0f172a;
    color: #dbeafe;
    border-radius: 8px;
    padding: .6rem;
    font-size: .78rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 0;
    max-height: 160px;
    overflow: auto;
}

@media (max-width: 576px) {
    html {
        font-size: 13px;
    }

    .app-container {
        padding-left: .75rem;
        padding-right: .75rem;
    }

    .app-hero {
        padding: .85rem;
    }

    .app-hero h1 {
        font-size: 1.1rem;
    }

    .app-card-header,
    .app-card-body {
        padding: .75rem;
    }

    .step-item {
        gap: .55rem;
    }

    .step-number {
        width: 24px;
        height: 24px;
        font-size: .7rem;
    }
}

.bit-data {
    font-family: Consolas, monospace;
    font-size: .82rem;
    line-height: 1.5;
}

.key-round-card {
    border: 1px solid var(--app-border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.key-round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .55rem .75rem;
    background: #f8f9ff;
    border-bottom: 1px solid var(--app-border);
}

.key-round-header h4 {
    font-size: .95rem;
    margin: 0;
}

.key-round-body {
    padding: .75rem;
}

.step-mini-title {
    font-weight: 700;
    font-size: .82rem;
    margin-bottom: .35rem;
}

.bit-line {
    margin-bottom: .4rem;
}

.bit-label {
    font-size: .78rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: .1rem;
}

.bit-value {
    font-family: Consolas, monospace;
    font-size: .78rem;
    line-height: 1.55;
    word-break: break-all;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    padding: .35rem .45rem;
}

.compact-accordion .accordion-item {
    border: 1px solid var(--app-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: .5rem;
}

.compact-accordion .accordion-button {
    padding: .55rem .75rem;
    font-size: .88rem;
    font-weight: 700;
    background: #f8f9ff;
}

.compact-accordion .accordion-button:not(.collapsed) {
    color: #1f2937;
    background: #eef2ff;
    box-shadow: none;
}

.compact-accordion .accordion-button:focus {
    box-shadow: none;
    border-color: var(--app-border);
}

.compact-accordion .accordion-body {
    padding: .75rem;
}

.key-round-body {
    background: #fff;
}

.step-mini-title {
    font-weight: 700;
    font-size: .82rem;
    margin-bottom: .35rem;
}

.bit-line {
    margin-bottom: .4rem;
}

.bit-label {
    font-size: .78rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: .1rem;
}

.bit-value {
    font-family: Consolas, monospace;
    font-size: .78rem;
    line-height: 1.55;
    word-break: break-all;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    padding: .35rem .45rem;
}

/* Base state (Expanded) */
.btn-toggle::after {
  content: '\25BC'; /* Unicode for down arrow ▼ */
  display: inline-block;
  margin-left: 10px;
  transition: transform 0.3s ease;
}

/* Collapsed state (Bootstrap adds .collapsed automatically) */
.btn-toggle.collapsed::after {
  transform: rotate(-90deg); /* Rotates to point right ► */
}

.feistel-round-card {
    border: 1px solid var(--app-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: .5rem;
}

.feistel-round-body {
    background: #fff;
}

.xor-block {
    font-family: Consolas, monospace;
    font-size: .78rem;
    line-height: 1.55;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    padding: .5rem .6rem;
    overflow-x: auto;
}

.xor-block hr {
    margin: .3rem 0;
}

.formula-box {
    font-family: Consolas, monospace;
    font-size: .78rem;
    line-height: 1.55;
    background: #f8f9ff;
    border: 1px dashed #c7d2fe;
    border-radius: 7px;
    padding: .5rem .6rem;
}