.idea-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 820px) {
  .idea-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .idea-grid { grid-template-columns: 1fr; }
}

.idea-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: var(--surface2);
  font-size: 0.88rem;
}

.idea-card h3 {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
}

.ctrl-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: center;
  margin-bottom: 0.55rem;
  font-size: 0.9rem;
}

.ctrl-row select {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.code-box {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 0 0 0.55rem;
  padding: 0.75rem 0.85rem;
  background: #1a222c;
  color: #e8eef4;
  border-radius: 8px;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
}

.chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.65rem 0 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface2);
}

.port-label {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  min-width: 2.2rem;
  text-align: center;
}

.port-val {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  display: block;
}

.ff-cell {
  width: 3.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.35rem;
  background: var(--surface);
  text-align: center;
  font-family: var(--mono);
  transition: border-color 0.15s, background 0.15s;
}

.ff-cell h3 {
  margin: 0;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}

.ff-cell .bit {
  margin: 0.2rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.ff-cell.is-hi {
  border-color: var(--ok);
  background: var(--ok-bg);
}

.ff-cell.is-lo {
  opacity: 0.92;
}

.chain-arrow {
  font-family: var(--mono);
  color: var(--muted);
  font-weight: 700;
  font-size: 1rem;
}

.pi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.55rem;
  font-size: 0.88rem;
}

.pi-row button.bit-btn {
  font-family: var(--mono);
  min-width: 2.4rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.pi-row button.bit-btn.is-hi {
  border-color: var(--ok);
  background: var(--ok-bg);
  font-weight: 700;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

@media (max-width: 560px) {
  .action-grid { grid-template-columns: 1fr; }
}

.action-grid button {
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}

.action-grid button:hover {
  background: var(--surface2);
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}

.status-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  background: var(--surface2);
}

.status-card h3 {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.status-card .val {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 700;
}

.status-card .note {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.trace-box,
.log-box {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  margin: 0 0 0.45rem;
  padding: 0.55rem 0.65rem;
  background: #1a222c;
  color: #c8d4e0;
  border-radius: 8px;
  border: 1px solid var(--line);
  max-height: 9rem;
  overflow: auto;
  white-space: pre-wrap;
}

.legend {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.45rem;
}

.cheat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.cheat-table th,
.cheat-table td {
  border: 1px solid var(--line);
  padding: 0.4rem 0.55rem;
  text-align: left;
}

.cheat-table th {
  background: var(--surface2);
}

.hint-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  color: var(--muted);
}
