/* Strumenti dei cifrari: usa i colori e i font della collana definiti dal layout (--accent, --hl, --hero-bg, --font-*). */
.cipher-hero { display: block; max-width: 48rem; }
.cipher-hero h1 { margin-top: .4rem; }
.cipher-page .section { max-width: 48rem; margin: 0 auto; }

.cipher-messages { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.cipher-messages a { display: flex; flex-direction: column; gap: 0; padding: .55rem .9rem; border-radius: .75rem; background: #fff; color: var(--ink); text-decoration: none; border: 2px solid transparent; }
.cipher-messages a:hover, .cipher-messages a:focus-visible { border-color: var(--accent); }
.cipher-messages a[aria-current="true"] { border-color: var(--accent); box-shadow: inset .4rem 0 0 var(--hl); }
.cipher-message-title { font-weight: 700; line-height: 1.3; }
.cipher-number { color: var(--accent); margin-right: .25rem; }
.cipher-message-meta { font-size: 1rem; color: #555; display: flex; align-items: center; gap: .4rem; }
.cipher-level { display: inline-flex; gap: .2rem; }
.cipher-level span { width: .7rem; height: .7rem; border-radius: 50%; border: 2px solid var(--accent); }
.cipher-level span.on { background: var(--accent); }
@media (min-width: 700px) { .cipher-messages { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.cipher-panel { background: #fff; border-radius: 1rem; padding: 1.25rem; margin-top: 1rem !important; scroll-margin-top: 1rem; }
.cipher-panel h2 { margin-top: 0; }
.cipher-panel h3 { font-family: var(--font-subheading); font-weight: 400; margin: 1rem 0 .3rem; }
.cipher-all-title { margin-top: 2rem !important; font-size: 1.05rem; }
.cipher-tool-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.cipher-chip, .cipher-btn { font: inherit; font-size: 1rem; border: 2px solid var(--accent); background: #fff; color: var(--accent); border-radius: 999px; padding: .45rem .9rem; cursor: pointer; min-height: 2.75rem; min-width: 2.75rem; }
.cipher-chip[aria-pressed="true"], .cipher-btn.primary { background: var(--accent); color: #fff; }
.cipher-chip:focus-visible, .cipher-btn:focus-visible, .cipher-tool textarea:focus-visible, .cipher-tool select:focus-visible, .cipher-tool input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.cipher-tool { margin-top: 1rem; }
.cipher-tool label { display: block; font-weight: 700; margin: 1rem 0 .35rem; }
.cipher-tool textarea { width: 100%; min-height: 5rem; font: inherit; font-family: "Courier New", monospace; font-size: 1.25rem; letter-spacing: .08em; padding: .75rem; border: 2px solid #555; border-radius: .5rem; resize: vertical; }
.cipher-tool select { font: inherit; padding: .4rem .6rem; min-height: 2.75rem; min-width: 4rem; }
.cipher-tool input[type=range] { flex: 1; min-width: 10rem; height: 2.75rem; accent-color: var(--accent); }
.cipher-switch { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 1rem; }
.cipher-switch label { font-weight: 700; }
.cipher-switch select { font: inherit; font-size: 1rem; min-height: 2.75rem; max-width: 100%; padding: .3rem .5rem; }
.cipher-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .6rem; }
.cipher-mode { display: inline-flex; gap: .4rem; }
.cipher-output { min-height: 3.5rem; margin-top: .5rem; padding: .75rem; border: 2px dashed var(--accent); border-radius: .5rem; font-family: "Courier New", monospace; font-size: 1.5rem; font-weight: 700; letter-spacing: .15em; word-break: break-word; background: color-mix(in srgb, var(--hl) 12%, #fff); }
.cipher-steps { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.cipher-step { display: inline-flex; flex-direction: column; align-items: center; min-width: 2.2rem; padding: .25rem; border-radius: .35rem; background: #f2f2f2; font-family: "Courier New", monospace; }
.cipher-step b { font-size: 1.25rem; }
.cipher-step small { font-size: .75rem; color: #555; }
.cipher-step.change { background: color-mix(in srgb, var(--hl) 45%, #fff); }
.cipher-key { font-size: 1.6rem; font-weight: 700; min-width: 2.5rem; text-align: center; }

.cipher-wheel { width: 100%; max-width: 22rem; margin: .5rem auto 0; display: block; }
.cipher-wheel text { font-family: "Courier New", monospace; font-weight: 700; font-size: 21px; text-anchor: middle; dominant-baseline: central; }
.cipher-wheel .ring-out { fill: var(--ink); }
.cipher-wheel .ring-in { fill: var(--accent); }
.cipher-wheel .inner { transition: transform .35s ease; transform-origin: 200px 200px; }
.cipher-wheel .marker { fill: var(--hl); }
@media (prefers-reduced-motion: reduce) { .cipher-wheel .inner { transition: none; } }
.cipher-wheel .inner.dragging { transition: none; }
.cipher-wheel-box { position: relative; max-width: 22rem; margin: .5rem auto 0; }
.cipher-wheel-box .cipher-wheel { margin: 0; }
/* Presa del disco interno (raggio 148 su 200): solo qui il dito gira il disco invece di scorrere la pagina. */
.cipher-wheel-grip { position: absolute; left: 13%; top: 13%; width: 74%; aspect-ratio: 1; border-radius: 50%; touch-action: none; cursor: grab; }
.cipher-wheel-grip:active { cursor: grabbing; }
.cipher-wheel-grip:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.cipher-wheel-hint { text-align: center; font-size: .95rem; color: #555; margin: .2rem 0 0; }

.cipher-table { border-collapse: collapse; margin: .5rem auto 0; font-family: "Courier New", monospace; }
.cipher-table th, .cipher-table td { border: 1px solid #999; width: 2.6rem; height: 2.6rem; text-align: center; font-size: 1.2rem; }
.cipher-table th { background: #f2f2f2; }
.cipher-table td.hit { background: var(--hl); font-weight: 700; }
.cipher-scroll { overflow-x: auto; }
.cipher-pairs { border-collapse: collapse; font-family: "Courier New", monospace; font-size: 1.05rem; }
.cipher-pairs td { border: 1px solid #ccc; min-width: 1.6rem; text-align: center; padding: .15rem; }
.cipher-pairs tr:last-child td { color: var(--accent); font-weight: 700; }

.cipher-keyboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.2rem, 1fr)); gap: .4rem; margin-top: .5rem; }
.cipher-keyboard button { aspect-ratio: 1; border: 2px solid #555; background: #fff; border-radius: .5rem; padding: .35rem; cursor: pointer; color: var(--ink); }
.cipher-keyboard button:active { background: var(--hl); }
.cipher-keyboard svg { width: 100%; height: 100%; display: block; }

.cipher-tap { display: block; width: 100%; margin-top: .6rem; padding: 1.4rem; font: inherit; font-weight: 700; border-radius: 1rem; border: 3px solid var(--accent); background: #fff; color: var(--accent); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.cipher-tap.down { background: var(--accent); color: #fff; }
