.cf-tool.cf-tool{box-sizing:border-box;max-width:1152px;margin:0 auto;padding:28px 32px;border-radius:14px;background:#1C1B19;color:#F6F3EC;font-family:'Public Sans',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;font-size:17px;line-height:1.5;display:flex;flex-direction:column;gap:20px;text-align:left}
.cf-tool.cf-tool *{box-sizing:border-box}
.cf-tool.cf-tool h3{margin:0;padding:0;font-family:'Fraunces',Georgia,serif;font-size:30px;font-weight:600;line-height:1.15;color:#F6F3EC;letter-spacing:0;text-transform:none}
.cf-tool.cf-tool p{margin:0}
.cf-tool output{color:inherit}
.cf-tool.cf-tool label{margin:0;font-weight:400;color:inherit}
.cf-tool .cf-head{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:8px}
.cf-tool .cf-sub,.cf-tool .cf-note{font-size:15px;color:#D9D3C7}
.cf-tool .cf-label{font-size:14px;color:#D9D3C7}
.cf-tool .cf-mono{font-family:'IBM Plex Mono',ui-monospace,Menlo,Consolas,monospace}
.cf-tool .cf-col{display:flex;flex-direction:column;gap:6px}
.cf-tool.cf-tool button.cf-pill{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;min-height:48px;min-width:48px;padding:0 12px;border-radius:8px;border:1.5px solid #F2B880;background:transparent;color:#F6F3EC;font-family:'IBM Plex Mono',ui-monospace,Menlo,Consolas,monospace;font-size:17px;font-weight:600;line-height:1;cursor:pointer}
.cf-tool.cf-tool button.cf-pill:focus-visible{outline:2px solid #F6F3EC;outline-offset:2px}
.cf-tool.cf-tool input[type=text]{width:100%;max-width:none;height:auto;min-height:48px;margin:0;padding:0 14px;border-radius:8px;border:1px solid #5A5650;background:#2A2926;color:#F6F3EC;font-family:'IBM Plex Mono',ui-monospace,Menlo,Consolas,monospace;font-size:18px;line-height:1.2;box-shadow:none}
.cf-tool.cf-tool input[type=text]:focus{outline:2px solid #F2B880;outline-offset:1px;border-color:#F2B880}
.cf-shift .cf-controls{display:flex;flex-wrap:wrap;gap:16px 28px;align-items:flex-end}
.cf-shift .cf-grow{flex:1 1 300px;min-width:0}
.cf-shift .cf-keybox{display:flex;align-items:center;gap:12px}
.cf-tool.cf-tool button.cf-pill.cf-sq{width:48px;padding:0;font-size:24px}
.cf-shift .cf-keycol{align-items:center;min-width:96px}
.cf-shift .cf-key{font-size:30px;font-weight:600;line-height:1.1;color:#F2B880}
.cf-shift .cf-pairs{display:flex;flex-wrap:wrap;gap:4px}
.cf-shift .cf-pair{width:36px;display:flex;flex-direction:column;border-radius:6px;overflow:hidden;font-family:'IBM Plex Mono',ui-monospace,Menlo,Consolas,monospace;font-size:16px;font-weight:600;line-height:1.7;text-align:center}
.cf-shift .cf-plain{background:#F6F3EC;color:#1C1B19}
.cf-shift .cf-cipher{background:#B3400B;color:#FFFFFF}
.cf-shift .cf-out{min-height:1.3em;font-size:26px;font-weight:600;letter-spacing:.06em;line-height:1.3;color:#F2B880;overflow-wrap:anywhere}
@media (max-width:600px){.cf-tool.cf-tool{padding:22px 18px}.cf-tool.cf-tool h3{font-size:26px}.cf-shift .cf-out{font-size:22px}}
(function () {
var A = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var roots = document.querySelectorAll('.cf-shift:not([data-cf-ready])');
Array.prototype.forEach.call(roots, function (root) {
root.setAttribute('data-cf-ready', '1');
var q = function (k) { return root.querySelector('[data-cf="' + k + '"]'); };
var shift = 3;
var cipherCells = [];
for (var j = 0; 26 > j; j++) {
var pair = document.createElement('span');
pair.className = 'cf-pair';
var plainCell = document.createElement('span');
plainCell.className = 'cf-plain';
plainCell.textContent = A.charAt(j);
var cipherCell = document.createElement('span');
cipherCell.className = 'cf-cipher';
pair.appendChild(plainCell);
pair.appendChild(cipherCell);
q('pairs').appendChild(pair);
cipherCells.push(cipherCell);
}
q('msg').addEventListener('input', render);
q('dec').addEventListener('click', function () { shift = (shift + 25) % 26; render(); });
q('inc').addEventListener('click', function () { shift = (shift + 1) % 26; render(); });
function render() {
var up = String(q('msg').value).toUpperCase();
var out = '';
for (var i = 0; up.length > i; i++) {
var ix = A.indexOf(up.charAt(i));
out += ix === -1 ? up.charAt(i) : A.charAt((ix + shift) % 26);
}
cipherCells.forEach(function (cell, k) { cell.textContent = A.charAt((k + shift) % 26); });
q('key').textContent = String(shift);
q('out').textContent = out;
q('pairs').setAttribute('aria-label', 'Key ' + shift + ': A becomes ' + A.charAt(shift) + ', B becomes ' + A.charAt((1 + shift) % 26) + ', and so on around the alphabet.');
}
render();
});
})();