/* Classical cipher tools (Playfair, Two-Square, Four-Square, Bifid, Trifid, Baconian, Autokey,
   Running Key, Porta, Gronsfeld) — shared panel, v3.100.0. Page: includes/classic-tool.php */
.ct-tool { max-width: 920px; }
.ct-box { background: rgba(0, 17, 0, 0.93); border: 1px solid rgba(0, 255, 65, 0.5); border-radius: 10px; padding: 20px; margin-bottom: 22px; color: #cfc; }
.ct-box h2 { margin-top: 0; }
.ct-box h3 { color: #0ff; margin: 18px 0 6px; font-size: 1.05em; }
.ct-modes { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.ct-mode.is-on { background: #0f0; color: #000; }

.ct-keyrow { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-start; margin-bottom: 16px; }
.ct-param { display: flex; flex-direction: column; gap: 4px; color: #0ff; font-size: 0.92em; min-width: 0; flex: 0 1 auto; }
.ct-param[hidden] { display: none; }
.ct-param-wide { flex: 1 1 100%; }
.ct-param input, .ct-param select, .ct-param textarea {
    font: inherit; font-size: 16px; background: #000; color: #0f0; border: 1px solid #0a0; border-radius: 4px; padding: 6px 8px; min-height: 40px;
    box-sizing: border-box; max-width: 100%;
}
.ct-param input[type="text"] { width: 16em; }
.ct-param input[type="number"] { width: 6em; }
.ct-param textarea { width: 100%; resize: vertical; }
.ct-note { color: #9c9; font-size: 0.88em; margin: 6px 0; }
.ct-param .ct-note { margin: 0; max-width: 22em; }

.ct-label { display: block; color: #0ff; letter-spacing: 1px; text-transform: uppercase; font-size: 0.8em; margin: 8px 0 6px; }
.ct-tool #ct-in {
    width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; background: #000; color: #0f0; border: 1px solid #0a0;
    border-radius: 6px; padding: 10px; resize: vertical; letter-spacing: 0.05em;
}
.ct-out-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
.ct-out { display: block; min-height: 3.2em; white-space: pre-wrap; overflow-wrap: anywhere; background: #000; border: 1px solid #0ff; border-radius: 6px; padding: 10px; color: #fff; letter-spacing: 0.05em; }
.ct-small { font-size: 0.85em; padding: 6px 10px; }

/* Key squares */
.ct-visual { display: flex; flex-wrap: wrap; gap: 16px 22px; margin-top: 18px; }
.ct-visual.is-col { flex-direction: column; align-items: flex-start; }
.ct-visual.is-quad { display: grid; grid-template-columns: repeat(2, max-content); }
.ct-grid { margin: 0; min-width: 0; max-width: 100%; }
.ct-grid figcaption { color: #0ff; font-size: 0.85em; margin-bottom: 6px; overflow-wrap: anywhere; }
.ct-grid-scroll { overflow-x: auto; max-width: 100%; }
.ct-grid table { border-collapse: collapse; margin: 0; }
.ct-grid td, .ct-grid th { border: 1px solid rgba(0, 255, 0, 0.35); width: 2em; height: 2em; text-align: center; padding: 0 2px; }
.ct-grid td { color: #ffd700; font-weight: bold; }
.ct-grid th { color: #0ff; font-weight: normal; font-size: 0.85em; }
.ct-grid th.ct-corner { border-color: transparent; }
.ct-grid.is-plain td { color: #9c9; font-weight: normal; }
.ct-grid.is-wide td { width: auto; padding: 4px 8px; white-space: nowrap; font-weight: normal; }
.ct-grid table.has-lit td { color: #4a7a4a; font-weight: normal; }
.ct-grid table.has-lit tr.is-lit td { background: rgba(0, 255, 65, 0.2); color: #ffd700; font-weight: bold; }
.ct-grid table.has-lit tr.is-lit th { color: #0f0; font-weight: bold; }
.ct-grid .ct-note { max-width: 32em; }

/* Step by step */
.ct-explain { margin-top: 18px; }
.ct-explain summary { color: #0ff; cursor: pointer; }
.ct-explain pre {
    margin: 8px 0 0; background: #000; border: 1px solid rgba(0, 255, 0, 0.3); border-radius: 6px; padding: 10px; color: #cfc;
    white-space: pre; overflow-x: auto; font: inherit; font-size: 0.9em; line-height: 1.5; max-height: 26em;
}

/* Written sections */
.ct-learn p, .ct-learn li, .ct-faq p { line-height: 1.65; }
.ct-learn code, .ct-faq code { color: #ffd700; overflow-wrap: anywhere; }
.ct-learn a, .ct-faq a { color: #0ff; }
.ct-learn ol li, .ct-learn ul li { margin-bottom: 4px; }

/* Baconian: hide a message in letter case */
.ct-hide-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.ct-hide textarea, .ct-hide input[type="text"] {
    width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; background: #000; color: #0f0; border: 1px solid #0a0; border-radius: 6px; padding: 8px;
}

@media (max-width: 600px) {
    .ct-box { padding: 14px; }
    .ct-param, .ct-param input[type="text"] { width: 100%; }
    .ct-param { flex-basis: 100%; }
    .ct-visual.is-quad { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .ct-grid td, .ct-grid th { width: 1.6em; height: 1.6em; font-size: 0.9em; }
}
