/* ============================================================
   Chess Move Cipher — Walkthrough Page Styles
   ============================================================ */

/* ─── Page base ─── */
.wt-back {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.wt-back:hover { color: var(--text); }
.wt-nav-sep  { color: var(--border-light); margin: 0 8px; }
.wt-nav-label { color: var(--gold); font-weight: 600; font-size: 0.88rem; }

/* ─── Input section ─── */
.wt-input-section {
  padding: 100px 0 60px;
  background: var(--bg);
}

.wt-page-header {
  text-align: center;
  margin-bottom: 40px;
}

.wt-page-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.wt-page-header p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ─── Mode tabs ─── */
.wt-mode-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 32px;
}

.wt-tab {
  padding: 10px 28px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.wt-tab:hover { border-color: var(--border-light); color: var(--text); }
.wt-tab.active {
  background: rgba(212,168,67,0.1);
  border-color: rgba(212,168,67,0.5);
  color: var(--gold);
}

/* ─── Form layout ─── */
.wt-form {
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
}

.wt-form-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.wt-fg-msg  { flex: 3; min-width: 200px; }
.wt-fg-key  { flex: 2; min-width: 160px; }
.wt-fg-btn  { flex-shrink: 0; }
.wt-hint    { font-size: 0.72rem; color: var(--text-dim); font-weight: 400; margin-left: 6px; }

.wt-run-btn { white-space: nowrap; }

/* ─── Viewer layout ─── */
.wt-viewer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding-bottom: 0;
}

/* Step bar */
.wt-step-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 32px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}

.wt-step-counter {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  min-width: 80px;
}

.wt-step-counter strong { color: var(--text); }

.wt-step-dots-wrap { flex: 1; overflow: hidden; }

.wt-step-dots {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.wt-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-light);
  flex-shrink: 0;
  transition: background 0.2s;
  cursor: pointer;
}
.wt-dot.done   { background: rgba(212,168,67,0.5); }
.wt-dot.active { background: var(--gold); box-shadow: 0 0 6px rgba(212,168,67,0.6); }

.wt-step-badge {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
  background: rgba(212,168,67,0.12);
  color: var(--gold);
  border: 1px solid rgba(212,168,67,0.3);
}

