:root {
    --font-size: 20px;
}

main {
    display: block;
    margin: 0;
    padding: 0;
}

.hk-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 28px 80px;
    display: flex;
    flex-direction: column;
    gap: 52px;
}

.hk-input-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hk-input {
    width: 100%;
    background: var(--container-color);
    color: var(--text-color);
    border: 2px solid transparent;
    border-radius: 14px;
    padding: 18px 22px;
    font-size: 2rem;
    outline: none;
    transition: border-color 0.2s;
}

.hk-input:focus {
    border-color: var(--accent-color);
}

.hk-hint {
    font-size: 0.78rem;
    color: #888;
    padding-left: 4px;
}

.hk-hint.error {
    color: #e05555;
}

.hk-section {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.hk-section-title {
    font-size: 0.78rem;
    color: #888;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid #3a3a3a;
    padding-bottom: 10px;
    margin: 0;
}

.hk-cards {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.hk-card {
    flex: 1 1 200px;
    background: var(--container-color);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hk-card-label {
    font-size: 0.72rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.hk-card-value {
    font-size: 1.15rem;
    word-break: break-all;
}

.hk-binary {
    line-height: 1.7;
}

.hk-bits-scroll {
    overflow-x: auto;
    padding-bottom: 6px;
}

.hk-bits-grid {
    display: flex;
    gap: 14px;
    width: max-content;
}

.hk-byte-group {
    display: flex;
    gap: 3px;
}

.hk-bit-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.hk-bit-box {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: #2a2a2a;
    color: #555;
}

.hk-bit-box.set {
    background: var(--accent-color);
    color: #fff;
}

.hk-bit-index {
    font-size: 0.58rem;
    color: #555;
}

.hk-align-table {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.hk-align-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hk-align-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hk-align-row-name {
    font-size: 0.95rem;
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.hk-align-row-note {
    font-size: 0.72rem;
    color: #888;
}

.hk-badge {
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.hk-badge.aligned {
    background: #163322;
    color: #4ecf70;
}

.hk-badge.unaligned {
    background: #3a1515;
    color: #e05555;
}

.hk-align-cells {
    display: flex;
}

.hk-cell-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
}

.hk-cell-box {
    width: 100%;
    height: 20px;
    border: 1px solid #2e2e2e;
    border-radius: 2px;
    background: #242424;
    box-sizing: border-box;
}

.hk-cell-box.hk-cell-boundary {
    background: #122a45;
    border-color: #2e78c4;
}

.hk-cell-box.hk-cell-you-aligned {
    background: #163322;
    border-color: #4ecf70;
}

.hk-cell-box.hk-cell-you-unaligned {
    background: #3a1515;
    border-color: #e05555;
}

.hk-cell-label {
    font-size: 0.48rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
}

.hk-legend {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

.hk-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hk-legend-swatch {
    display: inline-block;
    width: 15px;
    height: 15px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid #2e2e2e;
    background: #242424;
}

.hk-legend-swatch.hk-cell-boundary {
    background: #122a45;
    border-color: #2e78c4;
}

.hk-legend-swatch.hk-cell-you-aligned {
    background: #163322;
    border-color: #4ecf70;
}

.hk-legend-swatch.hk-cell-you-unaligned {
    background: #3a1515;
    border-color: #e05555;
}

.hk-empty {
    color: #555;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .hk-page {
        padding: 32px 16px 60px;
        gap: 40px;
    }

    .hk-input {
        font-size: 1.4rem;
        padding: 14px 16px;
    }

    .hk-card {
        flex: 1 1 100%;
    }

    .hk-align-row-name {
        font-size: 0.85rem;
    }
}