/* Type-specific badge colors */
.wt-step-badge.type-hmac_scored    { background: rgba(121,192,255,0.1); color: #79c0ff; border-color: rgba(121,192,255,0.3); }
.wt-step-badge.type-legal_moves    { background: rgba(100,130,220,0.1); color: #8b9eff; border-color: rgba(100,130,220,0.3); }
.wt-step-badge.type-usable_moves   { background: rgba(50,210,80,0.1);   color: #56d364; border-color: rgba(50,210,80,0.3); }
.wt-step-badge.type-bit_reading    { background: rgba(212,168,67,0.12); color: var(--gold); border-color: rgba(212,168,67,0.3); }
.wt-step-badge.type-move_selected  { background: rgba(212,168,67,0.2);  color: #e8c060; border-color: rgba(212,168,67,0.5); }
.wt-step-badge.type-move_played    { background: rgba(46,160,67,0.1);   color: #56d364; border-color: rgba(46,160,67,0.3); }
.wt-step-badge.type-complete,
.wt-step-badge.type-decrypt_complete { background: rgba(46,160,67,0.2); color: #7ee787; border-color: rgba(46,160,67,0.5); }
.wt-step-badge.type-char_to_bits   { background: rgba(248,81,73,0.1); color: #ff9da0; border-color: rgba(248,81,73,0.25); }
.wt-step-badge.type-move_decode    { background: rgba(121,192,255,0.12); color: #79c0ff; border-color: rgba(121,192,255,0.3); }

/* Step title row */
.wt-step-title-row {
  padding: 12px 32px 0;
}
.wt-step-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

/* ─── Main two-column area ─── */
.wt-main-area {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
  padding: 20px 32px 0;
  align-items: start;
}

/* Board panel */
.wt-board-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.board-with-arrows {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.board-overlay {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
}

/* Legend */
.wt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 10px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 416px;
}

.wt-legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.lbox {
  display: inline-block;
  width: 28px; height: 4px;
  border-radius: 2px;
}
.lbox.legal    { background: rgba(100,130,220,0.6); }
.lbox.usable   { background: rgba(50,210,80,0.85); }
.lbox.selected { background: rgba(212,168,67,1); }

/* ─── Info panel ─── */
.wt-info-panel {
  padding: 0 0 20px 32px;
  min-height: 300px;
  max-height: 480px;
  overflow-y: auto;
}

/* ─── Step body content ─── */
.wt-step-body { color: var(--text-muted); font-size: 0.9rem; line-height: 1.7; }

.wt-info-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.wt-info-p { margin-bottom: 10px; }

.wt-kv-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin-bottom: 16px;
}
.wt-k { font-size: 0.78rem; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding-top: 2px; }
.wt-v { font-weight: 600; color: var(--text); word-break: break-word; }
.wt-v.mono { font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; }

.wt-formula {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: #a5d6ff;
  margin-bottom: 14px;
  overflow-x: auto;
  white-space: nowrap;
}

/* Bit conversion visual */
.wt-char-conv {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.wt-conv-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.wt-conv-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gold);
  padding: 8px 16px;
  background: rgba(212,168,67,0.1);
  border: 1px solid rgba(212,168,67,0.3);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  min-width: 60px;
  text-align: center;
}
.wt-conv-val.sm { font-size: 1rem; padding: 8px 10px; }
.wt-conv-val.binary-val {
  font-size: 0.88rem;
  letter-spacing: 0.15em;
  color: #79c0ff;
  background: rgba(121,192,255,0.08);
  border-color: rgba(121,192,255,0.25);
}
.wt-conv-label { font-size: 0.68rem; color: var(--text-dim); font-weight: 600; text-transform: uppercase; }
.wt-conv-arrow { font-size: 1.4rem; color: var(--text-dim); padding-top: 16px; }

/* Binary bits display */
.wt-binary-row {
  display: flex;
  gap: 3px;
  margin-bottom: 12px;
}
.wt-bit {
  width: 22px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 4px;
  background: rgba(121,192,255,0.1);
  border: 1px solid rgba(121,192,255,0.25);
  color: #79c0ff;
  animation: bitAppear 0.15s ease both;
}
@keyframes bitAppear {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

/* HMAC table */
.wt-hmac-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 12px;
}
.wt-hmac-table th {
  text-align: left;
  padding: 6px 10px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.wt-hmac-table td {
  padding: 5px 10px;
  border-bottom: 1px solid rgba(48,54,61,0.5);
  color: var(--text-muted);
  vertical-align: middle;
}
.wt-hmac-table tr:last-child td { border-bottom: none; }
.wt-hmac-table tr.usable-row td { background: rgba(50,210,80,0.05); }
.wt-hmac-table tr.usable-row .wt-move-cell { color: #56d364; font-weight: 700; }
.wt-move-cell { color: var(--gold); font-weight: 600; }
.wt-score-cell { color: var(--text-dim); font-size: 0.72rem; }
.wt-rank-cell { color: var(--text-dim); width: 28px; }
.wt-badge-cell { width: 50px; }
.wt-badge-sm {
  font-size: 0.62rem;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
}
.wt-badge-sm.use  { background: rgba(50,210,80,0.15); color: #56d364; }
.wt-badge-sm.skip { background: rgba(100,100,100,0.15); color: var(--text-dim); }

/* k-calc highlight */
.wt-k-formula {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.wt-k-line {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.wt-k-line strong { color: var(--gold); }
.wt-k-line em { color: #56d364; font-style: normal; }

/* Chunk / bit selection */
.wt-chunk-display {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(212,168,67,0.08);
  border: 1px solid rgba(212,168,67,0.3);
  border-radius: 10px;
  margin-bottom: 14px;
  font-family: 'JetBrains Mono', monospace;
  flex-wrap: wrap;
}
.wt-chunk-bits { font-size: 1.8rem; font-weight: 800; color: var(--gold); letter-spacing: 0.15em; }
.wt-chunk-eq   { font-size: 1rem; color: var(--text-muted); }
.wt-chunk-idx  { font-size: 1.4rem; font-weight: 800; color: #79c0ff; }

/* Move list */
.wt-move-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}
.wt-move-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-muted);
}
.wt-move-chip.usable   { border-color: rgba(50,210,80,0.4); color: #56d364; background: rgba(50,210,80,0.06); }
.wt-move-chip.selected { border-color: rgba(212,168,67,0.6); color: var(--gold); background: rgba(212,168,67,0.12); font-weight: 700; }

/* Progress bar */
.wt-enc-progress {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.wt-enc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #f0a030);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Success box */
.wt-success-box {
  background: rgba(46,160,67,0.08);
  border: 1px solid rgba(46,160,67,0.3);
  border-radius: 12px;
  padding: 20px 24px;
  text-align: center;
}
.wt-success-icon { font-size: 2.5rem; margin-bottom: 10px; }
.wt-success-msg {
  font-size: 1.4rem;
  font-weight: 800;
  color: #7ee787;
  word-break: break-word;
  font-family: 'JetBrains Mono', monospace;
  padding: 12px 16px;
  background: var(--bg-3);
  border-radius: 8px;
  margin: 10px 0;
}

/* ─── Controls ─── */
.wt-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 32px;
  background: var(--bg-3);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.wt-ctrl-group { display: flex; gap: 6px; }

.wt-slider-wrap { flex: 1; min-width: 120px; }
.wt-slider {
  width: 100%;
  accent-color: var(--gold);
  cursor: pointer;
}

.wt-speed-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.wt-speed-label { font-size: 0.75rem; color: var(--text-dim); }
.wt-speed {
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.wt-speed:hover { border-color: var(--border-light); color: var(--text); }
.wt-speed.active { background: rgba(212,168,67,0.12); border-color: rgba(212,168,67,0.4); color: var(--gold); }

.ctrl-btn {
  width: 34px; height: 34px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ctrl-btn:hover { background: var(--border); }
.ctrl-btn.ctrl-play {
  width: 38px; height: 38px;
  background: var(--gold);
  border-color: var(--gold);
  color: #0d1117;
  font-weight: 700;
  font-size: 0.85rem;
}
.ctrl-btn.ctrl-play:hover { background: #e8c060; }
.ctrl-btn.is-playing { background: var(--bg-3); border-color: var(--gold); color: var(--gold); }

/* ─── Bit stream section ─── */
.wt-bitstream-section {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 14px 32px 24px;
}

.wt-bs-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.wt-bs-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wt-bs-info {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.wt-bs-scroll { overflow-x: auto; padding-bottom: 4px; }

.wt-bs {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
  align-items: flex-end;
  min-width: max-content;
  padding: 4px 2px;
}

.wt-bs-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: default;
}

.wt-bs-block {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  padding: 3px 5px;
  border-radius: 4px;
  border: 1px solid transparent;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transition: all 0.2s;
}

.wt-bs-block.hdr {
  background: rgba(121,192,255,0.1);
  border-color: rgba(121,192,255,0.3);
  color: #79c0ff;
}

.wt-bs-block.chr { color: var(--gold); }

.wt-bs-block.active {
  box-shadow: 0 0 0 2px var(--gold);
  transform: translateY(-2px);
}

.wt-bs-block.read {
  opacity: 0.5;
}

.wt-bs-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

/* Cursor indicator in bitstream */
.wt-bs-cursor {
  display: inline-block;
  width: 2px;
  height: 28px;
  background: var(--gold);
  border-radius: 1px;
  animation: blink 1s ease-in-out infinite;
  flex-shrink: 0;
  align-self: center;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ─── Loading overlay ─── */
.wt-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,17,23,0.85);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wt-loading-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 60px;
  text-align: center;
  box-shadow: var(--shadow);
}

.wt-loading-box p {
  color: var(--text-muted);
  margin-top: 16px;
  line-height: 1.6;
}

.wt-loading-box small { color: var(--text-dim); font-size: 0.82rem; }

.wt-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .wt-main-area {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .wt-info-panel {
    padding: 16px 0 0;
    max-height: none;
  }
  .wt-controls { padding: 12px 16px; }
  .wt-bitstream-section { padding: 12px 16px 20px; }
  .wt-step-bar { padding: 12px 16px; }
  .wt-step-title-row { padding: 10px 16px 0; }
  .wt-form { padding: 20px; }
}

@media (max-width: 600px) {
  .wt-form-row { flex-direction: column; }
  .wt-fg-msg, .wt-fg-key, .wt-fg-btn { width: 100%; }
  .wt-ctrl-group { gap: 4px; }
  .ctrl-btn { width: 30px; height: 30px; font-size: 0.68rem; }
}
